xxxrrrdddd 3 years ago
parent
commit
df0eb9c588
1 changed files with 13 additions and 2 deletions
  1. 13 2
      work

+ 13 - 2
work

@@ -1,8 +1,8 @@
 #!/usr/bin/env php
 <?php
 
+use app\common\model\Mobile;
 use think\App;
-use think\worker\Server;
 
 define('APP_PATH', __DIR__ . '/application/');
 bcscale(2);
@@ -12,6 +12,17 @@ App::initCommon();
 
 $work=new \Workerman\Worker();
 $work->onWorkerStart=function ($conn){
-    var_dump('asdasdas');
+    while (true){
+        $ids=Mobile::where('activity_time_end','<=',time())
+            ->where('is_activity',1)
+            ->where('type',1)
+            ->column('id');
+        var_dump("找到".count($ids).'条记录');
+        foreach ($ids as $id){
+            $mobile=Mobile::find($id);
+            $mobile->makeNotActivity();
+        }
+        sleep(3);
+    }
 };
 $work->run();