coupon-admin/app/subscribe/Coupon.php

23 lines
571 B
PHP
Raw Normal View History

2021-11-18 09:57:04 +00:00
<?php
declare (strict_types=1);
namespace app\subscribe;
use app\model\CouponMain;
use think\facade\Log;
class Coupon
{
/**
2022-03-31 06:42:56 +00:00
* 检查过期的签到券修改状态
2021-11-18 09:57:04 +00:00
* */
public function onCouponStatusCheck()
{
$count = CouponMain::whereTime("end_time", "<", date("Y-m-d"))->where(["status" => CouponMain::status_on])->count();
if ($count) {
2022-03-31 06:42:56 +00:00
Log::info("修改了签到券状态" . $count);
2021-11-18 09:57:04 +00:00
CouponMain::whereTime("end_time", "<", date("Y-m-d"))->update(["status" => CouponMain::status_off]);
}
}
}