diff --git a/app/Repositories/BonusRepository.php b/app/Repositories/BonusRepository.php index 798e6956..fe570a5b 100644 --- a/app/Repositories/BonusRepository.php +++ b/app/Repositories/BonusRepository.php @@ -262,10 +262,11 @@ class BonusRepository extends BaseRepository $userQuery = $userQuery->lockForUpdate(); } $user = $userQuery->findOrFail($uid); + $buyerLocale = $user->locale; $comment = nexus_trans('bonus.comment_buy_torrent', [ 'bonus' => $requireBonus, 'torrent_id' => $torrent->id, - ], $user->locale); + ], $buyerLocale); do_log("comment: $comment"); $this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_TORRENT, $comment); TorrentBuyLog::query()->create([ @@ -301,6 +302,18 @@ class BonusRepository extends BaseRepository ]; BonusLogs::query()->insert($bonusLog); } + $buyTorrentSuccessMessage = [ + 'sender' => 0, + 'receiver' => $user->id, + 'added' => now(), + 'subject' => nexus_trans("message.buy_torrent_success.subject", [], $buyerLocale), + 'msg' => nexus_trans("message.buy_torrent_success.body", [ + 'torrent_name' => $torrent->name, + 'bonus' => $requireBonus, + 'url' => sprintf('details.php?id=%s&hit=1', $torrent->id) + ], $buyerLocale), + ]; + Message::add($buyTorrentSuccessMessage); }); return true; diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 5a5f9afb..1fb28ac1 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -623,6 +623,11 @@ class UserRepository extends BaseRepository 'claims' => 'uid', 'exam_users' => 'uid', 'exam_progress' => 'uid', + 'user_metas' => 'uid', + 'user_medals' => 'uid', + 'attendance' => 'uid', + 'attendance_logs' => 'uid', + 'login_logs' => 'uid', ]; foreach ($tables as $table => $key) { \Nexus\Database\NexusDB::table($table)->whereIn($key, $uidArr)->delete(); diff --git a/include/constants.php b/include/constants.php index 44b8a6dd..2ca6d17e 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ If it is not your own operation, the account password may have been leaked, please change it in time! BODY, ], + 'buy_torrent_success' => [ + 'subject' => 'Successful torrent purchase reminder', + 'body' => 'You spent :bonus bonus to successfully buy the torrent:[url=:url]:torrent_name[/url]', + ], ]; diff --git a/resources/lang/zh_CN/message.php b/resources/lang/zh_CN/message.php index 9123fdff..0f304240 100644 --- a/resources/lang/zh_CN/message.php +++ b/resources/lang/zh_CN/message.php @@ -39,4 +39,8 @@ return [ 若不是你本人操作,账号密码可能已经泄露,请及时修改! BODY, ], + 'buy_torrent_success' => [ + 'subject' => '成功购买种子提醒', + 'body' => '你花费 :bonus 魔力成功购买了种子:[url=:url]:torrent_name[/url]', + ], ]; diff --git a/resources/lang/zh_TW/message.php b/resources/lang/zh_TW/message.php index 3ee67ed6..52d0ffff 100644 --- a/resources/lang/zh_TW/message.php +++ b/resources/lang/zh_TW/message.php @@ -37,5 +37,9 @@ return [ 上次登錄時間::last_login_time,IP::last_ip,位置::last_location。
若不是你本人操作,賬號密碼可能已經泄露,請及時修改! BODY, - ] + ], + 'buy_torrent_success' => [ + 'subject' => '成功購買種子提醒', + 'body' => '你花費 :bonus 魔力成功購買了種子:[url=:url]:torrent_name[/url]', + ], ];