|
|
|
@ -32,9 +32,7 @@ class CouponController extends BaseController |
|
|
|
|
|
|
|
$c_ids = CouponUserRecType::where('receive_type', $receive_type)->pluck('system_coupon_user_id'); |
|
|
|
$nowTime = time(); |
|
|
|
$cr_ids = CouponRec::where( |
|
|
|
'user_id',$user_id |
|
|
|
)->pluck('system_coupon_user_id'); |
|
|
|
$cr_ids = CouponRec::where('user_id',$user_id)->pluck('system_coupon_user_id'); |
|
|
|
|
|
|
|
$ids = array_merge($c_ids->toArray(), $cr_ids->toArray()); |
|
|
|
|
|
|
|
@ -49,7 +47,7 @@ class CouponController extends BaseController |
|
|
|
['u.status','=',1], |
|
|
|
]) |
|
|
|
->join('ims_system_coupon_user_receivetype as type', 'u.id', '=', 'type.system_coupon_user_id') |
|
|
|
->whereRaw('inventory_use <= inventory') |
|
|
|
->whereRaw('u.inventory_use <= u.inventory and u.inventory-u.inventory_use > type.one_receive_number') |
|
|
|
->whereIn('u.id',$ids) |
|
|
|
->select('u.*','type.one_receive_number') |
|
|
|
->orderBy('u.weigh','desc') |
|
|
|
|