瀏覽代碼

配置

tmp
huangjiajun 3 週之前
父節點
當前提交
6f38b82b1c
共有 1 個文件被更改,包括 12 次插入4 次删除
  1. +12
    -4
      app/hdl/hdl_callback_advertising.go

+ 12
- 4
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


Loading…
取消
儲存