Roc 3 years ago
parent
commit
17f81a5ca1
2 changed files with 5 additions and 7 deletions
  1. 5 5
      controller/wechat/wechat.go
  2. 0 2
      middleware/token_no_login.go

+ 5 - 5
controller/wechat/wechat.go

@@ -68,8 +68,8 @@ func Login(c *gin.Context) {
 
 // 消息解密请求参数
 type EncryptReq struct {
-	EncryptedData	string
-	Iv				string
+	EncryptedData string
+	Iv            string
 }
 
 // GetEncryptInfo 消息解密
@@ -82,7 +82,7 @@ type EncryptReq struct {
 // @Param iv query string true "加密算法初始向量"
 // @Success 200 {string} string "获取成功"
 // @Router /wechat/getEncryptInfo [post]
-func GetEncryptInfo(c *gin.Context)  {
+func GetEncryptInfo(c *gin.Context) {
 	var req EncryptReq
 	err := c.ShouldBind(&req)
 	if err != nil {
@@ -99,13 +99,13 @@ func GetEncryptInfo(c *gin.Context)  {
 	}
 	// 获取登录用户信息
 	userInfo := user.GetInfoByClaims(c)
-	if userInfo.SessionKey == "" {
+	if userInfo.RecordInfo.SessionKey == "" {
 		response.Fail("请重新登录", c)
 		return
 	}
 	decryptData, err := wx_app.GetDecryptInfo(userInfo.SessionKey, req.EncryptedData, req.Iv)
 	if err != nil {
-		response.Fail("获取失败,Err:" + err.Error(), c)
+		response.Fail("获取失败,Err:"+err.Error(), c)
 		return
 	}
 	response.OkData("获取成功", decryptData, c)

+ 0 - 2
middleware/token_no_login.go

@@ -1,7 +1,6 @@
 package middleware
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"hongze/hongze_yb/controller/response"
 	"hongze/hongze_yb/models/tables/rddp/session"
@@ -68,7 +67,6 @@ func TokenNoLogin() gin.HandlerFunc {
 		}
 
 		c.Set("userInfo", userInfo)
-		fmt.Println(userInfo)
 		c.Next()
 	}
 }