This commit is contained in:
songliang 2023-07-03 15:22:35 +08:00
parent 8aef9f16c0
commit c4353583e5
2 changed files with 12 additions and 9 deletions

View File

@ -181,12 +181,11 @@ class ShopController extends BaseAuthedController
$conn = myself()->_getMysql(''); $conn = myself()->_getMysql('');
$address = myself()->_getAddress(); $address = myself()->_getAddress();
if (!$address) {
$this->_rspErr(1, 'address is empty');
if (empty($address)) {
$address = myself()->_getAccountId();
} }
$chk = SqlHelper::insert( $chk = SqlHelper::insert(
$conn, $conn,
't_shop_buy_order', 't_shop_buy_order',
@ -819,10 +818,10 @@ class ShopController extends BaseAuthedController
public function getChestItems() public function getChestItems()
{ {
$address = $this->_getAddress(); $address = $this->_getAddress();
// if (!$address) { if (!$address) {
// $this->_rspErr(2, 'address is invalid'); $this->_rspErr(2, 'address is invalid');
// return; return;
// } }
$id = getReqVal('id', 0); $id = getReqVal('id', 0);
$goods = mt\ShopGoods::get($id); $goods = mt\ShopGoods::get($id);

View File

@ -132,11 +132,15 @@ class BuyShopGoodsCbService
$itemService = new ShopAddItemService(); $itemService = new ShopAddItemService();
$item_id = $goods['goods_id']; $item_id = $goods['goods_id'];
$goods_num = $goods['goods_num']; $goods_num = $goods['goods_num'];
$id = $goods['id']; $id = $goods['id'];
error_log(json_encode($goods)); error_log(json_encode($goods));
error_log('_addGoods ' . $address . ' item_id ' . $item_id . ' goods_num ' . $goods_num . ' id ' . $id); error_log('_addGoods ' . $address . ' item_id ' . $item_id . ' goods_num ' . $goods_num . ' id ' . $id);
$itemService->addItem($address, $item_id, $goods_num); $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){ private function getAccountId($address){