This commit is contained in:
songliang 2023-07-12 17:46:06 +08:00
parent c052c81e66
commit 01ad5f03da
2 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,70 @@
## 回调函数
1. ceg支付回调
地址: <https://game2006api-test.kingsome.cn/webapp/index.php?c=Callback&a=dispatch&action=gameItemMallBuyOk>
调用方: web3server
参数说明:
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------ | ---- | ------------------------ |
| trans\_id | string | 是 | 事务id |
| order\_id | string | 是 | 订单id |
返回说明:
```javascript
{
"errcode": 0, //0成功 1已发货 2订单不存在
"errmsg": ""
}
```
2. 购买ceg回调
地址: <https://game2006api-test.kingsome.cn/webapp/index.php?c=Shop&a=buyGoodsDirect>
调用方: 链上购买服务(hongliang)
请求方法: [GET]
参数说明:
| 参数名 | 类型 |必填 | 说明 |
| ----------- | ------- | ---- | ------------------------------------------------- |
| account_id | string | 是 | 账户id (中心化游戏账号,充值成功后会给绑定的账号一些奖励) |
| oreder_id | string | 是 | 订单id |
| status | string | 是 | 订单状态 |
| id | string | 是 | goods_id |
| txhash | string | 是 | txhash |
| sign | string | 是 | 签名 |
调用说明:
```
// let repdata = {
// account_id: string
// order_id: string
// status: string
// id: string
// txhash: string
// }
// 我返回给你这些数据和一个sign字段,
// sign使用上面 repdata 按key 顺序排后, 组成key1=val1&key2=val2后, 使用hmac_sha256 hash, key是 iG4Rpsa)6U31$H#^T85$^^3
// PENDING = 0, // 初始状态
// TRANSFERING = 1, //只有国库模式才会有该状态
// TRANSFERED = 2, //只有国库模式才会有该状态
// SUCCESS = 9, // 成功的最终状态
// TRANSFER_FAIL = 98, // 转账错误
// FAIL = 99, // 也是错误
//
```
返回说明:
```
{
"errcode": 0, // 0 操作成功
"errmsg" : ""
}
```

View File

@ -1004,15 +1004,33 @@ class MarketController extends BaseAuthedController
$this->_rspErr(500, 'internal error, no self');
return;
}
$address = $this->_getAddress();
if (!$address) {
$this->_rspErr(1, 'address not found');
return;
}
$account = $address;
$account = strtolower(getReqVal('account', ''));
$token = getReqVal('token', '');
$nft_token = getReqVal('nft_token', '');
$item_id = getReqVal('item_id', '');
if (empty($item_id)) {
$this->_rspErr(1, 'item_id not found');
return;
}
$s_price = getReqVal('s_price', '');
if (empty($s_price)) {
$this->_rspErr(1, 's_price not found');
return;
}
$amount = getReqVal('amount', 1);
if (empty($amount)) {
$this->_rspErr(1, 'amount not found');
return;
}
$payment_token_address = getReqVal('payment_token_address', '');
$nonce = getReqVal('nonce', '');