mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
add some
This commit is contained in:
parent
fc71adb56d
commit
e5dad62c87
@ -38,7 +38,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
CITY: {Help: "本地", Hand: func(m *ice.Message, arg ...string) {
|
CITY: {Help: "本地", Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.ProcessField(m, m.PrefixKey(), func() {
|
ctx.ProcessField(m, m.PrefixKey(), func() {
|
||||||
m.Push(ctx.DISPLAY, "/plugin/story/china.js?title=深圳资源分布&field=area&style=float&path=440300")
|
m.Push(ctx.DISPLAY, "/plugin/story/china.js?title=深圳资源分布&field=area&style=float&path=深圳市")
|
||||||
}, arg...)
|
}, arg...)
|
||||||
}},
|
}},
|
||||||
}, mdb.ExportHashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,gdp,population,area,text")), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.ExportHashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,gdp,population,area,text")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -9,13 +9,15 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
"shylinux.com/x/icebergs/base/web/html"
|
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
const GEOAREA = "geoarea"
|
const GEOAREA = "geoarea"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
const (
|
||||||
|
CITY = "city"
|
||||||
|
)
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
GEOAREA: {Name: "geoarea path auto", Help: "地区", Actions: ice.Actions{
|
GEOAREA: {Name: "geoarea path auto", Help: "地区", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -26,25 +28,18 @@ func init() {
|
|||||||
kit.If(!nfs.Exists(m, p), func() { m.Cmd(web.SPIDE, GEOAREA, web.SPIDE_SAVE, p, arg) })
|
kit.If(!nfs.Exists(m, p), func() { m.Cmd(web.SPIDE, GEOAREA, web.SPIDE_SAVE, p, arg) })
|
||||||
m.RenderDownload(p)
|
m.RenderDownload(p)
|
||||||
}},
|
}},
|
||||||
"china": {Hand: func(m *ice.Message, arg ...string) {
|
CITY: {Help: "城市", Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.ProcessField(m, m.PrefixKey(), func() {
|
|
||||||
m.Push(ctx.STYLE, html.FLOAT)
|
|
||||||
}, arg...)
|
|
||||||
}},
|
|
||||||
"city": {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
stat := map[string]int{}
|
stat := map[string]int{}
|
||||||
lead := map[string]string{}
|
lead := map[string]string{}
|
||||||
list := map[string][]string{}
|
list := map[string][]string{}
|
||||||
m.Cmdy(nfs.CAT, "usr/geoarea/city.txt", func(ls []string, text string) {
|
trans := kit.Dict("10", kit.Dict(mdb.NAME, "中国"))
|
||||||
|
m.Cmdy(nfs.CAT, ice.USR_GEOAREA+"city.txt", func(ls []string, text string) {
|
||||||
if len(ls) < 2 {
|
if len(ls) < 2 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, k := range []string{
|
for _, k := range []string{
|
||||||
"自治区", "自治州", "自治县", "自治旗", "盟", "旗",
|
"自治区", "自治州", "自治县", "自治旗", "盟", "旗",
|
||||||
"特别行政区", "特别行政区",
|
"特别行政区", "特别行政区", "特区", "地区", "林区",
|
||||||
"地区",
|
|
||||||
"林区",
|
|
||||||
"特区",
|
|
||||||
"省", "市", "县", "区",
|
"省", "市", "县", "区",
|
||||||
} {
|
} {
|
||||||
if strings.HasSuffix(ls[1], k) {
|
if strings.HasSuffix(ls[1], k) {
|
||||||
@ -53,31 +48,38 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(ls[0], "0000") {
|
if strings.HasSuffix(ls[0], "0000") {
|
||||||
lead[ls[0][0:2]] = ls[1]
|
lead[ls[0][:2]] = ls[1]
|
||||||
|
kit.Value(trans, kit.Keys("10", mdb.LIST, ls[1]), ls[0][:2])
|
||||||
|
kit.Value(trans, kit.Keys(ls[0][:2], mdb.NAME), ls[1])
|
||||||
kit.If(strings.HasSuffix(ls[1], "市"), func() { stat["直辖市"]++ })
|
kit.If(strings.HasSuffix(ls[1], "市"), func() { stat["直辖市"]++ })
|
||||||
stat["省级单位"]++ // 34 = 4 直辖市 23 省 5 自治区 2 特别行政区
|
stat["省级单位"]++ // 34 = 4 直辖市 23 省 5 自治区 2 特别行政区
|
||||||
} else if strings.HasSuffix(ls[0], "00") {
|
} else if strings.HasSuffix(ls[0], "00") {
|
||||||
list[lead[ls[0][0:2]]] = append(list[lead[ls[0][0:2]]], ls[1])
|
list[lead[ls[0][:2]]] = append(list[lead[ls[0][:2]]], ls[1])
|
||||||
|
kit.Value(trans, kit.Keys(ls[0][:2], mdb.LIST, ls[1]), ls[0][:4])
|
||||||
|
kit.Value(trans, kit.Keys(ls[0][:4], mdb.NAME), ls[1])
|
||||||
kit.If(strings.HasSuffix(ls[1], "市"), func() { stat["地级市"]++ })
|
kit.If(strings.HasSuffix(ls[1], "市"), func() { stat["地级市"]++ })
|
||||||
stat["地级单位"]++ // 333 = 293 地级市 30 自治州 3 盟 7 地区
|
stat["地级单位"]++ // 333 = 293 地级市 30 自治州 3 盟 7 地区
|
||||||
} else {
|
} else {
|
||||||
// list[lead[ls[0][0:2]]] = append(list[lead[ls[0][0:2]]], ls[1])
|
if strings.HasSuffix(lead[ls[0][:2]], "市") {
|
||||||
|
kit.Value(trans, kit.Keys(ls[0][:2], mdb.LIST, ls[1]), ls[0])
|
||||||
|
} else {
|
||||||
|
kit.Value(trans, kit.Keys(ls[0][:4], mdb.LIST, ls[1]), ls[0])
|
||||||
|
}
|
||||||
|
|
||||||
kit.If(strings.HasSuffix(ls[1], "市"), func() { stat["县级市"]++ })
|
kit.If(strings.HasSuffix(ls[1], "市"), func() { stat["县级市"]++ })
|
||||||
stat["县级单位"]++ // 2842 = 388 县级市 1312 县 117 自治县 3 自治旗 49 旗 5 林区 1 特区 967 市辖区
|
stat["县级单位"]++ // 2842 = 388 县级市 1312 县 117 自治县 3 自治旗 49 旗 5 林区 1 特区 967 市辖区
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
for k, v := range list {
|
if p := ice.USR_GEOAREA + "city.json"; !nfs.Exists(m, p) {
|
||||||
m.Push(mdb.NAME, k)
|
nfs.WriteFile(m, p, []byte(kit.Format(trans)))
|
||||||
m.Push(mdb.VALUE, len(v))
|
|
||||||
m.Push(mdb.LIST, strings.Join(v, ","))
|
|
||||||
}
|
}
|
||||||
m.SortIntR(mdb.VALUE).StatusTimeCount(stat)
|
for k, v := range list {
|
||||||
m.Action("china")
|
m.Push(mdb.NAME, k).Push(mdb.COUNT, len(v)).Push(mdb.LIST, strings.Join(v, ","))
|
||||||
|
}
|
||||||
|
m.SortIntR(mdb.COUNT).StatusTimeCount(stat)
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.DisplayStoryChina(m.Options(mdb.NAME, "中国", nfs.PATH, kit.Select("", arg, 0)))
|
ctx.DisplayStoryChina(m.Options(nfs.PATH, kit.Select("", arg, 0))).Action(CITY)
|
||||||
m.Action("city")
|
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
chapter "地区"
|
||||||
refer `
|
refer `
|
||||||
https://www.mca.gov.cn/mzsj/xzqh/2020/20201201.html
|
地图点 http://datav.aliyun.com/portal/school/atlas/area_selector
|
||||||
|
行政区 https://www.mca.gov.cn/mzsj/xzqh/2020/20201201.html
|
||||||
`
|
`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user