From 01ad5f03da55d5768e09de1c37b84d1b94fddf9e Mon Sep 17 00:00:00 2001 From: songliang Date: Wed, 12 Jul 2023 17:46:06 +0800 Subject: [PATCH] ... --- uml/game2006api_20230712.md | 70 ++++++++++++++++++++ webapp/controller/MarketController.class.php | 20 +++++- 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 uml/game2006api_20230712.md diff --git a/uml/game2006api_20230712.md b/uml/game2006api_20230712.md new file mode 100644 index 00000000..37f765a4 --- /dev/null +++ b/uml/game2006api_20230712.md @@ -0,0 +1,70 @@ +## 回调函数 + +1. ceg支付回调 + +地址: + +调用方: web3server + +参数说明: + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ------------------------ | +| trans\_id | string | 是 | 事务id | +| order\_id | string | 是 | 订单id | + +返回说明: + +```javascript +{ + "errcode": 0, //0成功 1:已发货 2:订单不存在 + "errmsg": "" +} +``` + +2. 购买ceg回调 + +地址: + +调用方: 链上购买服务(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" : "" +} +``` \ No newline at end of file diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index c36b64c9..f0fbf61c 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -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', '');