diff --git a/base/cli/cli.go b/base/cli/cli.go index 9ad51160..f697c814 100644 --- a/base/cli/cli.go +++ b/base/cli/cli.go @@ -69,6 +69,7 @@ var Index = &ice.Context{Name: "cli", Help: "命令模块", }}, ice.CLI_RUNTIME: {Name: "runtime", Help: "运行环境", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + m.Cmdy(ice.CTX_CONFIG, ice.CLI_RUNTIME, arg) }}, ice.CLI_SYSTEM: {Name: "system", Help: "系统命令", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { cmd := exec.Command(arg[0], arg[1:]...) diff --git a/base/ctx/ctx.go b/base/ctx/ctx.go index 129cd365..cfc96b5f 100644 --- a/base/ctx/ctx.go +++ b/base/ctx/ctx.go @@ -110,19 +110,27 @@ var Index = &ice.Context{Name: "ctx", Help: "配置模块", button := false for i, v := range list { if i > 0 { - ls := kit.Split(v, ":=") - switch ls[0] { + switch ls := kit.Split(v, ":="); ls[0] { + case "[", "]": case "auto": cmd.List = append(cmd.List, kit.List(kit.MDB_INPUT, "button", "name", "查看", "value", "auto")...) cmd.List = append(cmd.List, kit.List(kit.MDB_INPUT, "button", "name", "返回", "value", "Last")...) button = true default: - if len(ls) > 1 && ls[1] == "button" { + kind, value := "text", "" + if len(ls) == 3 { + kind, value = ls[1], ls[2] + } else if len(ls) == 2 { + if strings.Contains(v, "=") { + value = ls[1] + } else { + kind = ls[1] + } + } + if kind == "button" { button = true } - cmd.List = append(cmd.List, kit.List( - kit.MDB_INPUT, kit.Select("text", ls, 1), "name", ls[0], "value", kit.Select("", ls, 2), - )...) + cmd.List = append(cmd.List, kit.List(kit.MDB_INPUT, kind, "name", ls[0], "value", value)...) } } } diff --git a/base/ssh/ssh.go b/base/ssh/ssh.go index 6c22f947..8aee695c 100644 --- a/base/ssh/ssh.go +++ b/base/ssh/ssh.go @@ -357,6 +357,11 @@ var Index = &ice.Context{Name: "ssh", Help: "终端模块", } }) }}, + + "what": {Name: "what", Help: "上位机", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + ls := kit.Split("window:=auto", " ", ":=") + m.Echo("%v %v", len(ls), ls) + }}, }, } diff --git a/base/web/web.go b/base/web/web.go index 86a9c549..fab5ac92 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -483,7 +483,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", ice.WEB_SHARE: {Name: "share", Help: "共享链", Value: kit.Data("index", "usr/volcanos/share.html", "template", share_template)}, ice.WEB_ROUTE: {Name: "route", Help: "路由", Value: kit.Data(kit.MDB_SHORT, kit.MDB_NAME)}, - ice.WEB_PROXY: {Name: "proxy", Help: "代理", Value: kit.Data()}, + ice.WEB_PROXY: {Name: "proxy", Help: "代理", Value: kit.Data(kit.MDB_SHORT, "proxy")}, ice.WEB_GROUP: {Name: "group", Help: "分组", Value: kit.Data(kit.MDB_SHORT, "group")}, ice.WEB_LABEL: {Name: "label", Help: "标签", Value: kit.Data(kit.MDB_SHORT, "label")}, }, @@ -508,8 +508,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Conf(ice.WEB_SHARE, "meta.template", share_template) }}, ice.ICE_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - m.Save(ice.WEB_SPIDE, ice.WEB_SERVE, - ice.WEB_GROUP, ice.WEB_LABEL, + m.Save(ice.WEB_SPIDE, ice.WEB_SERVE, ice.WEB_GROUP, ice.WEB_LABEL, ice.WEB_FAVOR, ice.WEB_CACHE, ice.WEB_STORY, ice.WEB_SHARE, ) @@ -521,12 +520,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", }) }}, - ice.WEB_SPIDE: {Name: "spide name [msg|raw|cache] POST|GET url [json|form|part|file|data] arg...", Help: "蜘蛛侠", List: kit.List( - kit.MDB_INPUT, "text", "name", "name", - kit.MDB_INPUT, "button", "value", "查看", "action", "auto", - kit.MDB_INPUT, "button", "value", "返回", "cb", "Last", - ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - if len(arg) == 0 { + ice.WEB_SPIDE: {Name: "spide name=auto [action:select=msg|raw|cache] [method:select=POST|GET] url [format:select=json|form|part|data|file] arg... auto", Help: "蜘蛛侠", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + if len(arg) == 0 || arg[0] == "" { // 爬虫列表 m.Richs(ice.WEB_SPIDE, nil, "*", func(key string, value map[string]interface{}) { m.Push(key, value["client"], []string{"name", "share", "login", "method", "url"}) @@ -534,7 +529,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Sort("name") return } - if len(arg) == 1 { + if len(arg) == 1 || len(arg) > 3 && arg[3] == "" { // 爬虫详情 m.Richs(ice.WEB_SPIDE, nil, arg[0], func(key string, value map[string]interface{}) { m.Push("detail", value) @@ -625,8 +620,6 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", body, ok := m.Optionv("body").(io.Reader) if !ok && len(arg) > 0 && method != "GET" { switch arg[0] { - case "data": - body, arg = bytes.NewBufferString(arg[1]), arg[2:] case "file": if f, e := os.Open(arg[1]); m.Warn(e != nil, "%s", e) { return @@ -634,6 +627,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", defer f.Close() body, arg = f, arg[2:] } + case "data": + body, arg = bytes.NewBufferString(arg[1]), arg[2:] case "part": buf := &bytes.Buffer{} mp := multipart.NewWriter(buf) @@ -782,10 +777,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Cmd(ice.WEB_SPACE, "connect", k) } }}, - ice.WEB_SPACE: {Name: "space", Help: "空间站", Meta: kit.Dict("exports", []string{"pod", "name"}), List: kit.List( - kit.MDB_INPUT, "text", "name", "name", - kit.MDB_INPUT, "button", "value", "查看", "action", "auto", - kit.MDB_INPUT, "button", "value", "返回", "cb", "Last", + ice.WEB_SPACE: {Name: "space name auto", Help: "空间站", Meta: kit.Dict( + "exports", []string{"pod", "name"}, ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) == 0 { // 空间列表 @@ -901,13 +894,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", }) == nil, "not found %s", arg[0]) } }}, - ice.WEB_DREAM: {Name: "dream", Help: "梦想家", Meta: kit.Dict( - "exports", []string{"you", "name"}, - "detail", []interface{}{"启动", "停止"}, - ), List: kit.List( - kit.MDB_INPUT, "text", "value", "", "name", "name", - kit.MDB_INPUT, "button", "value", "创建", "action", "auto", - kit.MDB_INPUT, "button", "value", "返回", "cb", "Last", + ice.WEB_DREAM: {Name: "dream name auto", Help: "梦想家", Meta: kit.Dict( + "exports", []string{"you", "name"}, "detail", []interface{}{"启动", "停止"}, ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) > 1 && arg[0] == "action" { switch arg[1] { @@ -962,16 +950,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Cmdy("nfs.dir", p) }}, - ice.WEB_FAVOR: {Name: "favor [path [type name [text [key value]....]]", Help: "收藏夹", Meta: kit.Dict( - "exports", []string{"hot", "favor"}, - "detail", []string{"编辑", "收藏", "收录", "导出", "删除"}, - ), List: kit.List( - kit.MDB_INPUT, "text", "name", "favor", "action", "auto", - kit.MDB_INPUT, "text", "name", "id", "action", "auto", - kit.MDB_INPUT, "button", "name", "查看", "action", "auto", - kit.MDB_INPUT, "button", "name", "返回", "cb", "Last", - kit.MDB_INPUT, "button", "name", "渲染", - kit.MDB_INPUT, "button", "name", "回放", + ice.WEB_FAVOR: {Name: "favor favor=auto id=auto auto", Help: "收藏夹", Meta: kit.Dict( + "exports", []string{"hot", "favor"}, "detail", []string{"编辑", "收藏", "收录", "导出", "删除"}, ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { switch m.Option("_action") { case "渲染": @@ -1322,12 +1302,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Echo(arg[2]) } }}, - ice.WEB_STORY: {Name: "story", Help: "故事会", Meta: kit.Dict("exports", []string{"top", "story"}, - "detail", []string{"共享", "更新", "推送"}), List: kit.List( - kit.MDB_INPUT, "text", "name", "story", "action", "auto", - kit.MDB_INPUT, "text", "name", "list", "action", "auto", - kit.MDB_INPUT, "button", "value", "查看", "action", "auto", - kit.MDB_INPUT, "button", "value", "返回", "cb", "Last", + ice.WEB_STORY: {Name: "story story=auto key=auto auto", Help: "故事会", Meta: kit.Dict( + "exports", []string{"top", "story"}, "detail", []string{"共享", "更新", "推送"}, ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) > 1 && arg[0] == "action" { story, list := m.Option("story"), m.Option("list") @@ -1651,8 +1627,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Richs(ice.WEB_STORY, nil, list, func(key string, value map[string]interface{}) { // 直连节点 - m.Push("list", key) - m.Push(list, value, []string{"time", "count", "scene", "story"}) + m.Push(key, value, []string{"time", "key", "count", "scene", "story"}) m.Richs(ice.WEB_CACHE, nil, value["data"], func(key string, value map[string]interface{}) { m.Push("drama", value["text"]) m.Push("data", key) @@ -1661,8 +1636,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", kit.Fetch(value["list"], func(key string, val string) { m.Richs(ice.WEB_STORY, nil, val, func(key string, value map[string]interface{}) { // 复合节点 - m.Push("list", key) - m.Push(list, value, []string{"time", "count", "scene", "story"}) + m.Push(key, value, []string{"time", "key", "count", "scene", "story"}) m.Richs(ice.WEB_CACHE, nil, value["data"], func(key string, value map[string]interface{}) { m.Push("drama", value["text"]) m.Push("data", key) @@ -1691,11 +1665,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", }) } }}, - ice.WEB_SHARE: {Name: "share", Help: "共享链", List: kit.List( - kit.MDB_INPUT, "text", "name", "share", "action", "auto", - kit.MDB_INPUT, "button", "value", "查看", "action", "auto", - kit.MDB_INPUT, "button", "value", "返回", "cb", "Last", - ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + ice.WEB_SHARE: {Name: "share share auto", Help: "共享链", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) == 0 { // 共享列表 m.Grows(ice.WEB_SHARE, nil, "", "", func(index int, value map[string]interface{}) { diff --git a/core/chat/chat.go b/core/chat/chat.go index 3ce47236..9086eabd 100644 --- a/core/chat/chat.go +++ b/core/chat/chat.go @@ -189,14 +189,14 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心", } }}, - "search": {Name: "search label:text=some word:text=启动流程 auto", Help: "搜索引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + "search": {Name: "search label=some word=启动流程 auto", Help: "搜索引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) < 2 { m.Cmdy(ice.WEB_LABEL, arg) return } m.Cmdy(ice.WEB_LABEL, arg[0], "*", "favor", "search", arg[1:]) }}, - "commend": {Name: "commend label:text=some word:text=请求响应 auto", Help: "推荐引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + "commend": {Name: "commend label=some word=请求响应 auto", Help: "推荐引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) < 2 { m.Cmdy(ice.WEB_LABEL, arg) return diff --git a/core/code/code.go b/core/code/code.go index bdb22e88..83f4fdad 100644 --- a/core/code/code.go +++ b/core/code/code.go @@ -138,9 +138,9 @@ var Index = &ice.Context{Name: "code", Help: "编程中心", } }}, - "login": {Name: "login", Help: "登录", Meta: kit.Dict( + "login": {Name: "login key", Help: "登录", Meta: kit.Dict( "detail", []string{"编辑", "删除", "清理", "清空"}, - ), List: ice.ListLook("key"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) > 0 && arg[0] == "action" { switch arg[1] { case "modify", "编辑": diff --git a/core/mall/mall.go b/core/mall/mall.go index 36ca439f..2d825ec5 100644 --- a/core/mall/mall.go +++ b/core/mall/mall.go @@ -6,7 +6,6 @@ import ( "github.com/shylinux/toolkits" "encoding/csv" - "fmt" "strconv" "strings" ) @@ -39,8 +38,6 @@ func input(m *ice.Message, arg ...string) bool { var Index = &ice.Context{Name: "mall", Help: "贸易中心", Caches: map[string]*ice.Cache{}, Configs: map[string]*ice.Config{ - "railway": {Name: "railway", Help: "12306", Value: kit.Data("site", "https://kyfw.12306.cn")}, - "asset": {Name: "asset", Help: "资产", Value: kit.Data(kit.MDB_SHORT, "account", "site", kit.Dict( "公积金", "https://grwsyw.gjj.beijing.gov.cn/ish/flow/menu/PPLGRZH0102?_r=0.6644871172745264", "社保", "http://fuwu.rsj.beijing.gov.cn/csibiz/indinfo/index.jsp", @@ -52,495 +49,390 @@ var Index = &ice.Context{Name: "mall", Help: "贸易中心", Commands: map[string]*ice.Command{ ice.ICE_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() - m.Cmd(ice.WEB_SPIDE, "add", "12306", m.Conf("railway", "meta.site")) }}, ice.ICE_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - m.Save("asset", "railway") + m.Save("asset") }}, - "spend": {Name: "spend", Help: "支出", List: kit.List( - kit.MDB_INPUT, "text", "name", "account", "figure", "key", - kit.MDB_INPUT, "text", "name", "to", "figure", "key", - kit.MDB_INPUT, "text", "name", "name", "figure", "key", - kit.MDB_INPUT, "button", "name", "记录", - kit.MDB_INPUT, "textarea", "name", "text", "figure", "key", - kit.MDB_INPUT, "text", "name", "value", "figure", "key", - kit.MDB_INPUT, "text", "name", "time", "figure", "date", - ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - if input(m, arg...) { - // 输入补全 - return - } - if len(arg) < 2 { - // 查看流水 - m.Cmdy("asset", arg) - return - } - // 添加流水 - amount := kit.Int(arg[4]) - m.Cmdy("asset", arg[0], "", "转出", arg[1], arg[2], -amount, "time", arg[5:]) - m.Cmdy("asset", arg[1], "", "转入", arg[0], arg[2], amount, "time", arg[5:]) - m.Cmdy("asset", arg[1], "", "支出", arg[2], arg[3], -amount, "time", arg[5:]) - m.Cmdy("asset", "流水", "", "支出", arg[2], arg[3], -amount, "time", arg[5:]) - }}, - "trans": {Name: "trans", Help: "转账", List: kit.List( - kit.MDB_INPUT, "text", "name", "account", "figure", "key", - kit.MDB_INPUT, "text", "name", "to", "figure", "key", - kit.MDB_INPUT, "text", "name", "name", "figure", "key", - kit.MDB_INPUT, "button", "name", "记录", - kit.MDB_INPUT, "textarea", "name", "text", "figure", "key", - kit.MDB_INPUT, "text", "name", "value", "figure", "key", - kit.MDB_INPUT, "text", "name", "time", "figure", "date", - ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - if input(m, arg...) { - // 输入补全 - return - } - if len(arg) < 2 { - // 查看流水 - m.Cmdy("asset", arg) - return - } - // 添加流水 - amount := kit.Int(arg[4]) - m.Cmdy("asset", arg[0], "", "转出", arg[1], arg[2], -amount, "time", arg[5:]) - m.Cmdy("asset", arg[1], "", "转入", arg[0], arg[2], amount, "time", arg[5:]) - m.Cmd("asset", "流水", "", "转出", arg[2], arg[3], -amount, "time", arg[5:]) - m.Cmd("asset", "流水", "", "转入", arg[2], arg[3], amount, "time", arg[5:]) - }}, - "bonus": {Name: "bonus", Help: "收入", List: kit.List( - kit.MDB_INPUT, "text", "name", "account", "figure", "key", - kit.MDB_INPUT, "text", "name", "name", "figure", "key", - kit.MDB_INPUT, "text", "name", "value", "figure", "key", - kit.MDB_INPUT, "button", "name", "记录", - kit.MDB_INPUT, "textarea", "name", "text", "figure", "key", - kit.MDB_INPUT, "text", "name", "time", "figure", "date", - ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - if input(m, arg...) { - // 输入补全 - return - } - if len(arg) < 2 { - // 查看流水 - m.Cmdy("asset", arg) - return - } - // 添加流水 - amount := kit.Int(arg[2]) - m.Cmdy("asset", arg[0], "", "收入", arg[1], arg[3], amount, "time", arg[4:]) - m.Cmdy("asset", "流水", "", "收入", arg[1], arg[3], amount, "time", arg[4:]) - }}, - "month": {Name: "month", Help: "工资", List: kit.List( - kit.MDB_INPUT, "text", "name", "month", - kit.MDB_INPUT, "text", "name", "value", "figure", "key", - kit.MDB_INPUT, "text", "name", "value", "figure", "key", - kit.MDB_INPUT, "button", "name", "计算", - kit.MDB_INPUT, "button", "name", "记录", - ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - // 输入补全 - if input(m, arg...) { - return - } - - data := map[string]int64{"个税方案": 6, "基本工资": 0, "个税": 0, - "公积金比例": 1200, "养老保险比例": 800, "医疗保险比例": 200, "失业保险比例": 20, "工伤保险比例": 2, "生育保险比例": 0, - "公积金金额": 0, "养老保险金额": 0, "医疗保险金额": 0, "失业保险金额": 0, "工伤保险金额": 0, "生育保险金额": 0, - - "企业公积金比例": 1200, "企业养老保险比例": 2000, "企业医疗保险比例": 1000, "企业失业保险比例": 100, "企业工伤保险比例": 30, "企业生育保险比例": 80, - "企业公积金金额": 0, "企业养老保险金额": 0, "企业医疗保险金额": 0, "企业失业保险金额": 0, "企业工伤保险金额": 0, "企业生育保险金额": 0, - } - - for i := 3; i < len(arg)-1; i += 2 { - if _, ok := data[arg[i]]; ok { - data[arg[i]] = kit.Int64(arg[i+1]) - arg[i] = "" - } - } - - data["养老保险比例"] = 725 - data["失业保险比例"] = 18 - - salary := kit.Int64(arg[1]) - data["个税"] = kit.Int64(arg[2]) - base := data["基本工资"] - if base == 0 { - base = salary - } - - // 五险一金 - amount := int64(0) - for _, k := range []string{"公积金", "养老保险", "医疗保险", "失业保险", "工伤保险"} { - m.Push("名目", k) - value := -base * kit.Int64(data[k+"比例"]) / 10000 - m.Info("%v %v: %v %v", base, k, base*kit.Int64(data[k+"比例"]), value) - if m.Push("比例", data[k+"比例"]); data[k+"金额"] == 0 { - if k == "医疗保险" { - value -= 300 - } - data[k+"金额"] = value - } else { - value = data[k+"金额"] - } - amount += value - m.Push("金额", data[k+"金额"]) - } - - // 企业五险一金 - company := int64(0) - for _, k := range []string{"企业公积金", "企业养老保险", "企业医疗保险", "企业失业保险", "企业工伤保险", "企业生育保险"} { - m.Push("名目", k) - value := -base * kit.Int64(data[k+"比例"]) / 10000 - if m.Push("比例", data[k+"比例"]); data[k+"金额"] == 0 { - data[k+"金额"] = value - } - company += -value - m.Push("金额", data[k+"金额"]) - } - m.Push("名目", "企业承担") - m.Push("比例", "") - m.Push("金额", company) - - // 其它津贴 - for i := 3; i < len(arg)-1; i += 2 { - if arg[i] != "" && data[arg[i]] == 0 { - m.Push("名目", arg[i]) - m.Push("比例", "") - m.Push("金额", arg[i+1]) - amount += kit.Int64(arg[i+1]) - } - } - salary += amount - - m.Push("名目", "税前收入") - m.Push("比例", "") - m.Push("金额", salary) - - tax, amount := int64(0), salary - if data["个税方案"] == 6 { - // 2011年个税法案 - month := []int64{ - 8350000, 4500, - 5850000, 3500, - 3850000, 3000, - 1250000, 2500, - 800000, 2000, - 500000, 1000, - 350000, 300, - } - - for i := 0; i < len(month); i += 2 { - if amount > month[i] { - tax, amount = tax+(amount-month[i])*month[i+1]/10000, month[i] - } - } - if data["个税"] != 0 { - tax = data["个税"] - } - m.Push("名目", "个税") - m.Push("比例", "") - m.Push("金额", tax) - - m.Push("名目", "税后收入") - m.Push("比例", "") - m.Push("金额", salary-tax) - } else { - // 2019年个税法案 - // year := []int{ - // 96000000, 4500, - // 66000000, 3500, - // 42000000, 3000, - // 30000000, 2500, - // 14400000, 2000, - // 3600000, 1000, - // 0, 300, - // } - } - - switch m.Option(ice.MSG_ACTION) { - case "计算": - case "记录": - // 收入 - m.Cmd("bonus", "工资", "企业承担", company, arg[0]) - m.Cmd("bonus", "工资", "基本工资", arg[1], arg[0]) - for i := 3; i < len(arg)-1; i += 2 { - if arg[i] != "" && data[arg[i]] == 0 { - m.Cmd("bonus", "工资", arg[i], arg[i+1], arg[0]) - } - } - - // 转账 - m.Cmd("trans", "工资", "公积金", -data["企业公积金金额"], arg[0]) - for _, k := range []string{"企业养老保险", "企业医疗保险", "企业失业保险", "企业工伤保险", "企业生育保险"} { - m.Cmd("trans", "工资", k, -data[k+"金额"], arg[0]) - } - m.Cmd("trans", "工资", "公积金", -data["公积金金额"], arg[0]) - for _, k := range []string{"养老保险", "医疗保险", "失业保险"} { - m.Cmd("trans", "工资", k, -data[k+"金额"], arg[0]) - } - - // 个税 - m.Cmd("trans", "工资", "个税", tax, arg[0]) - } - }}, - "asset": {Name: "asset account type name value", Help: []string{"资产", - "action save file [account [key value]]", - "action load file [account]", - }, List: kit.List( - kit.MDB_INPUT, "text", "name", "account", "action", "auto", - kit.MDB_INPUT, "text", "name", "id", "action", "auto", - kit.MDB_INPUT, "button", "name", "查看", "action", "auto", - kit.MDB_INPUT, "button", "name", "返回", "cb", "Last", - kit.MDB_INPUT, "button", "name", "保存", - ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - if m.Option("_action") == "保存" { - arg = []string{"action", "save"} - } - if len(arg) > 0 && arg[0] == "action" { - switch arg[1] { - case "modify": - // 修改数据 - m.Richs(cmd, nil, m.Option("account"), func(key string, account map[string]interface{}) { - m.Grows(cmd, kit.Keys("hash", key), "id", arg[5], func(index int, current map[string]interface{}) { - m.Log(ice.LOG_MODIFY, "%s: %d %s: %s->%s", key, index, kit.Value(current, arg[2]), arg[2], arg[3]) - kit.Value(current, arg[2], arg[3]) - }) - }) - - case "save": - // 保存数据 - m.Option("cache.limit", -2) - if f, p, e := kit.Create(kit.Select("usr/local/asset.csv", arg, 2)); m.Assert(e) { - defer f.Close() - - w := csv.NewWriter(f) - defer w.Flush() - - w.Write([]string{"时间", "收支类型", "账目分类", "备注", "金额", "账户"}) - m.Richs(cmd, nil, kit.Select("*", arg, 3), func(key string, account map[string]interface{}) { - if kit.Format(kit.Value(account, "meta.account")) == "流水" { - return - } - m.Grows(cmd, kit.Keys("hash", key), kit.Select("", arg, 4), kit.Select("", arg, 5), func(index int, current map[string]interface{}) { - w.Write([]string{ - kit.Format(current["time"]), - kit.Format(current["type"]), - kit.Format(current["name"]), - kit.Format(current["text"]), - kit.Format(current["value"]), - kit.Format(kit.Value(account, "meta.account")), - }) - }) - }) - m.Log(ice.LOG_EXPORT, "%s", p) - m.Cmdy(ice.WEB_STORY, "catch", "csv", p) - } - - case "load": - // 加载数据 - m.CSV(m.Cmdx("nfs.cat", arg[2])).Table(func(index int, data map[string]string, head []string) { - v, _ := strconv.ParseFloat(data["金额"], 64) - for _, account := range []string{kit.Select(data["账户"], arg, 3), "流水"} { - // amount := kit.Int(v * 100) - item := kit.Dict( - "type", data["收支类型"], "name", data["账目分类"], "text", data["备注"], "value", kit.Int(v), - "time", data["时间"], "extra", kit.UnMarshal(data["extra"]), - ) - - if m.Richs(cmd, nil, account, nil) == nil { - // 添加账户 - m.Log(ice.LOG_CREATE, "account: %s", account) - m.Rich(cmd, nil, kit.Data("account", account, "amount", "0", "bonus", "0", "spend", "0")) - } - - m.Richs(cmd, nil, account, func(key string, value map[string]interface{}) { - // 账户流水 - m.Grow(cmd, kit.Keys("hash", key), item) - - // 账户结余 - amount := kit.Int(kit.Value(value, "meta.amount")) + kit.Int(v) - m.Log(ice.LOG_INSERT, "%s: %v", key, amount) - kit.Value(value, "meta.amount", amount) - - switch data["收支类型"] { - case "收入": - bonus := kit.Int(kit.Value(value, "meta.bonus")) + kit.Int(v) - kit.Value(value, "meta.bonus", bonus) - case "支出": - spend := kit.Int(kit.Value(value, "meta.spend")) + kit.Int(v) - kit.Value(value, "meta.spend", spend) - } - }) - } - }) - } - return - } - - if len(arg) == 0 { - // 账户列表 - m.Richs(cmd, nil, "*", func(key string, value map[string]interface{}) { - m.Push(key, value["meta"], []string{"account", "count", "amount", "bonus", "spend"}) - }) - m.Sort("amount", "int_r") - return - } - - if len(arg) > 5 && m.Richs(cmd, nil, arg[0], nil) == nil { - // 添加账户 - m.Rich(cmd, nil, kit.Data("account", arg[0], "amount", "0", "bonus", "0", "spend", "0")) - m.Log(ice.LOG_CREATE, "account: %s", arg[0]) - } - - field := []string{"time", "id", "value", "type", "name", "text"} - m.Richs(cmd, nil, arg[0], func(key string, value map[string]interface{}) { - if len(arg) == 1 { - // 消费流水 - m.Grows(cmd, kit.Keys("hash", key), "", "", func(index int, value map[string]interface{}) { - m.Push("", value, field) - }) - m.Sort("id", "int_r") + "spend": {Name: "spend account=@key to=@key name=@key 记录:button text:textarea value=@key time=@date", + Help: "支出", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + if input(m, arg...) { + // 输入补全 return } - if len(arg) == 2 { - // 消费详情 - m.Grows(cmd, kit.Keys("hash", key), "id", arg[1], func(index int, value map[string]interface{}) { - m.Push("detail", value) - }) + if len(arg) < 2 { + // 查看流水 + m.Cmdy("asset", arg) return } - if len(arg) < 6 { - // 消费查询 - name, value := "type", arg[2] - switch len(arg) { - case 3: - // 消费分类 - name, value = "type", arg[2] - case 4: - // 消费对象 - name, value = "name", arg[3] - case 5: - // 消费备注 - name, value = "text", arg[4] - } - m.Grows(cmd, kit.Keys("hash", key), name, value, func(index int, value map[string]interface{}) { - m.Push("", value, field) - }) - m.Sort("id", "int_r") - return - } - - // 词汇统计 - web.Count(m, cmd, "meta.word.type", arg[2]) - web.Count(m, cmd, "meta.word.name", arg[3]) - web.Count(m, cmd, "meta.word.text", arg[4]) - web.Count(m, cmd, "meta.word.value", strings.TrimPrefix(arg[5], "-")) - - // 数据结构 - amount := kit.Int(arg[5]) - extra := kit.Dict() - data := kit.Dict( - kit.MDB_TYPE, arg[2], kit.MDB_NAME, arg[3], kit.MDB_TEXT, arg[4], - "value", amount, "extra", extra, - ) - for i := 6; i < len(arg)-1; i += 2 { - switch arg[i] { - case kit.MDB_TIME: - kit.Value(data, arg[i], arg[i+1]) - default: - kit.Value(extra, arg[i], arg[i+1]) - } - } // 添加流水 - n := m.Grow(cmd, kit.Keys(kit.MDB_HASH, key), data) - - // 账户结余 - total := kit.Int(kit.Value(value, "meta.amount")) + amount - m.Log(ice.LOG_INSERT, "account: %s total: %v", arg[0], total) - kit.Value(value, "meta.amount", total) - m.Echo("%s: %d %d\n", arg[0], n, total) - - // 收支统计 - switch data["type"] { - case "收入": - bonus := kit.Int(kit.Value(value, "meta.bonus")) + amount - kit.Value(value, "meta.bonus", bonus) - case "支出": - spend := kit.Int(kit.Value(value, "meta.spend")) + amount - kit.Value(value, "meta.spend", spend) + amount := kit.Int(arg[4]) + m.Cmdy("asset", arg[0], "", "转出", arg[1], arg[2], -amount, "time", arg[5:]) + m.Cmdy("asset", arg[1], "", "转入", arg[0], arg[2], amount, "time", arg[5:]) + m.Cmdy("asset", arg[1], "", "支出", arg[2], arg[3], -amount, "time", arg[5:]) + m.Cmdy("asset", "流水", "", "支出", arg[2], arg[3], -amount, "time", arg[5:]) + }}, + "trans": {Name: "trans account=@key to=@key name=@key 记录:button text:textarea value=@key time=@date", + Help: "转账", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + if input(m, arg...) { + // 输入补全 + return } - }) - }}, - - "railway": &ice.Command{Name: "railway", Help: "12306", List: kit.List( - kit.MDB_INPUT, "text", "name", "date", "figure", "date", - kit.MDB_INPUT, "text", "name", "from", "value", "北京", "figure", "city", - kit.MDB_INPUT, "text", "name", "to", "value", "曲阜", "figure", "city", - kit.MDB_INPUT, "button", "name", "查询", - ), Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { - if !m.Confs("railway", "meta.place") { - list := strings.Split(strings.TrimPrefix(m.Cmdx(ice.WEB_SPIDE, "12306", "raw", "GET", "/otn/resources/js/framework/station_name.js?station_version=1.9090"), "var statuion_names ='"), "|") - for i := 0; i < len(list)-5; i += 5 { - m.Conf("railway", kit.Keys("meta.place", list[i+1]), list[i+2]) + if len(arg) < 2 { + // 查看流水 + m.Cmdy("asset", arg) + return + } + // 添加流水 + amount := kit.Int(arg[4]) + m.Cmdy("asset", arg[0], "", "转出", arg[1], arg[2], -amount, "time", arg[5:]) + m.Cmdy("asset", arg[1], "", "转入", arg[0], arg[2], amount, "time", arg[5:]) + m.Cmd("asset", "流水", "", "转出", arg[2], arg[3], -amount, "time", arg[5:]) + m.Cmd("asset", "流水", "", "转入", arg[2], arg[3], amount, "time", arg[5:]) + }}, + "bonus": {Name: "bonus account=@key name=@key value=@key 记录:button text:textarea time=@date", + Help: "收入", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + if input(m, arg...) { + // 输入补全 + return + } + if len(arg) < 2 { + // 查看流水 + m.Cmdy("asset", arg) + return + } + // 添加流水 + amount := kit.Int(arg[2]) + m.Cmdy("asset", arg[0], "", "收入", arg[1], arg[3], amount, "time", arg[4:]) + m.Cmdy("asset", "流水", "", "收入", arg[1], arg[3], amount, "time", arg[4:]) + }}, + "month": {Name: "month month value value 计算:button 记录:button", + Help: "工资", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + // 输入补全 + if input(m, arg...) { + return } - } - date := strings.Split(m.Time("24h"), " ")[0] - if len(arg) > 0 { - date, arg = arg[0], arg[1:] - } - date = strings.Split(date, " ")[0] - from := "北京" - if len(arg) > 0 { - from, arg = arg[0], arg[1:] - } - from_code := m.Conf("railway", kit.Keys("meta.place", from)) - to := "曲阜" - if len(arg) > 0 { - to, arg = arg[0], arg[1:] - } - to_code := m.Conf("railway", kit.Keys("meta.place", to)) + data := map[string]int64{"个税方案": 6, "基本工资": 0, "个税": 0, + "公积金比例": 1200, "养老保险比例": 800, "医疗保险比例": 200, "失业保险比例": 20, "工伤保险比例": 2, "生育保险比例": 0, + "公积金金额": 0, "养老保险金额": 0, "医疗保险金额": 0, "失业保险金额": 0, "工伤保险金额": 0, "生育保险金额": 0, - m.Echo("%s->%s %s\n", from, to, date) + "企业公积金比例": 1200, "企业养老保险比例": 2000, "企业医疗保险比例": 1000, "企业失业保险比例": 100, "企业工伤保险比例": 30, "企业生育保险比例": 80, + "企业公积金金额": 0, "企业养老保险金额": 0, "企业医疗保险金额": 0, "企业失业保险金额": 0, "企业工伤保险金额": 0, "企业生育保险金额": 0, + } - if len(arg) > 0 { - m.Cmdy(ice.WEB_SPIDE, "12306", "raw", "GET", fmt.Sprintf("/otn/czxx/queryByTrainNo?train_no=%s&from_station_telecode=%s&to_station_telecode=%s&depart_date=%s", - arg[0], from_code, to_code, date)) - return - } + for i := 3; i < len(arg)-1; i += 2 { + if _, ok := data[arg[i]]; ok { + data[arg[i]] = kit.Int64(arg[i+1]) + arg[i] = "" + } + } - m.Cmd(ice.WEB_SPIDE, "12306", "GET", fmt.Sprintf("/otn/leftTicket/init?linktypeid=dc&fs=%s,%s&ts=%s,%s&date=%s&flag=N,N,Y", - from, from_code, to, to_code, date)) - m.Cmd(ice.WEB_SPIDE, "12306", "GET", fmt.Sprintf("/otn/leftTicket/queryZ?leftTicketDTO.train_date=%s&leftTicketDTO.from_station=%s&leftTicketDTO.to_station=%s&purpose_codes=ADULT", - date, from_code, to_code)).Table(func(index int, value map[string]string, head []string) { - kit.Fetch(kit.Value(kit.UnMarshal(value["data"]), "result"), func(index int, value string) { - fields := strings.Split(value, "|") - m.Push("车次", fields[3]) - m.Push("出发", fields[8]) - m.Push("到站", fields[9]) - m.Push("时长", fields[10]) - m.Push("二等座", fields[30]) - m.Push("一等座", fields[31]) + data["养老保险比例"] = 725 + data["失业保险比例"] = 18 + + salary := kit.Int64(arg[1]) + data["个税"] = kit.Int64(arg[2]) + base := data["基本工资"] + if base == 0 { + base = salary + } + + // 五险一金 + amount := int64(0) + for _, k := range []string{"公积金", "养老保险", "医疗保险", "失业保险", "工伤保险"} { + m.Push("名目", k) + value := -base * kit.Int64(data[k+"比例"]) / 10000 + m.Info("%v %v: %v %v", base, k, base*kit.Int64(data[k+"比例"]), value) + if m.Push("比例", data[k+"比例"]); data[k+"金额"] == 0 { + if k == "医疗保险" { + value -= 300 + } + data[k+"金额"] = value + } else { + value = data[k+"金额"] + } + amount += value + m.Push("金额", data[k+"金额"]) + } + + // 企业五险一金 + company := int64(0) + for _, k := range []string{"企业公积金", "企业养老保险", "企业医疗保险", "企业失业保险", "企业工伤保险", "企业生育保险"} { + m.Push("名目", k) + value := -base * kit.Int64(data[k+"比例"]) / 10000 + if m.Push("比例", data[k+"比例"]); data[k+"金额"] == 0 { + data[k+"金额"] = value + } + company += -value + m.Push("金额", data[k+"金额"]) + } + m.Push("名目", "企业承担") + m.Push("比例", "") + m.Push("金额", company) + + // 其它津贴 + for i := 3; i < len(arg)-1; i += 2 { + if arg[i] != "" && data[arg[i]] == 0 { + m.Push("名目", arg[i]) + m.Push("比例", "") + m.Push("金额", arg[i+1]) + amount += kit.Int64(arg[i+1]) + } + } + salary += amount + + m.Push("名目", "税前收入") + m.Push("比例", "") + m.Push("金额", salary) + + tax, amount := int64(0), salary + if data["个税方案"] == 6 { + // 2011年个税法案 + month := []int64{ + 8350000, 4500, + 5850000, 3500, + 3850000, 3000, + 1250000, 2500, + 800000, 2000, + 500000, 1000, + 350000, 300, + } + + for i := 0; i < len(month); i += 2 { + if amount > month[i] { + tax, amount = tax+(amount-month[i])*month[i+1]/10000, month[i] + } + } + if data["个税"] != 0 { + tax = data["个税"] + } + m.Push("名目", "个税") + m.Push("比例", "") + m.Push("金额", tax) + + m.Push("名目", "税后收入") + m.Push("比例", "") + m.Push("金额", salary-tax) + } else { + // 2019年个税法案 + // year := []int{ + // 96000000, 4500, + // 66000000, 3500, + // 42000000, 3000, + // 30000000, 2500, + // 14400000, 2000, + // 3600000, 1000, + // 0, 300, + // } + } + + switch m.Option(ice.MSG_ACTION) { + case "计算": + case "记录": + // 收入 + m.Cmd("bonus", "工资", "企业承担", company, arg[0]) + m.Cmd("bonus", "工资", "基本工资", arg[1], arg[0]) + for i := 3; i < len(arg)-1; i += 2 { + if arg[i] != "" && data[arg[i]] == 0 { + m.Cmd("bonus", "工资", arg[i], arg[i+1], arg[0]) + } + } + + // 转账 + m.Cmd("trans", "工资", "公积金", -data["企业公积金金额"], arg[0]) + for _, k := range []string{"企业养老保险", "企业医疗保险", "企业失业保险", "企业工伤保险", "企业生育保险"} { + m.Cmd("trans", "工资", k, -data[k+"金额"], arg[0]) + } + m.Cmd("trans", "工资", "公积金", -data["公积金金额"], arg[0]) + for _, k := range []string{"养老保险", "医疗保险", "失业保险"} { + m.Cmd("trans", "工资", k, -data[k+"金额"], arg[0]) + } + + // 个税 + m.Cmd("trans", "工资", "个税", tax, arg[0]) + } + }}, + "asset": {Name: "asset account=auto id=auto auto", + Help: "资产", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + if m.Option("_action") == "保存" { + arg = []string{"action", "save"} + } + if len(arg) > 0 && arg[0] == "action" { + switch arg[1] { + case "modify": + // 修改数据 + m.Richs(cmd, nil, m.Option("account"), func(key string, account map[string]interface{}) { + m.Grows(cmd, kit.Keys("hash", key), "id", arg[5], func(index int, current map[string]interface{}) { + m.Log(ice.LOG_MODIFY, "%s: %d %s: %s->%s", key, index, kit.Value(current, arg[2]), arg[2], arg[3]) + kit.Value(current, arg[2], arg[3]) + }) + }) + + case "save": + // 保存数据 + m.Option("cache.limit", -2) + if f, p, e := kit.Create(kit.Select("usr/local/asset.csv", arg, 2)); m.Assert(e) { + defer f.Close() + + w := csv.NewWriter(f) + defer w.Flush() + + w.Write([]string{"时间", "收支类型", "账目分类", "备注", "金额", "账户"}) + m.Richs(cmd, nil, kit.Select("*", arg, 3), func(key string, account map[string]interface{}) { + if kit.Format(kit.Value(account, "meta.account")) == "流水" { + return + } + m.Grows(cmd, kit.Keys("hash", key), kit.Select("", arg, 4), kit.Select("", arg, 5), func(index int, current map[string]interface{}) { + w.Write([]string{ + kit.Format(current["time"]), + kit.Format(current["type"]), + kit.Format(current["name"]), + kit.Format(current["text"]), + kit.Format(current["value"]), + kit.Format(kit.Value(account, "meta.account")), + }) + }) + }) + m.Log(ice.LOG_EXPORT, "%s", p) + m.Cmdy(ice.WEB_STORY, "catch", "csv", p) + } + + case "load": + // 加载数据 + m.CSV(m.Cmdx("nfs.cat", arg[2])).Table(func(index int, data map[string]string, head []string) { + v, _ := strconv.ParseFloat(data["金额"], 64) + for _, account := range []string{kit.Select(data["账户"], arg, 3), "流水"} { + // amount := kit.Int(v * 100) + item := kit.Dict( + "type", data["收支类型"], "name", data["账目分类"], "text", data["备注"], "value", kit.Int(v), + "time", data["时间"], "extra", kit.UnMarshal(data["extra"]), + ) + + if m.Richs(cmd, nil, account, nil) == nil { + // 添加账户 + m.Log(ice.LOG_CREATE, "account: %s", account) + m.Rich(cmd, nil, kit.Data("account", account, "amount", "0", "bonus", "0", "spend", "0")) + } + + m.Richs(cmd, nil, account, func(key string, value map[string]interface{}) { + // 账户流水 + m.Grow(cmd, kit.Keys("hash", key), item) + + // 账户结余 + amount := kit.Int(kit.Value(value, "meta.amount")) + kit.Int(v) + m.Log(ice.LOG_INSERT, "%s: %v", key, amount) + kit.Value(value, "meta.amount", amount) + + switch data["收支类型"] { + case "收入": + bonus := kit.Int(kit.Value(value, "meta.bonus")) + kit.Int(v) + kit.Value(value, "meta.bonus", bonus) + case "支出": + spend := kit.Int(kit.Value(value, "meta.spend")) + kit.Int(v) + kit.Value(value, "meta.spend", spend) + } + }) + } + }) + } + return + } + + if len(arg) == 0 { + // 账户列表 + m.Richs(cmd, nil, "*", func(key string, value map[string]interface{}) { + m.Push(key, value["meta"], []string{"account", "count", "amount", "bonus", "spend"}) + }) + m.Sort("amount", "int_r") + return + } + + if len(arg) > 5 && m.Richs(cmd, nil, arg[0], nil) == nil { + // 添加账户 + m.Rich(cmd, nil, kit.Data("account", arg[0], "amount", "0", "bonus", "0", "spend", "0")) + m.Log(ice.LOG_CREATE, "account: %s", arg[0]) + } + + field := []string{"time", "id", "value", "type", "name", "text"} + m.Richs(cmd, nil, arg[0], func(key string, value map[string]interface{}) { + if len(arg) == 1 { + // 消费流水 + m.Grows(cmd, kit.Keys("hash", key), "", "", func(index int, value map[string]interface{}) { + m.Push("", value, field) + }) + m.Sort("id", "int_r") + return + } + if len(arg) == 2 { + // 消费详情 + m.Grows(cmd, kit.Keys("hash", key), "id", arg[1], func(index int, value map[string]interface{}) { + m.Push("detail", value) + }) + return + } + if len(arg) < 6 { + // 消费查询 + name, value := "type", arg[2] + switch len(arg) { + case 3: + // 消费分类 + name, value = "type", arg[2] + case 4: + // 消费对象 + name, value = "name", arg[3] + case 5: + // 消费备注 + name, value = "text", arg[4] + } + m.Grows(cmd, kit.Keys("hash", key), name, value, func(index int, value map[string]interface{}) { + m.Push("", value, field) + }) + m.Sort("id", "int_r") + return + } + + // 词汇统计 + web.Count(m, cmd, "meta.word.type", arg[2]) + web.Count(m, cmd, "meta.word.name", arg[3]) + web.Count(m, cmd, "meta.word.text", arg[4]) + web.Count(m, cmd, "meta.word.value", strings.TrimPrefix(arg[5], "-")) + + // 数据结构 + amount := kit.Int(arg[5]) + extra := kit.Dict() + data := kit.Dict( + kit.MDB_TYPE, arg[2], kit.MDB_NAME, arg[3], kit.MDB_TEXT, arg[4], + "value", amount, "extra", extra, + ) + for i := 6; i < len(arg)-1; i += 2 { + switch arg[i] { + case kit.MDB_TIME: + kit.Value(data, arg[i], arg[i+1]) + default: + kit.Value(extra, arg[i], arg[i+1]) + } + } + // 添加流水 + n := m.Grow(cmd, kit.Keys(kit.MDB_HASH, key), data) + + // 账户结余 + total := kit.Int(kit.Value(value, "meta.amount")) + amount + m.Log(ice.LOG_INSERT, "account: %s total: %v", arg[0], total) + kit.Value(value, "meta.amount", total) + m.Echo("%s: %d %d\n", arg[0], n, total) + + // 收支统计 + switch data["type"] { + case "收入": + bonus := kit.Int(kit.Value(value, "meta.bonus")) + amount + kit.Value(value, "meta.bonus", bonus) + case "支出": + spend := kit.Int(kit.Value(value, "meta.spend")) + amount + kit.Value(value, "meta.spend", spend) + } }) - }) - }}, - "passcode": &ice.Command{Name: "passcode", Help: "passcode", Meta: kit.Dict("active", "mall/input"), Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { - prefix := []string{ice.WEB_SPIDE, "12306"} - if len(arg) == 0 { - m.Cmd(prefix, "raw", "/passport/web/auth/uamtk-static", "form", "appid", "otn") - m.Cmd(prefix, "raw", "GET", "/otn/HttpZF/GetJS") - m.Cmd(prefix, "raw", "/otn/login/conf") - - m.Cmdy(prefix, "GET", fmt.Sprintf("/passport/captcha/captcha-image64?login_site=E&module=login&rand=sjrand")) - return - } - - switch arg[0] { - case "check": - m.Cmdy(prefix, "GET", fmt.Sprintf("/passport/captcha/captcha-check?login_site=E&rand=sjrand&answer=%s", arg[1])) - case "login": - m.Cmdy(prefix, "raw", "/passport/web/login", "form", "username", arg[1], "password", arg[2], "answer", arg[3], "appid", "otn") - } - }}, + }}, }, } diff --git a/core/team/team.go b/core/team/team.go index ddda224c..55ee137a 100644 --- a/core/team/team.go +++ b/core/team/team.go @@ -35,8 +35,7 @@ var Index = &ice.Context{Name: "team", Help: "团队中心", Configs: map[string]*ice.Config{ "task": {Name: "task", Help: "任务", Value: kit.Data(kit.MDB_SHORT, "zone")}, "plan": {Name: "plan", Help: "计划", Value: kit.Data(kit.MDB_SHORT, "zone", - "head", []interface{}{"周日", "周一", "周二", "周三", "周四", "周五", "周六"}, - "template", kit.Dict( + "head", []interface{}{"周日", "周一", "周二", "周三", "周四", "周五", "周六"}, "template", kit.Dict( "day", `