From 6f38b82b1cddc3791839901527ee91483ae948d7 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 11 Dec 2024 19:20:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_callback_advertising.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/hdl/hdl_callback_advertising.go b/app/hdl/hdl_callback_advertising.go index ad1f14a..bdce598 100644 --- a/app/hdl/hdl_callback_advertising.go +++ b/app/hdl/hdl_callback_advertising.go @@ -53,6 +53,7 @@ func CallbackChuanshanjia(c *gin.Context) { platform := "chuanshanjia" isEnd, spaceKey := comm(c, id, primeRit, platform, phonePlatform) if isEnd == 1 { + fmt.Println("isEnd") c.String(200, "{\"is_verify\":true,\"reason\":20000}") return } @@ -61,13 +62,16 @@ func CallbackChuanshanjia(c *gin.Context) { hash := sha256.Sum256([]byte(keyStr)) // 2. 将摘要转换为十六进制字符串 signStr := hex.EncodeToString(hash[:]) - fmt.Println(signStr) + fmt.Println("keyStr:" + keyStr) + fmt.Println("signStr:" + signStr) if strings.Contains(signStr, sign) == false { + fmt.Println("签名不一致") c.String(200, "{\"is_verify\":true,\"reason\":50002}") return } isEnds := commDoing(c, platform, transId, userId, extra, primeRit, uniqId) if isEnds == 1 { + fmt.Println("处理结束") c.String(200, "{\"is_verify\":true,\"reason\":20000}") return } @@ -155,12 +159,16 @@ func comm(c *gin.Context, id, primeRit, platform, phonePlatform string) (int, st return 1, "" } spaceData := gjson.Get(space.Info, platform+"."+phonePlatform+"_ad_id").String() - spaceList := make([]map[string]string, 0) + spaceList := make([]interface{}, 0) json.Unmarshal([]byte(spaceData), &spaceList) spaceKey := "" for _, v := range spaceList { - if v["id"] == primeRit { //找到对应广告位的key - spaceKey = v["key"] + v1, ok := v.(map[string]interface{}) + if ok == false { + continue + } + if v1["id"] == primeRit { //找到对应广告位的key + spaceKey = utils.AnyToString(v1["key"]) } } return 0, spaceKey