This commit is contained in:
aozhiwei 2023-08-05 17:10:15 +08:00
parent 7e1b580282
commit 3e6b1cfe93
3 changed files with 5 additions and 48 deletions

View File

@ -1414,7 +1414,6 @@ CREATE TABLE `t_market` (
`amount` varchar(255) NOT NULL DEFAULT '' COMMENT 'amount', `amount` varchar(255) NOT NULL DEFAULT '' COMMENT 'amount',
`currency` varchar(60) NOT NULL COMMENT 'currency', `currency` varchar(60) NOT NULL COMMENT 'currency',
`price` varchar(255) NOT NULL DEFAULT '' COMMENT 'price', `price` varchar(255) NOT NULL DEFAULT '' COMMENT 'price',
`update_currency` varchar(60) COMMENT 'update_currency',
`update_price` varchar(255) COMMENT 'update_price', `update_price` varchar(255) COMMENT 'update_price',
`update_time` int(11) COMMENT 'update_time', `update_time` int(11) COMMENT 'update_time',
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',

View File

@ -38,11 +38,10 @@ class Market extends BaseModel {
)); ));
} }
public static function updatePrice($orderId, $currency, $price) { public static function updatePrice($orderId, $price) {
self::internalUpdate( self::internalUpdate(
$orderId, $orderId,
array( array(
'update_currency' => $currency,
'update_price' => $price, 'update_price' => $price,
'update_time' => myself()->_getNowTime(), 'update_time' => myself()->_getNowTime(),
)); ));

View File

@ -1,67 +1,26 @@
<?php <?php
namespace services; namespace services;
require_once('MarketCallbackBase.php');
require_once ('services/callback/common/SignatureService.php'); require_once ('services/callback/common/SignatureService.php');
use services\MarketCallbackBase;
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
class MarketPriceUpdateOrderOk extends MarketCallbackBase { class MarketPriceUpdateOrderOk {
public function process() public function process()
{ {
SignatureService::web3ServiceCheck(); SignatureService::web3ServiceCheck();
error_log('MarketPriceUpdateOrderOk:' . json_encode($_REQUEST, JSON_PRETTY_PRINT)); error_log('MarketPriceUpdateOrderOk:' . json_encode($_REQUEST));
$orderId = getReqVal('orderId', '');; $orderId = getReqVal('orderId', '');;
$nftToken = getReqVal('nftToken', ''); $nftToken = getReqVal('nftToken', '');
$tokenId = getReqVal('tokenId', ''); $tokenId = getReqVal('tokenId', '');
$priceOld = getReqVal('priceOld', ''); $priceOld = getReqVal('priceOld', '');
$price = getReqVal('price', ''); $price = getReqVal('price', '');
error_log(
"eventPriceUpdateOrder:" . json_encode(
array(
'orderId' => $orderId,
'nftToken' => $nftToken,
'tokenId' => $tokenId,
'priceOld' => $priceOld,
'price' => $price,
),
JSON_PRETTY_PRINT
)
);
$o_link = $orderId; Market::updatePrice($orderId, $price);
$conn = myself()->_getMysql(''); myself()->_rspOk();
// 订单没找到
$chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $o_link, 'status' => 0, 's_price' => $priceOld));
if (empty($chk)) {
$this->_rspErr(2, 'not found order, o_link=' . $o_link);
return;
}
if ($chk['status'] == '0') {
$r = SqlHelper::update(
$conn,
't_market_store',
array(
'o_link' => $o_link,
),
array(
's_price' => $price,
)
);
if ($r) {
$this->_rspOk();
return;
} else {
$this->_rspErr(2, 'not found order, o_link=' . $o_link);
return;
}
}
} }
} }