| | |
| | | a.startTime as startTime, |
| | | a.endTime as endTime, |
| | | a.remark as remark, |
| | | a.`status` as `status`, |
| | | IF(a.`status` != 3, a.`status`, IF(NOW() < a.startTime, 5, if(now() >= a.startTime and now() < a.endTime, 6, 7))) as `status`, |
| | | ( |
| | | (select count(aa.id) from t_user_red_packet_record aa left join t_user_activity_redenvelope bb on (aa.redPacketActivityId = bb.id) where aa.state = 2 and bb.userActivityId = a.id) + |
| | | (select count(aa.id) from t_user_coupon_record aa left join t_user_activity_registered bb on (aa.couponActivityId = bb.id and aa.activityType = 2) where aa.state = 2 and bb.userActivityId = a.id) + |