作者 jinglong
1 个管道 的构建 通过 耗费 1 秒

修改订单结算优惠券

... ... @@ -398,14 +398,6 @@ class Cars extends Api
$res1 = Common::selectSoftWhereData('goods',['id'=>['in',$goods_id_s],'type'=>$flag[1]],'id,t_id');
$b_id_s = array_unique(array_values(array_column($res1,'t_id')));
//包含品牌中的商品
if(!empty($b_id_s)){
$where2['bg_id'] = ['in',$b_id_s];
$where2['type'] = $type[1];
}else{
$where2 = [];
}
//普通商品
$where1['bg_id'] = ['in',$goods_id_s];
$where1['type'] = $type[2];
... ... @@ -414,8 +406,14 @@ class Cars extends Api
$where['id'] = ['in',$receive_s];
$where['end_time'] = ['>',$time];
$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');
//包含品牌中的商品
if(!empty($b_id_s)){
$where2['bg_id'] = ['in',$b_id_s];
$where2['type'] = $type[1];
$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');
}else{
$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');
}
$res = [];
$key = 0;
foreach($data as $value){
... ...
... ... @@ -100,6 +100,20 @@ class Common
* 查找多条数据
* @ApiInternal
*/
public static function selectWhereOrData1($table,$where,$where1,$field,$order='id desc'){
$res = Db::name($table)
->where($where)
->where($where1)
->field($field)
->order($order)
->select();
return $res;
}
/**
* 查找多条数据
* @ApiInternal
*/
public static function selectWherePageData($table,$where,$field,$page,$limit='',$order='id desc'){
if($limit == ''){
$limit = config('verify.limit');
... ...