From bc1827fba4c4d7f2cf432914920556125518918a Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Mon, 26 Feb 2024 23:45:19 +0800 Subject: [PATCH] improve tmp invite log --- app/Jobs/GenerateTemporaryInvite.php | 1 + database/factories/UserFactory.php | 8 ++++- ...rrents_change_field_cache_stamp_to_int.php | 36 +++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2024_02_24_004527_alter_table_torrents_change_field_cache_stamp_to_int.php diff --git a/app/Jobs/GenerateTemporaryInvite.php b/app/Jobs/GenerateTemporaryInvite.php index a064d091..e3541279 100644 --- a/app/Jobs/GenerateTemporaryInvite.php +++ b/app/Jobs/GenerateTemporaryInvite.php @@ -64,6 +64,7 @@ class GenerateTemporaryInvite implements ShouldQueue return; } $idArr = explode(",", $idStr); + do_log(sprintf("going to handle %d uid...", count($idArr))); foreach ($idArr as $uid) { try { $hashArr = $toolRep->generateUniqueInviteHash([], $this->count, $this->count); diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index d652acae..17fe8bd5 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -37,6 +37,12 @@ class UserFactory extends Factory $username = sprintf("%s_%s", microtime(true), self::$sequence); $email = sprintf("%s@example.net", $username); self::$sequence++; + $randNum = random_int(1, 10); + if ($randNum >= 8) { + $class = random_int(intval(User::CLASS_POWER_USER), intval(User::CLASS_SYSOP)); + } else { + $class = User::CLASS_USER; + } return [ 'username' => $username, 'email' => $email, @@ -46,7 +52,7 @@ class UserFactory extends Factory 'stylesheet' => self::$defaultStyleSheet, 'added' => now()->toDateTimeString(), 'status' => User::STATUS_CONFIRMED, - 'class' => random_int(intval(User::CLASS_USER), intval(User::CLASS_SYSOP)) + 'class' => $class ]; } diff --git a/database/migrations/2024_02_24_004527_alter_table_torrents_change_field_cache_stamp_to_int.php b/database/migrations/2024_02_24_004527_alter_table_torrents_change_field_cache_stamp_to_int.php new file mode 100644 index 00000000..ad92f3fb --- /dev/null +++ b/database/migrations/2024_02_24_004527_alter_table_torrents_change_field_cache_stamp_to_int.php @@ -0,0 +1,36 @@ +integer("cache_stamp")->default(0)->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('torrents', function (Blueprint $table) { + // + }); + } +};