...
|
...
|
@@ -63,6 +63,7 @@ func (l *MiniUserLoginLogic) MiniUserLogin(req *types.MiniUserLoginRequest) (res |
|
|
Success: true,
|
|
|
}
|
|
|
if loginInfo.User == nil {
|
|
|
resp.Token = ""
|
|
|
resp.Success = false
|
|
|
}
|
|
|
return
|
...
|
...
|
@@ -88,6 +89,9 @@ type WxClientLogin struct { |
|
|
|
|
|
func (c WxClientLogin) WechatPhoneLogin(r domain.WechatLoginRequest) (*domain.LoginInfo, error) {
|
|
|
code := r.Code
|
|
|
response := &domain.LoginInfo{
|
|
|
Phone: "",
|
|
|
}
|
|
|
miniprogram := wechat.NewWechat().GetMiniProgram(&miniConfig.Config{
|
|
|
AppID: c.l.svcCtx.Config.Wechat.AppID,
|
|
|
AppSecret: c.l.svcCtx.Config.Wechat.AppSecret,
|
...
|
...
|
@@ -95,7 +99,7 @@ func (c WxClientLogin) WechatPhoneLogin(r domain.WechatLoginRequest) (*domain.Lo |
|
|
})
|
|
|
authResult, err := miniprogram.GetAuth().GetPhoneNumber(code)
|
|
|
if err != nil || authResult.ErrCode != 0 || authResult.PhoneInfo.PhoneNumber == "" {
|
|
|
return nil, xerr.NewCodeErrMsg(xerr.ErrWxMiniAuthFailError, nil, fmt.Sprintf("发起授权请求失败1 err : %v , code : %s , authResult : %+v", err, code, authResult))
|
|
|
return response, xerr.NewCodeErrMsg(xerr.ErrWxMiniAuthFailError, nil, fmt.Sprintf("发起授权请求失败1 err : %v , code : %s , authResult : %+v", err, code, authResult))
|
|
|
}
|
|
|
var (
|
|
|
users []*domain.User
|
...
|
...
|
@@ -106,11 +110,9 @@ func (c WxClientLogin) WechatPhoneLogin(r domain.WechatLoginRequest) (*domain.Lo |
|
|
MustWithKV("phone", phone).
|
|
|
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}))
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
response := &domain.LoginInfo{
|
|
|
Phone: phone,
|
|
|
return response, err
|
|
|
}
|
|
|
response.Phone = phone
|
|
|
if len(users) != 0 {
|
|
|
response.User = users[0]
|
|
|
}
|
...
|
...
|
|