批量优化
This commit is contained in:
1 parent
438145cae7
commit
c925b198d1
50 files changed
+5716
-291
No files matched your search
@@ -438,6 +438,23 @@ func handleTextIntent(openid, content string) string {
|
||||
if isLoginKeyword(text) {
|
||||
return DirectLoginReply(openid)
|
||||
}
|
||||
// 「注册」:注册页账号注册方式取码(无二维码兜底路径)
|
||||
if isRegisterKeyword(text) {
|
||||
row, err := LatestPendingRegisterVerifyByOpenID(openid)
|
||||
if err != nil || row == nil {
|
||||
row, err = CreateRegisterOpenIDVerify(openid, 0)
|
||||
if err != nil {
|
||||
return "系统繁忙,请稍后重新发送。"
|
||||
}
|
||||
}
|
||||
minutes := 1
|
||||
if row.ExpireAt != nil {
|
||||
if m := int(time.Until(*row.ExpireAt).Minutes()); m > 1 {
|
||||
minutes = m
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("您的注册验证码是:%s\n请回到注册页面输入完成验证(%d 分钟内有效)。", row.Code, minutes)
|
||||
}
|
||||
if !isBindKeyword(text) {
|
||||
return textBindGuide()
|
||||
}
|
||||
@@ -463,6 +480,11 @@ func handleTextIntent(openid, content string) string {
|
||||
return fmt.Sprintf("您的验证码是:%s\n请在系统页面「绑定微信」处输入完成绑定(%d 分钟内有效)。%s", row.Code, minutes, tip)
|
||||
}
|
||||
|
||||
// isRegisterKeyword 判断文本是否为「注册」意图(注册页账号注册取码)
|
||||
func isRegisterKeyword(text string) bool {
|
||||
return text == "注册" || strings.Contains(text, "注册")
|
||||
}
|
||||
|
||||
// isBindKeyword 判断文本是否为「获取验证码 / 绑定」类意图
|
||||
func isBindKeyword(text string) bool {
|
||||
if text == "" {
|
||||
|
||||
Reference in new issue
Block a user