This commit is contained in:
suyl
2021-07-15 14:06:51 +08:00
parent 71419171c8
commit c4ac39eea8
2 changed files with 10 additions and 4 deletions

View File

@@ -4,7 +4,6 @@ import (
"bytes"
"encoding/base64"
"errors"
"fmt"
"regexp"
"strings"
"time"
@@ -213,9 +212,9 @@ func SendVerifyCode(authToken, captchaID, captchaValue, authID string) (verfifyC
if handler := authers[authType]; handler == nil {
err = ErrIllegalAuthType
} else {
if user, _ := dao.GetUserByID(dao.GetDB(), "mobile", authID); user != nil {
return "", authInfo, fmt.Errorf("该用户已存在,请勿重复注册!")
}
//if user, _ := dao.GetUserByID(dao.GetDB(), "mobile", authID); user != nil {
// return "", authInfo, fmt.Errorf("该用户已存在,请勿重复注册!")
//}
verfifyCode, err = handler.SendVerifyCode(authID)
}
}

View File

@@ -1,6 +1,7 @@
package controllers
import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/weixinapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/auth2"
@@ -26,6 +27,7 @@ type User2Controller struct {
// @Param payload formData string true "json数据User对象(手机号必填)"
// @Param mobileVerifyCode formData string false "手机验证码通过auth2.SendVerifyCode获得mobileVerifyCode与authToken不能同时为空"
// @Param authToken formData string false "之前通过login得到的认证TOKENmobileVerifyCode与authToken不能同时为空"
// @Param version formData string false "当app登录时需要传版本号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /RegisterUser [post]
@@ -40,6 +42,11 @@ func (c *User2Controller) RegisterUser() {
} else if params.Token != "" {
manTokenInfo, err = auth2.GetTokenInfo(params.Token)
}
if configs, _ := dao.QueryConfigs(dao.GetDB(), "checkversion", model.ConfigTypeSys, ""); len(configs) > 0 {
if params.Version == "" || configs[0].Value != params.Version {
return nil, "", fmt.Errorf("当前APP版本过旧数据显示有错误请到'京西菜市'公众号下载最新版本APP")
}
}
if err == nil {
if err = jxutils.Strings2Objs(params.Payload, &user); err == nil {
user.Type = 0