vilson a97c74717f 项目燃尽图
Signed-off-by: vilson <545522390@qq.com>
2020-02-20 22:45:37 +08:00

41 lines
933 B
PHP

<?php
use Workerman\Lib\Timer;
use Workerman\Worker;
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/../../../../vendor/autoload.php';
date_default_timezone_set('Asia/Shanghai');
$task = new Worker();
$task->name = 'crontab';
$doneTicket = [];
$task->onWorkerStart = function ($task) {
$timerId = Timer::add(1, 'checkTime');
};
// 运行worker
Worker::runAll();
function checkTime()
{
global $doneTicket;
$now = time();
$dateTime = date('H:i', $now);
//每天23:55统计项目情况
if ($dateTime == '23:55' && (!isset($doneTicket['setProjectReportDate']) || date('Y-m-d', $now) != $doneTicket['setProjectReportDate'])) {
setProjectReport();
}
}
function setProjectReport()
{
global $doneTicket;
$doneTicket['setProjectReportDate'] = date('Y-m-d', time());
exec("php think projectReport",$out);
echo $out[0];
}