1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-07 05:36:54 +08:00
icebergs/core/mall/goods.go
2022-10-18 09:28:58 +08:00

33 lines
1.1 KiB
Go

package mall
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
)
const GOODS = "goods"
func init() {
Index.MergeCommands(ice.Commands{
GOODS: {Name: "goods hash auto", Help: "商品", Actions: ice.MergeActions(ice.Actions{
mdb.CREATE: {Name: "modify zone type name text price count image"},
mdb.MODIFY: {Name: "modify zone type name text price count image"},
"copy": {Hand: func(m *ice.Message, arg ...string) {
m.Cmd("", mdb.CREATE, m.OptionSimple("zone,type,name,text,price,count,image"))
}},
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) { web.Upload(m) }},
}, mdb.HashAction(mdb.FIELD, "time,hash,zone,type,name,text,price,count,image")), Hand: func(m *ice.Message, arg ...string) {
if mdb.HashSelect(m, arg...); len(arg) == 0 || arg[0] == "" {
if !m.IsMobile() {
m.Action(mdb.CREATE, mdb.EXPORT, mdb.IMPORT)
}
ctx.DisplayLocal(m, "")
} else {
m.EchoImages(web.MergeURL2(m, "/share/cache/"+m.Append("image")))
}
m.PushAction("copy", mdb.MODIFY, mdb.REMOVE)
}},
})
}