diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index fdcf813f..1c2f1727 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -181,12 +181,11 @@ class ShopController extends BaseAuthedController $conn = myself()->_getMysql(''); $address = myself()->_getAddress(); - - - if (empty($address)) { - $address = myself()->_getAccountId(); + if (!$address) { + $this->_rspErr(1, 'address is empty'); } + $chk = SqlHelper::insert( $conn, 't_shop_buy_order', @@ -819,10 +818,10 @@ class ShopController extends BaseAuthedController public function getChestItems() { $address = $this->_getAddress(); - // if (!$address) { - // $this->_rspErr(2, 'address is invalid'); - // return; - // } + if (!$address) { + $this->_rspErr(2, 'address is invalid'); + return; + } $id = getReqVal('id', 0); $goods = mt\ShopGoods::get($id); diff --git a/webapp/services/callback/BuyShopGoodsCbService.php b/webapp/services/callback/BuyShopGoodsCbService.php index 89a8dede..b42bb464 100644 --- a/webapp/services/callback/BuyShopGoodsCbService.php +++ b/webapp/services/callback/BuyShopGoodsCbService.php @@ -132,11 +132,15 @@ class BuyShopGoodsCbService $itemService = new ShopAddItemService(); $item_id = $goods['goods_id']; $goods_num = $goods['goods_num']; + $id = $goods['id']; + error_log(json_encode($goods)); error_log('_addGoods ' . $address . ' item_id ' . $item_id . ' goods_num ' . $goods_num . ' id ' . $id); $itemService->addItem($address, $item_id, $goods_num); - ShopBuyRecord::addWithAddress($address, $id, $goods_num); + if ($id) { + ShopBuyRecord::addWithAddress($address, $id, $goods_num); + } } private function getAccountId($address){