From 088d2f0d0ae2c5f1e4c08a047e54c04ad767aecb Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 10 Nov 2022 14:23:35 +0800 Subject: [PATCH 1/7] 1 --- sql/gamedb.sql | 2 ++ .../controller/BlockChainController.class.php | 17 +++++++++-- webapp/models/TransactionPrefee.php | 29 +++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 webapp/models/TransactionPrefee.php diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 495d6bb1..987708dc 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -803,6 +803,8 @@ CREATE TABLE `t_transaction_prefee` ( `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', + `target_token_id` bigint NOT NULL DEFAULT '0' COMMENT 'target_token_id', + `target_token_type` bigint NOT NULL DEFAULT '0' COMMENT 'target_token_type', `item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid', `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', `item_num` int(11) NOT NULL DEFAULT '0' COMMENT '道具数量', diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 5bcab723..df2d16f4 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -13,6 +13,7 @@ require_once('models/Chip.php'); require_once('models/Transaction.php'); require_once('models/BuyRecord.php'); require_once('models/Chip.php'); +require_once('models/TransactionPrefee.php'); require_once('services/AwardService.php'); require_once('services/PropertyChgService.php'); @@ -27,6 +28,7 @@ use models\Nft; use models\Transaction; use models\BuyRecord; use models\Chip; +use models\TransactionPrefee; class BlockChainController extends BaseAuthedController { @@ -181,7 +183,12 @@ class BlockChainController extends BaseAuthedController { $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); return; } - $this->_decItems($costItems); + $decFeeCb = function ($transId) use ($costItems){ + myself()->_decItems($costItems); + foreach ($costItems as $costItem){ + TransactionPrefee::add($transId,$costItem); + } + }; } $this->internalBcCall( array( @@ -200,7 +207,8 @@ class BlockChainController extends BaseAuthedController { 'tokenType' => Nft::HERO_TYPE, 'itemUniId' => $nft1['hero_uniid'], 'itemId' => $nft1['hero_id'] - ) + ), + $decFeeCb ); } break; @@ -810,7 +818,7 @@ class BlockChainController extends BaseAuthedController { } } - private function internalBcCall($params, $transParams) { + private function internalBcCall($params, $transParams, $cb = null) { $url = self::getWeb3ServiceUrl(); $response = ''; if (!phpcommon\HttpClient::get @@ -833,6 +841,9 @@ class BlockChainController extends BaseAuthedController { $transParams['itemUniId'], $transParams['itemId'] ); + if ($cb) { + $cb($transId); + } myself()->_rspData(array( 'trans_id' => $transId, 'params' => $rspObj['params'] diff --git a/webapp/models/TransactionPrefee.php b/webapp/models/TransactionPrefee.php new file mode 100644 index 00000000..ef87a44c --- /dev/null +++ b/webapp/models/TransactionPrefee.php @@ -0,0 +1,29 @@ +_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' => $transId, + 'item_id' => $param['item_id'], + 'item_num' => $param['item_num'], + 'done' => 0, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime(), + ) + ); + } +} \ No newline at end of file From da0bcbc3760d2a3b2b4134647482de52671af85b Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 10 Nov 2022 15:09:13 +0800 Subject: [PATCH 2/7] 1 --- .../controller/BlockChainController.class.php | 48 ++++++++++++++----- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index df2d16f4..47bf14fc 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -173,10 +173,10 @@ class BlockChainController extends BaseAuthedController { 'item_id' => V_ITEM_GOLD, 'item_num' => \services\FormulaService::Hero_Advanced_CEG_Expend($nft1['quality']+1) ), -// array( -// 'item_id' => V_ITEM_DIAMOND, -// 'item_num' => \services\FormulaService::Hero_Advanced_CEC_Expend($nft1['quality']+1) -// ) + array( + 'item_id' => V_ITEM_DIAMOND, + 'item_num' => \services\FormulaService::Hero_Advanced_CEC_Expend($nft1['quality']+1) + ) ); $lackItem = null; if (!$this->_hasEnoughItems($costItems, $lackItem)) { @@ -227,10 +227,10 @@ class BlockChainController extends BaseAuthedController { 'item_id' => V_ITEM_GOLD, 'item_num' => \services\FormulaService::Weapon_Advanced_CEG_Expend($nft1['quality']+1) ), -// array( -// 'item_id' => V_ITEM_DIAMOND, -// 'item_num' => \services\FormulaService::Weapon_Advanced_CEC_Expend($nft1['quality']+1) -// ) + array( + 'item_id' => V_ITEM_DIAMOND, + 'item_num' => \services\FormulaService::Weapon_Advanced_CEC_Expend($nft1['quality']+1) + ) ); $lackItem = null; @@ -238,7 +238,12 @@ class BlockChainController extends BaseAuthedController { $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); return; } - $this->_decItems($costItems); + $decFeeCb = function ($transId) use ($costItems){ + myself()->_decItems($costItems); + foreach ($costItems as $costItem){ + TransactionPrefee::add($transId,$costItem); + } + }; } $this->internalBcCall( @@ -258,7 +263,8 @@ class BlockChainController extends BaseAuthedController { 'tokenType' => Nft::EQUIP_TYPE, 'itemUniId' => $nft1['gun_uniid'], 'itemId' => $nft1['gun_id'] - ) + ), + $decFeeCb ); } break; @@ -418,7 +424,13 @@ class BlockChainController extends BaseAuthedController { $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); return; } - $this->_decItems($costItems); + $decFeeCb = function ($transId) use ($costItems){ + myself()->_decItems($costItems); + foreach ($costItems as $costItem){ + TransactionPrefee::add($transId,$costItem); + } + }; +// $this->_decItems($costItems); } if ($tokenType == Nft::EQUIP_TYPE){ $costItems = array( @@ -432,7 +444,13 @@ class BlockChainController extends BaseAuthedController { $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); return; } - $this->_decItems($costItems); + $decFeeCb = function ($transId) use ($costItems){ + myself()->_decItems($costItems); + foreach ($costItems as $costItem){ + TransactionPrefee::add($transId,$costItem); + } + }; +// $this->_decItems($costItems); } } @@ -471,6 +489,7 @@ class BlockChainController extends BaseAuthedController { 0, $itemId ); + $decFeeCb($transId); myself()->_rspData(array( 'trans_id' => $transId, 'params' => $rspObj['params'] @@ -819,6 +838,8 @@ class BlockChainController extends BaseAuthedController { } private function internalBcCall($params, $transParams, $cb = null) { + $propertyChgService = new services\PropertyChgService(); + $propertyChgService->addUserChg(); $url = self::getWeb3ServiceUrl(); $response = ''; if (!phpcommon\HttpClient::get @@ -846,7 +867,8 @@ class BlockChainController extends BaseAuthedController { } myself()->_rspData(array( 'trans_id' => $transId, - 'params' => $rspObj['params'] + 'params' => $rspObj['params'], + 'property_chg' => $propertyChgService->toDto(), )); } else { myself()->_rspErr(500, 'server internal error'); From 9b9c1ae771af3eb46851df1f1806dc0344d2c939 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Nov 2022 16:01:15 +0800 Subject: [PATCH 3/7] 1 --- doc/BlockChain.py | 14 ++++++++++++++ doc/_common.py | 1 + 2 files changed, 15 insertions(+) diff --git a/doc/BlockChain.py b/doc/BlockChain.py index 444dc53e..fe3fdab6 100644 --- a/doc/BlockChain.py +++ b/doc/BlockChain.py @@ -31,6 +31,20 @@ class BlockChain(object): _common.RspHead(), ] }, + { + 'name': 'getJumpInfo', + 'desc': '获取跳转信息', + 'group': 'BlockChain', + 'url': 'webapp/index.php?c=BlockChain&a=getJumpInfo', + 'params': [ + ['trans_id', '', '事务id'], + ], + 'response': [ + _common.RspHead(), + ['action', 0, '动作 1:跳转英雄界面 '], + ['!params', [''], '参数列表'], + ] + }, { 'name': 'active721Nft', 'desc': '激活721nft', diff --git a/doc/_common.py b/doc/_common.py index 52f5f1be..26a7f24a 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -969,6 +969,7 @@ class NftTransaction(object): def __init__(self): self.fields = [ + ['trans_id', 0, 'trans_id'], ['item_id', 0, '道具id'], ['action', 0, '动作'], ['time', 0, '时间'], From 21ae31f785a486c7b23aea14a8a065862c193ded Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 10 Nov 2022 16:51:25 +0800 Subject: [PATCH 4/7] 1 --- doc/BlockChain.py | 4 +- sql/gamedb.sql | 2 +- .../controller/BlockChainController.class.php | 28 ++- webapp/models/Transaction.php | 173 ++++++++++++++++++ 4 files changed, 199 insertions(+), 8 deletions(-) diff --git a/doc/BlockChain.py b/doc/BlockChain.py index fe3fdab6..27bf4a56 100644 --- a/doc/BlockChain.py +++ b/doc/BlockChain.py @@ -41,8 +41,8 @@ class BlockChain(object): ], 'response': [ _common.RspHead(), - ['action', 0, '动作 1:跳转英雄界面 '], - ['!params', [''], '参数列表'], + ['action', 0,'动作 1:特定英雄详情,2:特定枪械详情,3:NFTs芯片列表,4:英雄进阶介面,5:枪械进阶介面,6:芯片升级介面,7:NFTs碎片列表 ,8:目标英雄详情介面的Chip页签,9:目标枪械详情介面的Chip页签 '], + ['!params', [''], '参数列表 params[0]: token_id'], ] }, { diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 987708dc..1f4c0e2d 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -807,7 +807,7 @@ CREATE TABLE `t_transaction_prefee` ( `target_token_type` bigint NOT NULL DEFAULT '0' COMMENT 'target_token_type', `item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid', `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `item_num` int(11) NOT NULL DEFAULT '0' COMMENT '道具数量', + `item_num` double NOT NULL DEFAULT '0' COMMENT '道具数量', `done` int(11) NOT NULL DEFAULT '0' COMMENT 'done', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 47bf14fc..e35ad700 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -489,10 +489,13 @@ class BlockChainController extends BaseAuthedController { 0, $itemId ); + $propertyChgService = new services\PropertyChgService(); + $propertyChgService->addUserChg(); $decFeeCb($transId); myself()->_rspData(array( 'trans_id' => $transId, - 'params' => $rspObj['params'] + 'params' => $rspObj['params'], + 'property_chg' => $propertyChgService->toDto(), )); error_log(5555555555); } else { @@ -621,10 +624,10 @@ class BlockChainController extends BaseAuthedController { myself()->_rspErr(101, 'token_id paramater error'); return; } -// //CEG扣除 -// { -// Chip::getChipByTokenId($chipIds); -// } + //CEG扣除 + { + Chip::getChipByTokenId($chipIds[0]); + } $this->internalBcCall( array( 'c' => 'BcService', @@ -687,6 +690,21 @@ class BlockChainController extends BaseAuthedController { } } + 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); + } + private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId) { $params = array( diff --git a/webapp/models/Transaction.php b/webapp/models/Transaction.php index 10ab2234..0e9f1067 100644 --- a/webapp/models/Transaction.php +++ b/webapp/models/Transaction.php @@ -112,6 +112,179 @@ class Transaction extends BaseModel { } } + public static function getJumpInfo($transDb) + { + $jumpInfo = null; + switch ($transDb['action']) { + case self::MINT_721_ACTION_TYPE: + { + switch ($transDb['token_type']) { + case Nft::HERO_TYPE: + { + $jumpInfo = array( + 'action' => 1, //英雄激活(英雄详情) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + case Nft::EQUIP_TYPE: + { + $jumpInfo = array( + 'action' => 2,//武器激活(武器详情) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + } + + } + break; + case self::MINT_1155_ACTION_TYPE: + { + $jumpInfo = array( + 'action' => 3, //芯片生成(芯片列表) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + case self::EVOLVE_721_ACTION_TYPE: + { + switch ($transDb['token_type']) { + case Nft::HERO_TYPE: + { + $jumpInfo = array( + 'action' => 4, //英雄升阶(英雄进阶界面) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + case Nft::EQUIP_TYPE: + { + $jumpInfo = array( + 'action' => 5,//武器升阶(武器进阶界面) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + } + } + break; + case self::EVOLVE_CHIP_ACTION_TYPE: + { + $jumpInfo = array( + 'action' => 6, //芯片进阶(芯片升级界面) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + case self::MINT_SHARD_BATCH_ACTION_TYPE: + { + $jumpInfo = array( + 'action' => 7, //碎片生成(碎片列表) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + case self::SHARD_MIX_BY_USER_ACTION_TYPE: + {//碎片合成 + switch ($transDb['token_type']) { + case Nft::HERO_TYPE: + { + $jumpInfo = array( + 'action' => 1, //英雄合成(英雄详情) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + case Nft::EQUIP_TYPE: + { + $jumpInfo = array( + 'action' => 2,//武器合成(武器详情) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + } + } + break; + case self::PLUGIN_CHIP_ACTION_TYPE: + { + switch ($transDb['token_type']) { + case Nft::HERO_TYPE: + { + $jumpInfo = array( + 'action' => 8, //英雄芯片镶嵌(目标英雄详情介面的Chip页签) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + case Nft::EQUIP_TYPE: + { + $jumpInfo = array( + 'action' => 9,//武器芯片镶嵌(目标枪械详情介面的Chip页签) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + } + } + break; + case self::UNPLUG_CHIP_ACTION_TYPE: + { + switch ($transDb['token_type']) { + case Nft::HERO_TYPE: + { + $jumpInfo = array( + 'action' => 8, //英雄芯片卸下(目标英雄详情介面的Chip页签) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + case Nft::EQUIP_TYPE: + { + $jumpInfo = array( + 'action' => 9,//武器芯片卸下(目标枪械详情介面的Chip页签) + 'params' => array( + $transDb['token_id'] + ) + ); + } + break; + } + } + break; + default: + { + + } + } + return $jumpInfo; + } + public static function getStatusDesc($transDb) { switch ($transDb['status']) { From 4b25fe4a47bd3a06f7cb7e59916106e13ca4c2a4 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 10 Nov 2022 17:17:03 +0800 Subject: [PATCH 5/7] 1 --- webapp/controller/GunController.class.php | 19 +++++++++++++++++++ webapp/controller/HeroController.class.php | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/webapp/controller/GunController.class.php b/webapp/controller/GunController.class.php index bfc81ac4..c4143bca 100644 --- a/webapp/controller/GunController.class.php +++ b/webapp/controller/GunController.class.php @@ -779,4 +779,23 @@ class GunController extends BaseAuthedController { )); } + public function getLastQualityInfo(){ + $tokenId = getReqVal('token_id', ''); + if (!$tokenId){ + $this->_rspErr(1, ' error param'); + return; + } + $gunDb = Gun::findByTokenId2($tokenId); + if(!$gunDb || $gunDb['quality']<2){ + $this->_rspErr(1, ' error param'); + return; + } + $oldGunDb = $gunDb; + $oldGunDb['quality'] -= 1; + $this->_rspData(array( + 'new_gun' =>Gun::toDto($gunDb), + 'old_gun'=>Gun::toDto($oldGunDb) + )); + } + } diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index b065694f..9f230d0b 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -915,4 +915,23 @@ class HeroController extends BaseAuthedController { 'old_hero'=>$oldHero )); } + + public function getLastQualityInfo(){ + $tokenId = getReqVal('token_id', ''); + if (!$tokenId){ + $this->_rspErr(1, ' error param'); + return; + } + $heroDb = Hero::findByTokenId2($tokenId); + if(!$heroDb || $heroDb['quality']<2){ + $this->_rspErr(1, ' error param'); + return; + } + $oldHeroDb = $heroDb; + $oldHeroDb['quality'] -= 1; + $this->_rspData(array( + 'new_hero' =>Hero::toDto($heroDb), + 'old_hero'=>Hero::toDto($oldHeroDb) + )); + } } From a77e3c203e2bfd8ba74d85644cc562bba4acca6c Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 10 Nov 2022 19:20:31 +0800 Subject: [PATCH 6/7] 1 --- .../controller/BlockChainController.class.php | 48 +++++++++++++++++-- webapp/controller/ChipController.class.php | 4 +- webapp/models/Chip.php | 37 ++++++++++++++ 3 files changed, 84 insertions(+), 5 deletions(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index e35ad700..0a742e13 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -32,6 +32,7 @@ use models\TransactionPrefee; class BlockChainController extends BaseAuthedController { + const TEST_ITEM_ID = 666; public function _handlePre() { parent::_handlePre(); @@ -625,9 +626,50 @@ class BlockChainController extends BaseAuthedController { return; } //CEG扣除 - { - Chip::getChipByTokenId($chipIds[0]); - } +// { +// $costSum = 0; +// foreach ($chipIds as $chipId){ +// $chipDb = Chip::getChipByTokenId($chipId); +// if ($chipDb){ +// $tiliDiff = $chipDb['strength_max'] - $chipDb['strength']; +// $costSum += \services\FormulaService::Chip_Demount_Mint($tiliDiff); +// } +// } +// if ($costSum > 0){ +// $costItems = array( +// array( +// 'item_id' => V_ITEM_GOLD, +// 'item_num' => $costSum +// ), +// ); +// $lackItem = null; +// if (!$this->_hasEnoughItems($costItems, $lackItem)) { +// $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); +// return; +// } +// $decFeeCb = function ($transId) use ($costItems){ +// myself()->_decItems($costItems); +// foreach ($costItems as $costItem){ +// TransactionPrefee::add($transId,$costItem); +// } +// }; +// foreach ($chipIds as $chipId){ +// $chipDb = Chip::getChipByTokenId($chipId); +// $items = array( +// 'token_id' => $chipDb['token_id'], +// 'token_type' => $chipDb['chip_type'], +// 'item_id' => self::TEST_ITEM_ID, +// 'item_num' => $chipDb['strength_max'] - $chipDb['strength'] +// ); +// Chip::update($chipId,array( +// 'strength'=>$chipDb['strength_max'] +// )); +// $decFeeCb = function ($transId) use ($items){ +// TransactionPrefee::add($transId,$items); +// }; +// } +// } +// } $this->internalBcCall( array( 'c' => 'BcService', diff --git a/webapp/controller/ChipController.class.php b/webapp/controller/ChipController.class.php index c3f0e45b..ab05a5fa 100644 --- a/webapp/controller/ChipController.class.php +++ b/webapp/controller/ChipController.class.php @@ -74,10 +74,10 @@ class ChipController extends BaseAuthedController $chip['strength_temporary'] = \services\FormulaService::Hero_Chip_NFT_Maximum_Physical_Strength($chip['chip_grade'],$chip['lucky_temporary']); $chip['mint'] = strval(\services\FormulaService::Chip_Need_Mint_Cost($chip['chip_grade'])-$chip['upgrade_mint']); } - if ($chip['inlay_state'] == 1){ +// if ($chip['inlay_state'] == 1){ $tili = $chip['strength_max']-$chip['strength']; $chip['mint'] = \services\FormulaService::Chip_Demount_Mint($tili); - } +// } $chip = Chip::toDto($chip); $this->_rspData(array( 'data' => $chip, diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index e451be51..cd38d8fa 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -146,6 +146,43 @@ class Chip extends BaseModel } public static function belongsToWhere($row){ + $tokenId = $row['token_id']; + $sql = "select * from t_chip_plugin where chip1=:tokenId or chip2=:tokenId or chip3=:tokenId or chip4=:tokenId limit 1"; + $whereKv =array( + 'chip1' => $tokenId, + 'chip2' => $tokenId, + 'chip3' => $tokenId, + 'chip4' => $tokenId, + ); + $ChipPluginDb = myself()->_getMarketMysql()->execQuery($sql,$whereKv); + if (!$ChipPluginDb){ + return 0; + } + switch ($row['chip_type']){ + case 1:{ + $heroDb = Hero::findByTokenId2($ChipPluginDb['token_id']); + if($heroDb){ + return $heroDb['hero_id']; + }else{ + return 0; + } + } + break; + case 2:{ + $gunDb = Gun::findByTokenId2($ChipPluginDb['token_id']); + if($gunDb){ + return $gunDb['gun_id']; + }else{ + return 0; + } + } + break; + default:{ + return 0; + } + } + } + public static function belongsToWhereOld($row){ switch ($row['chip_type']){ case 1:{ $heroDb = array(); From 8b97ce35ddfe28a0e3692665bd9f305439c9dd27 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 10 Nov 2022 19:28:35 +0800 Subject: [PATCH 7/7] 1 --- webapp/models/Chip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index cd38d8fa..4d6820ff 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -141,7 +141,7 @@ class Chip extends BaseModel $row['rand_attr'] = $attrs; $row['today_get_gold'] = $todayGetGold; $row['last_get_gold_time'] = $lastGetGoldTime; - $row['belong_to_item_id'] = self::belongsToWhere($row); + $row['belong_to_item_id'] = self::belongsToWhereOld($row); return $row; }