This commit is contained in:
aozhiwei 2022-01-17 16:19:39 +08:00
parent 419e87b78d
commit 875b673371

View File

@ -37,6 +37,19 @@ class MarketController extends BaseController {
public function prebuy()
{
$account = getReqVal('account', '');
$goodsId = getReqVal('goods_id', '');
$goodsMeta = mt\Market::get($goodsId);
if (!$goodsMeta) {
$this->_rspErr(1, 'config error');
return;
}
$inventory = Goods::getRemainBuyableNum($meta);
if ($inventory < 0) {
$this->_rspErr(2, 'insufficient inventory');
return;
}
}
public function sell()
@ -88,7 +101,7 @@ class MarketController extends BaseController {
$nft['type'] = 0;
$nft['token_id'] = '';
$nft['status'] = 0;
$nft['inventory'] = 0;
$nft['inventory'] = $inventory;
$nft['owner_address'] = '';
$nft['owner_id'] = '';
$nft['image_avatar'] = '';