$tokenId, 'owner' => $owner, 'nftToken' => $nftToken, 'amount' => $amount, 'orderId' => $orderId, 'currency' => $currency, 'price' => $price, ), JSON_PRETTY_PRINT ) ); $conn = myself()->_getSelfMysql(); // 1. check order status $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); if (!empty($chk)) { $this->_rspErr(1, 'repeat sell order, orderId=' . $orderId); return; } // 2. insert sell order to t_market_store $nftDb = Nft::findNftByOwner($owner, $tokenId); if (empty($nftDb)) { $nftDb = Nft::getNft($tokenId); } $nftDetail = Nft::toDto($nftDb); $detail = $this->getNftGameData($nftDb); $r = SqlHelper::insert( $conn, 't_market_store', array( 'token_id' => $tokenId, 'o_link' => $orderId, 'nft_token' => $nftToken, 'status' => 0, 'owner_address' => $owner, 'token_type' => $nftDetail['type'], 'amount' => $amount, 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(), 's_currency' => $currency, 's_price' => $price, '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'], ) ); if (!$r) { $this->_rspErr(2, 'unknown error, orderId=' . $orderId); } $this->_rspOk(); } }