From c4ac39eea83d4548082f4bcf3e735449863a35ed Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Thu, 15 Jul 2021 14:06:51 +0800 Subject: [PATCH] aa --- business/auth2/auth2.go | 7 +++---- controllers/cms_user2.go | 7 +++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 02c8dfb9f..705fa3332 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -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) } } diff --git a/controllers/cms_user2.go b/controllers/cms_user2.go index 4ecb4e60b..ebfc17f38 100644 --- a/controllers/cms_user2.go +++ b/controllers/cms_user2.go @@ -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得到的认证TOKEN(mobileVerifyCode与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