Commit 497babac7a393eb4e68e92cf828bdc57daaae2ea

Authored by 王家文
1 parent 6722fc8b
Exists in master and in 1 other branch dev-wjw

test✅:调试签名验证日志

controllers/base.go
@@ -55,7 +55,7 @@ func (c *BaseController) GetPostData(postData any) bool { @@ -55,7 +55,7 @@ func (c *BaseController) GetPostData(postData any) bool {
55 } 55 }
56 56
57 // 接收参数,验证签名登录 57 // 接收参数,验证签名登录
58 - code, err := sign.Check(req, &postData, true, true) 58 + code, err := sign.Check(req, postData, true, true)
59 if err != nil { 59 if err != nil {
60 resp := make(map[string]interface{}) 60 resp := make(map[string]interface{})
61 resp = code_msg.CodeMsg(resp, code) 61 resp = code_msg.CodeMsg(resp, code)
controllers/cardholder.go
1 package controllers 1 package controllers
2 2
3 import ( 3 import (
4 - "apigame/middleware/sign"  
5 "apigame/models" 4 "apigame/models"
6 "apigame/service/cardholder" 5 "apigame/service/cardholder"
7 - code_msg "apigame/service/code-msg"  
8 ) 6 )
9 7
10 // CardHolderController 绑定控制器 8 // CardHolderController 绑定控制器
@@ -14,20 +12,21 @@ type CardHolderController struct { @@ -14,20 +12,21 @@ type CardHolderController struct {
14 12
15 // GetConfig 活动配置 13 // GetConfig 活动配置
16 func (c *CardHolderController) GetConfig() { 14 func (c *CardHolderController) GetConfig() {
17 - req := models.ReqCardHolderGetConfig{}  
18 - codeCheck, err := sign.Check(c.Ctx.Input.RequestBody, &req, true, true)  
19 - if err != nil {  
20 - resp := make(map[string]interface{})  
21 - resp = code_msg.CodeMsg(resp, codeCheck)  
22 - c.RetData(resp)  
23 - return  
24 - }  
25 -  
26 - //if !c.GetPostData(*req) { 15 + req := new(models.ReqCardHolderGetConfig)
  16 + //req := models.ReqCardHolderGetConfig{}
  17 + //codeCheck, err := sign.Check(c.Ctx.Input.RequestBody, &req, true, true)
  18 + //if err != nil {
  19 + // resp := make(map[string]interface{})
  20 + // resp = code_msg.CodeMsg(resp, codeCheck)
  21 + // c.RetData(resp)
27 // return 22 // return
28 //} 23 //}
29 24
30 - code, rsp := cardholder.HandleGetConfig(&req) 25 + if !c.GetPostData(req) {
  26 + return
  27 + }
  28 +
  29 + code, rsp := cardholder.HandleGetConfig(req)
31 30
32 c.RetRspCodeData(code, rsp) 31 c.RetRspCodeData(code, rsp)
33 } 32 }
service-common/svredis/index.go
@@ -2,6 +2,7 @@ package svredis @@ -2,6 +2,7 @@ package svredis
2 2
3 import ( 3 import (
4 "apigame/service-common/svconst" 4 "apigame/service-common/svconst"
  5 + "apigame/util/util-lx/lxredis"
5 "apigame/util/utstring" 6 "apigame/util/utstring"
6 "apigame/util/zjson" 7 "apigame/util/zjson"
7 "apigame/util/zredis" 8 "apigame/util/zredis"
@@ -19,6 +20,24 @@ type RedisConfig struct { @@ -19,6 +20,24 @@ type RedisConfig struct {
19 } 20 }
20 21
21 func Init() bool { 22 func Init() bool {
  23 +
  24 + {
  25 + //初始化Redis
  26 + redisconfig, _ := beego.AppConfig.GetSection("redis")
  27 + var mredisconfig lxredis.MapRedisConfig
  28 + err := mapstructure.Decode(redisconfig, &mredisconfig)
  29 + if err != nil {
  30 + fmt.Println(" mapstructure.Decode Error::" + err.Error())
  31 + } else {
  32 + err = lxredis.InitRedis(mredisconfig)
  33 + if err != nil {
  34 + fmt.Println(" lxredis.InitRedis Error::" + err.Error())
  35 + return false
  36 + }
  37 + }
  38 + fmt.Println(svconst.AppName + " redis init success")
  39 + }
  40 +
22 //初始化Redis 41 //初始化Redis
23 confText, _ := beego.AppConfig.GetSection("redis") 42 confText, _ := beego.AppConfig.GetSection("redis")
24 var conf RedisConfig 43 var conf RedisConfig