rdluck 4 years ago
parent
commit
646c3df5a7
1 changed files with 6 additions and 1 deletions
  1. 6 1
      controllers/wechat.go

+ 6 - 1
controllers/wechat.go

@@ -2,6 +2,7 @@ package controllers
 
 import (
 	"encoding/json"
+	"fmt"
 	"github.com/medivhzhan/weapp/v2"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
@@ -189,6 +190,10 @@ func (this *WechatCommonController) WechatLogin() {
 	wxUserInfo.Errcode = wxInfo.ErrCode
 	wxUserInfo.Errmsg = wxInfo.ErrMSG
 	wxUserInfo.SessionKey = wxInfo.SessionKey
+
+	fmt.Println("openId", wxInfo.OpenID)
+	fmt.Println("unionId", wxInfo.UnionID)
+
 	token, userId, firstLogin, _, err := services.WxLogin(code, wxInfo.OpenID, wxInfo.UnionID, wxUserInfo)
 	if err != nil {
 		br.Msg = "微信登录失败"
@@ -229,6 +234,7 @@ func (this *WechatCommonController) WechatLogin() {
 	br.Msg = "登录成功"
 	br.Data = resp
 }
+
 //
 //// @Title 小程序获取用户信息
 //// @Description 小程序获取用户信息接口(需要登录)
@@ -345,7 +351,6 @@ func (this *WechatCommonController) WechatLogin() {
 //	br.Success = true
 //}
 
-
 // @Title 小程序获取用户信息
 // @Description 小程序获取用户信息接口(需要登录)
 // @Param	request	body models.WxGetUserInfoReq true "type json string"