diff --git a/doc/Mall.py b/doc/Mall.py index 52958253..e0942006 100644 --- a/doc/Mall.py +++ b/doc/Mall.py @@ -13,14 +13,8 @@ class Mall(object): 'url': 'webapp/index.php?c=Mall&a=productOnline', 'params': [ _common.ReqHead(), - ['nft_token', '', 'nft_token'], ['item_id', '', '道具id,'], - ['s_price', '', '出售价格USDT'], ['amount', 0, '出售数量'], - ['payment_token_address', '', 'payment_token_address'], - ['nonce', '', 'nonce'], - ['signature', '', '签名soliditySha3(type, payment_token_address, price, nonce), 签名的replace客户端做处理'], - ['net_id', '', '网络id'], ], 'response': [ _common.RspHead() @@ -33,8 +27,6 @@ class Mall(object): 'url': 'webapp/index.php?c=Mall&a=productOffline', 'params': [ _common.ReqHead(), - ['account', '', '账号id'], - ['idx', '', '出售的idx'], ], 'response': [ _common.RspHead() @@ -47,8 +39,7 @@ class Mall(object): 'url': 'webapp/index.php?c=Mall&a=modifyPrice', 'params':[ _common.ReqHead(), - ['account', '', '账号id'], - ['idx', '', '出售的idx'], + ['goods_uuid', '', '出售的idx'], ['s_price', '', '出售价格USDT'], ], 'response': [ @@ -62,8 +53,7 @@ class Mall(object): 'url': 'webapp/index.php?c=Mall&a=buy', 'params': [ _common.ReqHead(), - ['account', '', '账号id'], - ['idx', '', '出售的idx'], + ['goods_uuid', '', '出售的idx'], ['s_price', '', '出售价格USDT'], ], 'response': [ diff --git a/webapp/controller/MallController.class.php b/webapp/controller/MallController.class.php index 624d334f..0384702f 100644 --- a/webapp/controller/MallController.class.php +++ b/webapp/controller/MallController.class.php @@ -1,28 +1,15 @@ appendChipsInfo(Hero::toDtoInfo(Hero::findByTokenId2($token_id))); - } - break; - case Nft::EQUIP_TYPE: { - return $this->appendChipsInfo(Gun::toDtoInfo(Gun::findByTokenId2($token_id))); - } - break; - case Nft::CHIP_TYPE: { - return Chip::toDto(Chip::getChipByTokenId($token_id)); - } - break; - case Nft::FRAGMENT_TYPE: { - return Fragment::ToDto($nftRowInfo); - } - break; - default: { - } - break; - } - return array('unknown' => 'unknown game data type, cannot find data'); - } - - private function appendChipsInfo($detail) - { - $detail['chips_info'] = array(); - if (!empty($detail['chip_ids'])) { - $chips = explode('|', $detail['chip_ids']); - foreach ($chips as $chip) { - $chip_info = ""; - if (!empty($chip)) { - $chip_info = Chip::toDto(Chip::getChipByTokenId($chip)); - } - array_push($detail['chips_info'], $chip_info); - } - } - return $detail; - } - - private function attach_market_selling(&$row) - { - $conn = myself()->_getSelfMysql(); - - $rows = $conn->execQuery( - 'SELECT * FROM t_market_store ' . - 'WHERE token_id=:token_id AND owner_address=:owner_address AND status=:status', - array( - ':token_id' => $row['token_id'], - ':owner_address' => $row['owner_address'], - ':status' => 0, - ) - ); - - $count = 0; - $link_array = array(); - foreach ($rows as $r) { - $count += $r['amount']; - array_push($link_array, $r['o_link']); - } - - $row['o_link'] = implode('|', $link_array); - $row['selling'] = $count; - } - - private function listMySelledNfts($account, $type) - { - // error_log('listMySelledNfts ' . $account . ' ' . $type); - - $conn = myself()->_getSelfMysql(); - - $rows = $conn->execQuery( - 'SELECT * FROM t_market_store ' . - 'WHERE owner_address=:account AND token_type=:token_type AND status=0 ', - array( - ':account' => $account, - ':token_type' => $type, - ) - ); - - return $rows; - } - - private function normalizeWeb3Price($price) - { - $bn1 = phpcommon\bnInit($price * pow(10, 8)); - $bn2 = phpcommon\bnInit('1000000000000000000'); - $ret_price = phpcommon\bnDiv(phpcommon\bnMul($bn1, $bn2), pow(10, 8)); - - // error_log('normalizeWeb3Price: ' . $ret_price . ' ' . $price * pow(10, 8)); - return phpcommon\bnToStr($ret_price); - } - - private function getGoodsByIdx($idx) - { - $row = SqlHelper::selectOne( - myself()->_getSelfMysql(), - 't_market_store', - array('order_id', 'item_id', 'amount', 's_price', 'owner_address'), - array( - 'idx' => $idx, - 'status' => 0, - ) - ); - if (!$row) { - return null; - } - if (!$row['item_id']) { - return null; - } - return $row; - } - - private function markOrderBuyStatus($idx) - { - $r = SqlHelper::update( - myself()->_getSelfMysql(), - 't_market_store', - array( - 'idx' => $idx, - ), - array( - 'status' => 3, - 'buytime' => myself()->_getNowTime(), - ) - ); - if (!$r) { - return false; - } - - return true; - } - }