From 9b437752afe07075dd7956568d35771a6d5ccf7c Mon Sep 17 00:00:00 2001 From: shaoying Date: Mon, 3 Aug 2020 09:17:57 +0800 Subject: [PATCH] opt some --- core/chat/chat.go | 7 +++++++ core/mall/mall.go | 45 +++++++++++++++++++++++++++++++++++++++------ core/team/team.go | 2 +- 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/core/chat/chat.go b/core/chat/chat.go index d4766833..11852ef4 100644 --- a/core/chat/chat.go +++ b/core/chat/chat.go @@ -173,6 +173,13 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心", } }}, + "tool": {Name: "tool", Help: "应用", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + }}, + "node": {Name: "node", Help: "设备", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + }}, + "user": {Name: "user", Help: "用户", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + }}, + "/ocean": {Name: "/ocean", Help: "大海洋", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) == 0 { // 用户列表 diff --git a/core/mall/mall.go b/core/mall/mall.go index 77567c85..c6461abb 100644 --- a/core/mall/mall.go +++ b/core/mall/mall.go @@ -1,10 +1,10 @@ package mall import ( - "github.com/shylinux/icebergs" + ice "github.com/shylinux/icebergs" "github.com/shylinux/icebergs/base/mdb" "github.com/shylinux/icebergs/base/web" - "github.com/shylinux/toolkits" + kit "github.com/shylinux/toolkits" "encoding/csv" "os" @@ -170,6 +170,7 @@ func _asset_render(m *ice.Message, kind, name, text string, arg ...string) { func _asset_action(m *ice.Message, status interface{}, action ...string) string { return strings.Join(action, "") } + func _asset_input(m *ice.Message, key, value string) { switch key { case ACCOUNT: @@ -194,10 +195,28 @@ func _asset_input(m *ice.Message, key, value string) { m.Sort("count", "int_r") } -var _asset_inputs = kit.List( +var _input_spend = kit.List( "_input", "text", "name", "account", "value", "@key", "_input", "select", "name", "type", "values", []interface{}{ - "支出", "收入", + "支出", "转账", "收入", + }, + "_input", "text", "name", "amount", + "_input", "text", "name", "name", "value", "@key", + "_input", "text", "name", "text", "value", "@key", +) +var _input_trans = kit.List( + "_input", "text", "name", "account", "value", "@key", + "_input", "select", "name", "type", "values", []interface{}{ + "转账", "支出", "收入", + }, + "_input", "text", "name", "amount", + "_input", "text", "name", "name", "value", "@key", + "_input", "text", "name", "text", "value", "@key", +) +var _input_bonus = kit.List( + "_input", "text", "name", "account", "value", "@key", + "_input", "select", "name", "type", "values", []interface{}{ + "收入", "转账", "支出", }, "_input", "text", "name", "amount", "_input", "text", "name", "name", "value", "@key", @@ -228,9 +247,23 @@ var Index = &ice.Context{Name: "mall", Help: "贸易中心", m.Cmd(mdb.RENDER, mdb.CREATE, ASSET, ASSET, m.Prefix()) }}, ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save(ASSET) }}, - ASSET: {Name: "asset account=auto id=auto auto 添加:button 导出:button 导入:button", Help: "资产", Meta: kit.Dict( - mdb.INSERT, _asset_inputs, + + ASSET: {Name: "asset account=auto id=auto auto 支出:button 转账:button 收入:button 导出:button 导入:button", Help: "资产", Meta: kit.Dict( + "支出", _input_spend, "转账", _input_trans, "收入", _input_bonus, ), Action: map[string]*ice.Action{ + "spend": {Name: "insert [key value]...", Help: "支出", Hand: func(m *ice.Message, arg ...string) { + _asset_create(m, arg[1]) + _asset_insert(m, arg[1], arg[2:]...) + }}, + "trans": {Name: "insert [key value]...", Help: "转账", Hand: func(m *ice.Message, arg ...string) { + _asset_create(m, arg[1]) + _asset_insert(m, arg[1], arg[2:]...) + }}, + "bonus": {Name: "insert [key value]...", Help: "收入", Hand: func(m *ice.Message, arg ...string) { + _asset_create(m, arg[1]) + _asset_insert(m, arg[1], arg[2:]...) + }}, + mdb.INSERT: {Name: "insert [key value]...", Help: "添加", Hand: func(m *ice.Message, arg ...string) { _asset_create(m, arg[1]) _asset_insert(m, arg[1], arg[2:]...) diff --git a/core/team/team.go b/core/team/team.go index 6ca6ab1b..3c7e31f1 100644 --- a/core/team/team.go +++ b/core/team/team.go @@ -299,7 +299,7 @@ var Index = &ice.Context{Name: "team", Help: "团队中心", ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save(TASK) }}, TASK: {Name: "task zone=auto id=auto auto 添加:button 导出:button 导入:button", Help: "任务", Meta: kit.Dict( - mdb.INSERT, _task_inputs, + "添加", _task_inputs, ), Action: map[string]*ice.Action{ mdb.INSERT: {Name: "insert [key value]...", Help: "添加", Hand: func(m *ice.Message, arg ...string) { _task_create(m, arg[1])