获取活动中的商品
This commit is contained in:
parent
b66ed3c583
commit
5e4d66e5d4
@ -1134,13 +1134,9 @@ class GoodsLogic extends Logic
|
|||||||
$GroupbuyGoods_info = GroupbuyGoods::where([
|
$GroupbuyGoods_info = GroupbuyGoods::where([
|
||||||
'goods_id' => $goods['id'],
|
'goods_id' => $goods['id'],
|
||||||
])->column('goods_id,item_id,activity_price,stock,limited_num', 'item_id');
|
])->column('goods_id,item_id,activity_price,stock,limited_num', 'item_id');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确定是抢购商品 先将商品市场价换成原SKU最小价
|
||||||
|
|
||||||
// 确定是抢购商品
|
|
||||||
// 先将商品市场价换成原SKU最小价
|
|
||||||
$goods['market_price'] = $goods['min_price'];
|
$goods['market_price'] = $goods['min_price'];
|
||||||
// 替换活动价
|
// 替换活动价
|
||||||
foreach($goods['goods_item'] as &$item) {
|
foreach($goods['goods_item'] as &$item) {
|
||||||
@ -1159,14 +1155,22 @@ class GoodsLogic extends Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 如果当前用户参与了抢购的活动(则不允许再次抢购)
|
// 如果当前用户参与了抢购的活动(则不允许再次抢购)
|
||||||
$in_activity = Order::where(['user_id' => $userId, 'order_type' => 4])->where('order_status', '<', 4)->find();
|
// $in_activity = Order::where(['user_id' => $userId, 'order_type' => 4])->where('order_status', '<', 4)->find();
|
||||||
|
//
|
||||||
|
// $goods['activity'] = [
|
||||||
|
// 'type' => 4,
|
||||||
|
// 'type_desc' => '抢购商品',
|
||||||
|
// 'in_groupbuy_activity' => (bool)$in_activity,
|
||||||
|
// 'msg' => '您已参与过本次活动,无法再次参与!'
|
||||||
|
// ];
|
||||||
|
|
||||||
$goods['activity'] = [
|
// 2024-11-29 更改规则:活动中的每件商品用户都能购买,但是只能买一件
|
||||||
'type' => 4,
|
$goods = Order::alias('a')
|
||||||
'type_desc' => '抢购商品',
|
->join('order_goods og', 'a.id = order_goods.order_id')
|
||||||
'in_groupbuy_activity' => (bool)$in_activity,
|
->where(['a.user_id' => $userId, 'a.order_type' => 4, 'og.goods_id' => $goods['id']])
|
||||||
'msg' => '您已参与过本次活动,无法再次参与!'
|
->where('a.order_status', '<', 4)
|
||||||
];
|
->find();
|
||||||
|
dump($goods);die;
|
||||||
return $goods;
|
return $goods;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user