...
|
...
|
@@ -416,11 +416,12 @@ class Cars extends Api |
|
|
$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');
|
|
|
|
|
|
$res = [];
|
|
|
foreach($data as $key=>$value){
|
|
|
|
|
|
$res[$key]['id'] = $value['id'];
|
|
|
$key = 0;
|
|
|
foreach($data as $value){
|
|
|
$key+=0;
|
|
|
//无门槛,有门槛
|
|
|
if($value['c_type'] == 0){
|
|
|
$res[$key]['id'] = $value['id'];
|
|
|
//无门槛
|
|
|
if($value['coupon_type'] == 0){
|
|
|
//减少券,去掉满减金额,折扣字段,
|
...
|
...
|
@@ -443,9 +444,24 @@ class Cars extends Api |
|
|
$res[$key]['is_discount'] = 1;//是否为折扣(0:否,1:是)
|
|
|
$res[$key]['price_tag'] = $value['discount'];
|
|
|
}
|
|
|
$res[$key]['coupon_name'] = $value['coupon_name'];//优惠券名称
|
|
|
$res[$key]['end_time'] = date('Y.n.j',$value['end_time']);//优惠券有效期
|
|
|
//全场,品牌,商品
|
|
|
if($value['type'] == 0){
|
|
|
$res[$key]['type'] = '全场通用';
|
|
|
|
|
|
}else if($value['type'] == 1){
|
|
|
$res[$key]['type'] = '部分品牌可用';
|
|
|
|
|
|
}else{
|
|
|
$res[$key]['type'] = '部分商品可用';
|
|
|
|
|
|
}
|
|
|
$key++;
|
|
|
}else{
|
|
|
//有门槛
|
|
|
if(($total_goods_price <=> $value['full_reduce']) >= 0){
|
|
|
$res[$key]['id'] = $value['id'];
|
|
|
//商品总金额大于等于满减金额
|
|
|
if($value['coupon_type'] == 0){
|
|
|
//减少券,去掉折扣字段,
|
...
|
...
|
@@ -466,21 +482,21 @@ class Cars extends Api |
|
|
$res[$key]['is_discount'] = 1;//是否为折扣(0:否,1:是)
|
|
|
$res[$key]['price_tag'] = $value['discount'];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$res[$key]['coupon_name'] = $value['coupon_name'];//优惠券名称
|
|
|
$res[$key]['end_time'] = date('Y.n.j',$value['end_time']);//优惠券有效期
|
|
|
//全场,品牌,商品
|
|
|
if($value['type'] == 0){
|
|
|
$res[$key]['type'] = '全场通用';
|
|
|
$res[$key]['coupon_name'] = $value['coupon_name'];//优惠券名称
|
|
|
$res[$key]['end_time'] = date('Y.n.j',$value['end_time']);//优惠券有效期
|
|
|
//全场,品牌,商品
|
|
|
if($value['type'] == 0){
|
|
|
$res[$key]['type'] = '全场通用';
|
|
|
|
|
|
}else if($value['type'] == 1){
|
|
|
$res[$key]['type'] = '部分品牌可用';
|
|
|
}else if($value['type'] == 1){
|
|
|
$res[$key]['type'] = '部分品牌可用';
|
|
|
|
|
|
}else{
|
|
|
$res[$key]['type'] = '部分商品可用';
|
|
|
}else{
|
|
|
$res[$key]['type'] = '部分商品可用';
|
|
|
|
|
|
}
|
|
|
$key++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|