Crontab.php 607 字节
<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use think\Db;

/**
 * 定时任务
 */
class Crontab extends Frontend
{
    protected $layout = '';
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function _initialize()
    {
        parent::_initialize();
    }

    /**
     * 每月1号凌晨清空用户暂存的上月的打卡总工时
     */
    public function clear()
    {
        Db::name('user')->where('id',10)->update(['work_hours_month'=>0,'work_salary_month'=>0,'work_subsidy_month'=>0,'recruit_subsidy_month'=>0]);
    }
   
}