From 2e91f7e53d221588443d9af9236bcaa06c8f9789 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 2 Apr 2022 21:29:16 +0800 Subject: [PATCH] 1 --- webapp/controller/BaseController.class.php | 2 +- webapp/controller/MarketController.class.php | 35 +++++++++++++++----- webapp/services/MarketService.php | 1 + 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/webapp/controller/BaseController.class.php b/webapp/controller/BaseController.class.php index aac1bb3e..f5955063 100644 --- a/webapp/controller/BaseController.class.php +++ b/webapp/controller/BaseController.class.php @@ -99,7 +99,7 @@ class BaseController { 'port' => $mysql_conf['port'], 'user' => $mysql_conf['user'], 'passwd' => $mysql_conf['passwd'], - 'dbname' => getXVal($mysql_conf, 'marketdb2006') + 'dbname' => getXVal($mysql_conf, 'dbname', 'marketdb2006') )); return $this->marketDbConn; } diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 0c3e95e6..bcc6f00b 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -219,18 +219,15 @@ class MarketController extends BaseController { $buyerAddress); $tokenId = $orderId; $tokenType = 0; - SqlHelper::insert( - myself()->_getMarketMysql(), - 't_box_order', - array( + $fieldsKv = array( 'game_id' => 2006, 'batch_idx' => $currBatchMeta['id'], 'order_id' => $orderId, 'type' => $type, - 'item_id' => $itemId, + //'item_id' => $itemId, 'buyer_address' => $buyerAddress, - 'token_id' => $tokenId, - 'token_type' => $tokenType, + //'token_id' => $tokenId, + //'token_type' => $tokenType, 'price' => $price, 'payment_token_address' => $paymentTokenAddress, 'nonce' => $nonce, @@ -238,7 +235,29 @@ class MarketController extends BaseController { 'done' => 0, 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime() - ) + ); + { + //for test + if (MarketService::isTestMode()) { + $fieldsKv['bc_paid'] = 1; + for ($i = 1; $i <= 3; ++$i) { + if ($i <= 3) { + $orderId = BuyRecord::genOrderId($gameId, + $funcId, + myself()->_getNowTime(), + $buyerAddress); + $fieldsKv['bc_mint_need' . $i] = 1; + $fieldsKv['bc_mint_tokenid' . $i] = $orderId; + $fieldsKv['bc_mint_itemid' . $i] = $itemId; + $fieldsKv['bc_mint_token_type' . $i] = $tokenType; + } + } + } + } + SqlHelper::insert( + myself()->_getMarketMysql(), + 't_box_order', + $fieldsKv ); myself()->_rspData(array( 'order_id' => $orderId diff --git a/webapp/services/MarketService.php b/webapp/services/MarketService.php index ba081b8a..6f4adc52 100644 --- a/webapp/services/MarketService.php +++ b/webapp/services/MarketService.php @@ -16,6 +16,7 @@ require_once('models/BuyRecord.php'); require_once('phpcommon/bchelper.php'); +use phpcommon; use phpcommon\SqlHelper; use models\BoxOrder; use models\Nft;