diff --git a/src/gonganxitong/grant.go b/src/gonganxitong/grant.go index 049300d..35a1deb 100644 --- a/src/gonganxitong/grant.go +++ b/src/gonganxitong/grant.go @@ -27,7 +27,7 @@ func (s grant) List(m *ice.Message, arg ...string) { } func (s grant) Header(m *ice.Message, arg ...string) { m.AddHeaderLogin(mdb.PLUGIN, "weixin", "微信扫码", "9") - m.Cmd(web.SPACE, ice.OPS, web.SERVE, ice.MAIN, m.Prefix("portal"), m.Option(ice.MSG_USERPOD)) + // m.Cmd(web.SPACE, ice.OPS, web.SERVE, ice.MAIN, s.PrefixPortal(m), m.Option(ice.MSG_USERPOD)) } func (s grant) Confirm(m *ice.Message, arg ...string) { if m.WarnNotAllow(m.Option(ice.MSG_METHOD) == http.MethodGet) { diff --git a/src/gonganxitong/service.go b/src/gonganxitong/service.go index a3c035a..b1138bc 100644 --- a/src/gonganxitong/service.go +++ b/src/gonganxitong/service.go @@ -22,7 +22,7 @@ type service struct { Table order string `data:"904"` update string `name:"update index name icon"` - autogen string `name:"autogen name* help* class* table*" icon:"bi bi-plus-square-dotted"` + autogen string `name:"autogen name* help* class* table* dream" icon:"bi bi-plus-square-dotted"` oauth string `name:"oauth" icon:"bi bi-shield-fill-check"` open string `name:"open" role:"void"` conf string `name:"conf" role:"void"` @@ -31,6 +31,13 @@ type service struct { func ServiceUID(m *ice.Message) string { return kit.Hashs(ice.Info.Hostname, ice.Info.Pwd, m.Prefix(web.PORTAL)) } +func (s service) Inputs(m *ice.Message, arg ...string) { + s.Table.Inputs(m, arg...) + switch arg[0] { + case web.DREAM: + m.Cut(arg[0]) + } +} func (s service) Update(m *ice.Message, arg ...string) { uid := ServiceUID(m) if s.Select(m.Spawn(), model.UID, uid).Length() == 0 { @@ -43,7 +50,11 @@ func (s service) Autogen(m *ice.Message, arg ...string) { table := m.Option(mdb.TABLE) msg := m.Cmd(api.GONGANXITONG_SERVICE) p, from := path.Join(nfs.SRC, m.Option(mdb.NAME)), "template/" - m.Option(nfs.MODULE, code.AutogenImport(m.Message, m.Option(mdb.NAME))) + m.Option(nfs.MODULE, m.Cmdx(web.SPACE, m.Option(web.DREAM), code.AUTOGEN, code.IMPORT, m.Option(mdb.NAME))) + // m.Option(nfs.MODULE, code.AutogenImport(m.Message, m.Option(mdb.NAME))) + if m.Option(web.DREAM) != "" { + m.Cmd(web.SPACE, m.Option(web.DREAM), nfs.DEFS, "src/template/web.code.autogen/demo.go", msg.Template("src/template/web.code.autogen/demo.go")) + } m.Option("CLASS", strings.ToUpper(m.Option(mdb.CLASS))) m.Option("Class", kit.Capital(m.Option(mdb.CLASS))) m.Option("class", kit.LowerCapital(m.Option(mdb.CLASS))) @@ -51,16 +62,19 @@ func (s service) Autogen(m *ice.Message, arg ...string) { m.Option("Table", kit.Capital(table)) m.Option("table", kit.LowerCapital(table)) m.Option("what", kit.LowerCapital(table)) - m.Cmd(nfs.DEFS, path.Join(p, "model/model.go"), msg.Template(from+"model/model.go")) - m.Cmd(nfs.DEFS, path.Join(p, "common.go"), msg.Template(from+"common.go")) - m.Cmd(nfs.DEFS, path.Join(p, "portal.go"), msg.Template(from+"portal.go")) - m.Cmd(nfs.DEFS, path.Join(p, "portal.json"), msg.Template(from+"portal.json")) - m.Cmd(nfs.DEFS, path.Join(p, "user"+m.Option("Class")+".go"), msg.Template(from+"userClass.go")) - m.Cmd(nfs.DEFS, path.Join(p, m.Option("class")+".go"), msg.Template(from+"class.go")) + save := func(name string, arg ...string) { + m.Cmd(web.SPACE, m.Option(web.DREAM), nfs.DEFS, path.Join(p, name), msg.Template(from+kit.Select(name, arg, 0))) + } + save("model/model.go") + save("common.go") + save("portal.go") + save("portal.json") + save("user"+m.Option("Class")+".go", "userClass.go") + save(m.Option("class")+".go", "class.go") kit.For(kit.Split(m.Option(mdb.TABLE)), func(table string) { msg.Option(mdb.TABLE, kit.LowerCapital(table)) - m.Cmd(nfs.DEFS, path.Join(p, m.Option(mdb.TABLE)+".go"), msg.Template(from+"homework.go")) - m.Cmd(nfs.DEFS, path.Join(p, m.Option(mdb.TABLE)+".js"), msg.Template(from+"homework.js")) + save(m.Option(mdb.TABLE)+".go", "homework.go") + save(m.Option(mdb.TABLE)+".js", "homework.js") }) } func (s service) Compile(m *ice.Message, arg ...string) { @@ -72,6 +86,7 @@ func (s service) Oauth(m *ice.Message, arg ...string) { m.Option("user_cmd", kit.JoinWord(m.Prefix(aaa.USER), mdb.CREATE)) m.Cmd(web.SPACE, ice.OPS, ctx.CONFIG, web.CHAT_WX_AGENT, web.SPACE, m.Option(ice.MSG_USERPOD)) m.Cmd(web.CHAT_WX_ACCESS, web.OAUTH) + m.Cmd(grant{}, web.HEADER) m.ProcessHold() } func (s service) List(m *ice.Message, arg ...string) { @@ -81,7 +96,7 @@ func (s service) List(m *ice.Message, arg ...string) { s.SelectDetail(m, model.UID, arg[1]) } if m.IsTech() { - m.PushAction(s.Open, s.Conf, s.Code, s.Data).Action(s.Autogen, s.Compile, s.Oauth) + m.PushAction(s.Open, s.Conf, s.Code, s.Data).Action(s.Autogen, s.Oauth) } else { m.PushAction(s.Open).Action() } diff --git a/src/main.shy b/src/main.shy index 4ef8297..52091dc 100644 --- a/src/main.shy +++ b/src/main.shy @@ -6,5 +6,6 @@ GORM https://gorm.io/docs/indexes.html ` field web.chat.wx.access field web.chat.wx.menu +field web.team.gonganxitong.service field web.code.mysql.client field web.code.mysql.query args `mysql gonganxitong` \ No newline at end of file