From baf44c039155963f74a628e917455d77820acead Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 7 Aug 2023 14:39:24 +0800 Subject: [PATCH] 1 --- .../controller/BlockChainController.class.php | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index bb3ddad5..659d9692 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -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; }