|
@@ -53,6 +53,7 @@ func CallbackChuanshanjia(c *gin.Context) { |
|
|
platform := "chuanshanjia" |
|
|
platform := "chuanshanjia" |
|
|
isEnd, spaceKey := comm(c, id, primeRit, platform, phonePlatform) |
|
|
isEnd, spaceKey := comm(c, id, primeRit, platform, phonePlatform) |
|
|
if isEnd == 1 { |
|
|
if isEnd == 1 { |
|
|
|
|
|
fmt.Println("isEnd") |
|
|
c.String(200, "{\"is_verify\":true,\"reason\":20000}") |
|
|
c.String(200, "{\"is_verify\":true,\"reason\":20000}") |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@@ -61,13 +62,16 @@ func CallbackChuanshanjia(c *gin.Context) { |
|
|
hash := sha256.Sum256([]byte(keyStr)) |
|
|
hash := sha256.Sum256([]byte(keyStr)) |
|
|
// 2. 将摘要转换为十六进制字符串 |
|
|
// 2. 将摘要转换为十六进制字符串 |
|
|
signStr := hex.EncodeToString(hash[:]) |
|
|
signStr := hex.EncodeToString(hash[:]) |
|
|
fmt.Println(signStr) |
|
|
|
|
|
|
|
|
fmt.Println("keyStr:" + keyStr) |
|
|
|
|
|
fmt.Println("signStr:" + signStr) |
|
|
if strings.Contains(signStr, sign) == false { |
|
|
if strings.Contains(signStr, sign) == false { |
|
|
|
|
|
fmt.Println("签名不一致") |
|
|
c.String(200, "{\"is_verify\":true,\"reason\":50002}") |
|
|
c.String(200, "{\"is_verify\":true,\"reason\":50002}") |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
isEnds := commDoing(c, platform, transId, userId, extra, primeRit, uniqId) |
|
|
isEnds := commDoing(c, platform, transId, userId, extra, primeRit, uniqId) |
|
|
if isEnds == 1 { |
|
|
if isEnds == 1 { |
|
|
|
|
|
fmt.Println("处理结束") |
|
|
c.String(200, "{\"is_verify\":true,\"reason\":20000}") |
|
|
c.String(200, "{\"is_verify\":true,\"reason\":20000}") |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@@ -155,12 +159,16 @@ func comm(c *gin.Context, id, primeRit, platform, phonePlatform string) (int, st |
|
|
return 1, "" |
|
|
return 1, "" |
|
|
} |
|
|
} |
|
|
spaceData := gjson.Get(space.Info, platform+"."+phonePlatform+"_ad_id").String() |
|
|
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) |
|
|
json.Unmarshal([]byte(spaceData), &spaceList) |
|
|
spaceKey := "" |
|
|
spaceKey := "" |
|
|
for _, v := range spaceList { |
|
|
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 |
|
|
return 0, spaceKey |
|
|