支付下单确认是否购买过好物直降商品
This commit is contained in:
parent
a220a46d02
commit
e03534469a
@ -120,22 +120,31 @@ class OrderLogic extends Logic
|
||||
|
||||
Db::startTrans();
|
||||
try {
|
||||
if ($post['order_type'] == 4) {
|
||||
$in_activity = Order::where(['user_id' => $post['user_id'], 'order_type' => 4])->where('order_status', '<', 4)->find();
|
||||
if ($in_activity) {
|
||||
throw new Exception('每位用户只能限抢一件商品');
|
||||
}
|
||||
if ($post['order_type'] == OrderEnum::GROUP_BUY) {
|
||||
// $in_activity = Order::where(['user_id' => $post['user_id'], 'order_type' => 4])->where('order_status', '<', 4)->find();
|
||||
// if ($in_activity) {
|
||||
// throw new Exception('每位用户只能限抢一件商品');
|
||||
// }
|
||||
|
||||
foreach ($goods as $activ) {
|
||||
$isOrder = Db::name('order')->where([
|
||||
'activity_sn' => $activ['activity_sn'],
|
||||
'user_id' => $post['user_id']
|
||||
])
|
||||
->where('order_status', '<>', 4)
|
||||
->find();
|
||||
if($isOrder){
|
||||
foreach ($goods as $v) {
|
||||
$in_activity = Order::alias('a')
|
||||
->join('order_goods og', 'a.id = og.order_id')
|
||||
->where(['a.user_id' => $post['user_id'], 'a.order_type' => 4, 'og.goods_id' => $v['goods_id']])
|
||||
->where('a.order_status', '<', 4)
|
||||
->find();
|
||||
|
||||
if ($in_activity) {
|
||||
throw new Exception('您已抢购过此商品');
|
||||
}
|
||||
// $isOrder = Db::name('order')->where([
|
||||
// 'activity_sn' => $activ['activity_sn'],
|
||||
// 'user_id' => $post['user_id']
|
||||
// ])
|
||||
// ->where('order_status', '<>', 4)
|
||||
// ->find();
|
||||
// if($isOrder){
|
||||
// throw new Exception('您已抢购过此商品');
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user