|
|
@ -42,13 +42,13 @@ class CouponController extends BaseController |
|
|
// $ids = collect($ids)->unique();
|
|
|
// $ids = collect($ids)->unique();
|
|
|
$c_ids = $c_ids->toArray(); |
|
|
$c_ids = $c_ids->toArray(); |
|
|
$cr_ids = $cr_ids->toArray(); |
|
|
$cr_ids = $cr_ids->toArray(); |
|
|
$ids = []; |
|
|
|
|
|
foreach ($c_ids as $key => $val){ |
|
|
|
|
|
if(!in_array($val,$cr_ids)) { |
|
|
|
|
|
$ids[] = $val; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $ids = [];
|
|
|
|
|
|
// foreach ($c_ids as $key => $val){
|
|
|
|
|
|
// if(!in_array($val,$cr_ids)) {
|
|
|
|
|
|
// $ids[] = $val;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// print_r($ids);print_r($c_ids);print_r($cr_ids);
|
|
|
|
|
|
|
|
|
$c = Db::table('ims_system_coupon_user as u') |
|
|
$c = Db::table('ims_system_coupon_user as u') |
|
|
->where([ |
|
|
->where([ |
|
|
@ -59,7 +59,8 @@ class CouponController extends BaseController |
|
|
]) |
|
|
]) |
|
|
->join('ims_system_coupon_user_receivetype as type', 'u.id', '=', 'type.system_coupon_user_id') |
|
|
->join('ims_system_coupon_user_receivetype as type', 'u.id', '=', 'type.system_coupon_user_id') |
|
|
->whereRaw('u.inventory_use <= u.inventory and u.inventory-u.inventory_use > type.one_receive_number') |
|
|
->whereRaw('u.inventory_use <= u.inventory and u.inventory-u.inventory_use > type.one_receive_number') |
|
|
->whereIn('u.id',$ids) |
|
|
|
|
|
|
|
|
->whereIn('u.id',$c_ids) |
|
|
|
|
|
->whereNotIn('u.id',$cr_ids) |
|
|
->select('u.*','type.one_receive_number') |
|
|
->select('u.*','type.one_receive_number') |
|
|
->orderBy('u.weigh','desc') |
|
|
->orderBy('u.weigh','desc') |
|
|
// ->orderByRaw('FIELD(u.id, '.implode(", " , $ids).')')
|
|
|
// ->orderByRaw('FIELD(u.id, '.implode(", " , $ids).')')
|
|
|
|