|
|
@@ -132,9 +132,10 @@
|
|
|
else cu.status end) as couponUserStatus,
|
|
|
(case
|
|
|
when cu.status = 'unused' then 0
|
|
|
- when cu.valid_end_time > now() then 1
|
|
|
- when ca.status = 0 then 2
|
|
|
- when cu.status = 'used' then 3
|
|
|
+ when cu.valid_start_time < now() then 1
|
|
|
+ when cu.valid_end_time < now() then 2
|
|
|
+ when ca.status = 0 then 3
|
|
|
+ when cu.status = 'used' then 4
|
|
|
end) as orderby
|
|
|
from `coupon_user` cu
|
|
|
left join `coupon` c on c.id = cu.coupon_id
|