afa před 4 měsíci
rodič
revize
912402c28f
1 změnil soubory, kde provedl 19 přidání a 3 odebrání
  1. 19 3
      application/api/command/Test.php

+ 19 - 3
application/api/command/Test.php

@@ -7,8 +7,8 @@ use app\common\logic\ScanLogic;
 use think\console\Command;
 use think\console\Input;
 use think\console\Output;
-use app\common\logic\TeamRewards;
-use app\common\model\TimedTaskLogModel;
+use app\common\model\ProductOrder;
+use app\common\model\UserModel;
 use think\Model;
 
 
@@ -32,9 +32,25 @@ class Test extends Command
         $begin_usdt = microtime(TRUE);
         $output->writeln("开始发放加权分红:");
 
-        (new \app\api\controller\Test())->reset_team();
+        $this->reset_user_pledge();
 
         $time_total = round(microtime(true) - $GLOBALS['_beginTime'], 4);//计算耗时
         $output->writeln('定时任务执行结束,总耗时' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
     }
+
+
+
+    public static function reset_user_pledge(){
+
+        $productOrder =  new ProductOrder(); //Loader::model('ProductOrder');
+        $count = 0;
+        UserModel::chunk(500, function($items) use ($count, $productOrder) {
+            foreach ($items as $item) {
+                // 处理每个数据项
+                $productOrder::setPopularNoAreaOrder(6, 0, 0, 14, $item->id, 5);
+                $count ++;
+            }
+        });
+        dump("总计:".$count);
+    }
 }