afa 4 månader sedan
förälder
incheckning
9e88adcdac
1 ändrade filer med 9 tillägg och 6 borttagningar
  1. 9 6
      application/api/command/Test.php

+ 9 - 6
application/api/command/Test.php

@@ -32,10 +32,9 @@ class Test extends Command
         $begin_usdt = microtime(TRUE);
         $output->writeln("开始发放加权分红:");
 
-        $this->reset_user_pledge();
+        $count = $this->reset_user_pledge();
 
-        $time_total = round(microtime(true) - $GLOBALS['_beginTime'], 4);//计算耗时
-        $output->writeln('定时任务执行结束,总耗时' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
+        $output->writeln('定时任务执行结束,总执行:' .  $count  . '个');
     }
 
 
@@ -44,13 +43,17 @@ class Test extends Command
 
         $productOrder =  new ProductOrder(); //Loader::model('ProductOrder');
         $count = 0;
-        UserModel::chunk(500, function($items) use ($count, $productOrder) {
+        $num = 6;
+        $ids = 14;
+
+        UserModel::chunk(500, function($items) use ($count,$num , $ids, $productOrder) {
             foreach ($items as $item) {
                 // 处理每个数据项
-                $productOrder::setPopularNoAreaOrder(6, 0, 0, 14, $item->id, 5);
+                $productOrder::setPopularNoAreaOrder($num, 0, 0, $ids, $item->id, 5);
                 $count ++;
             }
         });
-        dump("总计:".$count);
+        
+        return $count;
     }
 }