123456789101112131415161718192021222324 |
- <?php
- use app\common\model\Mobile;
- use Workerman\Worker as WO;
- class MobileActivity extends Com{
- public static function run(){
- $work=new WO();
- $work->onWorkerStart=function (WO $worker){
- while (true){
- $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();
- }
- sleep(3);
- }
- };
- }
- }
- MobileActivity::run();
|