webman/process/Task4.php

59 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace process;
use App\Utils\API\SendCode;
use app\dao\UserRewardDao;
use Workerman\Crontab\Crontab;
use app\model\GetLodeLog;
use app\model\User;
use app\model\UserPhone;
/**
* 查询用户是否在线类
*/
class Task4
{
public function onWorkerStart()
{
// // 每秒钟执行一次
// new Crontab('*/1 * * * * *', function(){
// echo date('Y-m-d H:i:s')."\n";
// });
// // 每5秒执行一次
// new Crontab('*/5 * * * * *', function(){
// echo date('Y-m-d H:i:s')."\n";
// });
// // 每分钟执行一次
// new Crontab('0 */1 * * * *', function(){
// echo date('Y-m-d H:i:s')."\n";
// });
// // 每5分钟执行一次
// new Crontab('0 */5 * * * *', function(){
// echo date('Y-m-d H:i:s')."\n";
// });
// // 每分钟的第一秒执行
// new Crontab('1 * * * * *', function(){
// echo date('Y-m-d H:i:s')."\n";
// });
// // 每天的7点50执行注意这里省略了秒位
// new Crontab('50 7 * * *', function(){
// echo date('Y-m-d H:i:s')."\n";
// });
// // 每天凌晨0点执行
new Crontab('0 0 0 * * *', function () {
echo date('Y-m-d H:i:s')."\n";
//把user里所有数据的today_num全部变成0
User::where('today_num','>',0)->update(['today_num'=>0]);
User::where('active_figures','>',0)->update(['active_figures'=>0]);
UserPhone::query()->update(['day_score' => 0]);
});
}
}