2637309949 4 年之前
父节点
当前提交
c5374cacaa
共有 2 个文件被更改,包括 5 次插入0 次删除
  1. 4 0
      internal/logic/auth/loginbyweixinlogic.go
  2. 1 0
      internal/logic/user/getuserlogic.go

+ 4 - 0
internal/logic/auth/loginbyweixinlogic.go

@@ -2,6 +2,7 @@ package auth
 
 import (
 	"context"
+	"errors"
 	"fmt"
 	"time"
 
@@ -125,6 +126,9 @@ func (l *LoginByWeixinLogic) Login(code string) (*types.WXUserInfo, error) {
 
 	var res types.WXLoginResponse
 	req.ToJSON(&res)
+	if res.ErrCode != 0 {
+		return nil, errors.New(res.ErrMsg)
+	}
 	userinfo, err := l.DecryptUserInfoData(res.SessionKey)
 	userinfo.OpenID = res.OpenID
 	userinfo.SessionKey = res.SessionKey

+ 1 - 0
internal/logic/user/getuserlogic.go

@@ -48,6 +48,7 @@ func (l *GetUserLogic) GetUser() (*types.InfoResponse, error) {
 	info.UserName = user.Username
 	info.NickName = user.Nickname
 	info.Gender = user.Gender
+	info.Mobile = user.Mobile
 	info.ErpRoleType = resp.ErpRoleType
 	return info, nil
 }