|
@@ -47,11 +47,11 @@ func WxAppletLogin(c *gin.Context) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if !cacheKeyExist { // 如果是首次设置 设置过期时间 |
|
|
if !cacheKeyExist { // 如果是首次设置 设置过期时间 |
|
|
//_, err := cache.Expire(cacheKey, md.CfgCacheTime) |
|
|
|
|
|
//if err != nil { |
|
|
|
|
|
|
|
|
// _, err := cache.Expire(cacheKey, md.CfgCacheTime) |
|
|
|
|
|
// if err != nil { |
|
|
// _ = logx.Error(err) |
|
|
// _ = logx.Error(err) |
|
|
// return "" |
|
|
// return "" |
|
|
//} |
|
|
|
|
|
|
|
|
// } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
e.OutSuc(c, md.WxAppletLoginResponse{ |
|
|
e.OutSuc(c, md.WxAppletLoginResponse{ |
|
@@ -82,7 +82,7 @@ func WxDecryptUserInfo(c *gin.Context) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//获取sessionKey |
|
|
|
|
|
|
|
|
// 获取sessionKey |
|
|
get, err := cache.HGetString(md.WxSessionCacheKey, req.OpenId) |
|
|
get, err := cache.HGetString(md.WxSessionCacheKey, req.OpenId) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
@@ -113,7 +113,7 @@ func WxDecryptMobile(c *gin.Context) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//获取sessionKey |
|
|
|
|
|
|
|
|
// 获取sessionKey |
|
|
get, err := cache.HGetString(md.WxSessionCacheKey, req.OpenId) |
|
|
get, err := cache.HGetString(md.WxSessionCacheKey, req.OpenId) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
@@ -172,13 +172,14 @@ func Register(c *gin.Context) { |
|
|
var req md.RegisterReq |
|
|
var req md.RegisterReq |
|
|
err := c.ShouldBindJSON(&req) |
|
|
err := c.ShouldBindJSON(&req) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
|
|
|
utils.FilePutContents("Register_ERR", utils.SerializeStr(req)) |
|
|
err = svc2.HandleValidateErr(err) |
|
|
err = svc2.HandleValidateErr(err) |
|
|
err1 := err.(e.E) |
|
|
err1 := err.(e.E) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//TODO::解密 |
|
|
|
|
|
|
|
|
// TODO::解密 |
|
|
phone := utils.Base64StdDecode(req.Phone) |
|
|
phone := utils.Base64StdDecode(req.Phone) |
|
|
if phone == "" { |
|
|
if phone == "" { |
|
|
e.OutErr(c, e.ERR, "非法/恶意 参数!!!") |
|
|
e.OutErr(c, e.ERR, "非法/恶意 参数!!!") |
|
@@ -234,10 +235,10 @@ func Register(c *gin.Context) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if req.UserId != "" { |
|
|
if req.UserId != "" { |
|
|
//支付宝 |
|
|
|
|
|
|
|
|
// 支付宝 |
|
|
user.UserId = req.UserId |
|
|
user.UserId = req.UserId |
|
|
} else { |
|
|
} else { |
|
|
//微信 |
|
|
|
|
|
|
|
|
// 微信 |
|
|
user.OpenId = req.OpenId |
|
|
user.OpenId = req.OpenId |
|
|
user.UnionId = req.UnionId |
|
|
user.UnionId = req.UnionId |
|
|
} |
|
|
} |
|
@@ -307,10 +308,10 @@ func UpdateUser(c *gin.Context) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if req.UserId != "" { |
|
|
if req.UserId != "" { |
|
|
//支付宝 |
|
|
|
|
|
|
|
|
// 支付宝 |
|
|
user.UserId = req.UserId |
|
|
user.UserId = req.UserId |
|
|
} else { |
|
|
} else { |
|
|
//微信 |
|
|
|
|
|
|
|
|
// 微信 |
|
|
user.OpenId = req.OpenId |
|
|
user.OpenId = req.OpenId |
|
|
user.UnionId = req.UnionId |
|
|
user.UnionId = req.UnionId |
|
|
} |
|
|
} |
|
|