Browse Source

测试空投

afa 4 months ago
parent
commit
9b74f496ec
1 changed files with 11 additions and 9 deletions
  1. 11 9
      application/api/controller/Index.php

+ 11 - 9
application/api/controller/Index.php

@@ -5,7 +5,7 @@ namespace app\api\controller;
 use app\common\controller\Api;
 use app\common\model\ProductOrder;
 use fast\Asset;
-use app\common\model\LedgerTeacChangeModel;
+use app\common\model\UserModel;
 use app\common\model\LedgerWalletModel;
 use app\common\model\UserPledge;
 use think\Db;
@@ -47,17 +47,19 @@ class Index extends Api
         $this->success('ok:'. $i);
     }
 
+    //空投产品
     public function reset_user_pledge()
     {
-        $list = UserPledge::where('status', 1)->select();
-        $ids = '';
-        foreach ($list as $item){
-            $info = json_decode($item->details, true);
-            foreach ($info as $value){
-                $ids .= $value->id . ',';
+        $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($ids);
+        });
+        dump("总计:".$count);
 
     }