diff --git a/base/web/serve.go b/base/web/serve.go index 875c1ec8..5c2eabde 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -181,7 +181,6 @@ func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWrite } } m.Cmd(COUNT, mdb.CREATE, aaa.IP, m.Option(ice.MSG_USERIP), m.Option(ice.MSG_USERUA), kit.Dict(ice.LOG_DISABLE, ice.TRUE)) - m.Cmd(COUNT, mdb.CREATE, m.R.Method, m.R.URL.Path, kit.Join(kit.Simple(m.Optionv(ice.MSG_CMDS)), " "), kit.Dict(ice.LOG_DISABLE, ice.TRUE)) return cmds, aaa.Right(m, key, cmds) } diff --git a/core/chat/action.go b/core/chat/action.go index 61f31261..d3b86503 100644 --- a/core/chat/action.go +++ b/core/chat/action.go @@ -21,11 +21,6 @@ func _action_exec(m *ice.Message, river, storm, index string, arg ...string) { }).Length() == 0, ice.ErrNotRight, index, arg) { return } - if len(arg) > 0 && arg[0] == ctx.ACTION { - m.Cmd(web.COUNT, mdb.CREATE, ACTION, index, "", kit.Dict(ice.LOG_DISABLE, ice.TRUE)) - } else { - m.Cmd(web.COUNT, mdb.CREATE, ACTION, index, kit.Join(arg), kit.Dict(ice.LOG_DISABLE, ice.TRUE)) - } kit.If(!ctx.PodCmd(m, index, arg), func() { m.Cmdy(index, arg) }) } func _action_auth(m *ice.Message, share string) *ice.Message { diff --git a/core/chat/chat.go b/core/chat/chat.go index 37bb33d0..5da64230 100644 --- a/core/chat/chat.go +++ b/core/chat/chat.go @@ -10,6 +10,6 @@ const CHAT = "chat" var Index = &ice.Context{Name: CHAT, Help: "聊天中心"} -func init() { web.Index.Register(Index, &web.Frame{}, FAVOR) } +func init() { web.Index.Register(Index, &web.Frame{}, HEADER, FAVOR) } func Prefix(arg ...string) string { return web.Prefix(CHAT, kit.Keys(arg)) } diff --git a/core/chat/header.go b/core/chat/header.go index 4f4b82ec..b5684d49 100644 --- a/core/chat/header.go +++ b/core/chat/header.go @@ -72,7 +72,9 @@ func init() { aaa.Black(m, kit.Keys(HEADER, ctx.ACTION, mdb.CREATE)) aaa.Black(m, kit.Keys(HEADER, ctx.ACTION, mdb.REMOVE)) aaa.Black(m, kit.Keys(HEADER, ctx.ACTION, mdb.MODIFY)) - kit.If(mdb.HashSelect(m.Spawn()).Length() == 0, func() { m.Cmd("", mdb.CREATE, mdb.TYPE, cli.QRCODE, mdb.NAME, "扫码登录", mdb.ORDER, "1") }) + kit.If(mdb.HashSelect(m.Spawn()).Length() == 0, func() { + m.Cmd("", mdb.CREATE, mdb.TYPE, cli.QRCODE, mdb.NAME, "扫码登录", mdb.ORDER, "1") + }) }}, web.SHARE: {Hand: _header_share}, aaa.LOGIN: {Hand: func(m *ice.Message, arg ...string) {}}, @@ -97,6 +99,23 @@ func init() { m.Options(ice.MSG_USERWEB, kit.MergeURL(m.Option(ice.MSG_USERWEB), web.SHARE, m.Cmdx(web.SHARE, mdb.CREATE, mdb.TYPE, web.LOGIN))) m.Cmdy(aaa.EMAIL, aaa.SEND, arg, aaa.CONTENT, nfs.Template(m, "email.html")) }}, + ice.DEMO: {Help: "体验", Hand: func(m *ice.Message, arg ...string) { + if m.Option(ice.MSG_USERROLE) == aaa.TECH { + if mdb.Config(m, ice.DEMO) == ice.TRUE { + mdb.Config(m, ice.DEMO, ice.FALSE) + } else { + mdb.Config(m, ice.DEMO, ice.TRUE) + m.Cmd("", mdb.CREATE, mdb.TYPE, mdb.PLUGIN, mdb.NAME, "免登录体验", mdb.ORDER, "2", ctx.INDEX, HEADER, ctx.ARGS, ice.DEMO) + } + return + } + if mdb.Config(m, ice.DEMO) == ice.TRUE { + web.RenderCookie(m, aaa.SessCreate(m, ice.Info.Username)) + m.Echo("login success") + } else { + m.Echo("hello world") + } + }}, mdb.CREATE: {Name: "create type*=oauth,plugin,qrcode name* icons link order space index args", Hand: func(m *ice.Message, arg ...string) { mdb.HashCreate(m, m.OptionSimple()) }}, mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { mdb.HashRemove(m, m.OptionSimple(mdb.NAME)) }}, mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, m.OptionSimple(mdb.NAME), arg) }}, @@ -107,11 +126,14 @@ func init() { m.Option("icon.lib", mdb.Conf(m, ICON, kit.Keym(nfs.PATH))) m.Option(MENUS, mdb.Config(m, MENUS)) m.Echo(mdb.Config(m, TITLE)) - if mdb.HashSelect(m, arg...).Sort("order", "int"); m.Length() < 2 { - kit.If(GetSSO(m), func(p string) { - m.Push(mdb.TIME, m.Time()).Push(mdb.NAME, web.SERVE).Push(mdb.ICONS, nfs.USR_ICONS_ICEBERGS).Push(mdb.TYPE, "oauth").Push(web.LINK, p) - }) + mdb.HashSelect(m, arg...).Sort("order", "int") + if m.Option(ice.MSG_USERROLE) == aaa.TECH { + m.Action(mdb.CREATE, ice.DEMO) } + kit.If(GetSSO(m), func(p string) { + m.Push(mdb.TIME, m.Time()).Push(mdb.NAME, web.SERVE).Push(mdb.ICONS, nfs.USR_ICONS_ICEBERGS).Push(mdb.TYPE, "oauth").Push(web.LINK, p) + }) + m.StatusTimeCount(kit.Dict(ice.DEMO, mdb.Config(m, ice.DEMO))) if gdb.Event(m, HEADER_AGENT); !_header_check(m, arg...) { return } diff --git a/core/mall/goods.go b/core/mall/goods.go index f78ad88f..e5881c30 100644 --- a/core/mall/goods.go +++ b/core/mall/goods.go @@ -19,9 +19,16 @@ const GOODS = "goods" func init() { Index.MergeCommands(ice.Commands{ GOODS: {Help: "商品", Icon: "mall.png", Actions: ice.MergeActions(ice.Actions{ - mdb.CREATE: {Name: "create zone* name* text price* count*=1 units*=件,个,份,斤 image*=4@img"}, - mdb.MODIFY: {Name: "modify zone* name* text price* count*=1 units*=件,个,份,斤 image*=4@img"}, + mdb.CREATE: {Name: "create zone* name* text price* count*=1 units*=件 image*=4@img"}, + // mdb.MODIFY: {Name: "modify zone* name* text price* count*=1 units*=件 image*=4@img"}, ORDER: {Name: "order count*=1", Help: "选购", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(CART, mdb.INSERT, arg) }}, + web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) { m.Echo(web.Upload(m)[0]) }}, + mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { + switch mdb.HashInputs(m, arg); arg[0] { + case "units": + m.Push(arg[0], kit.Split(nfs.TemplateText(m, arg[0]))) + } + }}, }, aaa.RoleAction(), web.ExportCacheAction(nfs.IMAGE), mdb.ExportHashAction(ctx.TOOLS, kit.Fields(Prefix(CART), Prefix(ORDER)), mdb.FIELD, "time,hash,zone,name,text,price,count,units,image")), Hand: func(m *ice.Message, arg ...string) { kit.If(len(arg) == 0 && m.IsMobileUA(), func() { m.OptionDefault(ice.MSG_FIELDS, "zone,name,price,count,units,text,hash,time,image") }) mdb.HashSelect(m, arg...).PushAction(ORDER).Action("filter:text")