1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
shaoying 2022-10-18 09:28:58 +08:00
parent a54df18a51
commit 623cb165e2
2 changed files with 10 additions and 2 deletions

View File

@ -14,15 +14,20 @@ func init() {
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.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"},
"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) }}, 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] == "" {
m.Action(mdb.CREATE, mdb.EXPORT, mdb.IMPORT) if !m.IsMobile() {
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, "/share/cache/"+m.Append("image")))
} }
m.PushAction(mdb.MODIFY, mdb.REMOVE) m.PushAction("copy", mdb.MODIFY, mdb.REMOVE)
}}, }},
}) })
} }

View File

@ -137,6 +137,9 @@ func (m *Message) SetResult(arg ...string) *Message {
return m.Set(MSG_RESULT, arg...) return m.Set(MSG_RESULT, arg...)
} }
func (m *Message) IsMobile() bool {
return strings.Contains(m.Option(MSG_USERUA), "Mobile")
}
func (m *Message) Design(action Any, help string, input ...Any) { func (m *Message) Design(action Any, help string, input ...Any) {
list := kit.List() list := kit.List()
for _, input := range input { for _, input := range input {