1
0
mirror of https://shylinux.com/x/icebergs synced 2025-06-26 02:17:30 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-07-21 14:50:43 +08:00
parent d401e8ec2c
commit 271e743c3c
3 changed files with 12 additions and 4 deletions

View File

@ -54,7 +54,7 @@ func toastTitle(m *ice.Message) string {
}
func toastContent(m *ice.Message, state string, arg ...ice.Any) string {
if len(arg) == 0 {
return kit.JoinWord(kit.Simple(Icons[state], kit.Select(ice.LIST, m.ActionKey()), state)...)
return kit.JoinWord(kit.Simple(Icons[state], m.Trans(kit.Select(ice.LIST, m.ActionKey()), ""), m.Trans(state, ""))...)
} else {
return kit.JoinWord(kit.Simple(Icons[state], arg)...)
}
@ -121,7 +121,7 @@ func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title
kit.If(len(arg) == 0, func() { arg = append(arg, "") })
kit.If(len(arg) > 0 && arg[0] == "", func() { arg[0] = toastTitle(m) })
if m.IsDebug() {
arg[0] = kit.Format(arg[0]) + "\t" + kit.FileLine(-1, 3)
// arg[0] = kit.Format(arg[0]) + "\t" + kit.FileLine(-1, 3)
}
PushNoticeToast(m, text, arg)
return m

View File

@ -197,6 +197,14 @@ func (m *Message) ToastProcess(arg ...string) func(...string) {
func (m *Message) Trans(en string, zh string) string {
switch strings.ToLower(kit.Select("", kit.Split(m.Option(MSG_LANGUAGE), "_-"), 0)) {
case "zh":
switch en {
case PROCESS:
return "处理中"
case FAILURE:
return "失败"
case SUCCESS:
return "成功"
}
if zh == "" {
if h, ok := m.Target().Commands[m.CommandKey()].Actions[en]; ok {
return kit.Select(en, h.Help)

View File

@ -85,7 +85,7 @@ func init() {
ctx.OptionFromConfig(m, ACCESS, APPID)
}},
"user": {Name: "user openid", Hand: func(m *ice.Message, arg ...string) {
SpideGet(m, "user/info", "openid", m.Option("openid"))
SpideGet(m, "user/info", OPENID, m.Option(OPENID))
}},
"api": {Name: "api method=GET,POST path params", Hand: func(m *ice.Message, arg ...string) {
switch m.Option("method") {
@ -154,7 +154,7 @@ func spideToken(m *ice.Message, api string, token, expire string, arg ...string)
if m.Warn(!kit.IsIn(res.Append("errcode"), "0", ""), res.Append("errmsg")) {
return
}
m.Debug("res: %v", res.FormatMeta())
m.Info("what res: %v", res.FormatMeta())
mdb.HashModify(m, m.OptionSimple(ACCESS), expire, m.Time(kit.Format("%vs", res.Append(oauth.EXPIRES_IN))), token, res.Append(kit.Select(oauth.ACCESS_TOKEN, TICKET, api == TICKET_GETTICKET)))
msg = mdb.HashSelect(m.Spawn(), m.Option(ACCESS))
}