|
@@ -63,6 +63,7 @@ func (l *MiniUserLoginLogic) MiniUserLogin(req *types.MiniUserLoginRequest) (res |
|
@@ -63,6 +63,7 @@ func (l *MiniUserLoginLogic) MiniUserLogin(req *types.MiniUserLoginRequest) (res |
63
|
Success: true,
|
63
|
Success: true,
|
64
|
}
|
64
|
}
|
65
|
if loginInfo.User == nil {
|
65
|
if loginInfo.User == nil {
|
|
|
66
|
+ resp.Token = ""
|
66
|
resp.Success = false
|
67
|
resp.Success = false
|
67
|
}
|
68
|
}
|
68
|
return
|
69
|
return
|
|
@@ -88,6 +89,9 @@ type WxClientLogin struct { |
|
@@ -88,6 +89,9 @@ type WxClientLogin struct { |
88
|
|
89
|
|
89
|
func (c WxClientLogin) WechatPhoneLogin(r domain.WechatLoginRequest) (*domain.LoginInfo, error) {
|
90
|
func (c WxClientLogin) WechatPhoneLogin(r domain.WechatLoginRequest) (*domain.LoginInfo, error) {
|
90
|
code := r.Code
|
91
|
code := r.Code
|
|
|
92
|
+ response := &domain.LoginInfo{
|
|
|
93
|
+ Phone: "",
|
|
|
94
|
+ }
|
91
|
miniprogram := wechat.NewWechat().GetMiniProgram(&miniConfig.Config{
|
95
|
miniprogram := wechat.NewWechat().GetMiniProgram(&miniConfig.Config{
|
92
|
AppID: c.l.svcCtx.Config.Wechat.AppID,
|
96
|
AppID: c.l.svcCtx.Config.Wechat.AppID,
|
93
|
AppSecret: c.l.svcCtx.Config.Wechat.AppSecret,
|
97
|
AppSecret: c.l.svcCtx.Config.Wechat.AppSecret,
|
|
@@ -95,7 +99,7 @@ func (c WxClientLogin) WechatPhoneLogin(r domain.WechatLoginRequest) (*domain.Lo |
|
@@ -95,7 +99,7 @@ func (c WxClientLogin) WechatPhoneLogin(r domain.WechatLoginRequest) (*domain.Lo |
95
|
})
|
99
|
})
|
96
|
authResult, err := miniprogram.GetAuth().GetPhoneNumber(code)
|
100
|
authResult, err := miniprogram.GetAuth().GetPhoneNumber(code)
|
97
|
if err != nil || authResult.ErrCode != 0 || authResult.PhoneInfo.PhoneNumber == "" {
|
101
|
if err != nil || authResult.ErrCode != 0 || authResult.PhoneInfo.PhoneNumber == "" {
|
98
|
- return nil, xerr.NewCodeErrMsg(xerr.ErrWxMiniAuthFailError, nil, fmt.Sprintf("发起授权请求失败1 err : %v , code : %s , authResult : %+v", err, code, authResult))
|
102
|
+ return response, xerr.NewCodeErrMsg(xerr.ErrWxMiniAuthFailError, nil, fmt.Sprintf("发起授权请求失败1 err : %v , code : %s , authResult : %+v", err, code, authResult))
|
99
|
}
|
103
|
}
|
100
|
var (
|
104
|
var (
|
101
|
users []*domain.User
|
105
|
users []*domain.User
|
|
@@ -106,11 +110,9 @@ func (c WxClientLogin) WechatPhoneLogin(r domain.WechatLoginRequest) (*domain.Lo |
|
@@ -106,11 +110,9 @@ func (c WxClientLogin) WechatPhoneLogin(r domain.WechatLoginRequest) (*domain.Lo |
106
|
MustWithKV("phone", phone).
|
110
|
MustWithKV("phone", phone).
|
107
|
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}))
|
111
|
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}))
|
108
|
if err != nil {
|
112
|
if err != nil {
|
109
|
- return nil, err
|
|
|
110
|
- }
|
|
|
111
|
- response := &domain.LoginInfo{
|
|
|
112
|
- Phone: phone,
|
113
|
+ return response, err
|
113
|
}
|
114
|
}
|
|
|
115
|
+ response.Phone = phone
|
114
|
if len(users) != 0 {
|
116
|
if len(users) != 0 {
|
115
|
response.User = users[0]
|
117
|
response.User = users[0]
|
116
|
}
|
118
|
}
|