1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-05 20:57:02 +08:00
icebergs/core/mall/goods.go
2022-10-17 23:04:07 +08:00

28 lines
956 B
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"},
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] == "" {
m.Action(mdb.CREATE, mdb.EXPORT, mdb.IMPORT)
ctx.DisplayLocal(m, "")
} else {
m.EchoImages(web.MergeURL2(m, "/share/cache/"+m.Append("image")))
}
m.PushAction(mdb.MODIFY, mdb.REMOVE)
}},
})
}