Merge branch 'hotfix/allocation' into develop

This commit is contained in:
2025-08-22 18:01:30 +08:00
+4 -2
View File
@@ -529,14 +529,16 @@ class CustomerService
$uidRotator = new \app\common\utils\RedisUidRotator('allocation_customer_user'); $uidRotator = new \app\common\utils\RedisUidRotator('allocation_customer_user');
$uidRotator->setUids($userId, false); $uidRotator->setUids($userId, false);
Customer::whereIn('user_id',$resignUerIds)->chunk(500, function ($customers) use ($uidRotator){ Customer::whereIn('user_id', $resignUerIds)
->orderBy('id', 'asc')
->chunkById(500, function ($customers) use ($uidRotator) {
foreach ($customers as $customer) { foreach ($customers as $customer) {
// 获取下一个分配的UID // 获取下一个分配的UID
$newUserId = $uidRotator->next(); $newUserId = $uidRotator->next();
$customer->user_id = $newUserId; $customer->user_id = $newUserId;
$customer->save(); $customer->save();
} }
}); }, 'id');
return [ return [