diff --git a/app/Repositories/BonusRepository.php b/app/Repositories/BonusRepository.php index 52743a7e..07869b17 100644 --- a/app/Repositories/BonusRepository.php +++ b/app/Repositories/BonusRepository.php @@ -26,7 +26,6 @@ class BonusRepository extends BaseRepository $requireBonus = BonusLogs::getBonusForCancelHitAndRun(); NexusDB::transaction(function () use ($user, $hitAndRun, $requireBonus) { $comment = nexus_trans('hr.bonus_cancel_comment', [ - 'now' => Carbon::now()->toDateTimeString(), 'bonus' => $requireBonus, ], $user->locale); $comment = addslashes($comment); @@ -85,7 +84,7 @@ class BonusRepository extends BaseRepository ], $user->locale); $comment = addslashes($comment); do_log("comment: $comment"); - $this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_ATTENDANCE_CARD, "$comment"); + $this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_ATTENDANCE_CARD, $comment); User::query()->where('id', $user->id)->increment('attendance_card'); }); @@ -100,6 +99,7 @@ class BonusRepository extends BaseRepository throw new \LogicException("User bonus point not enough."); } NexusDB::transaction(function () use ($user, $requireBonus, $logBusinessType, $logComment) { + $bonusComment = date('Y-m-d') . " - $logComment"; $oldUserBonus = $user->seedbonus; $newUserBonus = bcsub($oldUserBonus, $requireBonus); $log = "user: {$user->id}, requireBonus: $requireBonus, oldUserBonus: $oldUserBonus, newUserBonus: $newUserBonus, logBusinessType: $logBusinessType, logComment: $logComment"; @@ -107,7 +107,10 @@ class BonusRepository extends BaseRepository $affectedRows = NexusDB::table($user->getTable()) ->where('id', $user->id) ->where('seedbonus', $oldUserBonus) - ->update(['seedbonus' => $newUserBonus]); + ->update([ + 'seedbonus' => $newUserBonus, + 'bonuscomment' => NexusDB::raw("if(bonuscomment = '', '$bonusComment', concat_ws('\n', '$bonusComment', bonuscomment))") + ]); if ($affectedRows != 1) { do_log("update user seedbonus affected rows != 1, query: " . last_query(), 'error'); throw new \RuntimeException("Update user seedbonus fail."); diff --git a/public/mybonus.php b/public/mybonus.php index bb562fb7..a7855130 100644 --- a/public/mybonus.php +++ b/public/mybonus.php @@ -508,7 +508,7 @@ if ($action == "exchange") { } $vip_until = date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) + 28*86400)); $bonuscomment = date("Y-m-d") . " - " .$points. " Points for 1 month VIP Status.\n " .htmlspecialchars($bonuscomment); - sql_query("UPDATE users SET class = '".UC_VIP."', vip_added = 'yes', vip_until = ".sqlesc($vip_until).", seedbonus = seedbonus - $points WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__); + sql_query("UPDATE users SET class = '".UC_VIP."', vip_added = 'yes', vip_until = ".sqlesc($vip_until).", seedbonus = seedbonus - $points, bonuscomment=".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__); nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=vip"); } //=== trade for invites @@ -518,7 +518,7 @@ if ($action == "exchange") { $invites = $CURUSER['invites']; $inv = $invites+$bonusarray['menge']; $bonuscomment = date("Y-m-d") . " - " .$points. " Points for invites.\n " .htmlspecialchars($bonuscomment); - sql_query("UPDATE users SET invites = ".sqlesc($inv).", seedbonus = seedbonus - $points WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__); + sql_query("UPDATE users SET invites = ".sqlesc($inv).", seedbonus = seedbonus - $points, bonuscomment=".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__); nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=invite"); } //=== trade for special title diff --git a/resources/lang/en/bonus.php b/resources/lang/en/bonus.php index 2d2bb3c6..323dbe07 100644 --- a/resources/lang/en/bonus.php +++ b/resources/lang/en/bonus.php @@ -2,4 +2,5 @@ return [ 'comment_buy_medal' => 'Spend :bonus bonus buy :medal_name', + 'comment_buy_attendance_card' => 'Spend :bonus bonus buy one attend card', ]; diff --git a/resources/lang/en/hr.php b/resources/lang/en/hr.php index 25d44a4f..e25bb3f6 100644 --- a/resources/lang/en/hr.php +++ b/resources/lang/en/hr.php @@ -23,5 +23,5 @@ return [ 'unreached_disable_comment' => 'H&R quantity reached the upper limit and account was disabled by the system', 'unreached_disable_message_content' => 'Your account has been disabled because the cumulative H&R count has been reached the system limit: :ban_user_when_counts_reach', - 'bonus_cancel_comment' => ':now, spend :bonus canceled', + 'bonus_cancel_comment' => 'spend :bonus canceled', ]; diff --git a/resources/lang/zh_CN/hr.php b/resources/lang/zh_CN/hr.php index a6d31a70..9edb0ac7 100644 --- a/resources/lang/zh_CN/hr.php +++ b/resources/lang/zh_CN/hr.php @@ -23,5 +23,5 @@ return [ 'unreached_disable_comment' => 'H&R 数量达上限被系统禁用。', 'unreached_disable_message_content' => '由于累计 H&R 数量已达系统上限::ban_user_when_counts_reach,你的账号已被禁用。', - 'bonus_cancel_comment' => ':now 花费 :bonus 魔力进行了消除', + 'bonus_cancel_comment' => '花费 :bonus 魔力进行了消除', ]; diff --git a/resources/lang/zh_TW/bonus.php b/resources/lang/zh_TW/bonus.php index a0fa40b6..0e57807c 100644 --- a/resources/lang/zh_TW/bonus.php +++ b/resources/lang/zh_TW/bonus.php @@ -2,4 +2,5 @@ return [ 'comment_buy_medal' => '花費 :bonus 魔力購買了 :medal_name', + 'comment_buy_attendance_card' => '花費 :bonus 魔力購買了 1 張補簽卡', ]; diff --git a/resources/lang/zh_TW/hr.php b/resources/lang/zh_TW/hr.php index 8d37f157..430bb47c 100644 --- a/resources/lang/zh_TW/hr.php +++ b/resources/lang/zh_TW/hr.php @@ -23,5 +23,5 @@ return [ 'unreached_disable_comment' => 'H&R 數量達上限被系統禁用。', 'unreached_disable_message_content' => '由於累計 H&R 數量已達系統上限::ban_user_when_counts_reach,你的賬號已被禁用。', - 'bonus_cancel_comment' => ':now 花費 :bonus 魔力進行了消除', + 'bonus_cancel_comment' => '花費 :bonus 魔力進行了消除', ];