触发事件:
update coupon m
join
(select coupon_id id,
case when now()<begin_time then 0
when now() BETWEEN begin_time and end_time then 1
when now()>end_time then 2 else 3 end status2
from coupon
where is_delete=0 and begin_time is not null and end_time is not null)n
on m.coupon_id=n.id
set m.status=n.status2,m.update_time=now()
where m.status<>n.status2