...
This commit is contained in:
parent
1384cf4f8f
commit
26f578d366
@ -513,11 +513,6 @@ class MarketController extends BaseAuthedController
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$payment_token_address = getReqVal('payment_token_address', '');
|
|
||||||
$nonce = getReqVal('nonce', '');
|
|
||||||
$signature = getReqVal('signature', '');
|
|
||||||
$net_id = getReqVal('net_id', '');
|
|
||||||
|
|
||||||
$conn = myself()->_getSelfMysql();
|
$conn = myself()->_getSelfMysql();
|
||||||
|
|
||||||
$nftDb = null;
|
$nftDb = null;
|
||||||
@ -530,34 +525,23 @@ class MarketController extends BaseAuthedController
|
|||||||
$c_type = null;
|
$c_type = null;
|
||||||
$c_id = null;
|
$c_id = null;
|
||||||
|
|
||||||
if ($nft_token) {
|
// 检查是否有足够的物品
|
||||||
$nftDb = Nft::findNftByOwner($account, $nft_token);
|
$costItems = $this->makeCostItems($item_id, $amount);
|
||||||
$nftDetail = Nft::toDto($nftDb);
|
$lackItem = null;
|
||||||
$detail = $this->getNftGameData($nftDb);
|
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
|
||||||
$c_name = $nftDetail['info']['name'];
|
$this->_rspErr(2, $this->_getLackItemErrMsg($lackItem));
|
||||||
$c_job = isset($nftDetail['info']['job']) ? $nftDetail['info']['job']
|
return;
|
||||||
: (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;
|
|
||||||
}
|
}
|
||||||
|
$this->_decItems($costItems);
|
||||||
|
|
||||||
|
$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,
|
||||||
@ -583,6 +567,17 @@ class MarketController extends BaseAuthedController
|
|||||||
$this->_rspOk();
|
$this->_rspOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function makeCostItems($item_id, $num)
|
||||||
|
{
|
||||||
|
$costItems = array(
|
||||||
|
array(
|
||||||
|
'item_id' => $item_id,
|
||||||
|
'item_num' => $num
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $costItems;
|
||||||
|
}
|
||||||
|
|
||||||
public function sellCancel()
|
public function sellCancel()
|
||||||
{
|
{
|
||||||
$account = strtolower(getReqVal('account', ''));
|
$account = strtolower(getReqVal('account', ''));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user