更新每日推送数据的保存

This commit is contained in:
2026-07-22 11:00:42 +08:00
parent 140a068b88
commit b2b4fd4fbc
7 changed files with 621 additions and 61 deletions

View File

@@ -119,16 +119,12 @@ class MallDailyPushBackfill
return ['created' => true, 'updated' => false];
}
$phone = $this->buildTempPhone();
if ($phone === null) {
throw new \RuntimeException('Failed to allocate phone for playx user');
}
$pwd = hash_password(Random::build('alnum', 16));
$now = time();
$created = MallUserAsset::create([
'playx_user_id' => $playxUserId,
'username' => $effectiveUsername,
'phone' => $phone,
'phone' => '',
'password' => $pwd,
'admin_id' => 0,
'locked_points' => 0,
@@ -145,16 +141,5 @@ class MallDailyPushBackfill
}
return ['created' => true, 'updated' => false];
}
private function buildTempPhone(): ?string
{
for ($i = 0; $i < 8; $i++) {
$candidate = '13' . str_pad(strval(mt_rand(0, 999999999)), 9, '0', STR_PAD_LEFT);
if (!MallUserAsset::where('phone', $candidate)->find()) {
return $candidate;
}
}
return null;
}
}