This commit is contained in:
xiaomlove
2023-06-13 01:53:58 +08:00
parent 48df2f3da3
commit 2b56de2a01
4 changed files with 9 additions and 4 deletions

View File

@@ -97,8 +97,7 @@ class Test extends Command
*/
public function handle()
{
$r = TorrentUpdated::dispatch(5);
dd($r);
}
}

View File

@@ -84,6 +84,12 @@ class MedalRepository extends BaseRepository
}
$current = $userMedal->status;
if ($current == UserMedal::STATUS_NOT_WEARING) {
$maxWearAllow = Setting::get('system.maximum_number_of_medals_can_be_worn');
$user = User::query()->findOrFail($userId, User::$commonFields);
$wearCount = $user->wearing_medals()->count();
if ($maxWearAllow && $wearCount >= $maxWearAllow) {
throw new NexusException(nexus_trans('medal.max_allow_wearing', ['count' => $maxWearAllow]));
}
$userMedal->status = UserMedal::STATUS_WEARING;
} elseif ($current == UserMedal::STATUS_WEARING) {
$userMedal->status = UserMedal::STATUS_NOT_WEARING;