Merge branch 'star' of git.kingsome.cn:server/game2006api into star

This commit is contained in:
hujiabin 2023-07-03 14:54:52 +08:00
commit 1a615a971d
2 changed files with 45 additions and 2 deletions

View File

@ -900,6 +900,48 @@ class MarketController extends BaseController {
));
}
public function sell() {
$account = strtolower(getReqVal('account', ''));
$item_id = getReqVal('item_id', '');
$token = getReqVal('token', '');
$nft_token = getReqVal('nft_token', '');
$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('');
$nftDb = Nft::findNftByOwner($account, $nft_token);
$nftDetail = Nft::toDto($nftDb);
$detail = $this->getNftGameData($nftDb);
$r = SqlHelper::insert(
$conn,
't_market_store',
array(
'token_id' => $nft_token,
'token_type' => $nftDetail['type'],
'owner' => $account,
'price' => $s_price,
'amount' => $amount,
'payment_token_address' => $payment_token_address,
'status' => 0,
'create_time' => time(),
'update_time' => time(),
)
);
if (!$r) {
myself()->_rspErr(1, 'insert error');
return;
}
$this->_rspData(array(
'nft' => $nftDetail,
'detail' => $detail,
));
}
public function sellMyNft() {
$account = strtolower(getReqVal('account', ''));
@ -1334,7 +1376,7 @@ class MarketController extends BaseController {
private function listMySelledNfts($account, $type)
{
error_log('listMySelledNfts ' . $account . ' ' . $type);
$conn = myself()->_getMarketMysql('');
$rows = $conn->execQuery(

View File

@ -1377,7 +1377,8 @@ class ShopController extends BaseAuthedController
if (!empty($goods['free_type'])) {
$count = $this->countFreeBuyTimes($goods['free_type'], $goods['id'], $goods['goods_id']);
$goods['free_num'] = $goods['free_num'] - $count;
error_log('free_num:' . $goods['free_num']);
} else {
$goods['free_num'] = 0;
}
$free_num = $goods['free_num'];