This commit is contained in:
aozhiwei 2023-07-31 11:36:50 +08:00
parent 24d154faff
commit bfc870c3ba
2 changed files with 14 additions and 10 deletions

View File

@ -62,7 +62,7 @@ class ShopController extends BaseAuthedController {
public function buyGoods()
{
$goodsUuid = getReqVal('goods_uuid', 0);
$goodsUuid = getReqVal('goods_id', 0);
$tokenType = getReqVal('token_type', '');
$goodsNum = getReqVal('goods_num', 0);
@ -246,7 +246,7 @@ class ShopController extends BaseAuthedController {
public function inappPurchase()
{
$goodsUuid = getReqVal('goods_uuid', 0);
$goodsUuid = getReqVal('goods_id', 0);
$goodsNum = getReqVal('goods_num', 0);
$goods = mt\ShopGoods::getByGoodsUuid($goodsUuid);
if (!$goods) {
@ -310,17 +310,20 @@ class ShopController extends BaseAuthedController {
public function boxPreview()
{
$id = getReqVal('id', 0);
$goods = mt\ShopGoods::get($id);
$goodsId = $goods['goods_id'];
$shopId = $goods['shop_id'];
$meta = mt\Item::get($goodsId);
if ($meta['type'] != mt\Item::CHEST_BOX_TYPE) {
$goodsMeta = mt\ShopGoods::get($goodsId);
if (!$goodsMeta) {
myself()->_rspErr(1, 'goods not found');
return;
}
$itemMeta = mt\Item::get($goodsMeta['item_id']);
if ($itemMeta['type'] != mt\Item::CHEST_BOX_TYPE) {
$this->_rspErr(2, 'goods_id is invalid');
return;
}
$chestType = $meta['sub_type'];
$chestType = $itemMeta['sub_type'];
$itemStore = mt\ShopChest::getRandomItemListByChestType($chestType);
if (!$itemStore) {
$this->_rspErr(2, 'goods_id is invalid');
@ -343,11 +346,11 @@ class ShopController extends BaseAuthedController {
$goods['free_num'] = 0;
}
$free_num = $goods['free_num'];
$freeNum = $goods['free_num'];
$this->_rspData(
array(
'items' => array_keys($record),
'free_num' => $free_num,
'free_num' => $freeNum,
)
);
}

View File

@ -33,6 +33,7 @@ class ShopService {
$goodsList = array();
foreach ($goodsMetaList as $goodsMeta) {
$goodsDto = array(
'goods_id' => $goodsMeta['goods_id'],
'goods_meta' => self::goodsMetaToInfo($goodsMeta),
'bought_times' => 0,
'free_num' => 0,