[api] add notifications

This commit is contained in:
xiaomlove
2022-03-31 16:28:08 +08:00
parent 3e4a5766c4
commit f91cd6f20a
28 changed files with 274 additions and 44 deletions

View File

@@ -30,10 +30,11 @@ class RewardRepository extends BaseRepository
}
$torrent = Torrent::query()->findOrFail($torrentId, Torrent::$commentFields);
$torrent->checkIsNormal();
$torrentOwner = User::query()->findOrFail($torrent->owner, ['id', 'seedbonus']);
$torrentOwner = User::query()->findOrFail($torrent->owner);
if ($user->id == $torrentOwner->id) {
throw new \LogicException("you can't reward to yourself.");
}
$torrentOwner->checkIsNormal();
return DB::transaction(function () use ($torrentId, $value, $user, $torrentOwner) {
$model = $user->reward_torrent_logs()->create([
'torrentid' => $torrentId,