Browse Source

Merge branch 'hotfix_coupon' into develop

# Conflicts:
#	app/Controller/CouponController.php
master
weigang 6 years ago
parent
commit
07c33adba1
  1. 32
      app/Controller/CouponController.php

32
app/Controller/CouponController.php

@ -64,22 +64,22 @@ class CouponController extends BaseController
$couponIds = array_diff($c_ids, $cr_ids);
$c = Db::table('ims_system_coupon_user as u')
->where([
['u.end_time','>',$nowTime],
['u.start_time','<=',$nowTime],
['type.receive_type','=',$receive_type],
['u.status','=',1],
])
->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')
// ->whereIn('u.id',$c_ids)
// ->whereNotIn('u.id',$cr_ids)
->whereIn('u.id', $couponIds)
->select('u.*','type.one_receive_number')
->orderBy('u.weigh','desc')
// ->orderByRaw('FIELD(u.id, '.implode(", " , $ids).')')
->limit(4)
->get();
->where([
['u.end_time','>',$nowTime],
['u.start_time','<=',$nowTime],
['type.receive_type','=',$receive_type],
['u.status','=',1],
])
->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')
// ->whereIn('u.id',$c_ids)
// ->whereNotIn('u.id',$cr_ids)
->whereIn('u.id', $couponIds)
->select('u.*','type.one_receive_number')
->orderBy('u.weigh','desc')
// ->orderByRaw('FIELD(u.id, '.implode(", " , $ids).')')
->limit(4)
->get();
foreach ($c as $k => &$v){
if($v->discount_type == 2){
$v->discounts = floatval($v->discounts);

Loading…
Cancel
Save