Browse Source

op updates (#5930)

vic 5 years ago
parent
commit
0ba4199487
1 changed files with 3 additions and 1 deletions
  1. 3 1
      frameworks/PHP/one/App/Controllers/IndexController.php

+ 3 - 1
frameworks/PHP/one/App/Controllers/IndexController.php

@@ -53,11 +53,13 @@ class IndexController extends Controller
     {
         $count = max(min(intval($count), 500), 1);
         $list  = [];
+        $updates = [];
         while ($count--) {
             $row    = World::repeatStatement()->find(mt_rand(1, 10000));
             $list[] = $row;
-            $row->repeatStatement()->update(['randomNumber' => mt_rand(1, 10000)]);
+            $updates[] = 'update world set randomNumber='.mt_rand(1, 10000).' where id='.$row->id;
         }
+        $row->exec(implode(';',$updates));
         return $this->json($list);
     }