Merge branch 'star' of git.kingsome.cn:server/game2006api into star
This commit is contained in:
commit
a91c844117
@ -403,6 +403,27 @@ class Market(object):
|
||||
_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',
|
||||
'desc': '购买NFT',
|
||||
|
@ -187,7 +187,8 @@ class Shop(object):
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['idx', 0, '每日精选的索引'],
|
||||
['cost', 0, '每日精选的当前刷新价格'],
|
||||
['refresh_info', '', '每日精选的刷新信息(格式:刷新次数/可刷新总数)'],
|
||||
['cost', 0, '每日精选的当前刷新价格,-1表示不可刷新'],
|
||||
['!goods_list', [_common.DailySelectionGoods()], '每日精选列表'],
|
||||
]
|
||||
},
|
||||
|
@ -86,6 +86,9 @@ class BaseAuthedController extends BaseController {
|
||||
}
|
||||
$r = $this->_getRedis($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)) {
|
||||
$this->updateSession(myself()->_getAccountId(),
|
||||
myself()->_getSessionId());
|
||||
@ -96,6 +99,7 @@ class BaseAuthedController extends BaseController {
|
||||
phpcommon\sendError(1001, 'session expiration');
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
$this->_userLvRestriction();
|
||||
}
|
||||
|
@ -35,7 +35,8 @@ use services\MarketService;
|
||||
use services\LuckyBoxService;
|
||||
use services\ActivateNftService;
|
||||
|
||||
class MarketController extends BaseController {
|
||||
class MarketController extends BaseController
|
||||
{
|
||||
|
||||
public function getPreSaleInfo()
|
||||
{
|
||||
@ -79,8 +80,10 @@ class MarketController extends BaseController {
|
||||
$saleBox = $this->fillPresaleBox($currBatchMeta, $meta);
|
||||
if ($saleBox) {
|
||||
++$pageInfo['total'];
|
||||
if ($pageInfo['total'] > $startPos &&
|
||||
count($rows) < $pageInfo['per_page']) {
|
||||
if (
|
||||
$pageInfo['total'] > $startPos &&
|
||||
count($rows) < $pageInfo['per_page']
|
||||
) {
|
||||
array_push($rows, $saleBox);
|
||||
}
|
||||
}
|
||||
@ -119,7 +122,8 @@ class MarketController extends BaseController {
|
||||
$paymentTokenAddress,
|
||||
$price,
|
||||
$nonce,
|
||||
$signature);
|
||||
$signature
|
||||
);
|
||||
|
||||
$batchIdx = 0;
|
||||
$idx = 0;
|
||||
@ -129,12 +133,14 @@ class MarketController extends BaseController {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($type) ||
|
||||
if (
|
||||
empty($type) ||
|
||||
empty($buyerAddress) ||
|
||||
empty($price) ||
|
||||
empty($paymentTokenAddress) ||
|
||||
empty($signature) ||
|
||||
empty($nonce)) {
|
||||
empty($nonce)
|
||||
) {
|
||||
myself()->_rspErr(2, 'parameter error');
|
||||
return;
|
||||
}
|
||||
@ -192,15 +198,19 @@ class MarketController extends BaseController {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MarketService::isTestMode() &&
|
||||
BoxOrder::isBuyed($buyerAddress, $currBatchMeta['id'])) {
|
||||
if (
|
||||
!MarketService::isTestMode() &&
|
||||
BoxOrder::isBuyed($buyerAddress, $currBatchMeta['id'])
|
||||
) {
|
||||
myself()->_rspErr(1, 'account can only choose 1 hero to purchase');
|
||||
return;
|
||||
}
|
||||
$orderId = BuyRecord::genOrderId($gameId,
|
||||
$orderId = BuyRecord::genOrderId(
|
||||
$gameId,
|
||||
$funcId,
|
||||
myself()->_getNowTime(),
|
||||
$buyerAddress);
|
||||
$buyerAddress
|
||||
);
|
||||
|
||||
$fieldsKv = array(
|
||||
'game_id' => $gameId,
|
||||
@ -397,17 +407,18 @@ class MarketController extends BaseController {
|
||||
if (!$currencyMeta) {
|
||||
return null;
|
||||
}
|
||||
$boxId = phpcommon\genBoxId($batchMeta['id'],
|
||||
$boxId = phpcommon\genBoxId(
|
||||
$batchMeta['id'],
|
||||
$goodsMeta['id'],
|
||||
$goodsMeta['item_id']);
|
||||
$goodsMeta['item_id']
|
||||
);
|
||||
|
||||
$itemMeta = mt\Item::get($goodsMeta['item_id']);
|
||||
$originalPrice = $goodsMeta['price'] * pow(10, MarketService::CURRENCY_DECIMALS);
|
||||
$discountPrice = $goodsMeta['discount'] * 100 > 0 ?
|
||||
$originalPrice * $goodsMeta['discount'] : $originalPrice;
|
||||
$name = '';
|
||||
$job = 0;
|
||||
{
|
||||
$job = 0; {
|
||||
$heroMeta = mt\Hero::get($goodsMeta['item_id']);
|
||||
if ($heroMeta) {
|
||||
$name = emptyReplace($heroMeta['name'], 'Hill');
|
||||
@ -429,7 +440,8 @@ class MarketController extends BaseController {
|
||||
'decimals' => MarketService::CURRENCY_DECIMALS,
|
||||
'contract_address' => $currencyMeta['address'],
|
||||
)
|
||||
));
|
||||
)
|
||||
);
|
||||
return $saleBox;
|
||||
}
|
||||
|
||||
@ -570,6 +582,40 @@ class MarketController extends BaseController {
|
||||
};
|
||||
$nfts = array();
|
||||
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: {
|
||||
$rows = Nft::getNftListByType($account, $type);
|
||||
$rows = array_merge($rows, $this->listMySelledNfts($account, $type));
|
||||
@ -682,7 +728,6 @@ class MarketController extends BaseController {
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
|
||||
}
|
||||
}
|
||||
return $nfts;
|
||||
@ -833,11 +878,14 @@ class MarketController extends BaseController {
|
||||
if (!$nftDb) {
|
||||
$nftDb = Nft::findNftByOwner('0xfc628dd79137395f3c9744e33b1c5de554d94882', $row['token_id']);
|
||||
if (!$nftDb) {
|
||||
if ($row['item_id']) {
|
||||
} else {
|
||||
myself()->_rspErr(1, 'nft not exists');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$nft = Nft::toDto($nftDb);
|
||||
$row['info'] = $nft;
|
||||
$row['detail'] = $this->getNftGameData($nftDb);
|
||||
@ -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', ''));
|
||||
$item_id = getReqVal('item_id', '');
|
||||
$token = getReqVal('token', '');
|
||||
|
||||
$nft_token = getReqVal('nft_token', '');
|
||||
$item_id = getReqVal('item_id', '');
|
||||
|
||||
$s_price = getReqVal('s_price', '');
|
||||
$amount = getReqVal('amount', 1);
|
||||
|
||||
$payment_token_address = getReqVal('payment_token_address', '');
|
||||
$nonce = getReqVal('nonce', '');
|
||||
$signature = getReqVal('signature', '');
|
||||
$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);
|
||||
$nftDetail = Nft::toDto($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(
|
||||
$conn,
|
||||
't_market_store',
|
||||
array(
|
||||
'token_id' => $nft_token,
|
||||
'token_type' => $nftDetail['type'],
|
||||
'owner' => $account,
|
||||
'price' => $s_price,
|
||||
'item_id' => $item_id,
|
||||
'owner_address' => $account,
|
||||
'token_type' => 0,
|
||||
'amount' => $amount,
|
||||
'payment_token_address' => $payment_token_address,
|
||||
'status' => 0,
|
||||
'create_time' => time(),
|
||||
'update_time' => time(),
|
||||
'createtime' => $self->_getNowTime(),
|
||||
'modifytime' => $self->_getNowTime(),
|
||||
's_price' => $s_price,
|
||||
'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) {
|
||||
myself()->_rspErr(1, 'insert error');
|
||||
return;
|
||||
}
|
||||
$this->_rspData(array(
|
||||
'nft' => $nftDetail,
|
||||
'detail' => $detail,
|
||||
));
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function sellMyNft() {
|
||||
private function sellMyNft()
|
||||
{
|
||||
|
||||
$account = strtolower(getReqVal('account', ''));
|
||||
$token = getReqVal('token', '');
|
||||
@ -954,7 +1048,7 @@ class MarketController extends BaseController {
|
||||
$signature = getReqVal('signature', '');
|
||||
$net_id = getReqVal('net_id', '');
|
||||
|
||||
$conn = myself()->_getMysql('');
|
||||
$conn = myself()->_getMarketMysql('');
|
||||
|
||||
$nftDb = Nft::findNftByOwner($account, $nft_token);
|
||||
$nftDetail = Nft::toDto($nftDb);
|
||||
@ -985,7 +1079,8 @@ class MarketController extends BaseController {
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function buyNft() {
|
||||
public function buyNft()
|
||||
{
|
||||
$account = strtolower(getReqVal('account', ''));
|
||||
$token = getReqVal('token', '');
|
||||
$nft_token = getReqVal('nft_token', '');
|
||||
@ -1000,7 +1095,8 @@ class MarketController extends BaseController {
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function getSupportedCurrencyTypes() {
|
||||
public function getSupportedCurrencyTypes()
|
||||
{
|
||||
$types = array();
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
array_push($types, array(
|
||||
@ -1018,19 +1114,19 @@ class MarketController extends BaseController {
|
||||
));
|
||||
}
|
||||
|
||||
public function getTransactionRecord() {
|
||||
public function getTransactionRecord()
|
||||
{
|
||||
$account = strtolower(getReqVal('account', ''));
|
||||
$type = getReqVal('type', 0);
|
||||
$start = getReqVal('start', 0);
|
||||
$page_size = getReqVal('page_size', 10);
|
||||
|
||||
$conn = myself()->_getMysql('');
|
||||
$conn = myself()->_getMarketMysql('');
|
||||
|
||||
$type_filter_fn = function ($f) {
|
||||
if ($f == 0) {
|
||||
return '';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return 'AND type=' . $f;
|
||||
}
|
||||
};
|
||||
@ -1073,8 +1169,9 @@ class MarketController extends BaseController {
|
||||
));
|
||||
}
|
||||
|
||||
private function addTransactionRecord($record) {
|
||||
$conn = myself()->_getMysql('');
|
||||
private function addTransactionRecord($record)
|
||||
{
|
||||
$conn = myself()->_getMarketMysql('');
|
||||
|
||||
$r = SqlHelper::insert(
|
||||
$conn,
|
||||
@ -1086,7 +1183,8 @@ class MarketController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
public function eventSellOrder() {
|
||||
public function eventSellOrder()
|
||||
{
|
||||
$tokenId = getReqVal('tokenId', '');
|
||||
$owner = strtolower(getReqVal('owner', ''));
|
||||
$nftToken = getReqVal('nftToken', '');
|
||||
@ -1095,7 +1193,8 @@ class MarketController extends BaseController {
|
||||
$currency = getReqVal('currency', '');
|
||||
$price = getReqVal('price', '');
|
||||
|
||||
error_log("eventSellOrder:" . json_encode(
|
||||
error_log(
|
||||
"eventSellOrder:" . json_encode(
|
||||
array(
|
||||
'tokenId' => $tokenId,
|
||||
'owner' => $owner,
|
||||
@ -1159,7 +1258,8 @@ class MarketController extends BaseController {
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function eventBuyOrder() {
|
||||
public function eventBuyOrder()
|
||||
{
|
||||
$tokenId = getReqVal('tokenId', '');
|
||||
$orderId = getReqVal('orderId', '');
|
||||
$nftToken = getReqVal('nftToken', '');
|
||||
@ -1169,7 +1269,8 @@ class MarketController extends BaseController {
|
||||
$erc20 = getReqVal('erc20', '');
|
||||
$price = getReqVal('price', '');
|
||||
|
||||
error_log("eventBuyOrder:" . json_encode(
|
||||
error_log(
|
||||
"eventBuyOrder:" . json_encode(
|
||||
array(
|
||||
'tokenId' => $tokenId,
|
||||
'orderId' => $orderId,
|
||||
@ -1224,11 +1325,13 @@ class MarketController extends BaseController {
|
||||
$this->_rspErr(1, 'order status error, order=' . $orderId);
|
||||
}
|
||||
|
||||
public function eventCancelOrder() {
|
||||
public function eventCancelOrder()
|
||||
{
|
||||
$orderId = getReqVal('orderId', '');
|
||||
$nftToken = getReqVal('nftToken', '');
|
||||
$tokenId = getReqVal('tokenId', '');
|
||||
error_log("eventCancelOrder:" . json_encode(
|
||||
error_log(
|
||||
"eventCancelOrder:" . json_encode(
|
||||
array(
|
||||
'orderId' => $orderId,
|
||||
'nftToken' => $nftToken,
|
||||
@ -1265,13 +1368,15 @@ class MarketController extends BaseController {
|
||||
$this->_rspErr(1, 'order status error, order=' . $orderId);
|
||||
}
|
||||
|
||||
public function eventPriceUpdateOrder() {
|
||||
public function eventPriceUpdateOrder()
|
||||
{
|
||||
$orderId = getReqVal('orderId', '');;
|
||||
$nftToken = getReqVal('nftToken', '');
|
||||
$tokenId = getReqVal('tokenId', '');
|
||||
$priceOld = getReqVal('priceOld', '');
|
||||
$price = getReqVal('price', '');
|
||||
error_log("eventPriceUpdateOrder:" . json_encode(
|
||||
error_log(
|
||||
"eventPriceUpdateOrder:" . json_encode(
|
||||
array(
|
||||
'orderId' => $orderId,
|
||||
'nftToken' => $nftToken,
|
||||
@ -1312,29 +1417,36 @@ class MarketController extends BaseController {
|
||||
$this->_rspErr(1, 'price update failed, orderId=' . $orderId);
|
||||
}
|
||||
|
||||
private function getNftGameData($nftRowInfo) {
|
||||
private function getNftGameData($nftRowInfo)
|
||||
{
|
||||
$t = $nftRowInfo['token_type'];
|
||||
$token_id = $nftRowInfo['token_id'];
|
||||
switch ($t) {
|
||||
case Nft::HERO_TYPE: {
|
||||
return $this->appendChipsInfo(Hero::toDtoInfo(Hero::findByTokenId2($token_id)));
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case Nft::EQUIP_TYPE: {
|
||||
return $this->appendChipsInfo(Gun::toDtoInfo(Gun::findByTokenId2($token_id)));
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case Nft::CHIP_TYPE: {
|
||||
return Chip::toDto(Chip::getChipByTokenId($token_id));
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case Nft::FRAGMENT_TYPE: {
|
||||
return Fragment::ToDto($nftRowInfo);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return array('unknown' => 'unknown game data type, cannot find data');
|
||||
}
|
||||
|
||||
private function appendChipsInfo($detail) {
|
||||
private function appendChipsInfo($detail)
|
||||
{
|
||||
$detail['chips_info'] = array();
|
||||
if (!empty($detail['chip_ids'])) {
|
||||
$chips = explode('|', $detail['chip_ids']);
|
||||
@ -1349,7 +1461,8 @@ class MarketController extends BaseController {
|
||||
return $detail;
|
||||
}
|
||||
|
||||
private function attach_market_selling(&$row) {
|
||||
private function attach_market_selling(&$row)
|
||||
{
|
||||
$conn = myself()->_getMarketMysql('');
|
||||
|
||||
$rows = $conn->execQuery(
|
||||
@ -1390,4 +1503,92 @@ class MarketController extends BaseController {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -418,11 +418,14 @@ class ShopController extends BaseAuthedController
|
||||
$count = $this->countTodayRefreshTimes($address);
|
||||
$costs = mt\Parameter::getByName('daily_selection_refresh_cost');
|
||||
$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(
|
||||
array(
|
||||
'idx' => $selection['idx'],
|
||||
'refresh_info' => "{$count}/{$max_count}",
|
||||
'cost' => $cost,
|
||||
'goods_list' => $goodsList,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user