setName('coupon_end') ->setDescription('优惠券结束领取&用户优惠券过期'); } protected function execute(Input $input, Output $output) { (new Coupon())->where([ ['status', '=', CouponEnum::COUPON_STATUS_CONDUCT], ['use_time_type', '=', CouponEnum::USE_TIME_TYPE_FIXED], ['use_time_end', '<=', time()] ])->update([ 'status' => CouponEnum::COUPON_STATUS_END, 'update_time' => time() ]); // 已过期的优惠券标记失效 (new CouponList())->where([ ['status', '=', CouponEnum::USE_STATUS_NOT], ['invalid_time', '<=', time()] ])->update([ 'status' => CouponEnum::USE_STATUS_EXPIRE, 'update_time' => time() ]); } }