mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-28 06:57:22 +08:00
fix send gift
This commit is contained in:
@@ -44,6 +44,7 @@ class BonusLogs extends NexusModel
|
|||||||
const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000;
|
const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000;
|
||||||
const BUSINESS_TYPE_TORRENT_BE_DOWNLOADED = 1001;
|
const BUSINESS_TYPE_TORRENT_BE_DOWNLOADED = 1001;
|
||||||
const BUSINESS_TYPE_RECEIVE_REWARD = 1002;
|
const BUSINESS_TYPE_RECEIVE_REWARD = 1002;
|
||||||
|
const BUSINESS_TYPE_RECEIVE_GIFT = 1003;
|
||||||
|
|
||||||
public static array $businessTypes = [
|
public static array $businessTypes = [
|
||||||
self::BUSINESS_TYPE_CANCEL_HIT_AND_RUN => ['text' => 'Cancel H&R'],
|
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_ROLE_WORK_SALARY => ['text' => 'Role work salary'],
|
||||||
self::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => ['text' => 'Torrent be downloaded'],
|
self::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => ['text' => 'Torrent be downloaded'],
|
||||||
self::BUSINESS_TYPE_RECEIVE_REWARD => ['text' => 'Receive reward'],
|
self::BUSINESS_TYPE_RECEIVE_REWARD => ['text' => 'Receive reward'],
|
||||||
|
self::BUSINESS_TYPE_RECEIVE_GIFT => ['text' => 'Receive gift'],
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getBusinessTypeTextAttribute()
|
public function getBusinessTypeTextAttribute()
|
||||||
|
|||||||
+5
-4
@@ -728,7 +728,7 @@ if ($action == "exchange") {
|
|||||||
$message = $_POST["message"];
|
$message = $_POST["message"];
|
||||||
//==gift for peeps with no more options
|
//==gift for peeps with no more options
|
||||||
$usernamegift = sqlesc(trim($_POST["username"]));
|
$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);
|
$arr = mysql_fetch_assoc($res);
|
||||||
if (empty($arr)) {
|
if (empty($arr)) {
|
||||||
stdmsg($lang_mybonus['text_error'], $lang_mybonus['text_receiver_not_exists'], 0);
|
stdmsg($lang_mybonus['text_error'], $lang_mybonus['text_receiver_not_exists'], 0);
|
||||||
@@ -737,7 +737,7 @@ if ($action == "exchange") {
|
|||||||
}
|
}
|
||||||
$useridgift = $arr['id'];
|
$useridgift = $arr['id'];
|
||||||
$userseedbonus = $arr['seedbonus'];
|
$userseedbonus = $arr['seedbonus'];
|
||||||
$receiverbonuscomment = $arr['bonuscomment'];
|
// $receiverbonuscomment = $arr['bonuscomment'];
|
||||||
if (!is_numeric($points) || $points < $bonusarray['points']) {
|
if (!is_numeric($points) || $points < $bonusarray['points']) {
|
||||||
//write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is hacking bonus system",'mod');
|
//write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is hacking bonus system",'mod');
|
||||||
stdmsg($lang_mybonus['text_error'], $lang_mybonus['bonus_amount_not_allowed']);
|
stdmsg($lang_mybonus['text_error'], $lang_mybonus['bonus_amount_not_allowed']);
|
||||||
@@ -755,7 +755,7 @@ if ($action == "exchange") {
|
|||||||
$aftertaxpoint -= $basictax_bonus;
|
$aftertaxpoint -= $basictax_bonus;
|
||||||
|
|
||||||
$points2receiver = number_format($aftertaxpoint,1);
|
$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){
|
if ($userid==$useridgift){
|
||||||
stdmsg($lang_mybonus['text_huh'], $lang_mybonus['text_karma_self_giving_warning'], 0);
|
stdmsg($lang_mybonus['text_huh'], $lang_mybonus['text_karma_self_giving_warning'], 0);
|
||||||
stdfoot();
|
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__);
|
// 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"])));
|
$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
|
//===send message
|
||||||
$subject = sqlesc($lang_mybonus_target[get_user_lang($useridgift)]['msg_someone_loves_you']);
|
$subject = sqlesc($lang_mybonus_target[get_user_lang($useridgift)]['msg_someone_loves_you']);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ return [
|
|||||||
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => 'Role work salary',
|
\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_TORRENT_BE_DOWNLOADED => 'Torrent be downloaded',
|
||||||
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => 'Receive reward',
|
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => 'Receive reward',
|
||||||
|
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT => 'Receive gift',
|
||||||
],
|
],
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'business_type' => 'Business type',
|
'business_type' => 'Business type',
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ return [
|
|||||||
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作组工资',
|
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作组工资',
|
||||||
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '种子被下载',
|
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '种子被下载',
|
||||||
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => '收到奖励',
|
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => '收到奖励',
|
||||||
|
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT => '收到礼物',
|
||||||
],
|
],
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'business_type' => '业务类型',
|
'business_type' => '业务类型',
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ return [
|
|||||||
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作組工資',
|
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作組工資',
|
||||||
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '種子被下載',
|
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '種子被下載',
|
||||||
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => '收到獎勵',
|
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_REWARD => '收到獎勵',
|
||||||
|
\App\Models\BonusLogs::BUSINESS_TYPE_RECEIVE_GIFT => '收到禮物',
|
||||||
],
|
],
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'business_type' => '業務類型',
|
'business_type' => '業務類型',
|
||||||
|
|||||||
Reference in New Issue
Block a user