fix send gift

This commit is contained in:
xiaomlove
2025-02-08 00:43:37 +08:00
parent 53e167787c
commit 4a0475b49c
5 changed files with 10 additions and 4 deletions

View File

@@ -44,6 +44,7 @@ class BonusLogs extends NexusModel
const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000;
const BUSINESS_TYPE_TORRENT_BE_DOWNLOADED = 1001;
const BUSINESS_TYPE_RECEIVE_REWARD = 1002;
const BUSINESS_TYPE_RECEIVE_GIFT = 1003;
public static array $businessTypes = [
self::BUSINESS_TYPE_CANCEL_HIT_AND_RUN => ['text' => 'Cancel H&R'],
@@ -69,6 +70,7 @@ class BonusLogs extends NexusModel
self::BUSINESS_TYPE_ROLE_WORK_SALARY => ['text' => 'Role work salary'],
self::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => ['text' => 'Torrent be downloaded'],
self::BUSINESS_TYPE_RECEIVE_REWARD => ['text' => 'Receive reward'],
self::BUSINESS_TYPE_RECEIVE_GIFT => ['text' => 'Receive gift'],
];
public function getBusinessTypeTextAttribute()

View File

@@ -728,7 +728,7 @@ if ($action == "exchange") {
$message = $_POST["message"];
//==gift for peeps with no more options
$usernamegift = sqlesc(trim($_POST["username"]));
$res = sql_query("SELECT id, bonuscomment FROM users WHERE username=" . $usernamegift);
$res = sql_query("SELECT id, seedbonus FROM users WHERE username=" . $usernamegift);
$arr = mysql_fetch_assoc($res);
if (empty($arr)) {
stdmsg($lang_mybonus['text_error'], $lang_mybonus['text_receiver_not_exists'], 0);
@@ -737,7 +737,7 @@ if ($action == "exchange") {
}
$useridgift = $arr['id'];
$userseedbonus = $arr['seedbonus'];
$receiverbonuscomment = $arr['bonuscomment'];
// $receiverbonuscomment = $arr['bonuscomment'];
if (!is_numeric($points) || $points < $bonusarray['points']) {
//write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is hacking bonus system",'mod');
stdmsg($lang_mybonus['text_error'], $lang_mybonus['bonus_amount_not_allowed']);
@@ -755,7 +755,7 @@ if ($action == "exchange") {
$aftertaxpoint -= $basictax_bonus;
$points2receiver = number_format($aftertaxpoint,1);
$newreceiverbonuscomment = date("Y-m-d") . " + " .$points2receiver. " Points (after tax) as a gift from ".($CURUSER["username"]).".\n " .htmlspecialchars($receiverbonuscomment);
// $newreceiverbonuscomment = date("Y-m-d") . " + " .$points2receiver. " Points (after tax) as a gift from ".($CURUSER["username"]).".\n " .htmlspecialchars($receiverbonuscomment);
if ($userid==$useridgift){
stdmsg($lang_mybonus['text_huh'], $lang_mybonus['text_karma_self_giving_warning'], 0);
stdfoot();
@@ -764,7 +764,8 @@ if ($action == "exchange") {
// sql_query("UPDATE users SET seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_GIFT_TO_SOMEONE, $points2 . " Points as gift to ".htmlspecialchars(trim($_POST["username"])));
sql_query("UPDATE users SET seedbonus = seedbonus + $aftertaxpoint, bonuscomment = ".sqlesc($newreceiverbonuscomment)." WHERE id = ".sqlesc($useridgift));
sql_query("UPDATE users SET seedbonus = seedbonus + $aftertaxpoint WHERE id = ".sqlesc($useridgift));
\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);
//===send message
$subject = sqlesc($lang_mybonus_target[get_user_lang($useridgift)]['msg_someone_loves_you']);

View File

@@ -25,6 +25,7 @@ return [
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => 'Role work salary',
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => 'Torrent be downloaded',
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => 'Receive reward',
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT => 'Receive gift',
],
'fields' => [
'business_type' => 'Business type',

View File

@@ -27,6 +27,7 @@ return [
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作组工资',
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '种子被下载',
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => '收到奖励',
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT => '收到礼物',
],
'fields' => [
'business_type' => '业务类型',

View File

@@ -25,6 +25,7 @@ return [
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作組工資',
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '種子被下載',
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => '收到獎勵',
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT => '收到禮物',
],
'fields' => [
'business_type' => '業務類型',