This commit is contained in:
aozhiwei 2022-02-11 17:30:49 +08:00
parent e782350d25
commit 1dd24ec83f
2 changed files with 6 additions and 3 deletions

View File

@ -20,6 +20,7 @@ use models\Nft;
use models\BuyRecord;
const CURRENCY_DECIMALS = 8;
const PRICE_PAD = '0000000000';
const PRESALE_NOT_STARTED = 0;
const PRESALE_PREPARE = 1;
@ -238,6 +239,9 @@ class MarketController extends BaseController {
$originalPrice = $goodsMeta['price'] * pow(10, CURRENCY_DECIMALS);
$discountPrice = $goodsMeta['discount'] * 100 > 0 ?
$originalPrice * $goodsMeta['discount'] : $originalPrice;
$discountPrice .= PRICE_PAD;
error_log('discountPrice:' . $discountPrice . ' price:' . $price . ' originPrice:' . $originalPrice);
if (!$discountPrice || $price != $discountPrice) {
myself()->_rspErr(500, 'price error');
return;

View File

@ -50,15 +50,14 @@ class RestApiController extends BaseController {
return;
}
$heroMeta = mt\Hero::get($nftDb['item_id']);
$itemMeta = mt\Item::get($nftDb['item_id']) ;
if (!$heroMeta || !$itemMeta) {
if (!$heroMeta) {
myself()->_rspErr(2, 'server internal error');
return;
}
$nftDto = array();
$nftDto['name'] = $heroMeta['name'];
$nftDto['description'] = '';
$nftDto['image'] = 'https://www.cebg.games/res/avatars/' . $itemMeta['nft_image_id'] . '.png';
$nftDto['image'] = 'https://www.cebg.games/res/nft/' . $nftDb['item_id'] . '.png';
$nftDto['job'] = $heroMeta['herotype'];
$nftDto['level'] = 1;