add message to buy torrent success

This commit is contained in:
xiaomlove
2023-06-30 02:55:53 +08:00
parent 5caa0cc7a3
commit b951fda138
6 changed files with 34 additions and 4 deletions
+14 -1
View File
@@ -262,10 +262,11 @@ class BonusRepository extends BaseRepository
$userQuery = $userQuery->lockForUpdate(); $userQuery = $userQuery->lockForUpdate();
} }
$user = $userQuery->findOrFail($uid); $user = $userQuery->findOrFail($uid);
$buyerLocale = $user->locale;
$comment = nexus_trans('bonus.comment_buy_torrent', [ $comment = nexus_trans('bonus.comment_buy_torrent', [
'bonus' => $requireBonus, 'bonus' => $requireBonus,
'torrent_id' => $torrent->id, 'torrent_id' => $torrent->id,
], $user->locale); ], $buyerLocale);
do_log("comment: $comment"); do_log("comment: $comment");
$this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_TORRENT, $comment); $this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_TORRENT, $comment);
TorrentBuyLog::query()->create([ TorrentBuyLog::query()->create([
@@ -301,6 +302,18 @@ class BonusRepository extends BaseRepository
]; ];
BonusLogs::query()->insert($bonusLog); 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; return true;
+5
View File
@@ -623,6 +623,11 @@ class UserRepository extends BaseRepository
'claims' => 'uid', 'claims' => 'uid',
'exam_users' => 'uid', 'exam_users' => 'uid',
'exam_progress' => 'uid', 'exam_progress' => 'uid',
'user_metas' => 'uid',
'user_medals' => 'uid',
'attendance' => 'uid',
'attendance_logs' => 'uid',
'login_logs' => 'uid',
]; ];
foreach ($tables as $table => $key) { foreach ($tables as $table => $key) {
\Nexus\Database\NexusDB::table($table)->whereIn($key, $uidArr)->delete(); \Nexus\Database\NexusDB::table($table)->whereIn($key, $uidArr)->delete();
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.4'); defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.5');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-06-18'); defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-06-30');
defined('IN_TRACKER') || define('IN_TRACKER', false); defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP"); defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org"); defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
+4
View File
@@ -39,4 +39,8 @@ Last login time::last_login_time, IP::last_ip, location::last_location.<br/>
If it is not your own operation, the account password may have been leaked, please change it in time! If it is not your own operation, the account password may have been leaked, please change it in time!
BODY, BODY,
], ],
'buy_torrent_success' => [
'subject' => 'Successful torrent purchase reminder',
'body' => 'You spent :bonus bonus to successfully buy the torrent:[url=:url]:torrent_name[/url]',
],
]; ];
+4
View File
@@ -39,4 +39,8 @@ return [
若不是你本人操作,账号密码可能已经泄露,请及时修改! 若不是你本人操作,账号密码可能已经泄露,请及时修改!
BODY, BODY,
], ],
'buy_torrent_success' => [
'subject' => '成功购买种子提醒',
'body' => '你花费 :bonus 魔力成功购买了种子:[url=:url]:torrent_name[/url]',
],
]; ];
+5 -1
View File
@@ -37,5 +37,9 @@ return [
上次登錄時間::last_login_timeIP:last_ip,位置::last_location。<br/> 上次登錄時間::last_login_timeIP:last_ip,位置::last_location。<br/>
若不是你本人操作,賬號密碼可能已經泄露,請及時修改! 若不是你本人操作,賬號密碼可能已經泄露,請及時修改!
BODY, BODY,
] ],
'buy_torrent_success' => [
'subject' => '成功購買種子提醒',
'body' => '你花費 :bonus 魔力成功購買了種子:[url=:url]:torrent_name[/url]',
],
]; ];