获取活动中的商品
This commit is contained in:
parent
1df6789afc
commit
58f804a379
@ -1154,31 +1154,29 @@ 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' => '您已参与过本次活动,无法再次参与!'
|
||||
// ];
|
||||
|
||||
// 2024-11-29 更改规则:活动中的每件商品用户都能购买,但是只能买一件
|
||||
$in_activity = Order::alias('a')
|
||||
->join('order_goods og', 'a.id = og.order_id')
|
||||
->where(['a.user_id' => $userId, 'a.order_type' => 4, 'og.goods_id' => $goods['id']])
|
||||
->where('a.order_status', '<', 4)
|
||||
->find();
|
||||
|
||||
$goods['activity'] = [
|
||||
'type' => 4,
|
||||
'type_desc' => '抢购商品',
|
||||
'in_groupbuy_activity' => (bool)$in_activity,
|
||||
'msg' => '您已参与过本次活动,无法再次参与!'
|
||||
'in_groupbuy_activity' => !empty($in_activity) ? true : false,
|
||||
'msg' => '您已购买过改商品!'
|
||||
];
|
||||
|
||||
// 2024-11-29 更改规则:活动中的每件商品用户都能购买,但是只能买一件
|
||||
// $in_activity = Order::alias('a')
|
||||
// ->join('order_goods og', 'a.id = og.order_id')
|
||||
// ->where(['a.user_id' => $userId, 'a.order_type' => 4, 'og.goods_id' => $goods['id']])
|
||||
// ->where('a.order_status', '<', 4)
|
||||
// ->find();
|
||||
//
|
||||
// if (!empty($in_activity)) {
|
||||
// $goods['activity'] = [
|
||||
// 'type' => 4,
|
||||
// 'type_desc' => '抢购商品',
|
||||
// 'in_groupbuy_activity' => true,
|
||||
// 'msg' => '您已购买过改商品!'
|
||||
// ];
|
||||
// }
|
||||
|
||||
return $goods;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user