fix: 全模块Critical安全修复 — 防重入+锁+精度+XSS
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Users;
|
||||
class UpdateParent extends Command
|
||||
{
|
||||
protected $signature = "update:parent";
|
||||
protected $description = "更新用户上级";
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function handle()
|
||||
{
|
||||
Users::where('type', 1)->chunk(10000, function ($users) {
|
||||
foreach ($users as $key => $user) {
|
||||
$parent = Users::where('origin_user_id', $user->origin_parent_id)->first();
|
||||
if (!$parent) {
|
||||
continue 1;
|
||||
}
|
||||
$user->parent_id = $parent->id;
|
||||
$user->save();
|
||||
$this->info('更新用户' . $user->id . '的上级完成');
|
||||
}
|
||||
});
|
||||
$this->info('全部执行完成');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user