Merge branch 'star' of git.kingsome.cn:server/game2006api into star

This commit is contained in:
hujiabin 2023-07-03 22:15:05 +08:00
commit a91c844117
5 changed files with 502 additions and 272 deletions

View File

@ -403,6 +403,27 @@ class Market(object):
_common.RspHead() _common.RspHead()
] ]
}, },
{
'name': 'sell',
'desc': '出售NFT',
'group': 'Market',
'url': 'webapp/index.php?c=Market&a=sell',
'params': [
['account', '', '账号id'],
['token', '', 'token'],
['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()
]
},
{ {
'name': 'buyNft', 'name': 'buyNft',
'desc': '购买NFT', 'desc': '购买NFT',

View File

@ -187,7 +187,8 @@ class Shop(object):
'response': [ 'response': [
_common.RspHead(), _common.RspHead(),
['idx', 0, '每日精选的索引'], ['idx', 0, '每日精选的索引'],
['cost', 0, '每日精选的当前刷新价格'], ['refresh_info', '', '每日精选的刷新信息(格式:刷新次数/可刷新总数)'],
['cost', 0, '每日精选的当前刷新价格,-1表示不可刷新'],
['!goods_list', [_common.DailySelectionGoods()], '每日精选列表'], ['!goods_list', [_common.DailySelectionGoods()], '每日精选列表'],
] ]
}, },

View File

@ -86,6 +86,9 @@ class BaseAuthedController extends BaseController {
} }
$r = $this->_getRedis($this->_getAccountId()); $r = $this->_getRedis($this->_getAccountId());
$sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId()); $sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId());
// error_log('SERVER_ENV:' . SERVER_ENV . '_DEBUG:' . _DEBUG);
if (SERVER_ENV != _DEBUG)
{
if (empty($sessionId)) { if (empty($sessionId)) {
$this->updateSession(myself()->_getAccountId(), $this->updateSession(myself()->_getAccountId(),
myself()->_getSessionId()); myself()->_getSessionId());
@ -96,6 +99,7 @@ class BaseAuthedController extends BaseController {
phpcommon\sendError(1001, 'session expiration'); phpcommon\sendError(1001, 'session expiration');
die(); die();
} }
}
$this->_userLvRestriction(); $this->_userLvRestriction();
} }

View File

@ -35,14 +35,15 @@ use services\MarketService;
use services\LuckyBoxService; use services\LuckyBoxService;
use services\ActivateNftService; use services\ActivateNftService;
class MarketController extends BaseController { class MarketController extends BaseController
{
public function getPreSaleInfo() public function getPreSaleInfo()
{ {
$account = strtolower(getReqVal('account', '')); $account = strtolower(getReqVal('account', ''));
$presaleInfo = MarketService::getPreSaleInfo($account); $presaleInfo = MarketService::getPreSaleInfo($account);
if (MarketService::isTestMode()) { if (MarketService::isTestMode()) {
foreach(array_keys($presaleInfo) as $key) { foreach (array_keys($presaleInfo) as $key) {
if (!is_null(getReqVal($key, null))) { if (!is_null(getReqVal($key, null))) {
$presaleInfo[$key] = getReqVal($key, $presaleInfo[$key]); $presaleInfo[$key] = getReqVal($key, $presaleInfo[$key]);
} }
@ -69,7 +70,7 @@ class MarketController extends BaseController {
'current_page' => $page, 'current_page' => $page,
'total_pages' => 0 'total_pages' => 0
); );
$startPos= $pageInfo['per_page'] * ($pageInfo['current_page'] - 1); $startPos = $pageInfo['per_page'] * ($pageInfo['current_page'] - 1);
$currBatchMeta = mt\MarketBatch::getCurrentBatch(); $currBatchMeta = mt\MarketBatch::getCurrentBatch();
if ($currBatchMeta) { if ($currBatchMeta) {
@ -79,8 +80,10 @@ class MarketController extends BaseController {
$saleBox = $this->fillPresaleBox($currBatchMeta, $meta); $saleBox = $this->fillPresaleBox($currBatchMeta, $meta);
if ($saleBox) { if ($saleBox) {
++$pageInfo['total']; ++$pageInfo['total'];
if ($pageInfo['total'] > $startPos && if (
count($rows) < $pageInfo['per_page']) { $pageInfo['total'] > $startPos &&
count($rows) < $pageInfo['per_page']
) {
array_push($rows, $saleBox); array_push($rows, $saleBox);
} }
} }
@ -119,7 +122,8 @@ class MarketController extends BaseController {
$paymentTokenAddress, $paymentTokenAddress,
$price, $price,
$nonce, $nonce,
$signature); $signature
);
$batchIdx = 0; $batchIdx = 0;
$idx = 0; $idx = 0;
@ -129,12 +133,14 @@ class MarketController extends BaseController {
return; return;
} }
if (empty($type) || if (
empty($type) ||
empty($buyerAddress) || empty($buyerAddress) ||
empty($price) || empty($price) ||
empty($paymentTokenAddress) || empty($paymentTokenAddress) ||
empty($signature) || empty($signature) ||
empty($nonce)) { empty($nonce)
) {
myself()->_rspErr(2, 'parameter error'); myself()->_rspErr(2, 'parameter error');
return; return;
} }
@ -192,15 +198,19 @@ class MarketController extends BaseController {
return; return;
} }
if (!MarketService::isTestMode() && if (
BoxOrder::isBuyed($buyerAddress, $currBatchMeta['id'])) { !MarketService::isTestMode() &&
BoxOrder::isBuyed($buyerAddress, $currBatchMeta['id'])
) {
myself()->_rspErr(1, 'account can only choose 1 hero to purchase'); myself()->_rspErr(1, 'account can only choose 1 hero to purchase');
return; return;
} }
$orderId = BuyRecord::genOrderId($gameId, $orderId = BuyRecord::genOrderId(
$gameId,
$funcId, $funcId,
myself()->_getNowTime(), myself()->_getNowTime(),
$buyerAddress); $buyerAddress
);
$fieldsKv = array( $fieldsKv = array(
'game_id' => $gameId, 'game_id' => $gameId,
@ -317,7 +327,7 @@ class MarketController extends BaseController {
), ),
) )
), ),
'handle' => function ($row) use(&$nftDbList) { 'handle' => function ($row) use (&$nftDbList) {
#error_log(json_encode($row)); #error_log(json_encode($row));
array_push($nftDbList, $row); array_push($nftDbList, $row);
} }
@ -385,7 +395,7 @@ class MarketController extends BaseController {
public function auth() public function auth()
{ {
$account = strtolower(getReqVal('account', '')); $account = strtolower(getReqVal('account', ''));
$tips = getReqVal('tips', '') ; $tips = getReqVal('tips', '');
$nonce = getReqVal('nonce', ''); $nonce = getReqVal('nonce', '');
$signature = getReqVal('signature', ''); $signature = getReqVal('signature', '');
MarketService::auth($account, $tips, $nonce, $signature); MarketService::auth($account, $tips, $nonce, $signature);
@ -397,17 +407,18 @@ class MarketController extends BaseController {
if (!$currencyMeta) { if (!$currencyMeta) {
return null; return null;
} }
$boxId = phpcommon\genBoxId($batchMeta['id'], $boxId = phpcommon\genBoxId(
$batchMeta['id'],
$goodsMeta['id'], $goodsMeta['id'],
$goodsMeta['item_id']); $goodsMeta['item_id']
);
$itemMeta = mt\Item::get($goodsMeta['item_id']); $itemMeta = mt\Item::get($goodsMeta['item_id']);
$originalPrice = $goodsMeta['price'] * pow(10, MarketService::CURRENCY_DECIMALS); $originalPrice = $goodsMeta['price'] * pow(10, MarketService::CURRENCY_DECIMALS);
$discountPrice = $goodsMeta['discount'] * 100 > 0 ? $discountPrice = $goodsMeta['discount'] * 100 > 0 ?
$originalPrice * $goodsMeta['discount'] : $originalPrice; $originalPrice * $goodsMeta['discount'] : $originalPrice;
$name = ''; $name = '';
$job = 0; $job = 0; {
{
$heroMeta = mt\Hero::get($goodsMeta['item_id']); $heroMeta = mt\Hero::get($goodsMeta['item_id']);
if ($heroMeta) { if ($heroMeta) {
$name = emptyReplace($heroMeta['name'], 'Hill'); $name = emptyReplace($heroMeta['name'], 'Hill');
@ -429,7 +440,8 @@ class MarketController extends BaseController {
'decimals' => MarketService::CURRENCY_DECIMALS, 'decimals' => MarketService::CURRENCY_DECIMALS,
'contract_address' => $currencyMeta['address'], 'contract_address' => $currencyMeta['address'],
) )
)); )
);
return $saleBox; return $saleBox;
} }
@ -547,22 +559,22 @@ class MarketController extends BaseController {
$sortByLevel = function ($a, $b) use ($order_asc) { $sortByLevel = function ($a, $b) use ($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['hero_lv'] - $a['detail']['hero_lv']); return ($order_asc == 1 ? 1 : -1) * ($b['detail']['hero_lv'] - $a['detail']['hero_lv']);
}; };
$sortByGunLv = function ($a, $b) use($order_asc) { $sortByGunLv = function ($a, $b) use ($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['gun_lv'] - $a['detail']['gun_lv']); return ($order_asc == 1 ? 1 : -1) * ($b['detail']['gun_lv'] - $a['detail']['gun_lv']);
}; };
$sortByTili = function ($a, $b) use($order_asc) { $sortByTili = function ($a, $b) use ($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['hero_tili'] - $a['detail']['hero_tili']); return ($order_asc == 1 ? 1 : -1) * ($b['detail']['hero_tili'] - $a['detail']['hero_tili']);
}; };
$sortByStar = function ($a, $b) use($order_asc) { $sortByStar = function ($a, $b) use ($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['quality'] - $a['detail']['quality']); return ($order_asc == 1 ? 1 : -1) * ($b['detail']['quality'] - $a['detail']['quality']);
}; };
$sortByDurability = function ($a, $b) use($order_asc) { $sortByDurability = function ($a, $b) use ($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['durability_max'] - $a['detail']['durability_max']); return ($order_asc == 1 ? 1 : -1) * ($b['detail']['durability_max'] - $a['detail']['durability_max']);
}; };
$sortByPower = function ($a, $b) use($order_asc) { $sortByPower = function ($a, $b) use ($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['strength'] - $a['detail']['strength']); return ($order_asc == 1 ? 1 : -1) * ($b['detail']['strength'] - $a['detail']['strength']);
}; };
$sortByGrade = function ($a, $b) use($order_asc) { $sortByGrade = function ($a, $b) use ($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['chip_grade'] - $a['detail']['chip_grade']); return ($order_asc == 1 ? 1 : -1) * ($b['detail']['chip_grade'] - $a['detail']['chip_grade']);
}; };
$sortByTokenId = function ($a, $b) use ($order_asc) { $sortByTokenId = function ($a, $b) use ($order_asc) {
@ -570,6 +582,40 @@ class MarketController extends BaseController {
}; };
$nfts = array(); $nfts = array();
switch ($type) { switch ($type) {
case Nft::NONE_TYPE: {
$rows = Nft::getNftListByType($account, $type);
$rows = array_merge($rows, $this->listMySelledNfts($account, $type));
foreach ($rows as &$row) {
$nftDb = Nft::findNftByOwner($account, $row['token_id']);
if (empty($nftDb)) {
$nftDb = Nft::getNft($row['token_id']);
}
$row['info'] = Nft::toDto($nftDb);
// $row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id']));
// if (in_array($row['info']['info']['job'], $job) == false) continue;
// if ($row['detail']['hero_lv'] < $lv) continue;
// if ($row['detail']['quality'] < $quality) continue;
// if ($row['detail']['hero_tili'] < $durability) continue;
if (count($search) > 0) {
$searchLower = array_map('strtolower', $search);
if (!(in_array(strtolower($row['detail']['hero_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue;
}
// $row['detail'] = $this->appendChipsInfo($row['detail']);
array_push($nfts, $row);
}
switch ($order_method) {
case 1:
usort($nfts, $sortByLevel);
break;
case 2:
usort($nfts, $sortByTili);
break;
case 3:
usort($nfts, $sortByStar);
break;
}
}
break;
case Nft::HERO_TYPE: { case Nft::HERO_TYPE: {
$rows = Nft::getNftListByType($account, $type); $rows = Nft::getNftListByType($account, $type);
$rows = array_merge($rows, $this->listMySelledNfts($account, $type)); $rows = array_merge($rows, $this->listMySelledNfts($account, $type));
@ -580,11 +626,11 @@ class MarketController extends BaseController {
} }
$row['info'] = Nft::toDto($nftDb); $row['info'] = Nft::toDto($nftDb);
$row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id'])); $row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id']));
if (in_array($row['info']['info']['job'], $job)==false) continue; if (in_array($row['info']['info']['job'], $job) == false) continue;
if ($row['detail']['hero_lv']<$lv) continue; if ($row['detail']['hero_lv'] < $lv) continue;
if ($row['detail']['quality']<$quality) continue; if ($row['detail']['quality'] < $quality) continue;
if ($row['detail']['hero_tili']<$durability) continue; if ($row['detail']['hero_tili'] < $durability) continue;
if (count($search)>0) { if (count($search) > 0) {
$searchLower = array_map('strtolower', $search); $searchLower = array_map('strtolower', $search);
if (!(in_array(strtolower($row['detail']['hero_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; if (!(in_array(strtolower($row['detail']['hero_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue;
} }
@ -614,10 +660,10 @@ class MarketController extends BaseController {
} }
$row['info'] = Nft::toDto($nftDb); $row['info'] = Nft::toDto($nftDb);
$row['detail'] = Gun::toDtoInfo(Gun::findByTokenId2($row['token_id'])); $row['detail'] = Gun::toDtoInfo(Gun::findByTokenId2($row['token_id']));
if ($row['detail']['gun_lv']<$lv) continue; if ($row['detail']['gun_lv'] < $lv) continue;
if ($row['detail']['quality']<$quality) continue; if ($row['detail']['quality'] < $quality) continue;
if ($row['detail']['durability']<$durability) continue; if ($row['detail']['durability'] < $durability) continue;
if (count($search)>0) { if (count($search) > 0) {
$searchLower = array_map('strtolower', $search); $searchLower = array_map('strtolower', $search);
if (!(in_array(strtolower($row['detail']['gun_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; if (!(in_array(strtolower($row['detail']['gun_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue;
} }
@ -644,8 +690,8 @@ class MarketController extends BaseController {
$row['detail'] = Chip::toDto(Chip::getChipByTokenId($row['token_id'])); $row['detail'] = Chip::toDto(Chip::getChipByTokenId($row['token_id']));
if (!in_array($row['detail']['chip_type'], $job)) if (!in_array($row['detail']['chip_type'], $job))
continue; continue;
if ($row['detail']['chip_grade']<$lv) continue; if ($row['detail']['chip_grade'] < $lv) continue;
if (count($search)>0) { if (count($search) > 0) {
$searchLower = array_map('strtolower', $search); $searchLower = array_map('strtolower', $search);
if (!(in_array(strtolower($row['detail']['chip_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; if (!(in_array(strtolower($row['detail']['chip_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue;
} }
@ -672,7 +718,7 @@ class MarketController extends BaseController {
$row['detail'] = $this->getNftGameData($nftDb); $row['detail'] = $this->getNftGameData($nftDb);
if (!in_array($row['detail']['type'], $job)) if (!in_array($row['detail']['type'], $job))
continue; continue;
if (count($search)>0) { if (count($search) > 0) {
$searchLower = array_map('strtolower', $search); $searchLower = array_map('strtolower', $search);
if (!(in_array(strtolower($row['detail']['name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; if (!(in_array(strtolower($row['detail']['name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue;
} }
@ -682,7 +728,6 @@ class MarketController extends BaseController {
} }
break; break;
default: { default: {
} }
} }
return $nfts; return $nfts;
@ -710,19 +755,19 @@ class MarketController extends BaseController {
$job_filter_fn = function ($f) { $job_filter_fn = function ($f) {
$str = ''; $str = '';
$arr = array(); $arr = array();
foreach($f as $v) { foreach ($f as $v) {
if (!empty($v)) { if (!empty($v)) {
array_push($arr, 'c_job=\'' . $v . '\' '); array_push($arr, 'c_job=\'' . $v . '\' ');
} }
} }
if (count($arr)>0) { if (count($arr) > 0) {
$str = implode('OR ', $arr); $str = implode('OR ', $arr);
$str = 'AND (' . $str . ') '; $str = 'AND (' . $str . ') ';
} }
return $str; return $str;
}; };
$price_filter_fn = function ($f) { $price_filter_fn = function ($f) {
if (count($f)==2) { if (count($f) == 2) {
$low = $f[0]; $low = $f[0];
$top = $f[1]; $top = $f[1];
return 'AND s_price>=' . $low . ' AND s_price<=' . $top . ' '; return 'AND s_price>=' . $low . ' AND s_price<=' . $top . ' ';
@ -731,25 +776,25 @@ class MarketController extends BaseController {
}; };
$lv_filter_fn = function ($f) { $lv_filter_fn = function ($f) {
$f = (int) $f; $f = (int) $f;
return 'AND c_lv>=' . $f. ' '; return 'AND c_lv>=' . $f . ' ';
}; };
$quality_filter_fn = function ($f) { $quality_filter_fn = function ($f) {
$f = (int) $f; $f = (int) $f;
return 'AND c_quality>=' . $f. ' '; return 'AND c_quality>=' . $f . ' ';
}; };
$durability_filter_fn = function ($f) { $durability_filter_fn = function ($f) {
$f = (int) $f; $f = (int) $f;
return 'AND c_durability>=' . $f. ' '; return 'AND c_durability>=' . $f . ' ';
}; };
$search_filter_fn = function ($f) { $search_filter_fn = function ($f) {
$str = ''; $str = '';
$arr_options = array(); $arr_options = array();
foreach($f as $v) { foreach ($f as $v) {
if (!empty($v)) { if (!empty($v)) {
array_push($arr_options,'c_name=\'' . $v . '\' OR token_id=\'' . $v. '\' '); array_push($arr_options, 'c_name=\'' . $v . '\' OR token_id=\'' . $v . '\' ');
} }
} }
if (count($arr_options)>0) { if (count($arr_options) > 0) {
$str = implode('OR ', $arr_options); $str = implode('OR ', $arr_options);
$str = 'AND (' . $str . ') '; $str = 'AND (' . $str . ') ';
} }
@ -783,14 +828,14 @@ class MarketController extends BaseController {
$conn = myself()->_getMarketMysql(''); $conn = myself()->_getMarketMysql('');
$counts = $conn->execQuery( $counts = $conn->execQuery(
'SELECT count(*) as count FROM t_market_store '. 'SELECT count(*) as count FROM t_market_store ' .
'WHERE token_type=:token_type AND status=0 '. 'WHERE token_type=:token_type AND status=0 ' .
$job_filter_fn($job_filter_array). $job_filter_fn($job_filter_array) .
$lv_filter_fn($lv_filter). $lv_filter_fn($lv_filter) .
$quality_filter_fn($quality_filter). $quality_filter_fn($quality_filter) .
$durability_filter_fn($durability_filter). $durability_filter_fn($durability_filter) .
$price_filter_fn($price_filter_array). $price_filter_fn($price_filter_array) .
$search_filter_fn($search_filter_array). $search_filter_fn($search_filter_array) .
$order_fn($order_method, $order_asc), $order_fn($order_method, $order_asc),
array( array(
':token_type' => $type, ':token_type' => $type,
@ -801,22 +846,22 @@ class MarketController extends BaseController {
$page_end = $start + $page_size; $page_end = $start + $page_size;
if ($page_end > $total) { if ($page_end > $total) {
$page_end = $total; $page_end = $total;
$start = $total-1; $start = $total - 1;
$start = intval($start / $page_size) * $page_size; $start = intval($start / $page_size) * $page_size;
if ($start<0) $start = 0; if ($start < 0) $start = 0;
} }
$rows = $conn->execQuery( $rows = $conn->execQuery(
'SELECT * FROM t_market_store '. 'SELECT * FROM t_market_store ' .
'WHERE token_type=:token_type AND status=0 '. 'WHERE token_type=:token_type AND status=0 ' .
$job_filter_fn($job_filter_array). $job_filter_fn($job_filter_array) .
$lv_filter_fn($lv_filter). $lv_filter_fn($lv_filter) .
$quality_filter_fn($quality_filter). $quality_filter_fn($quality_filter) .
$durability_filter_fn($durability_filter). $durability_filter_fn($durability_filter) .
$price_filter_fn($price_filter_array). $price_filter_fn($price_filter_array) .
$search_filter_fn($search_filter_array). $search_filter_fn($search_filter_array) .
$order_fn($order_method, $order_asc). $order_fn($order_method, $order_asc) .
'LIMIT '.$start.','.$page_size, 'LIMIT ' . $start . ',' . $page_size,
array( array(
':token_type' => $type, ':token_type' => $type,
) )
@ -825,7 +870,7 @@ class MarketController extends BaseController {
$nfts = array(); $nfts = array();
for ($x = $start; $x < $page_end; $x++) { for ($x = $start; $x < $page_end; $x++) {
$row = $rows[$x%$page_size]; $row = $rows[$x % $page_size];
$nftDb = Nft::getNft($row['token_id']); $nftDb = Nft::getNft($row['token_id']);
if (!$nftDb) { if (!$nftDb) {
$nftDb = Nft::findNftByOwner($account, $row['token_id']); $nftDb = Nft::findNftByOwner($account, $row['token_id']);
@ -833,11 +878,14 @@ class MarketController extends BaseController {
if (!$nftDb) { if (!$nftDb) {
$nftDb = Nft::findNftByOwner('0xfc628dd79137395f3c9744e33b1c5de554d94882', $row['token_id']); $nftDb = Nft::findNftByOwner('0xfc628dd79137395f3c9744e33b1c5de554d94882', $row['token_id']);
if (!$nftDb) { if (!$nftDb) {
if ($row['item_id']) {
} else {
myself()->_rspErr(1, 'nft not exists'); myself()->_rspErr(1, 'nft not exists');
return; return;
} }
} }
} }
}
$nft = Nft::toDto($nftDb); $nft = Nft::toDto($nftDb);
$row['info'] = $nft; $row['info'] = $nft;
$row['detail'] = $this->getNftGameData($nftDb); $row['detail'] = $this->getNftGameData($nftDb);
@ -864,7 +912,7 @@ class MarketController extends BaseController {
$job_filters = getReqVal('job_filters', ''); $job_filters = getReqVal('job_filters', '');
$job_filter_array = explode('|', $job_filters); $job_filter_array = explode('|', $job_filters);
$search_filters = getReqVal('search_filters', ''); $search_filters = getReqVal('search_filters', '');
if ($search_filters!='') { if ($search_filters != '') {
$search_filter_array = explode('|', $search_filters); $search_filter_array = explode('|', $search_filters);
} else { } else {
$search_filter_array = array(); $search_filter_array = array();
@ -880,9 +928,9 @@ class MarketController extends BaseController {
$page_end = $start + $page_size; $page_end = $start + $page_size;
if ($page_end > $total) { if ($page_end > $total) {
$page_end = $total; $page_end = $total;
$start = $total-1; $start = $total - 1;
$start = intval($start / $page_size) * $page_size; $start = intval($start / $page_size) * $page_size;
if ($start<0) $start = 0; if ($start < 0) $start = 0;
} }
$nfts = array(); $nfts = array();
@ -900,49 +948,95 @@ class MarketController extends BaseController {
)); ));
} }
public function sell() { public function sell()
{
$self = myself();
if (!$self) {
$this->_rspErr(500, 'internal error, no self');
return;
}
$account = strtolower(getReqVal('account', '')); $account = strtolower(getReqVal('account', ''));
$item_id = getReqVal('item_id', '');
$token = getReqVal('token', ''); $token = getReqVal('token', '');
$nft_token = getReqVal('nft_token', ''); $nft_token = getReqVal('nft_token', '');
$item_id = getReqVal('item_id', '');
$s_price = getReqVal('s_price', ''); $s_price = getReqVal('s_price', '');
$amount = getReqVal('amount', 1); $amount = getReqVal('amount', 1);
$payment_token_address = getReqVal('payment_token_address', ''); $payment_token_address = getReqVal('payment_token_address', '');
$nonce = getReqVal('nonce', ''); $nonce = getReqVal('nonce', '');
$signature = getReqVal('signature', ''); $signature = getReqVal('signature', '');
$net_id = getReqVal('net_id', ''); $net_id = getReqVal('net_id', '');
$conn = myself()->_getMysql(''); $conn = $self->_getMarketMysql('');
$nftDb = null;
$c_name = null;
$c_job = null;
$c_lv = null;
$c_quality = null;
$c_durability = null;
$c_type = null;
$c_id = null;
if ($nft_token) {
$nftDb = Nft::findNftByOwner($account, $nft_token); $nftDb = Nft::findNftByOwner($account, $nft_token);
$nftDetail = Nft::toDto($nftDb); $nftDetail = Nft::toDto($nftDb);
$detail = $this->getNftGameData($nftDb); $detail = $this->getNftGameData($nftDb);
$c_name = $nftDetail['info']['name'];
$c_job = isset($nftDetail['info']['job']) ? $nftDetail['info']['job']
: (isset($detail['chip_type']) ? $detail['chip_type']
: (isset($detail['type']) ? $detail['type']
: 0));
$c_lv = @$detail['gun_lv'] | @$detail['hero_lv'] | @$detail['chip_grade'];
$c_quality = isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0;
$c_durability = isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : (isset($detail['hero_tili']) ? $detail['hero_tili'] : 0);
$c_type = isset($detail['type']) ? $detail['type'] : 0;
$c_id = $nftDetail['item_id'];
} else {
if (!$this->decItems($account, $item_id, $amount)) {
$this->_rspErr(1, 'item not enough, item_id:' . $item_id);
return;
}
$itemMeta = mt\Item::get($item_id);
$c_name = $itemMeta['name'];
$c_job = 0;
$c_lv = 0;
$c_quality = $itemMeta['quality'];
$c_durability = 0;
$c_type = 0;
$c_id = $item_id;
}
$r = SqlHelper::insert( $r = SqlHelper::insert(
$conn, $conn,
't_market_store', 't_market_store',
array( array(
'token_id' => $nft_token, 'token_id' => $nft_token,
'token_type' => $nftDetail['type'], 'item_id' => $item_id,
'owner' => $account, 'owner_address' => $account,
'price' => $s_price, 'token_type' => 0,
'amount' => $amount, 'amount' => $amount,
'payment_token_address' => $payment_token_address, 'createtime' => $self->_getNowTime(),
'status' => 0, 'modifytime' => $self->_getNowTime(),
'create_time' => time(), 's_price' => $s_price,
'update_time' => time(), 'c_name' => $c_name,
'c_job' => $c_job,
'c_lv' => $c_lv,
'c_quality' => $c_quality,
'c_durability' => $c_durability,
'c_type' => $c_type,
'c_id' => $c_id,
) )
); );
if (!$r) { $this->_rspOk();
myself()->_rspErr(1, 'insert error');
return;
}
$this->_rspData(array(
'nft' => $nftDetail,
'detail' => $detail,
));
} }
public function sellMyNft() { private function sellMyNft()
{
$account = strtolower(getReqVal('account', '')); $account = strtolower(getReqVal('account', ''));
$token = getReqVal('token', ''); $token = getReqVal('token', '');
@ -954,7 +1048,7 @@ class MarketController extends BaseController {
$signature = getReqVal('signature', ''); $signature = getReqVal('signature', '');
$net_id = getReqVal('net_id', ''); $net_id = getReqVal('net_id', '');
$conn = myself()->_getMysql(''); $conn = myself()->_getMarketMysql('');
$nftDb = Nft::findNftByOwner($account, $nft_token); $nftDb = Nft::findNftByOwner($account, $nft_token);
$nftDetail = Nft::toDto($nftDb); $nftDetail = Nft::toDto($nftDb);
@ -973,8 +1067,8 @@ class MarketController extends BaseController {
'c_name' => $nftDetail['info']['name'], 'c_name' => $nftDetail['info']['name'],
'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] 'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job']
: (isset($detail['chip_type']) ? $detail['chip_type'] : (isset($detail['chip_type']) ? $detail['chip_type']
: (isset($detail['type'])?$detail['type'] : (isset($detail['type']) ? $detail['type']
:0)), : 0)),
'c_lv' => @$detail['gun_lv'] | @$detail['hero_lv'] | @$detail['chip_grade'], 'c_lv' => @$detail['gun_lv'] | @$detail['hero_lv'] | @$detail['chip_grade'],
'c_quality' => isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0, 'c_quality' => isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0,
'c_durability' => isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : (isset($detail['hero_tili']) ? $detail['hero_tili'] : 0), 'c_durability' => isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : (isset($detail['hero_tili']) ? $detail['hero_tili'] : 0),
@ -985,7 +1079,8 @@ class MarketController extends BaseController {
$this->_rspOk(); $this->_rspOk();
} }
public function buyNft() { public function buyNft()
{
$account = strtolower(getReqVal('account', '')); $account = strtolower(getReqVal('account', ''));
$token = getReqVal('token', ''); $token = getReqVal('token', '');
$nft_token = getReqVal('nft_token', ''); $nft_token = getReqVal('nft_token', '');
@ -995,12 +1090,13 @@ class MarketController extends BaseController {
$net_id = getReqVal('net_id', ''); $net_id = getReqVal('net_id', '');
$conn = myself()->_getMarketMysql(''); $conn = myself()->_getMarketMysql('');
$conn->execScript('DELETE FROM t_market_store WHERE '.'token_id=\''.$nft_token.'\''); $conn->execScript('DELETE FROM t_market_store WHERE ' . 'token_id=\'' . $nft_token . '\'');
$this->_rspOk(); $this->_rspOk();
} }
public function getSupportedCurrencyTypes() { public function getSupportedCurrencyTypes()
{
$types = array(); $types = array();
if (SERVER_ENV == _ONLINE) { if (SERVER_ENV == _ONLINE) {
array_push($types, array( array_push($types, array(
@ -1018,27 +1114,27 @@ class MarketController extends BaseController {
)); ));
} }
public function getTransactionRecord() { public function getTransactionRecord()
{
$account = strtolower(getReqVal('account', '')); $account = strtolower(getReqVal('account', ''));
$type = getReqVal('type', 0); $type = getReqVal('type', 0);
$start = getReqVal('start', 0); $start = getReqVal('start', 0);
$page_size = getReqVal('page_size', 10); $page_size = getReqVal('page_size', 10);
$conn = myself()->_getMysql(''); $conn = myself()->_getMarketMysql('');
$type_filter_fn = function ($f) { $type_filter_fn = function ($f) {
if ($f==0) { if ($f == 0) {
return ''; return '';
} } else {
else {
return 'AND type=' . $f; return 'AND type=' . $f;
} }
}; };
$counts = $conn->execQuery( $counts = $conn->execQuery(
'SELECT count(*) as count FROM t_market_transaction_record '. 'SELECT count(*) as count FROM t_market_transaction_record ' .
'WHERE (seller=:account OR buyer=:account) '. 'WHERE (seller=:account OR buyer=:account) ' .
$type_filter_fn($type). $type_filter_fn($type) .
' ORDER BY createtime DESC', ' ORDER BY createtime DESC',
array( array(
':account' => $account, ':account' => $account,
@ -1049,17 +1145,17 @@ class MarketController extends BaseController {
$page_end = $start + $page_size; $page_end = $start + $page_size;
if ($page_end > $total) { if ($page_end > $total) {
$page_end = $total; $page_end = $total;
$start = $total-1; $start = $total - 1;
$start = intval($start / $page_size) * $page_size; $start = intval($start / $page_size) * $page_size;
if ($start<0) $start = 0; if ($start < 0) $start = 0;
} }
$rows = $conn->execQuery( $rows = $conn->execQuery(
'SELECT * FROM t_market_transaction_record '. 'SELECT * FROM t_market_transaction_record ' .
'WHERE (seller=:account OR buyer=:account) '. 'WHERE (seller=:account OR buyer=:account) ' .
$type_filter_fn($type). $type_filter_fn($type) .
' ORDER BY createtime DESC '. ' ORDER BY createtime DESC ' .
'LIMIT '.$start.','.$page_size, 'LIMIT ' . $start . ',' . $page_size,
array( array(
':account' => $account, ':account' => $account,
) )
@ -1073,8 +1169,9 @@ class MarketController extends BaseController {
)); ));
} }
private function addTransactionRecord($record) { private function addTransactionRecord($record)
$conn = myself()->_getMysql(''); {
$conn = myself()->_getMarketMysql('');
$r = SqlHelper::insert( $r = SqlHelper::insert(
$conn, $conn,
@ -1082,11 +1179,12 @@ class MarketController extends BaseController {
$record $record
); );
if (!$r) { if (!$r) {
$this->_rspErr(2, 'unknown error, orderId='.$record['orderid']); $this->_rspErr(2, 'unknown error, orderId=' . $record['orderid']);
} }
} }
public function eventSellOrder() { public function eventSellOrder()
{
$tokenId = getReqVal('tokenId', ''); $tokenId = getReqVal('tokenId', '');
$owner = strtolower(getReqVal('owner', '')); $owner = strtolower(getReqVal('owner', ''));
$nftToken = getReqVal('nftToken', ''); $nftToken = getReqVal('nftToken', '');
@ -1095,7 +1193,8 @@ class MarketController extends BaseController {
$currency = getReqVal('currency', ''); $currency = getReqVal('currency', '');
$price = getReqVal('price', ''); $price = getReqVal('price', '');
error_log("eventSellOrder:" . json_encode( error_log(
"eventSellOrder:" . json_encode(
array( array(
'tokenId' => $tokenId, 'tokenId' => $tokenId,
'owner' => $owner, 'owner' => $owner,
@ -1114,7 +1213,7 @@ class MarketController extends BaseController {
// 1. check order status // 1. check order status
$chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId));
if (!empty($chk)) { if (!empty($chk)) {
$this->_rspErr(1, 'repeat sell order, orderId='.$orderId); $this->_rspErr(1, 'repeat sell order, orderId=' . $orderId);
return; return;
} }
@ -1143,8 +1242,8 @@ class MarketController extends BaseController {
'c_name' => $nftDetail['info']['name'], 'c_name' => $nftDetail['info']['name'],
'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] 'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job']
: (isset($detail['chip_type']) ? $detail['chip_type'] : (isset($detail['chip_type']) ? $detail['chip_type']
: (isset($detail['type'])?$detail['type'] : (isset($detail['type']) ? $detail['type']
:0)), : 0)),
'c_lv' => @$detail['gun_lv'] | @$detail['hero_lv'] | @$detail['chip_grade'], 'c_lv' => @$detail['gun_lv'] | @$detail['hero_lv'] | @$detail['chip_grade'],
'c_quality' => isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0, 'c_quality' => isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0,
'c_durability' => isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : (isset($detail['hero_tili']) ? $detail['hero_tili'] : 0), 'c_durability' => isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : (isset($detail['hero_tili']) ? $detail['hero_tili'] : 0),
@ -1153,13 +1252,14 @@ class MarketController extends BaseController {
) )
); );
if (!$r) { if (!$r) {
$this->_rspErr(2, 'unknown error, orderId='.$orderId); $this->_rspErr(2, 'unknown error, orderId=' . $orderId);
} }
$this->_rspOk(); $this->_rspOk();
} }
public function eventBuyOrder() { public function eventBuyOrder()
{
$tokenId = getReqVal('tokenId', ''); $tokenId = getReqVal('tokenId', '');
$orderId = getReqVal('orderId', ''); $orderId = getReqVal('orderId', '');
$nftToken = getReqVal('nftToken', ''); $nftToken = getReqVal('nftToken', '');
@ -1169,7 +1269,8 @@ class MarketController extends BaseController {
$erc20 = getReqVal('erc20', ''); $erc20 = getReqVal('erc20', '');
$price = getReqVal('price', ''); $price = getReqVal('price', '');
error_log("eventBuyOrder:" . json_encode( error_log(
"eventBuyOrder:" . json_encode(
array( array(
'tokenId' => $tokenId, 'tokenId' => $tokenId,
'orderId' => $orderId, 'orderId' => $orderId,
@ -1187,12 +1288,12 @@ class MarketController extends BaseController {
$conn = myself()->_getMarketMysql(''); $conn = myself()->_getMarketMysql('');
// 1. check order status // 1. check order status
$chk = SqlHelper::selectOne($conn, 't_market_store', array('status','idx', 'c_name', 'token_type'), array('o_link' => $orderId)); $chk = SqlHelper::selectOne($conn, 't_market_store', array('status', 'idx', 'c_name', 'token_type'), array('o_link' => $orderId));
if (empty($chk)) { if (empty($chk)) {
$this->_rspErr(1, 'not found order, orderId='.$orderId); $this->_rspErr(1, 'not found order, orderId=' . $orderId);
return; return;
} }
if ($chk['status']== '0') { if ($chk['status'] == '0') {
$r = SqlHelper::update( $r = SqlHelper::update(
$conn, $conn,
't_market_store', 't_market_store',
@ -1221,14 +1322,16 @@ class MarketController extends BaseController {
return; return;
} }
} }
$this->_rspErr(1, 'order status error, order='.$orderId); $this->_rspErr(1, 'order status error, order=' . $orderId);
} }
public function eventCancelOrder() { public function eventCancelOrder()
{
$orderId = getReqVal('orderId', ''); $orderId = getReqVal('orderId', '');
$nftToken = getReqVal('nftToken', ''); $nftToken = getReqVal('nftToken', '');
$tokenId = getReqVal('tokenId', ''); $tokenId = getReqVal('tokenId', '');
error_log("eventCancelOrder:" . json_encode( error_log(
"eventCancelOrder:" . json_encode(
array( array(
'orderId' => $orderId, 'orderId' => $orderId,
'nftToken' => $nftToken, 'nftToken' => $nftToken,
@ -1243,10 +1346,10 @@ class MarketController extends BaseController {
// 1. check order status // 1. check order status
$chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId));
if (empty($chk)) { if (empty($chk)) {
$this->_rspErr(1, 'not found order, orderId='.$orderId); $this->_rspErr(1, 'not found order, orderId=' . $orderId);
return; return;
} }
if ($chk['status']== '0') { if ($chk['status'] == '0') {
$r = SqlHelper::update( $r = SqlHelper::update(
$conn, $conn,
't_market_store', 't_market_store',
@ -1262,16 +1365,18 @@ class MarketController extends BaseController {
return; return;
} }
} }
$this->_rspErr(1, 'order status error, order='.$orderId); $this->_rspErr(1, 'order status error, order=' . $orderId);
} }
public function eventPriceUpdateOrder() { public function eventPriceUpdateOrder()
{
$orderId = getReqVal('orderId', '');; $orderId = getReqVal('orderId', '');;
$nftToken = getReqVal('nftToken', ''); $nftToken = getReqVal('nftToken', '');
$tokenId = getReqVal('tokenId', ''); $tokenId = getReqVal('tokenId', '');
$priceOld = getReqVal('priceOld', ''); $priceOld = getReqVal('priceOld', '');
$price = getReqVal('price', ''); $price = getReqVal('price', '');
error_log("eventPriceUpdateOrder:" . json_encode( error_log(
"eventPriceUpdateOrder:" . json_encode(
array( array(
'orderId' => $orderId, 'orderId' => $orderId,
'nftToken' => $nftToken, 'nftToken' => $nftToken,
@ -1288,11 +1393,11 @@ class MarketController extends BaseController {
// 1. check order status // 1. check order status
$chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId));
if (empty($chk)) { if (empty($chk)) {
$this->_rspErr(1, 'not found order, orderId='.$orderId); $this->_rspErr(1, 'not found order, orderId=' . $orderId);
return; return;
} }
if ($chk['status']== '0') { if ($chk['status'] == '0') {
$r = SqlHelper::update( $r = SqlHelper::update(
$conn, $conn,
't_market_store', 't_market_store',
@ -1309,32 +1414,39 @@ class MarketController extends BaseController {
} }
} }
$this->_rspErr(1, 'price update failed, orderId='.$orderId); $this->_rspErr(1, 'price update failed, orderId=' . $orderId);
} }
private function getNftGameData($nftRowInfo) { private function getNftGameData($nftRowInfo)
{
$t = $nftRowInfo['token_type']; $t = $nftRowInfo['token_type'];
$token_id = $nftRowInfo['token_id']; $token_id = $nftRowInfo['token_id'];
switch($t) { switch ($t) {
case Nft::HERO_TYPE: { case Nft::HERO_TYPE: {
return $this->appendChipsInfo(Hero::toDtoInfo(Hero::findByTokenId2($token_id))); return $this->appendChipsInfo(Hero::toDtoInfo(Hero::findByTokenId2($token_id)));
} break; }
break;
case Nft::EQUIP_TYPE: { case Nft::EQUIP_TYPE: {
return $this->appendChipsInfo(Gun::toDtoInfo(Gun::findByTokenId2($token_id))); return $this->appendChipsInfo(Gun::toDtoInfo(Gun::findByTokenId2($token_id)));
} break; }
break;
case Nft::CHIP_TYPE: { case Nft::CHIP_TYPE: {
return Chip::toDto(Chip::getChipByTokenId($token_id)); return Chip::toDto(Chip::getChipByTokenId($token_id));
} break; }
break;
case Nft::FRAGMENT_TYPE: { case Nft::FRAGMENT_TYPE: {
return Fragment::ToDto($nftRowInfo); return Fragment::ToDto($nftRowInfo);
} break; }
break;
default: { default: {
} break; }
break;
} }
return array('unknown' => 'unknown game data type, cannot find data'); return array('unknown' => 'unknown game data type, cannot find data');
} }
private function appendChipsInfo($detail) { private function appendChipsInfo($detail)
{
$detail['chips_info'] = array(); $detail['chips_info'] = array();
if (!empty($detail['chip_ids'])) { if (!empty($detail['chip_ids'])) {
$chips = explode('|', $detail['chip_ids']); $chips = explode('|', $detail['chip_ids']);
@ -1349,11 +1461,12 @@ class MarketController extends BaseController {
return $detail; return $detail;
} }
private function attach_market_selling(&$row) { private function attach_market_selling(&$row)
{
$conn = myself()->_getMarketMysql(''); $conn = myself()->_getMarketMysql('');
$rows = $conn->execQuery( $rows = $conn->execQuery(
'SELECT * FROM t_market_store '. 'SELECT * FROM t_market_store ' .
'WHERE token_id=:token_id AND owner_address=:owner_address AND status=:status', 'WHERE token_id=:token_id AND owner_address=:owner_address AND status=:status',
array( array(
':token_id' => $row['token_id'], ':token_id' => $row['token_id'],
@ -1380,7 +1493,7 @@ class MarketController extends BaseController {
$conn = myself()->_getMarketMysql(''); $conn = myself()->_getMarketMysql('');
$rows = $conn->execQuery( $rows = $conn->execQuery(
'SELECT * FROM t_market_store '. 'SELECT * FROM t_market_store ' .
'WHERE owner_address=:account AND token_type=:token_type AND status=0 ', 'WHERE owner_address=:account AND token_type=:token_type AND status=0 ',
array( array(
':account' => $account, ':account' => $account,
@ -1390,4 +1503,92 @@ class MarketController extends BaseController {
return $rows; return $rows;
} }
private function decItems($address, $item_id, $amount)
{
return true;
}
private function getCostItem($address, $item_id)
{
$self = myself();
if (!$self) {
return null;
}
$userInfo = $this->getUserInfo($address, array('gold'));
$count = $this->getItemCount($item_id, $userInfo);
return array(
'item_id' => $item_id,
'item_amount' => $count
);
}
private function getItemCount($item_id, $userInfo)
{
switch ($item_id) {
case V_ITEM_GOLD: {
return $userInfo['gold'];
}
}
return "0";
}
private function getUserInfo($address, $fields)
{
$self = myself();
if (!$self) {
return null;
}
// $account_id = $this->getAccountId($address);
// if (!$account_id) {
// return null;
// }
$conn = $self->_getMysql($address);
$row = SqlHelper::selectOne(
$conn,
't_user',
$fields,
array(
'address' => $address
)
);
if (empty($row)) {
return null;
}
return $row;
}
private function getAccountId($address)
{
$self = myself();
if (!$self) {
return null;
}
$row = SqlHelper::selectOne(
$self->_getMysql($address),
't_user',
array('account_id'),
array(
'address' => $address
)
);
return $row['account_id'];
}
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);
}
} }

View File

@ -418,11 +418,14 @@ class ShopController extends BaseAuthedController
$count = $this->countTodayRefreshTimes($address); $count = $this->countTodayRefreshTimes($address);
$costs = mt\Parameter::getByName('daily_selection_refresh_cost'); $costs = mt\Parameter::getByName('daily_selection_refresh_cost');
$arrCosts = explode('|', $costs['param_value']); $arrCosts = explode('|', $costs['param_value']);
$cost = $count < count($arrCosts) ? $arrCosts[$count] : null;
$max_count = count($arrCosts);
$cost = $count < $max_count ? $arrCosts[$count] : -1;
$this->_rspData( $this->_rspData(
array( array(
'idx' => $selection['idx'], 'idx' => $selection['idx'],
'refresh_info' => "{$count}/{$max_count}",
'cost' => $cost, 'cost' => $cost,
'goods_list' => $goodsList, 'goods_list' => $goodsList,
) )