From c94fe3f39607601c1f2cee61bb3bf995ba6a85ff Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 9 Aug 2024 11:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9C=AA=E7=94=A8=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changed.md | 23 +++ doc/README.php | 6 + .../controller/BlockChainController.class.php | 191 ------------------ webapp/models/BoxOpenedEvent.php | 22 -- webapp/models/BoxOrder.php | 47 ----- webapp/models/Chip.php | 2 - webapp/models/Currency.php | 166 --------------- webapp/models/Gun.php | 2 - webapp/models/GunTalent.php | 54 ----- webapp/models/Hero.php | 2 - webapp/models/LuckyBox.php | 38 ---- webapp/models/Market.php | 106 ---------- webapp/models/NftUpEvent.php | 30 --- webapp/models/NftUpReceive.php | 81 -------- webapp/models/Recharge.php | 40 ---- webapp/models/TransactionPrefee.php | 29 --- webapp/models/Transfer.php | 25 --- webapp/models/UserWalletRecord.php | 49 ----- webapp/models/Web2Order.php | 37 ---- webapp/models/Withdrawal.php | 86 -------- webapp/mt/Recharge.php | 31 --- webapp/services/ContractConfig.php | 52 ----- webapp/services/LoginService.php | 11 - webapp/services/ShopService.php | 162 --------------- 24 files changed, 29 insertions(+), 1263 deletions(-) create mode 100644 changed.md delete mode 100644 webapp/models/BoxOpenedEvent.php delete mode 100644 webapp/models/BoxOrder.php delete mode 100644 webapp/models/Currency.php delete mode 100644 webapp/models/GunTalent.php delete mode 100644 webapp/models/LuckyBox.php delete mode 100644 webapp/models/Market.php delete mode 100644 webapp/models/NftUpEvent.php delete mode 100644 webapp/models/NftUpReceive.php delete mode 100644 webapp/models/Recharge.php delete mode 100644 webapp/models/TransactionPrefee.php delete mode 100644 webapp/models/Transfer.php delete mode 100644 webapp/models/UserWalletRecord.php delete mode 100644 webapp/models/Web2Order.php delete mode 100644 webapp/models/Withdrawal.php delete mode 100644 webapp/mt/Recharge.php delete mode 100644 webapp/services/ContractConfig.php delete mode 100644 webapp/services/LoginService.php delete mode 100644 webapp/services/ShopService.php diff --git a/changed.md b/changed.md new file mode 100644 index 00000000..975c326a --- /dev/null +++ b/changed.md @@ -0,0 +1,23 @@ +# 2024/08/09 +# modified: controller/BlockChainController.class.php +# deleted: models/BoxOpenedEvent.php +# deleted: models/BoxOrder.php +# modified: models/Chip.php +# deleted: models/Currency.php +# modified: models/Gun.php +# deleted: models/GunTalent.php +# modified: models/Hero.php +# deleted: models/LuckyBox.php +# deleted: models/Market.php +# deleted: models/NftUpEvent.php +# deleted: models/NftUpReceive.php +# deleted: models/Recharge.php +# deleted: models/TransactionPrefee.php +# deleted: models/Transfer.php +# deleted: models/UserWalletRecord.php +# deleted: models/Web2Order.php +# deleted: models/Withdrawal.php +# deleted: mt/Recharge.php +# deleted: services/ContractConfig.php +# deleted: services/LoginService.php +# deleted: services/ShopService.php diff --git a/doc/README.php b/doc/README.php index e1a249b9..a328fa3e 100644 --- a/doc/README.php +++ b/doc/README.php @@ -50,6 +50,12 @@ * 删除 c=PayMethod * 删除 c=OutAppPlanet * 删除 c=Shop + * 删除 c=BlockChain&a=getTransactionList + * 删除 c=BlockChain&a=getTransactionInfo + * 删除 c=BlockChain&a=reportResult + * 删除 c=BlockChain&a=getJumpInfo + * 删除 c=BlockChain&a=buyDiamond + * 删除 c=BlockChain&a=buyMallProduct * * */ diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 3af5397d..d2efad82 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -4,7 +4,6 @@ require_once('mt/Parameter.php'); require_once('mt/Item.php'); require_once('mt/Drop.php'); require_once('mt/Hero.php'); -require_once('mt/Recharge.php'); require_once('models/Hero.php'); require_once('models/Gun.php'); @@ -14,7 +13,6 @@ require_once('models/Transaction.php'); require_once('models/BuyRecord.php'); require_once('models/Chip.php'); require_once('models/BcOrder.php'); -require_once('models/Recharge.php'); require_once('services/AwardService.php'); require_once('services/PropertyChgService.php'); @@ -28,7 +26,6 @@ use models\Transaction; use models\BuyRecord; use models\Chip; use models\BcOrder; -use models\Recharge; use services\BlockChainService; @@ -47,72 +44,6 @@ class BlockChainController extends BaseAuthedController { error_log(json_encode($_REQUEST)); } - public function getTransactionList() - { - $trans = array(); - foreach (Transaction::all() as $tran) { - if (myself()->_getNowTime() - $tran['createtime'] < 24*3600){ - array_push( - $trans, - array( - 'trans_id' => $tran['trans_id'], - 'item_id' => $tran['item_id'], - 'action' => Transaction::getActionDesc($tran), - 'status' => Transaction::getStatusDesc($tran), - 'time' => $tran['createtime'], - ) - ); - } - } - $this->_rspData(array( - 'transactions' => $trans - )); - } - - public function reportResult() - { - $transId = getReqVal('trans_id', ''); - $result = getReqVal('result', ''); - error_log($result); - Transaction::reportResult($transId, $result); - myself()->_rspOk(); - } - - public function getJumpInfo() - { - $transId = getReqVal('trans_id', ''); - if (!$transId){ - myself()->_rspErr(101, 'trans_id paramater error'); - return; - } - $tranDb= Transaction::find($transId); - if (!$tranDb){ - myself()->_rspErr(101, 'trans_id paramater error'); - return; - } - $data = Transaction::getJumpInfo($tranDb); - myself()->_rspData($data); - } - - public function getTransactionInfo() - { - $transId = getReqVal('trans_id', ''); - if (!$transId){ - myself()->_rspErr(101, 'trans_id paramater error'); - return; - } - $tranDb= Transaction::find($transId); - myself()->_rspData(array( - 'data' => array( - 'trans_id' => $tranDb['trans_id'], - 'item_id' => $tranDb['item_id'], - 'action' => Transaction::getActionDesc($tranDb), - 'status' => Transaction::getStatusDesc($tranDb), - 'time' => $tranDb['createtime'], - ) - )); - } - public function active721Nft() { $type = getReqVal('type', 0); @@ -323,128 +254,6 @@ class BlockChainController extends BaseAuthedController { } } - public function _buyDiamond() - { - return; - error_log(json_encode($_REQUEST)); - $num = getReqVal('num', 0); - $tokenType = getReqVal('token_type', ''); - if (!is_numeric($num)) { - myself()->_rspErr(1, "num is invalid, {$num}"); - return; - } - if ($num <= 0) { - myself()->_rspErr(1, "num is invalid, {$num}"); - return; - } - if (!in_array( - $tokenType, - array( - BlockChainService::CURRENCY_CEG, - BlockChainService::CURRENCY_USDC, - BlockChainService::CURRENCY_USDT, - ) - )) { - myself()->_rspErr(1, "token_type error"); - return; - } - $rate = 1; - if (in_array( - $tokenType, - array( - BlockChainService::CURRENCY_USDC, - BlockChainService::CURRENCY_USDT, - ) - )) { - $rate = 10; - } - $jinDu = BlockChainService::getCurrencyDecimals($tokenType); - if ($jinDu === false) { - myself()->_rspErr(1, "token_type error"); - return; - } - $currency = $tokenType; - $price = BlockChainService::formatCurrencyEx($num, $jinDu); - - $itemId = V_ITEM_DIAMOND; - $itemCount = $num * $rate; - - $rspObj = BlockChainService::gameItemMallBuy( - Transaction::BUY_GOODS_ACTION_TYPE, - $currency, - $price, - $itemId, - $itemCount - ); - - BcOrder::upsert($rspObj['trans_id'], array( - 'item_id' => $itemId, - 'item_num' => $itemCount, - 'order_type' => BcOrder::SPEC_ORDER_TYPE, - 'price' => $num, - 'currency_name' => $currency, - 'ext_data' => json_encode(array( - 'mode' => BcOrder::SHOP_BUY_MODE_NORMAL, - )), - )); - - error_log(json_encode( - array( - 'trans_id' => $rspObj['trans_id'], - 'params' => $rspObj['params'], - 'item_id' => $itemId, - 'item_num' => $itemCount - ) - )); - myself()->_rspData( - array( - 'trans_id' => $rspObj['trans_id'], - 'params' => $rspObj['params'], - 'item_id' => $itemId, - 'item_num' => $itemCount - ) - ); - } - - private function rechargeBuyS() - { - $goodsMeta = mt\Recharge::get(getReqVal('goods_id', '')); - if (!$goodsMeta) { - myself()->_rspErr(1, 'goods_id paramater error'); - return; - } - $orderId = Recharge::addOrder($goodsMeta['id']); - { - $params = array( - 'c' => 'BcService', - 'a' => 'recharge', - 'account_address' => myself()->_getAddress(), - 'passport_address' => myself()->_getAddress(), - 'net_id' => NET_ID, - 'amount' => 1, - 'currency_name' => 'TestToken', - 'order_id' => $orderId, - ); - //$params['account_address'] = '0xAd2DeA1977055Db01C66e6E53309C4604AB869b8'; - //$params['passport_address'] = '0xAd2DeA1977055Db01C66e6E53309C4604AB869b8'; - error_log(json_encode($params)); - { - $url = self::getWeb3ServiceUrl(); - $response = ''; - if (!phpcommon\HttpClient::get - ($url, - $params, - $response)) { - myself()->_rspErr(500, 'server internal error'); - die(); - return; - } - error_log($response); - echo $response; - } - } - } - private static function getWeb3ServiceUrl() { $web3ServiceCluster = require_once('../config/web3service.cluster.php'); diff --git a/webapp/models/BoxOpenedEvent.php b/webapp/models/BoxOpenedEvent.php deleted file mode 100644 index 54632161..00000000 --- a/webapp/models/BoxOpenedEvent.php +++ /dev/null @@ -1,22 +0,0 @@ -_getMarketMysql(), - 't_boxopened_event', - array( - 'box_token_id' => $boxId, - ) - ); - return $row; - } - -} diff --git a/webapp/models/BoxOrder.php b/webapp/models/BoxOrder.php deleted file mode 100644 index e85fec80..00000000 --- a/webapp/models/BoxOrder.php +++ /dev/null @@ -1,47 +0,0 @@ -_getMarketMysql()->execQueryOne - ('SELECT COUNT(*) AS sold_num FROM t_box_order WHERE batch_idx=:batch_idx AND ' . - ' (bc_paid = 1 OR done <> 1);', - array( - ':batch_idx' => $batchIdx - )); - return $row && $row['sold_num'] ? (int)$row['sold_num'] : 0; - } - - public function isBuyed($buyerAddress, $batchIdx) - { - $row = myself()->_getMarketMysql()->execQueryOne - ('SELECT COUNT(*) AS buy_count FROM t_box_order WHERE batch_idx=:batch_idx AND ' . - ' buyer_address=:buyer_address AND (bc_paid = 1 OR done <> 1);', - array( - ':buyer_address' => $buyerAddress, - ':batch_idx' => $batchIdx - )); - return $row && $row['buy_count'] ? $row['buy_count'] > 0 : false; - } - - public function findByOrderId($orderId) - { - $row = SqlHelper::ormSelectOne( - myself()->_getMarketMysql(), - 't_box_order', - array( - 'order_id' => $orderId, - ) - ); - return $row; - } - -} diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index 65f8e50c..96ff7f5f 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -5,7 +5,6 @@ namespace models; require_once('services/NftService.php'); require_once('services/FormulaService.php'); -require_once('services/ContractConfig.php'); require_once('mt/Item.php'); require_once('mt/EconomyAttribute.php'); @@ -14,7 +13,6 @@ require_once('mt/ChipAttribute.php'); use mt; use phpcommon\SqlHelper; -use services\ContractConfig; use services\NftService; use services\FormulaService; diff --git a/webapp/models/Currency.php b/webapp/models/Currency.php deleted file mode 100644 index 308e1e7b..00000000 --- a/webapp/models/Currency.php +++ /dev/null @@ -1,166 +0,0 @@ -_getSelfMysql(), - 't_user_currency', - array( - 'account_id'=>myself()->_getAccountId() - ) - ); - if ($rows){ - $list = array_merge($baseList,$rows); - }else{ - $list = $baseList; - } - return $list; - } - - public static function addCurrency($data){ - if (!$data){ - return; - } - SqlHelper::upsert - (myself()->_getSelfMysql(), - 't_user_currency', - array( - 'account_id' => myself()->_getAccountId(), - 'net_id' => $data['net_id'], - 'address' => $data['address'], - ), - array( - ), - array( - 'account_id' => myself()->_getAccountId(), - 'net_id' => $data['net_id'], - 'address' => $data['address'], - 'symbol' => $data['symbol'], - 'precision' => $data['precision'], - 'type' => $data['type'], - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime(), - - ) - ); - } - - - private static function baseCurrency(){ - if (SERVER_ENV == _ONLINE) { - return array( - array( - 'account_id'=> myself()->_getAccountId(), - 'net_id'=>80001, - 'address'=>'0xfa513999031dC1DCf86e99d91101e17d07839235', - 'symbol'=>'CEC', - 'precision'=>18, - 'type'=>3, - 'symbol_id' =>2 - ), - array( - 'account_id'=> myself()->_getAccountId(), - 'net_id'=>80001, - 'address'=>'0x9f87eCA8F0479383fF11a5AB2336b5A6c383d6F3', - 'symbol'=>'CEG', - 'precision'=>18, - 'type'=>3, - 'symbol_id' =>1 - ), -// array( -// 'account_id'=> myself()->_getAccountId(), -// 'net_id'=>80001, -// 'address'=>'0x3EBF5196dADC8F3F09C808333f98FE8A4b7d1e62', -// 'symbol'=>'hero', -// 'precision'=>18, -// 'type'=>1, -// ), -// array( -// 'account_id'=> myself()->_getAccountId(), -// 'net_id'=>80001, -// 'address'=>'0x2F2Ed1c403cB7156617449795dE1CB47A0302a25', -// 'symbol'=>'weapon', -// 'precision'=>18, -// 'type'=>1, -// ), -// array( -// 'account_id'=> myself()->_getAccountId(), -// 'net_id'=>80001, -// 'address'=>'0x73482411443E87CAC124C12A10B34e9Aaa2De168', -// 'symbol'=>'chip', -// 'precision'=>18, -// 'type'=>2, -// ), -// array( -// 'account_id'=> myself()->_getAccountId(), -// 'net_id'=>80001, -// 'address'=>'0xFc21A863bFb4E4534B246078772e2074e076f0a7', -// 'symbol'=>'shard', -// 'precision'=>18, -// 'type'=>2, -// ), - ); - }else{ - return array( - array( - 'account_id'=> myself()->_getAccountId(), - 'net_id'=>1338, - 'address'=>'0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7', - 'symbol'=>'CEC', - 'precision'=>18, - 'type'=>3, - 'symbol_id' =>2 - ), - array( - 'account_id'=> myself()->_getAccountId(), - 'net_id'=>1338, - 'address'=>'0x59d3631c86BbE35EF041872d502F218A39FBa150', - 'symbol'=>'CEG', - 'precision'=>18, - 'type'=>3, - 'symbol_id' =>1 - ), -// array( -// 'account_id'=> myself()->_getAccountId(), -// 'net_id'=>1338, -// 'address'=>'0x9b1f7F645351AF3631a656421eD2e40f2802E6c0', -// 'symbol'=>'hero', -// 'precision'=>18, -// 'type'=>1, -// ), -// array( -// 'account_id'=> myself()->_getAccountId(), -// 'net_id'=>1338, -// 'address'=>'0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66', -// 'symbol'=>'weapon', -// 'precision'=>18, -// 'type'=>1, -// ), -// array( -// 'account_id'=> myself()->_getAccountId(), -// 'net_id'=>1338, -// 'address'=>'0x26b4AFb60d6C903165150C6F0AA14F8016bE4aec', -// 'symbol'=>'chip', -// 'precision'=>18, -// 'type'=>2, -// ), -// array( -// 'account_id'=> myself()->_getAccountId(), -// 'net_id'=>1338, -// 'address'=>'0x0E696947A06550DEf604e82C26fd9E493e576337', -// 'symbol'=>'shard', -// 'precision'=>18, -// 'type'=>2, -// ), - ); - } - } -} \ No newline at end of file diff --git a/webapp/models/Gun.php b/webapp/models/Gun.php index 444df564..7fc68d1f 100644 --- a/webapp/models/Gun.php +++ b/webapp/models/Gun.php @@ -10,14 +10,12 @@ require_once('models/ChipPlugin.php'); require_once('models/User.php'); require_once('services/NftService.php'); require_once('services/FormulaService.php'); -require_once('services/ContractConfig.php'); use mt; use phpcommon; use phpcommon\SqlHelper; use services\NftService; use services\FormulaService; -use services\ContractConfig; use models\ChipPlugin; class Gun extends BaseModel { diff --git a/webapp/models/GunTalent.php b/webapp/models/GunTalent.php deleted file mode 100644 index d1860cb8..00000000 --- a/webapp/models/GunTalent.php +++ /dev/null @@ -1,54 +0,0 @@ -_getSelfMysql(), - 't_gun_talent', - array( - 'account_id' => myself()->_getAccountId(), - 'talent_id' => $talentId - ) - ); - return $row; - } - - public static function toDto($row) - { - return array( - 'talent_id' => $row['talent_id'], - 'talent_lv' => $row['talent_lv'], - ); - } - - public static function upgradeLv($talentId, $talentLv) - { - SqlHelper::upsert( - myself()->_getSelfMysql(), - 't_gun_talent', - array( - 'account_id' => myself()->_getAccountId(), - 'talent_id' => $talentId - ), - array( - 'talent_lv' => $talentLv, - 'modifytime' => myself()->_getNowTime() - ), - array( - 'account_id' => myself()->_getAccountId(), - 'talent_id' => $talentId, - 'talent_lv' => $talentLv, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ) - ); - } - -} diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index dc54ab34..dd3b72af 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -19,7 +19,6 @@ require_once('models/ChipPage.php'); require_once('models/Nft.php'); require_once('services/NftService.php'); require_once('services/FormulaService.php'); -require_once('services/ContractConfig.php'); use mt; @@ -27,7 +26,6 @@ use phpcommon; use phpcommon\SqlHelper; use services\NftService; use services\FormulaService; -use services\ContractConfig; class Hero extends BaseModel { diff --git a/webapp/models/LuckyBox.php b/webapp/models/LuckyBox.php deleted file mode 100644 index ba03a2af..00000000 --- a/webapp/models/LuckyBox.php +++ /dev/null @@ -1,38 +0,0 @@ -_getMarketMysql(), - 't_lucky_box', - array( - 'box_token_id' => $boxTokenId, - ) - ); - return $row; - } - - - public static function add($boxTokenId, $account, $tokenIds) - { - SqlHelper::insert( - myself()->_getMarketMysql(), - 't_lucky_box', - array( - 'box_token_id' => $boxTokenId, - 'account' => $account, - 'token_id1' => $tokenIds[0], - 'token_id2' => $tokenIds[1], - 'token_id3' => $tokenIds[2], - ) - ); - } - -} diff --git a/webapp/models/Market.php b/webapp/models/Market.php deleted file mode 100644 index cbd49c29..00000000 --- a/webapp/models/Market.php +++ /dev/null @@ -1,106 +0,0 @@ -_getMysql(''), - 't_market', - array( - 'order_id' => $orderId, - 'net_id' => $netId, - ) - ); - return $row; - } - - public static function add($orderId, $netId, $tokenId, $seller, $nftToken, - $amount, $currency, $price, $fieldsKv) { - if (empty($fieldsKv)) { - $fieldsKv = array(); - } - $fieldsKv = array_merge( - $fieldsKv, - array( - 'token_id' => $tokenId, - 'seller' => $seller, - 'nft_token' => $nftToken, - 'amount' => $amount, - 'currency' => strtolower($currency), - 'price' => $price, - 'activated' => 1, - 'selltime' => myself()->_getNowTime(), - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime(), - )); - self::internalUpdate( - $orderId, - $netId, - $fieldsKv); - } - - public static function updatePrice($orderId, $netId, $price) { - self::internalUpdate( - $orderId, - $netId, - array( - 'update_price' => $price, - 'update_time' => myself()->_getNowTime(), - )); - } - - public static function buyOk($orderId, $netId) { - self::internalUpdate( - $orderId, - $netId, - array( - 'status' => self::BUY_OK_STATE, - )); - } - - public static function cancel($orderId, $netId) { - self::internalUpdate( - $orderId, - $netId, - array( - 'status' => self::CANCEL_STATE, - )); - } - - private static function internalUpdate($orderId, $netId, $fieldsKv){ - SqlHelper::upsert - (myself()->_getMysql(''), - 't_market', - array( - 'order_id' => $orderId, - 'net_id' => $netId, - ), - array( - ), - array( - 'order_id' => $orderId, - 'net_id' => $netId, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime(), - ) - ); - SqlHelper::update - (myself()->_getMysql(''), - 't_market', - array( - 'order_id' => $orderId, - 'net_id' => $netId, - ), - $fieldsKv - ); - } - -} diff --git a/webapp/models/NftUpEvent.php b/webapp/models/NftUpEvent.php deleted file mode 100644 index 9c2112de..00000000 --- a/webapp/models/NftUpEvent.php +++ /dev/null @@ -1,30 +0,0 @@ -_getMysql($transId), - 't_nft_up_event', - array( - 'trans_id' => $transId, - ) - ); - return $row; - } - - public static function add($fieldKv){ - return SqlHelper::insert( - myself()->_getMysql(''), - 't_nft_up_event', - $fieldKv - ); - } - -} \ No newline at end of file diff --git a/webapp/models/NftUpReceive.php b/webapp/models/NftUpReceive.php deleted file mode 100644 index b13017c3..00000000 --- a/webapp/models/NftUpReceive.php +++ /dev/null @@ -1,81 +0,0 @@ -_getMysql($accountId), - 't_nft_up_receive', - array( - 'trans_id' => $transId, - ) - ); - return $row; - } - - public static function add($accountId,$fieldKv){ - return SqlHelper::insert( - myself()->_getMysql($accountId), - 't_nft_up_receive', - $fieldKv - ); - } - - public static function all($accountId,$tokenType) - { - $row = SqlHelper::ormSelect( - myself()->_getMysql($accountId), - 't_nft_up_receive', - array( - 'account_id' => $accountId, - 'token_type' => $tokenType, - ) - ); - return $row; - } - - public static function upsert($accountId,$data){ - SqlHelper::upsert( - myself()->_getMysql($accountId), - 't_nft_up_receive', - array( - 'trans_id' => $data['trans_id'] - ), - array( - 'state' => 1, - 'modifytime' => myself()->_getNowTime() - ), - array( - 'account_id' => $accountId, - 'trans_id' => $data['trans_id'], - 'token_id1' => $data['token_id1'], - 'token_id2' => $data['token_id2'], - 'state' => 1, - 'token_type' => $data['token_type'], - 'from_data' => 1, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ) - ); - } - - public static function setAccountIdNull($accountId,$transId){ - SqlHelper::update( - myself()->_getMysql($accountId), - 't_nft_up_receive', - array( - 'trans_id' => $transId, - ), - array( - 'account_id' => '', - ) - ); - } - -} \ No newline at end of file diff --git a/webapp/models/Recharge.php b/webapp/models/Recharge.php deleted file mode 100644 index a0102b91..00000000 --- a/webapp/models/Recharge.php +++ /dev/null @@ -1,40 +0,0 @@ -_getNowTime(), - myself()->_getAddress() - ); - SqlHelper::insert - (myself()->_getSelfMysql(), - 't_recharge_order', - array( - 'order_id' => $orderId, - 'account_id' => myself()->_getAccountId(), - 'account_address' => myself()->_getAddress(), - 'currency_address' => '0xfd42bfb03212da7e1a4608a44d7658641d99cf34', - 'currency_name' => 'TestToken', - 'status' => 0, - 'item_id' => $goodsId, - 'item_num' => 1, - 'price' => 1, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime(), - ) - ); - return $orderId; - } - -} diff --git a/webapp/models/TransactionPrefee.php b/webapp/models/TransactionPrefee.php deleted file mode 100644 index 04d9fa0c..00000000 --- a/webapp/models/TransactionPrefee.php +++ /dev/null @@ -1,29 +0,0 @@ -_getSelfMysql(), - 't_transaction_prefee', - array( - 'account_id' => myself()->_getAccountId(), - 'trans_id' => $transId, - 'target_token_id' => isset($param['token_id']) ? $param['token_id']:0, - 'target_token_type' => isset($param['token_type']) ? $param['token_type']:0, - 'item_uniid' => isset($param['item_uniid']) ? $param['item_uniid'] : 0, - 'item_id' => $param['item_id'], - 'item_num' => $param['item_num'], - 'done' => 0, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime(), - ) - ); - } -} diff --git a/webapp/models/Transfer.php b/webapp/models/Transfer.php deleted file mode 100644 index 0d13801d..00000000 --- a/webapp/models/Transfer.php +++ /dev/null @@ -1,25 +0,0 @@ -_getMarketMysql(), - 't_transfer', - array( - 'txhash' => $txHash, - ) - ); - return $row; - } - -} diff --git a/webapp/models/UserWalletRecord.php b/webapp/models/UserWalletRecord.php deleted file mode 100644 index 001de33a..00000000 --- a/webapp/models/UserWalletRecord.php +++ /dev/null @@ -1,49 +0,0 @@ - $txHash, - ) - ); - return $row; - } - - public static function add($conn, $txHash, $dir, $accountId, $type, $value) - { - SqlHelper::insert( - $conn, - 't_user_wallet_record', - array( - 'txhash' => $txHash, - 'dir' => $dir, - 'account_id' => $accountId, - 'type' => $type, - 'value' => $value, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - )); - } - - public static function update($conn, $txHash, $fieldKv) - { - SqlHelper::update( - $conn, - 't_user_wallet_record', - array( - 'txhash' => $txHash, - ), - $fieldKv); - } - -} diff --git a/webapp/models/Web2Order.php b/webapp/models/Web2Order.php deleted file mode 100644 index c1ebafde..00000000 --- a/webapp/models/Web2Order.php +++ /dev/null @@ -1,37 +0,0 @@ -_getSelfMysql(), - 't_bc_order', - array( - 'order_id' => $transId - ), - array( - 'status' => 1, - 'modifytime' => myself()->_getNowTime(), - ), - array( - 'order_id' => $transId, - 'order_type' => getXVal($fieldsKv,'order_type',0), - 'account_id' => myself()->_getAccountId(), - 'address' => myself()->_getAddress(), - 'status' => 0, - 'item_id' => $fieldsKv['item_id'], - 'item_num' => $fieldsKv['item_num'], - 'ext_data' => getXVal($fieldsKv,'ext_data',''), - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime(), - 'price' => $fieldsKv['price'], - ) - ); - } -} \ No newline at end of file diff --git a/webapp/models/Withdrawal.php b/webapp/models/Withdrawal.php deleted file mode 100644 index e0930e40..00000000 --- a/webapp/models/Withdrawal.php +++ /dev/null @@ -1,86 +0,0 @@ -_getMarketMysql()->execQueryOne( - 'SELECT COUNT(1) AS times FROM t_withdrawal WHERE account=:account AND createtime>=:now_dayseconds AND createtime<=:now_dayseconds + 3600 * 24;', - array( - ':account' => $account, - ':now_dayseconds' => myself()->_getNowDaySeconds() - ) - ); - return $row ? $row['times'] : 0; - } - - public static function add($account, $type, $netId, $amount) - { - SqlHelper::insert - (myself()->_getMarketMysql(), - 't_withdrawal', - array( - 'account' => $account, - 'type' => $type, - 'net_id' => $netId, - 'amount' => $amount, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ) - ); - $seqId = SqlHelper::getLastInsertId(myself()->_getMarketMysql()); - return $seqId; - } - - public static function find($seqId) - { - $row = SqlHelper::ormSelectOne( - myself()->_getMarketMysql(), - 't_withdrawal', - array( - 'idx' => $seqId, - ) - ); - return $row; - } - - public static function testOk($idx, $account, $type, $netId, $amount) - { - SqlHelper::update( - myself()->_getMarketMysql(), - 't_withdrawal', - array( - 'idx' => $idx, - ), - array( - 'state' => 2, - 'bc_block_number' => 1, - 'bc_txhash' => $idx, - 'bc_time' => myself()->_getNowTime(), - ) - ); - SqlHelper::insert - (myself()->_getMarketMysql(), - 't_transfer', - array( - 'txhash' => $idx, - 'type' => $type, - '_from' => $account, - '_to' => $account, - 'value' => $amount, - 'state' => 1, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ) - ); - } - -} diff --git a/webapp/mt/Recharge.php b/webapp/mt/Recharge.php deleted file mode 100644 index af2a3610..00000000 --- a/webapp/mt/Recharge.php +++ /dev/null @@ -1,31 +0,0 @@ - "0xE6A69474E04B93De50dd07F239d62879dB9bF716", - "gun" => "0x8Ce844402bE22fA1276a375Ff2354DD27aDEF285", - "chip" => "0x4678fE0177B15538F441264cB851364d9F3872AA", - ); - } - case "erc20" : { - return array( - "CEC" => "0x8dd1439E0C3254b4543d6D68b3C0C891E5Bd2eCE", - "CEG" => "0x2C7221588D4FBac2585D71618CD540e74c7413B8", - ); - } - } - } else { - switch ($type){ - case "erc721" : { - return array( - "hero" => "0x79fc2a4216A1e595DBD09D13c4B4bD3B095d5bb2", - "gun" => "", - "chip" => "0x551838d7754157D13e7D945b8a37bBD6Ad50dDC7", - ); - } - case "erc20" : { - return array( - "CEC" => "", - "CEG" => "0x741482aE1480E552735E44Ff3A733448AcBbeD8d", - ); - } - } - } - } -} diff --git a/webapp/services/LoginService.php b/webapp/services/LoginService.php deleted file mode 100644 index 3a46488a..00000000 --- a/webapp/services/LoginService.php +++ /dev/null @@ -1,11 +0,0 @@ - $goodsMeta['goods_id'], - 'goods_meta' => self::goodsMetaToInfo($goodsMeta), - 'bought_times' => 0, - 'free_num' => 0, - ); - array_push($goodsList, $goodsDto); - switch ($goodsMeta['limit_type']) { - case mt\Shop::DAILY_BUY_LIMIT: { - $buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']); - $goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0; - } - break; - case mt\Shop::WEEKLY_BUY_LIMIT: { - $buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']); - $goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0; - } - break; - case mt\Shop::TOTAL_BUY_LIMIT: { - $buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']); - $goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0; - } - break; - default: { - } - break; - } - - $itemMeta = mt\Item::get($goodsMeta['item_id']); - if ($itemMeta) { - // 如果是皮肤,判断是否已经拥有,如果已经拥有,不能购买 - if ($itemMeta['type'] == mt\Item::HERO_SKIN_TYPE) { - $errCode = 0; - $errMsg = ''; - if (!self::canBuy($itemMeta, $errCode, $errMsg)) { - $goods['bought_times'] = 1; - } else { - $goods['bought_times'] = 0; - } - } - } else if ($goodsMeta['goods_id'] != 9999){ - error_log('item not found:' . json_encode($goodsMeta)); - } - } - return $goodsList; - } - - public static function buyLimitCheck($goodsMeta, &$errCode, &$errMsg) - { - $errCode = 0; - $errMsg = ''; - $buyRecordHash = ShopBuyRecord::allToHash(); - $boughtTimes = 1; - $goodsId = $goodsMeta['goods_id']; - { - switch ($goodsMeta['limit_type']) { - case mt\Shop::DAILY_BUY_LIMIT: { - $buyRecord = getXVal($buyRecordHash, $goodsId); - $boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1; - if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $goodsMeta['limit_num']) { - $errCode = 2; - $errMsg = 'Daily purchase limit'; - return false; - } - } - break; - case mt\Shop::WEEKLY_BUY_LIMIT: { - $buyRecord = getXVal($buyRecordHash, $goodsId); - $boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1; - if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $goodsMeta['limit_num']) { - $errCode = 2; - $errMsg = 'Weekly purchase limit reached'; - return false; - } - } - break; - case mt\Shop::TOTAL_BUY_LIMIT: { - // error_log("total buy limit " . $address . " " . $goodsId . " " . $goodsMeta['limit_num']); - $buyRecord = getXVal($buyRecordHash, $goodsId); - $boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1; - if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $goodsMeta['limit_num']) { - $errCode = 2; - $errMsg = 'Purchase limit reached'; - return false; - } - } - break; - default: { - } - break; - } - } - return true; - } - - public static function goodsMetaToInfo($goodsMeta) - { - return array( - 'item_id' => $goodsMeta['item_id'], - 'item_num' => $goodsMeta['item_num'], - 'max_amount' => $goodsMeta['max_amount'], - 'shop_id' => $goodsMeta['shop_id'], - 'shopstage' => $goodsMeta['shopstage'], - 'tag' => $goodsMeta['tag'], - 'recommend' => $goodsMeta['recommend'], - 'token_type' => $goodsMeta['token_type'], - 'price' => $goodsMeta['price'], - 'free_type' => $goodsMeta['free_type'], - 'shop_icon' => $goodsMeta['shop_icon'], - 'gg_product_id' => $goodsMeta['gg_product_id'], - 'ios_product_id' => $goodsMeta['ios_product_id'], - 'bonus' => $goodsMeta['bonus'], - 'bonus_num' => $goodsMeta['bonus_num'], - ); - } - - public static function canBuy($itemMeta, &$errCode, &$errMsg) - { - $errCode = 0; - $errMsg = ''; - return true; - } - -}