This commit is contained in:
aozhiwei 2023-08-07 14:39:24 +08:00
parent e2478b0757
commit baf44c0391

View File

@ -15,6 +15,7 @@ require_once('models/BuyRecord.php');
require_once('models/Chip.php');
require_once('models/TransactionPrefee.php');
require_once('models/BcOrder.php');
require_once('models/Mall.php');
require_once('services/AwardService.php');
require_once('services/PropertyChgService.php');
@ -30,6 +31,7 @@ use models\Transaction;
use models\BuyRecord;
use models\Chip;
use models\BcOrder;
use models\Mall;
use models\TransactionPrefee;
use services\BlockChainService;
@ -367,31 +369,31 @@ class BlockChainController extends BaseAuthedController {
public function buyMallProduct()
{
$address = $this->_getAddress();
$address = myself()-_getAddress();
if (!$address) {
$this->_rspErr(1, 'address not found');
myself()-_rspErr(1, 'address not found');
return;
}
$goodsUuid = getReqVal('goods_uuid', '');
$price = getReqVal('price', '');
if (empty($s_price)) {
$this->_rspErr(1, 's_price not found');
myself()-_rspErr(1, 's_price not found');
return;
}
if (!is_numeric($s_price)) {
$this->_rspErr(1, 's_price not number');
myself()-_rspErr(1, 's_price not number');
return;
}
$goods = $this->getGoodsByIdx($idx);
if (!$goods) {
$this->_rspErr(1, 'goods not found, idx:' . $idx);
$goodsDb = Mall::findByGoodsUuid($goodsUuid);
if (!$goodsDb) {
myself()-_rspErr(1, 'goods not found, idx:');
return;
}
if ($s_price != $goods['s_price']) {
$this->_rspErr(1, 'price not match, idx:' . $idx);
if ($price != $goodsDb['price']) {
myself()-_rspErr(1, 'price not match, idx:' . $idx);
return;
}
@ -404,7 +406,7 @@ class BlockChainController extends BaseAuthedController {
);
if (!$this->markOrderBuyStatus($idx)) {
$this->_rspErr(1, 'buy failed, update order status failed, idx:' . $idx);
myself()-_rspErr(1, 'buy failed, update order status failed, idx:' . $idx);
return;
}