aa
This commit is contained in:
@@ -11,7 +11,9 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
beego "github.com/astaxie/beego/adapter"
|
beego "github.com/astaxie/beego/adapter"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type User2Controller struct {
|
type User2Controller struct {
|
||||||
@@ -303,16 +305,28 @@ type UserInfoWithWeixin struct {
|
|||||||
// @Param data formData string true "加密数据"
|
// @Param data formData string true "加密数据"
|
||||||
// @Param iv formData string true "iv"
|
// @Param iv formData string true "iv"
|
||||||
// @Param jsCode formData string false "小程序jsCode"
|
// @Param jsCode formData string false "小程序jsCode"
|
||||||
|
// @Param authType formData string false "authType"
|
||||||
|
// @Param appID formData string false "appID"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /GetUserByMiniInfo [post]
|
// @router /GetUserByMiniInfo [post]
|
||||||
func (c *User2Controller) GetUserByMiniInfo() {
|
func (c *Auth2Controller) GetUserByMiniInfo() {
|
||||||
c.callGetUserByMiniInfo(func(params *tUser2GetUserByMiniInfoParams) (retVal interface{}, errCode string, err error) {
|
c.callGetUserByMiniInfo(func(params *tAuth2GetUserByMiniInfoParams) (retVal interface{}, errCode string, err error) {
|
||||||
authInfo := &auth2.AuthInfo{}
|
authInfo := &auth2.AuthInfo{}
|
||||||
|
if params.JsCode == "" {
|
||||||
|
result := api.Cacher.Get(params.Token)
|
||||||
|
utils.Map2StructByJson(result.(map[string]interface{}), &authInfo, false)
|
||||||
|
}
|
||||||
|
str := []string{
|
||||||
|
params.AppID,
|
||||||
|
params.JsCode,
|
||||||
|
}
|
||||||
|
jsCode := strings.Join(str, ",")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
decryptedDataBase64, err2 := weixin.AutherObjMini.DecryptData(authInfo, GetComposedCode(&c.Controller, params.JsCode), params.Data, params.Iv)
|
decryptedDataBase64, err2 := weixin.AutherObjMini.DecryptData(authInfo, jsCode, params.Data, params.Iv)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
var userInfo *weixinapi.MiniUserInfo
|
var userInfo *weixinapi.MiniUserInfo
|
||||||
|
globals.SugarLogger.Debugf("GetUserByMiniInfo :%v", decryptedDataBase64)
|
||||||
if err = utils.UnmarshalUseNumber([]byte(decryptedDataBase64), &userInfo); err == nil {
|
if err = utils.UnmarshalUseNumber([]byte(decryptedDataBase64), &userInfo); err == nil {
|
||||||
result := &UserInfoWithWeixin{}
|
result := &UserInfoWithWeixin{}
|
||||||
result.Mobile = userInfo.PhoneNumber
|
result.Mobile = userInfo.PhoneNumber
|
||||||
|
|||||||
Reference in New Issue
Block a user