1
0
forked from x/icebergs
This commit is contained in:
harveyshao 2022-10-18 12:23:52 +08:00
parent 623cb165e2
commit 30348175f4
2 changed files with 9 additions and 9 deletions

View File

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

View File

@ -26,7 +26,7 @@ func Render(m *Message, cmd string, args ...Any) string {
list = append(list, kit.Format(`<input type="button" name="%s" value="%s">`, k, list = append(list, kit.Format(`<input type="button" name="%s" value="%s">`, k,
kit.Select(k, kit.Value(m._cmd.Meta, kit.Keys("_trans", k)), m.Option(MSG_LANGUAGE) != "en"))) kit.Select(k, kit.Value(m._cmd.Meta, kit.Keys("_trans", k)), m.Option(MSG_LANGUAGE) != "en")))
} }
return kit.Join(list, SP) return strings.Join(list, "")
case RENDER_IMAGES: // src [height] case RENDER_IMAGES: // src [height]
m.Debug("what %v", m.Option(MSG_USERUA)) m.Debug("what %v", m.Option(MSG_USERUA))