|
@@ -398,26 +398,40 @@ class Cars extends Api |
|
@@ -398,26 +398,40 @@ class Cars extends Api |
398
|
$res1 = Common::selectSoftWhereData('goods',['id'=>['in',$goods_id_s],'type'=>$flag[1]],'id,t_id');
|
398
|
$res1 = Common::selectSoftWhereData('goods',['id'=>['in',$goods_id_s],'type'=>$flag[1]],'id,t_id');
|
399
|
$b_id_s = array_unique(array_values(array_column($res1,'t_id')));
|
399
|
$b_id_s = array_unique(array_values(array_column($res1,'t_id')));
|
400
|
|
400
|
|
401
|
- //普通商品
|
|
|
402
|
- $where1['bg_id'] = ['in',$goods_id_s];
|
|
|
403
|
- $where1['type'] = $type[2];
|
|
|
404
|
-
|
|
|
405
|
$time = time();
|
401
|
$time = time();
|
406
|
$where['id'] = ['in',$receive_s];
|
402
|
$where['id'] = ['in',$receive_s];
|
407
|
$where['end_time'] = ['>',$time];
|
403
|
$where['end_time'] = ['>',$time];
|
408
|
|
404
|
|
409
|
- //包含品牌中的商品
|
|
|
410
|
- if(!empty($b_id_s)){
|
|
|
411
|
- $where2['bg_id'] = ['in',$b_id_s];
|
|
|
412
|
- $where2['type'] = $type[1];
|
|
|
413
|
- $data = Common::selectWhereOrData('coupon',$where,$where1,$where2,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number,end_time','sort desc,id desc');
|
|
|
414
|
- }else{
|
|
|
415
|
- $data = Common::selectWhereOrData1('coupon',$where,$where1,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number,end_time','sort desc,id desc');
|
|
|
416
|
- }
|
405
|
+ $data = Common::selectWhereData('coupon',$where,'id,type,coupon_name,c_type,bg_id,coupon_type,full_reduce,reduce,discount,coupon_number,end_time','sort desc,id desc');
|
|
|
406
|
+
|
417
|
$res = [];
|
407
|
$res = [];
|
418
|
$key = 0;
|
408
|
$key = 0;
|
419
|
foreach($data as $value){
|
409
|
foreach($data as $value){
|
420
|
$key+=0;
|
410
|
$key+=0;
|
|
|
411
|
+ $flag = 0;
|
|
|
412
|
+ if(!empty($b_id_s)){
|
|
|
413
|
+ //有品牌,看商品所属品牌
|
|
|
414
|
+ if($value['type'] != $type[0]){
|
|
|
415
|
+ $flag = 1;
|
|
|
416
|
+ }else{
|
|
|
417
|
+ if($value['type'] == $type[1] && in_array($value['bg_id'],$b_id_s)){
|
|
|
418
|
+ //去除不是该商品的
|
|
|
419
|
+ $flag = 1;
|
|
|
420
|
+ }
|
|
|
421
|
+ }
|
|
|
422
|
+
|
|
|
423
|
+ }else{
|
|
|
424
|
+ //无品牌
|
|
|
425
|
+ if($value['type'] == $type[0]){//是全场券
|
|
|
426
|
+ $flag = 1;
|
|
|
427
|
+ }else{
|
|
|
428
|
+ if($value['type'] == $type[2] && in_array($value['bg_id'],$goods_id_s)){
|
|
|
429
|
+ //去除不是该商品的
|
|
|
430
|
+ $flag = 1;
|
|
|
431
|
+ }
|
|
|
432
|
+ }
|
|
|
433
|
+ }
|
|
|
434
|
+ if($flag == 1){
|
421
|
//无门槛,有门槛
|
435
|
//无门槛,有门槛
|
422
|
if($value['c_type'] == 0){
|
436
|
if($value['c_type'] == 0){
|
423
|
$res[$key]['id'] = $value['id'];
|
437
|
$res[$key]['id'] = $value['id'];
|
|
@@ -498,6 +512,7 @@ class Cars extends Api |
|
@@ -498,6 +512,7 @@ class Cars extends Api |
498
|
}
|
512
|
}
|
499
|
}
|
513
|
}
|
500
|
}
|
514
|
}
|
|
|
515
|
+ }
|
501
|
|
516
|
|
502
|
$this->success('成功',$res);
|
517
|
$this->success('成功',$res);
|
503
|
}else{
|
518
|
}else{
|