This commit is contained in:
songliang 2023-07-17 11:27:08 +08:00
parent 64ea33df3b
commit 04e450ce6c

View File

@ -228,6 +228,8 @@ class MarketController extends BaseAuthedController
public function listSellNfts()
{
$this->autoRestoreBuyingOrders();
$account = strtolower(getReqVal('account', ''));
$token = getReqVal('token', '');
$start = getReqVal('start', 0);
@ -756,7 +758,7 @@ class MarketController extends BaseAuthedController
$goods['amount']
);
if (!$this->markOrderBuyStatus($idx)) {
if (!$this->markOrderBuying($idx)) {
$this->_rspErr(1, 'buy failed, update order status failed, idx:' . $idx);
return;
}
@ -906,7 +908,7 @@ class MarketController extends BaseAuthedController
return $row;
}
private function markOrderBuyStatus($idx)
private function markOrderBuying($idx)
{
$r = SqlHelper::update(
myself()->_getSelfMysql(),
@ -925,4 +927,31 @@ class MarketController extends BaseAuthedController
return true;
}
private function autoRestoreBuyingOrders()
{
$conn = myself()->_getSelfMysql();
$rows = $conn->execQuery(
'SELECT * FROM t_market_store ' .
'WHERE status=3 AND buytime<:buytime',
array(
':buytime' => myself()->_getNowTime() - 3600 * 24 * 1,
)
);
foreach ($rows as $row) {
$r = SqlHelper::update(
myself()->_getSelfMysql(),
't_market_store',
array(
'idx' => $row['idx'],
),
array(
'status' => 0,
'buytime' => 0,
)
);
}
}
}