purchase notify
This commit is contained in:
parent
9769a62222
commit
046ae1b710
@ -13,6 +13,7 @@
|
||||
"appkey": "CrIjLw1wiExEnNBVqBQqWGMy0yToREC7",
|
||||
"appsecret": "148509437b331acd15580b279e8511af",
|
||||
"zoneid": "1",
|
||||
"offerid": "1450318181"
|
||||
"offerid": "1450318181",
|
||||
"notifyurl": "https://game2004api-test.kingsome.cn/index.php"
|
||||
}
|
||||
]
|
@ -222,8 +222,48 @@ func (this *MainServiceApi) WxNotifyPurchase(c *gin.Context) {
|
||||
orderModel.GameId = int32(gameid)
|
||||
f5.GetSysLog().Debug("notify url:%s, %s", appid, notifyurl)
|
||||
|
||||
nowtimestr := q5.SafeToString(f5.GetApp().GetRealSeconds())
|
||||
originstr := "account_id=" + orderModel.AccountId
|
||||
originstr += "&goodsid=" + string(orderModel.ItemId)
|
||||
originstr += "&orderid=" + orderModel.OrderId
|
||||
originstr += "&amount=" + q5.SafeToString(payloadobj.GoodsInfo.ActualPrice)
|
||||
originstr += ":" + nowtimestr + constant.NOFITY_GAMESERVER_SALT
|
||||
params := map[string]string{
|
||||
"c": "Recharge",
|
||||
"a": "purchaseNotify",
|
||||
"account_id": orderModel.AccountId,
|
||||
"orderid": orderModel.OrderId,
|
||||
"timestamp": nowtimestr,
|
||||
"goodsid": string(orderModel.ItemId),
|
||||
"amount": q5.SafeToString(payloadobj.GoodsInfo.ActualPrice),
|
||||
"sign": q5.Md5Str(originstr),
|
||||
}
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
notifyurl,
|
||||
params,
|
||||
func(hcr f5.HttpCliResponse) {
|
||||
if hcr.GetErr() != nil {
|
||||
return
|
||||
}
|
||||
|
||||
rspObj := struct {
|
||||
ErrCode int64 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
}{}
|
||||
|
||||
f5.GetSysLog().Debug("get game rsp:%s", hcr.GetRawData())
|
||||
if json.Unmarshal([]byte(hcr.GetRawData()), &rspObj) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if rspObj.ErrCode == 0 {
|
||||
orderModel.Status = 2
|
||||
orderModel.UpdateFields([]string{"status"})
|
||||
rspObj.ErrCode = 0
|
||||
rspObj.ErrMsg = "Success"
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
c.JSON(200, rspObj)
|
||||
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ const (
|
||||
|
||||
const (
|
||||
GLOBAL_SALT = "f3a6a9a5-217a-4079-ab99-b5d69b8212be"
|
||||
NOFITY_GAMESERVER_SALT = "NrN3zkVOzXF1vRzUc9eJM9ZKRO5eLooD"
|
||||
)
|
||||
|
||||
const (
|
||||
|
Loading…
x
Reference in New Issue
Block a user