1
This commit is contained in:
@@ -33,3 +33,16 @@ type WxLoginReq struct {
|
|||||||
Phone string `json:"phone" form:"phone"` // 微信和电话登录使用
|
Phone string `json:"phone" form:"phone"` // 微信和电话登录使用
|
||||||
Password string `json:"password" form:"password"` // 密码登录
|
Password string `json:"password" form:"password"` // 密码登录
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 微信小程序解密后 用户手机号结构体
|
||||||
|
type UserPhone struct {
|
||||||
|
PhoneNumber string `json:"phoneNumber,omitempty"`
|
||||||
|
PurePhoneNumber string `json:"purePhoneNumber,omitempty"`
|
||||||
|
CountryCode string `json:"countryCode,omitempty"`
|
||||||
|
Watermark *watermarkInfo `json:"watermark,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type watermarkInfo struct {
|
||||||
|
Appid string `json:"appid,omitempty"`
|
||||||
|
Timestamp int `json:"timestamp,omitempty"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/gopay-main/wechat"
|
|
||||||
"git.rosy.net.cn/jx-print/dao"
|
"git.rosy.net.cn/jx-print/dao"
|
||||||
"git.rosy.net.cn/jx-print/globals"
|
"git.rosy.net.cn/jx-print/globals"
|
||||||
"git.rosy.net.cn/jx-print/model"
|
"git.rosy.net.cn/jx-print/model"
|
||||||
@@ -43,7 +42,7 @@ func (u *UserLogin) WxLogin(ctx *gin.Context, param *wxLogin.WeChatPhoneNumberPa
|
|||||||
return nil, errors.New("数据异常,用户电话不唯一,联系管理员")
|
return nil, errors.New("数据异常,用户电话不唯一,联系管理员")
|
||||||
}
|
}
|
||||||
|
|
||||||
weChatLogin := new(wechat.UserPhone)
|
weChatLogin := new(wxLogin.UserPhone)
|
||||||
if err := DecryptOpenDataToStruct(param.EncryptedData, param.IV, openObj.SessionKey, weChatLogin); err != nil {
|
if err := DecryptOpenDataToStruct(param.EncryptedData, param.IV, openObj.SessionKey, weChatLogin); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user