123456789101112131415161718192021222324 |
- <?php
- use app\common\model\Mobile;
- use Workerman\Lib\Timer;
- use Workerman\Worker as WO;
- class MobileActivity extends Com{
- public static function run(){
- $work=self::newWorker();
- $work->onWorkerStart=function (WO $worker){
- Timer::add(3,function (){
- $ids=Mobile::where('activity_time_end','<=',time())
- ->where('is_activity',1)
- ->where('type',1)
- ->column('id');
- self::log("找到".count($ids).'条记录');
- foreach ($ids as $id){
- $mobile=Mobile::find($id);
- $mobile->makeNotActivity();
- }
- });
- };
- }
- }
- //MobileActivity::run();
|