From 42011b19bb82c92af4747540529b8f7cbe1b41fa Mon Sep 17 00:00:00 2001 From: shaoying Date: Sun, 2 Feb 2020 04:21:34 +0800 Subject: [PATCH] add 20200202 --- etc/conf/go.vim | 6 +++--- go.mod | 2 +- miss.md | 29 +++++++++++++++++++++++++++++ src/support/wuhan/wuhan.go | 34 ++++++++++++++++++++++++++++++---- 4 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 miss.md diff --git a/etc/conf/go.vim b/etc/conf/go.vim index 552a636a..3f118caf 100644 --- a/etc/conf/go.vim +++ b/etc/conf/go.vim @@ -7,7 +7,7 @@ syntax match kitConst "app\.[a-z0-9A-Z_.]*" highlight msgConst ctermfg=cyan -syntax match msgConst "m\.[a-z0-9A-Z_.]*" -syntax match msgConst "msg\.[a-z0-9A-Z_.]*" -syntax match msgConst "sub\.[a-z0-9A-Z_.]*" +syntax match msgConst "\Am\.[a-z0-9A-Z_.]*" +syntax match msgConst "\Amsg\.[a-z0-9A-Z_.]*" +syntax match msgConst "\Asub\.[a-z0-9A-Z_.]*" diff --git a/go.mod b/go.mod index 579b3261..8695c3a3 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module miss go 1.13 require ( - github.com/shylinux/contexts v0.0.0-00010101000000-000000000000 // indirect + github.com/shylinux/contexts v0.0.0-00010101000000-000000000000 github.com/shylinux/icebergs v0.1.9 github.com/shylinux/toolkits v0.1.0 ) diff --git a/miss.md b/miss.md new file mode 100644 index 00000000..eb2a0ae0 --- /dev/null +++ b/miss.md @@ -0,0 +1,29 @@ +# {{title "contexts"}} + +## {{chapter "编程"}} +{{table "编程" ` +原型 接口 +框架 模块 +`}} + +## {{chapter "趋势"}} +{{table "趋势" ` +模块化 contexts +集群化 icebergs +自动化 volcanos +`}} + +## {{chapter "网络"}} +{{table "网络" ` +SPIDE SERVE SPACE DREAM +FAVOR CACHE STORY SHARE +ROUTE PROXY GROUP LABEL +`}} + +## {{chapter "图谱"}} +{{table "图谱" ` +code wiki chat team mall +linux nginx golang redis mysql +zsh tmux docker git vim +`}} + diff --git a/src/support/wuhan/wuhan.go b/src/support/wuhan/wuhan.go index 76f1844b..dbf27adf 100644 --- a/src/support/wuhan/wuhan.go +++ b/src/support/wuhan/wuhan.go @@ -2,7 +2,7 @@ package wuhan import ( "github.com/shylinux/icebergs" - "github.com/shylinux/icebergs/base/cli" + "github.com/shylinux/icebergs/core/team" "github.com/shylinux/toolkits" ) @@ -15,10 +15,36 @@ var Index = &ice.Context{Name: "wuhan", Help: "武汉加油", ice.ICE_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}}, ice.ICE_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}}, - "wuhan": {Name: "wuhan", Help: "武汉", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - m.Echo("hello world") + "wuhan": {Name: "wuhan", Help: "武汉", Meta: kit.Dict( + "display", "china", + ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + data := kit.UnMarshal(m.Cmdx(ice.WEB_SPIDE, "shy", "raw", "GET", "https://view.inews.qq.com/g2/getOnsInfo?name=wuwei_ww_area_counts")) + m.Option("title", kit.Format("疫情分布\n%s", m.Time())) + + suspect := map[string]int{} + confirm := map[string]int{} + dead := map[string]int{} + deal := map[string]int{} + + kit.Fetch(kit.UnMarshal(kit.Value(data, "data").(string)), func(index int, value map[string]interface{}) { + area := kit.Select(kit.Format(value["country"]), kit.Format(value["area"])) + suspect[area] += kit.Int(value["suspect"]) + confirm[area] += kit.Int(value["confirm"]) + dead[area] += kit.Int(value["dead"]) + deal[area] += kit.Int(value["deal"]) + }) + + for k, v := range suspect { + m.Push("name", k) + m.Push("suspect", v) + m.Push("confirm", confirm[k]) + m.Push("dead", dead[k]) + m.Push("deal", deal[k]) + m.Push("value", confirm[k]) + } + m.Sort("confirm", "int_r") }}, }, } -func init() { cli.Index.Register(Index, nil) } +func init() { team.Index.Register(Index, nil) }