From e042dc832cc0340b1678f91743ce58141a8f91b4 Mon Sep 17 00:00:00 2001 From: shy Date: Wed, 20 Nov 2024 22:49:56 +0800 Subject: [PATCH] add some --- core/code/go.go | 17 +++++++++++------ core/code/js.go | 2 +- misc/wx/agent.js | 1 - 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/code/go.go b/core/code/go.go index 00a19cba..3751f3d1 100644 --- a/core/code/go.go +++ b/core/code/go.go @@ -74,19 +74,24 @@ func _go_show(m *ice.Message, arg ...string) { // ctx.ProcessField(m, "web.code.xterm", kit.Simple()) ctx.ProcessField(m, "log.debug", kit.Simple("bench")) } else if cmd := ctx.GetFileCmd(path.Join(arg[2], arg[1])); cmd != "" { - if p := path.Join(path.Dir(path.Join(arg[2], arg[1])), "portal.go"); path.Base(arg[1]) != "portal.go" && nfs.Exists(m, p) && - !kit.IsIn(arg[1], "gonganxitong/user.go", "gonganxitong/domain.go") { + if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); path.Base(arg[1]) != "portal.go" && nfs.Exists(m, p) && + !kit.IsIn(arg[1], + "gonganxitong/user.go", + "gonganxitong/domain.go", + "gonganxitong/command.go", + ) { if cmd := ctx.GetFileCmd(p); cmd != "" { if m.ActionKey() == mdb.RENDER { ctx.ProcessField(m, cmd, kit.Simple()) } else { ls := kit.Split(strings.TrimSuffix(arg[1], ".go"), "/") - if kit.HasSuffix(ls[1], "y") { - ls[1] = ls[1][:len(ls[1])-1] + "ies" + table := kit.Select("", ls, -1) + if kit.HasSuffix(table, "y") { + table = table[:len(table)-1] + "ies" } else { - ls[1] = ls[1] + "s" + table = table + "s" } - ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", ls[0], ls[1])) + ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", ls[0], table)) } return } diff --git a/core/code/js.go b/core/code/js.go index 829aeb7f..e0ef85c5 100644 --- a/core/code/js.go +++ b/core/code/js.go @@ -22,7 +22,7 @@ func _js_show(m *ice.Message, arg ...string) { ctx.ProcessField(m, kit.Select(ice.CAN_PLUGIN, "web."+strings.Replace(strings.TrimSuffix(strings.TrimPrefix(arg[1], "plugin/local/"), nfs.PT+JS), nfs.PS, nfs.PT, -1)), nil) } } else { - if p := path.Join(path.Dir(path.Join(arg[2], arg[1])), "portal.go"); nfs.Exists(m, p) { + if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); nfs.Exists(m, p) { if cmd := ctx.GetFileCmd(p); cmd != "" { ctx.ProcessField(m, cmd, kit.Simple()) return diff --git a/misc/wx/agent.js b/misc/wx/agent.js index 507c92ec..0ae4d7d3 100644 --- a/misc/wx/agent.js +++ b/misc/wx/agent.js @@ -1,7 +1,6 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { if (!can.user.info.username && can.user.info._cmd != "web.chat.oauth.client" && msg.Option("oauth")) { - debugger return can.user.jumps(msg.Option("oauth")) } msg.Option(ice.MSG_ACTION, ""), can.require([msg.Option(nfs.SCRIPT)], function(can) {