From d26706ed4d55ec3771594b75eb177413aad27f4c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 2 Nov 2022 11:58:52 +0800 Subject: [PATCH 1/9] 1 --- sql/gamedb.sql | 1 + webapp/models/Transaction.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 3b2dcfb3..3625d209 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -796,6 +796,7 @@ CREATE TABLE `t_transaction` ( `item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid', `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `client_result` mediumblob COMMENT 'client_result', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), diff --git a/webapp/models/Transaction.php b/webapp/models/Transaction.php index a462255f..453b2b5b 100644 --- a/webapp/models/Transaction.php +++ b/webapp/models/Transaction.php @@ -56,7 +56,9 @@ class Transaction extends BaseModel { 'token_type' => $tokenType, 'item_uniid' => $itemUniId, 'item_id' => $itemId, - 'status' => self::CREATED_STATUS + 'status' => self::CREATED_STATUS, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime(), ) ); } From ac5932afe60e91ab69d16b7a24037bc1a8f67835 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 2 Nov 2022 12:10:14 +0800 Subject: [PATCH 2/9] 1 --- doc/BlockChain.py | 80 ++++--------------- .../controller/BlockChainController.class.php | 27 ++----- webapp/models/Transaction.php | 15 ++++ 3 files changed, 34 insertions(+), 88 deletions(-) diff --git a/doc/BlockChain.py b/doc/BlockChain.py index 4e875a39..cfa4ad37 100644 --- a/doc/BlockChain.py +++ b/doc/BlockChain.py @@ -18,6 +18,19 @@ class BlockChain(object): ['!transactions', [_common.NftTransaction()], '交易列表'] ] }, + { + 'name': 'reportResult', + 'desc': '上报链调用结果', + 'group': 'BlockChain', + 'url': 'webapp/index.php?c=BlockChain&a=reportResult', + 'params': [ + ['trans_id', '', '事务id'], + ['result', '', '合约返回值'], + ], + 'response': [ + _common.RspHead(), + ] + }, { 'name': 'active721Nft', 'desc': '激活721nft', @@ -47,19 +60,6 @@ class BlockChain(object): ['!params', [''], '合约参数列表'], ] }, - { - 'name': 'reportActiveResult', - 'desc': '上报激活结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportActiveResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, { 'name': 'evolve721Nft', 'desc': 'nft进阶(英雄,武器)', @@ -76,19 +76,6 @@ class BlockChain(object): ['!params', [''], '合约参数列表'], ] }, - { - 'name': 'reportEvolve721NftResult', - 'desc': '上报nft进阶(英雄、武器)结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportEvolve721NftResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, { 'name': 'evolveChip', 'desc': '芯片进阶', @@ -104,19 +91,6 @@ class BlockChain(object): ['!params', [''], '合约参数列表'], ] }, - { - 'name': 'reportEvolveChipResult', - 'desc': '上报芯片进阶结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportEvolveChipResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, { 'name': 'mintShardBatchUser', 'desc': '碎片生成', @@ -131,19 +105,6 @@ class BlockChain(object): ['!params', [''], '合约参数列表'], ] }, - { - 'name': 'reportMintShardBatchUserResult', - 'desc': '上报碎片生成结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportMintShardBatchUserResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, { 'name': 'shardMixByUser', 'desc': '碎片合成', @@ -158,18 +119,5 @@ class BlockChain(object): ['trans_id', '', '事务id'], ['!params', [''], '合约参数列表'], ] - }, - { - 'name': 'reportShardMixByUserUserResult', - 'desc': '上报碎片合成结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportShardMixByUserResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, + } ] diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 8d7bd8c7..10ffb5d3 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -106,9 +106,12 @@ class BlockChainController extends BaseAuthedController { } - public function reportActiveResult() + public function reportResult() { - + $transId = getReqVal('trans_id', ''); + $result = getReqVal('result', ''); + Transaction::reportResult($transId, $result); + myself()->_rspOk(); } public function evolve721Nft() @@ -116,41 +119,21 @@ class BlockChainController extends BaseAuthedController { } - public function reportEvolve721NftResult() - { - - } - public function evolveChip() { } - public function reportEvolveChipResult() - { - - } - public function mintShardBatchUser() { } - public function reportMintShardBatchUserResult() - { - - } - public function shardMixByUser() { } - public function reportShardMixByUserResult() - { - - } - private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId) { $params = array( diff --git a/webapp/models/Transaction.php b/webapp/models/Transaction.php index 453b2b5b..d961c031 100644 --- a/webapp/models/Transaction.php +++ b/webapp/models/Transaction.php @@ -120,4 +120,19 @@ class Transaction extends BaseModel { } } + public static function reportResult($transId, $result) + { + SqlHelper::update( + myself()->_getSelfMysql(), + 't_transaction', + array( + 'account_id' => myself()->_getAccountId(), + 'trans_id' => $transId + ), + array( + 'client_result' => $result + ) + ); + } + } From 3025f0d659f6e0ec072a9c895ef400a66f628aba Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 2 Nov 2022 12:10:55 +0800 Subject: [PATCH 3/9] 1 --- webapp/models/Transaction.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/models/Transaction.php b/webapp/models/Transaction.php index d961c031..7a2fc2c4 100644 --- a/webapp/models/Transaction.php +++ b/webapp/models/Transaction.php @@ -130,7 +130,8 @@ class Transaction extends BaseModel { 'trans_id' => $transId ), array( - 'client_result' => $result + 'client_result' => $result, + 'modifytime' => myself()->_getNowTime() ) ); } From 023cb7690286162003c614dc7d05c45d9b375c83 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 2 Nov 2022 12:55:18 +0800 Subject: [PATCH 4/9] update shop buygoodsnew --- third_party/j7 | 2 +- third_party/phpcommon | 2 +- webapp/controller/ShopController.class.php | 14 ++------------ 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/third_party/j7 b/third_party/j7 index 7533a5e7..f98d9e8d 160000 --- a/third_party/j7 +++ b/third_party/j7 @@ -1 +1 @@ -Subproject commit 7533a5e7ed287378d33cb1bc3244487d33de7951 +Subproject commit f98d9e8dfb0575f3c42795163bfbaa5c807a5935 diff --git a/third_party/phpcommon b/third_party/phpcommon index 848e05c0..571b6c46 160000 --- a/third_party/phpcommon +++ b/third_party/phpcommon @@ -1 +1 @@ -Subproject commit 848e05c01f44622e52996bb04dfb6b344acce1b8 +Subproject commit 571b6c46137597d3bede13989e284130a070bea0 diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index d13cbe97..af84d3af 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -67,13 +67,7 @@ class ShopController extends BaseAuthedController { $token_type = getReqVal('token_type', ''); $goods_num = getReqVal('goods_num', 0); - $row = SqlHelper::ormSelectOne( - $this->_getSelfMysql(), - 't_shop_goods', - array( - 'id' => $id, - ) - ); + $row = mt\ShopGoods::get($id); $desired_token_type = $row['token_type']; $check_token_type = splitStr1($desired_token_type); @@ -151,6 +145,7 @@ class ShopController extends BaseAuthedController { switch($token_type) { case ShopController::TOKEN_TYPE_CEG: + case ShopController::TOKEN_TYPE_CEC: $costItems = $this->makeCostItems($costItemId, $goods_num*$need_price); $lackItem = null; if (!$this->_hasEnoughItems($costItems, $lackItem)) { @@ -193,11 +188,6 @@ class ShopController extends BaseAuthedController { )); break; - case ShopController::TOKEN_TYPE_CEC: - echo "token type: {$token_type} {$need_price} {$discount}"; - - break; - case ShopController::TOKEN_TYPE_BCEG: break; From 71cdfdf48aaf5a13f389b46078ecd06313d5eff4 Mon Sep 17 00:00:00 2001 From: songliang Date: Wed, 2 Nov 2022 13:16:30 +0800 Subject: [PATCH 5/9] shop discount test --- third_party/j7 | 2 +- third_party/phpcommon | 2 +- webapp/controller/ShopController.class.php | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/third_party/j7 b/third_party/j7 index f98d9e8d..7533a5e7 160000 --- a/third_party/j7 +++ b/third_party/j7 @@ -1 +1 @@ -Subproject commit f98d9e8dfb0575f3c42795163bfbaa5c807a5935 +Subproject commit 7533a5e7ed287378d33cb1bc3244487d33de7951 diff --git a/third_party/phpcommon b/third_party/phpcommon index 571b6c46..848e05c0 160000 --- a/third_party/phpcommon +++ b/third_party/phpcommon @@ -1 +1 @@ -Subproject commit 571b6c46137597d3bede13989e284130a070bea0 +Subproject commit 848e05c01f44622e52996bb04dfb6b344acce1b8 diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index af84d3af..d680e9a3 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -137,7 +137,10 @@ class ShopController extends BaseAuthedController { $price_array = splitStr1($row['price']); $discount_array = splitStr1($row['discount']); - + $discount_begin = $row['discount_begin']; + $discount_end = $row['discount_end']; + $nowTime = $this->_getNowTime(); + $need_price = $price_array[$token_pos]; $discount = $discount_array[$token_pos]; From 43ef81c3b1636c52cfae7fb07cdce9896da31a8c Mon Sep 17 00:00:00 2001 From: songliang Date: Wed, 2 Nov 2022 13:43:33 +0800 Subject: [PATCH 6/9] shop add discount --- webapp/controller/ShopController.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index d680e9a3..529506d8 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -137,13 +137,18 @@ class ShopController extends BaseAuthedController { $price_array = splitStr1($row['price']); $discount_array = splitStr1($row['discount']); - $discount_begin = $row['discount_begin']; - $discount_end = $row['discount_end']; - $nowTime = $this->_getNowTime(); $need_price = $price_array[$token_pos]; $discount = $discount_array[$token_pos]; + $discount_begin = $row['discount_begin']; + $discount_end = $row['discount_end']; + $nowTime = $this->_getNowTime(); + + if ($nowTime>=$discount_begin && $nowTime<$discount_end) { + $need_price = ceil($need_price * ($discount / 100.0)); + } + $costItemId = $this->getCostItemIdByTokenType($token_type); switch($token_type) { From 7e447c7f5fe0a1970219325002e0c42b5dc53e9e Mon Sep 17 00:00:00 2001 From: songliang Date: Wed, 2 Nov 2022 14:10:34 +0800 Subject: [PATCH 7/9] shop discount --- webapp/controller/ShopController.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 529506d8..35cb0e13 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -141,11 +141,12 @@ class ShopController extends BaseAuthedController { $need_price = $price_array[$token_pos]; $discount = $discount_array[$token_pos]; - $discount_begin = $row['discount_begin']; - $discount_end = $row['discount_end']; + $discount_begin = strtotime($row['discount_begin'].' UTC'); + $discount_end = strtotime($row['discount_end'].' UTC'); $nowTime = $this->_getNowTime(); - + if ($nowTime>=$discount_begin && $nowTime<$discount_end) { + $need_price = ceil($need_price * ($discount / 100.0)); } From 999b20a7985d13695cdcdd1fb92370994b238390 Mon Sep 17 00:00:00 2001 From: songliang Date: Wed, 2 Nov 2022 14:13:14 +0800 Subject: [PATCH 8/9] ... --- webapp/controller/ShopController.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 35cb0e13..74228cfb 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -87,9 +87,7 @@ class ShopController extends BaseAuthedController { switch ($row['limit_type']) { case ShopController::DAILY_BUY_LIMIT: { - $buyRecord = getXVal($buyRecordHash, $id); - echo "===========".json_encode($buyRecord)."-------".$row['limit_num']."..".getXVal($buyRecord, 'this_day_buy_times', 0); $boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1: 1; if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $row['limit_num']) { $this->_rspErr(2, 'Has reached the maximum number of purchase restrictions today'); From 0065534a5972b0f2e23c5cfe90122aa5b987f49e Mon Sep 17 00:00:00 2001 From: songliang Date: Wed, 2 Nov 2022 14:18:08 +0800 Subject: [PATCH 9/9] ... --- doc/Shop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Shop.py b/doc/Shop.py index 449e26a4..eb20a346 100644 --- a/doc/Shop.py +++ b/doc/Shop.py @@ -69,7 +69,7 @@ class Shop(object): 'name': 'getShopNames', 'desc': '获取商店名称', 'group': 'Shop', - 'url': 'webapp/index.php?c=Shop&a=getShowNames', + 'url': 'webapp/index.php?c=Shop&a=getShopNames', 'params': [ _common.ReqHead() ],