Skip to content

Commit 4a0475b

Browse files
committed
fix send gift
1 parent 53e1677 commit 4a0475b

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

app/Models/BonusLogs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class BonusLogs extends NexusModel
4444
const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000;
4545
const BUSINESS_TYPE_TORRENT_BE_DOWNLOADED = 1001;
4646
const BUSINESS_TYPE_RECEIVE_REWARD = 1002;
47+
const BUSINESS_TYPE_RECEIVE_GIFT = 1003;
4748

4849
public static array $businessTypes = [
4950
self::BUSINESS_TYPE_CANCEL_HIT_AND_RUN => ['text' => 'Cancel H&R'],
@@ -69,6 +70,7 @@ class BonusLogs extends NexusModel
6970
self::BUSINESS_TYPE_ROLE_WORK_SALARY => ['text' => 'Role work salary'],
7071
self::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => ['text' => 'Torrent be downloaded'],
7172
self::BUSINESS_TYPE_RECEIVE_REWARD => ['text' => 'Receive reward'],
73+
self::BUSINESS_TYPE_RECEIVE_GIFT => ['text' => 'Receive gift'],
7274
];
7375

7476
public function getBusinessTypeTextAttribute()

public/mybonus.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ function bonusarray($option = 0){
728728
$message = $_POST["message"];
729729
//==gift for peeps with no more options
730730
$usernamegift = sqlesc(trim($_POST["username"]));
731-
$res = sql_query("SELECT id, bonuscomment FROM users WHERE username=" . $usernamegift);
731+
$res = sql_query("SELECT id, seedbonus FROM users WHERE username=" . $usernamegift);
732732
$arr = mysql_fetch_assoc($res);
733733
if (empty($arr)) {
734734
stdmsg($lang_mybonus['text_error'], $lang_mybonus['text_receiver_not_exists'], 0);
@@ -737,7 +737,7 @@ function bonusarray($option = 0){
737737
}
738738
$useridgift = $arr['id'];
739739
$userseedbonus = $arr['seedbonus'];
740-
$receiverbonuscomment = $arr['bonuscomment'];
740+
// $receiverbonuscomment = $arr['bonuscomment'];
741741
if (!is_numeric($points) || $points < $bonusarray['points']) {
742742
//write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is hacking bonus system",'mod');
743743
stdmsg($lang_mybonus['text_error'], $lang_mybonus['bonus_amount_not_allowed']);
@@ -755,7 +755,7 @@ function bonusarray($option = 0){
755755
$aftertaxpoint -= $basictax_bonus;
756756

757757
$points2receiver = number_format($aftertaxpoint,1);
758-
$newreceiverbonuscomment = date("Y-m-d") . " + " .$points2receiver. " Points (after tax) as a gift from ".($CURUSER["username"]).".\n " .htmlspecialchars($receiverbonuscomment);
758+
// $newreceiverbonuscomment = date("Y-m-d") . " + " .$points2receiver. " Points (after tax) as a gift from ".($CURUSER["username"]).".\n " .htmlspecialchars($receiverbonuscomment);
759759
if ($userid==$useridgift){
760760
stdmsg($lang_mybonus['text_huh'], $lang_mybonus['text_karma_self_giving_warning'], 0);
761761
stdfoot();
@@ -764,7 +764,8 @@ function bonusarray($option = 0){
764764

765765
// sql_query("UPDATE users SET seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
766766
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_GIFT_TO_SOMEONE, $points2 . " Points as gift to ".htmlspecialchars(trim($_POST["username"])));
767-
sql_query("UPDATE users SET seedbonus = seedbonus + $aftertaxpoint, bonuscomment = ".sqlesc($newreceiverbonuscomment)." WHERE id = ".sqlesc($useridgift));
767+
sql_query("UPDATE users SET seedbonus = seedbonus + $aftertaxpoint WHERE id = ".sqlesc($useridgift));
768+
\App\Models\BonusLogs::add($useridgift, $userseedbonus, $aftertaxpoint, $userseedbonus + $aftertaxpoint, " + " .$points2receiver. " Points (after tax) as a gift from ".($CURUSER["username"]), \App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT);
768769

769770
//===send message
770771
$subject = sqlesc($lang_mybonus_target[get_user_lang($useridgift)]['msg_someone_loves_you']);

resources/lang/en/bonus-log.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => 'Role work salary',
2626
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => 'Torrent be downloaded',
2727
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => 'Receive reward',
28+
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT => 'Receive gift',
2829
],
2930
'fields' => [
3031
'business_type' => 'Business type',

resources/lang/zh_CN/bonus-log.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作组工资',
2828
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '种子被下载',
2929
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => '收到奖励',
30+
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT => '收到礼物',
3031
],
3132
'fields' => [
3233
'business_type' => '业务类型',

resources/lang/zh_TW/bonus-log.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作組工資',
2626
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '種子被下載',
2727
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => '收到獎勵',
28+
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT => '收到禮物',
2829
],
2930
'fields' => [
3031
'business_type' => '業務類型',

0 commit comments

Comments
 (0)