diff --git a/base/web/toast.go b/base/web/toast.go index f170134b..882efdae 100644 --- a/base/web/toast.go +++ b/base/web/toast.go @@ -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 diff --git a/misc.go b/misc.go index 50c6b97b..4da19e55 100644 --- a/misc.go +++ b/misc.go @@ -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) diff --git a/misc/wx/access.go b/misc/wx/access.go index 2f90c04d..c97b13ed 100644 --- a/misc/wx/access.go +++ b/misc/wx/access.go @@ -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)) }