1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-07-19 18:11:03 +08:00
parent 97bdf84965
commit 9ba006a1da
5 changed files with 17 additions and 6 deletions

View File

@ -52,6 +52,7 @@ const (
SPAN = "span" SPAN = "span"
TEXT = "text" TEXT = "text"
PLUG = "plug" PLUG = "plug"
FORM = "form"
TEXTAREA = "textarea" TEXTAREA = "textarea"
PASSWORD = "password" PASSWORD = "password"
CHECKBOX = "checkbox" CHECKBOX = "checkbox"

View File

@ -138,7 +138,6 @@ func init() {
m.Cmdy(TEMPLATE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH)) m.Cmdy(TEMPLATE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH))
}}, }},
COMPLETE: {Hand: func(m *ice.Message, arg ...string) { COMPLETE: {Hand: func(m *ice.Message, arg ...string) {
return
m.Cmdy(COMPLETE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH)) m.Cmdy(COMPLETE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH))
}}, }},
COMPILE: {Hand: func(m *ice.Message, arg ...string) { COMPILE: {Hand: func(m *ice.Message, arg ...string) {

View File

@ -197,7 +197,12 @@ func (m *Message) ToastProcess(arg ...string) func(...string) {
func (m *Message) Trans(en string, zh string) string { func (m *Message) Trans(en string, zh string) string {
switch strings.ToLower(kit.Select("", kit.Split(m.Option(MSG_LANGUAGE), "_-"), 0)) { switch strings.ToLower(kit.Select("", kit.Split(m.Option(MSG_LANGUAGE), "_-"), 0)) {
case "zh": case "zh":
return zh if zh == "" {
if h, ok := m.Target().Commands[m.CommandKey()].Actions[en]; ok {
return kit.Select(en, h.Help)
}
}
return kit.Select(en, zh)
default: default:
return en return en
} }

View File

@ -95,7 +95,6 @@ func init() {
} }
}}, }},
MEDIA: {Hand: func(m *ice.Message, arg ...string) { MEDIA: {Hand: func(m *ice.Message, arg ...string) {
m.OptionDefault(ACCESS, mdb.Config(m, ACCESS))
m.Cmdy(web.SPIDE, WX, web.SPIDE_SAVE, arg[1], http.MethodGet, MEDIA_GET, oauth.ACCESS_TOKEN, m.Cmdx(ACCESS, TOKENS), "media_id", arg[0]) m.Cmdy(web.SPIDE, WX, web.SPIDE_SAVE, arg[1], http.MethodGet, MEDIA_GET, oauth.ACCESS_TOKEN, m.Cmdx(ACCESS, TOKENS), "media_id", arg[0])
}}, }},
OAUTH: {Icon: "bi bi-shield-fill-check", Hand: func(m *ice.Message, arg ...string) { OAUTH: {Icon: "bi bi-shield-fill-check", Hand: func(m *ice.Message, arg ...string) {
@ -145,6 +144,7 @@ func init() {
} }
func spideToken(m *ice.Message, api string, token, expire string, arg ...string) { func spideToken(m *ice.Message, api string, token, expire string, arg ...string) {
msg := mdb.HashSelect(m.Spawn(), m.OptionDefault(ACCESS, mdb.Config(m, ACCESS))) msg := mdb.HashSelect(m.Spawn(), m.OptionDefault(ACCESS, mdb.Config(m, ACCESS)))
m.Info("what token %v %v", msg.Append(expire), msg.Append(token))
if msg.Append(token) == "" || m.Time() > msg.Append(expire) { if msg.Append(token) == "" || m.Time() > msg.Append(expire) {
kit.If(api != TICKET_GETTICKET, func() { arg = append(arg, msg.AppendSimple(APPID, SECRET)...) }) kit.If(api != TICKET_GETTICKET, func() { arg = append(arg, msg.AppendSimple(APPID, SECRET)...) })
res := m.Cmd(web.SPIDE, WX, kit.Select(http.MethodGet, http.MethodPost, api == STABLE_TOKEN), api, arg) res := m.Cmd(web.SPIDE, WX, kit.Select(http.MethodGet, http.MethodPost, api == STABLE_TOKEN), api, arg)

View File

@ -1,11 +1,12 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
if (!can.user.info.username && can.user.info._cmd != "web.chat.oauth.client" && msg.Option("oauth")) { if (!can.user.info.username && can.user.info._cmd != "web.chat.oauth.client" && msg.Option("oauth")) {
can.user.jumps(msg.Option("oauth")) return can.user.jumps(msg.Option("oauth"))
return
} }
msg.Option(ice.MSG_ACTION, ""), can.require([msg.Option(nfs.SCRIPT)], function(can) { msg.Option(ice.MSG_ACTION, ""), can.require([msg.Option(nfs.SCRIPT)], function(can) {
var debug = msg.isDebug() && can.user.info.userrole == aaa.TECH; debug && can.onmotion.toggle(can, can._fields, true) var debug = msg.isDebug() && can.user.info.userrole == aaa.TECH; debug && can.onmotion.toggle(can, can._fields, true)
// debug = false
can.onmotion.hidden(can, can._fields)
wx.config({debug: debug, signature: msg.Option("signature"), timestamp: msg.Option("timestamp"), nonceStr: msg.Option("noncestr"), appId: msg.Option("appid"), wx.config({debug: debug, signature: msg.Option("signature"), timestamp: msg.Option("timestamp"), nonceStr: msg.Option("noncestr"), appId: msg.Option("appid"),
openTagList: ["wx-open-subscribe"], openTagList: ["wx-open-subscribe"],
jsApiList: can.core.Item({ jsApiList: can.core.Item({
@ -26,9 +27,14 @@ Volcanos(chat.ONIMPORT, {
can.base.isFunc(cb) && cb(res.serverId) can.base.isFunc(cb) && cb(res.serverId)
} }) }, } }) },
}, function(key, value) { return can.user.agent[key] = value, key }).concat([ }, function(key, value) { return can.user.agent[key] = value, key }).concat([
// "updateAppMessageShareData", "updateTimelineShareData", "updateAppMessageShareData", "updateTimelineShareData",
]), ]),
}) })
wx.ready(function () {
var p = can.misc.Resource(can, can.user.info.favicon); can.base.beginWith(p, "/") && (p = location.origin + p)
wx.updateAppMessageShareData({title: can.user.info.titles, desc: "车管所业务代办", link: location.href, imgUrl: p})
wx.updateTimelineShareData({title: can.user.info.titles, link: location.href, imgUrl: p})
})
}) })
}, },
}) })