mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:48:51 +08:00
record mybouns page bonus consume log
This commit is contained in:
@@ -17,6 +17,13 @@ class BonusLogs extends NexusModel
|
|||||||
const BUSINESS_TYPE_BUY_ATTENDANCE_CARD = 3;
|
const BUSINESS_TYPE_BUY_ATTENDANCE_CARD = 3;
|
||||||
const BUSINESS_TYPE_STICKY_PROMOTION = 4;
|
const BUSINESS_TYPE_STICKY_PROMOTION = 4;
|
||||||
const BUSINESS_TYPE_POST_REWARD = 5;
|
const BUSINESS_TYPE_POST_REWARD = 5;
|
||||||
|
const BUSINESS_TYPE_EXCHANGE_UPLOAD = 6;
|
||||||
|
const BUSINESS_TYPE_EXCHANGE_INVITE = 7;
|
||||||
|
const BUSINESS_TYPE_CUSTOM_TITLE = 8;
|
||||||
|
const BUSINESS_TYPE_BUY_VIP = 9;
|
||||||
|
const BUSINESS_TYPE_GIFT_TO_SOMEONE = 10;
|
||||||
|
const BUSINESS_TYPE_NO_AD = 11;
|
||||||
|
const BUSINESS_TYPE_GIFT_TO_LOW_SHARE_RATIO = 12;
|
||||||
|
|
||||||
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'],
|
||||||
@@ -24,6 +31,13 @@ class BonusLogs extends NexusModel
|
|||||||
self::BUSINESS_TYPE_BUY_ATTENDANCE_CARD => ['text' => 'Buy attendance card'],
|
self::BUSINESS_TYPE_BUY_ATTENDANCE_CARD => ['text' => 'Buy attendance card'],
|
||||||
self::BUSINESS_TYPE_STICKY_PROMOTION => ['text' => 'Buy torrent sticky promotion'],
|
self::BUSINESS_TYPE_STICKY_PROMOTION => ['text' => 'Buy torrent sticky promotion'],
|
||||||
self::BUSINESS_TYPE_POST_REWARD => ['text' => 'Reward post'],
|
self::BUSINESS_TYPE_POST_REWARD => ['text' => 'Reward post'],
|
||||||
|
self::BUSINESS_TYPE_EXCHANGE_UPLOAD => ['text' => 'Exchange upload'],
|
||||||
|
self::BUSINESS_TYPE_EXCHANGE_INVITE => ['text' => 'Exchange invite'],
|
||||||
|
self::BUSINESS_TYPE_CUSTOM_TITLE => ['text' => 'Custom title'],
|
||||||
|
self::BUSINESS_TYPE_BUY_VIP => ['text' => 'Buy VIP'],
|
||||||
|
self::BUSINESS_TYPE_GIFT_TO_SOMEONE => ['text' => 'Gift to someone'],
|
||||||
|
self::BUSINESS_TYPE_NO_AD => ['text' => 'No ad'],
|
||||||
|
self::BUSINESS_TYPE_GIFT_TO_LOW_SHARE_RATIO => ['text' => 'Gift to low share ratio'],
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function getBonusForCancelHitAndRun()
|
public static function getBonusForCancelHitAndRun()
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ class User extends Authenticatable implements FilamentUser, HasName
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'username', 'email', 'passhash', 'secret', 'stylesheet', 'editsecret', 'added', 'modcomment', 'enabled', 'status',
|
'username', 'email', 'passhash', 'secret', 'stylesheet', 'editsecret', 'added', 'modcomment', 'enabled', 'status',
|
||||||
'leechwarn', 'leechwarnuntil', 'page', 'class', 'uploaded', 'downloaded', 'clientselect', 'showclienterror', 'last_home',
|
'leechwarn', 'leechwarnuntil', 'page', 'class', 'uploaded', 'downloaded', 'clientselect', 'showclienterror', 'last_home',
|
||||||
'seedbonus', 'bonuscomment', 'downloadpos'
|
'seedbonus', 'bonuscomment', 'downloadpos', 'vip_added', 'vip_until', 'title',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -95,28 +95,35 @@ class BonusRepository extends BaseRepository
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function consumeUserBonus($user, $requireBonus, $logBusinessType, $logComment = '')
|
public function consumeUserBonus($user, $requireBonus, $logBusinessType, $logComment = '', array $userUpdates = [])
|
||||||
{
|
{
|
||||||
|
if (!isset(BonusLogs::$businessTypes[$logBusinessType])) {
|
||||||
|
throw new \InvalidArgumentException("Invalid logBusinessType: $logBusinessType");
|
||||||
|
}
|
||||||
|
if (isset($userUpdates['seedbonus']) || isset($userUpdates['bonuscomment'])) {
|
||||||
|
throw new \InvalidArgumentException("Not support update seedbonus or bonuscomment");
|
||||||
|
}
|
||||||
if ($requireBonus <= 0) {
|
if ($requireBonus <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$user = $this->getUser($user);
|
||||||
if ($user->seedbonus < $requireBonus) {
|
if ($user->seedbonus < $requireBonus) {
|
||||||
do_log("user: {$user->id}, bonus: {$user->seedbonus} < requireBonus: $requireBonus", 'error');
|
do_log("user: {$user->id}, bonus: {$user->seedbonus} < requireBonus: $requireBonus", 'error');
|
||||||
throw new \LogicException("User bonus point not enough.");
|
throw new \LogicException("User bonus point not enough.");
|
||||||
}
|
}
|
||||||
NexusDB::transaction(function () use ($user, $requireBonus, $logBusinessType, $logComment) {
|
NexusDB::transaction(function () use ($user, $requireBonus, $logBusinessType, $logComment, $userUpdates) {
|
||||||
|
$logComment = addslashes($logComment);
|
||||||
$bonusComment = date('Y-m-d') . " - $logComment";
|
$bonusComment = date('Y-m-d') . " - $logComment";
|
||||||
$oldUserBonus = $user->seedbonus;
|
$oldUserBonus = $user->seedbonus;
|
||||||
$newUserBonus = bcsub($oldUserBonus, $requireBonus);
|
$newUserBonus = bcsub($oldUserBonus, $requireBonus);
|
||||||
$log = "user: {$user->id}, requireBonus: $requireBonus, oldUserBonus: $oldUserBonus, newUserBonus: $newUserBonus, logBusinessType: $logBusinessType, logComment: $logComment";
|
$log = "user: {$user->id}, requireBonus: $requireBonus, oldUserBonus: $oldUserBonus, newUserBonus: $newUserBonus, logBusinessType: $logBusinessType, logComment: $logComment";
|
||||||
do_log($log);
|
do_log($log);
|
||||||
|
$userUpdates['seedbonus'] = $newUserBonus;
|
||||||
|
$userUpdates['bonuscomment'] = NexusDB::raw("if(bonuscomment = '', '$bonusComment', concat_ws('\n', '$bonusComment', bonuscomment))");
|
||||||
$affectedRows = NexusDB::table($user->getTable())
|
$affectedRows = NexusDB::table($user->getTable())
|
||||||
->where('id', $user->id)
|
->where('id', $user->id)
|
||||||
->where('seedbonus', $oldUserBonus)
|
->where('seedbonus', $oldUserBonus)
|
||||||
->update([
|
->update($userUpdates);
|
||||||
'seedbonus' => $newUserBonus,
|
|
||||||
'bonuscomment' => NexusDB::raw("if(bonuscomment = '', '$bonusComment', concat_ws('\n', '$bonusComment', bonuscomment))")
|
|
||||||
]);
|
|
||||||
if ($affectedRows != 1) {
|
if ($affectedRows != 1) {
|
||||||
do_log("update user seedbonus affected rows != 1, query: " . last_query(), 'error');
|
do_log("update user seedbonus affected rows != 1, query: " . last_query(), 'error');
|
||||||
throw new \RuntimeException("Update user seedbonus fail.");
|
throw new \RuntimeException("Update user seedbonus fail.");
|
||||||
@@ -127,7 +134,7 @@ class BonusRepository extends BaseRepository
|
|||||||
'old_total_value' => $oldUserBonus,
|
'old_total_value' => $oldUserBonus,
|
||||||
'value' => $requireBonus,
|
'value' => $requireBonus,
|
||||||
'new_total_value' => $newUserBonus,
|
'new_total_value' => $newUserBonus,
|
||||||
'comment' => $logComment,
|
'comment' => sprintf('[%s] %s', BonusLogs::$businessTypes[$logBusinessType]['text'], $logComment),
|
||||||
];
|
];
|
||||||
BonusLogs::query()->insert($bonusLog);
|
BonusLogs::query()->insert($bonusLog);
|
||||||
do_log("bonusLog: " . nexus_json_encode($bonusLog));
|
do_log("bonusLog: " . nexus_json_encode($bonusLog));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.19');
|
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.19');
|
||||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-07-24');
|
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-07-25');
|
||||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||||
|
|||||||
+27
-21
@@ -484,6 +484,7 @@ if ($action == "exchange") {
|
|||||||
$seedbonus=$CURUSER['seedbonus']-$points;
|
$seedbonus=$CURUSER['seedbonus']-$points;
|
||||||
|
|
||||||
if($CURUSER['seedbonus'] >= $points) {
|
if($CURUSER['seedbonus'] >= $points) {
|
||||||
|
$bonusRep = new \App\Repositories\BonusRepository();
|
||||||
//=== trade for upload
|
//=== trade for upload
|
||||||
if($art == "traffic") {
|
if($art == "traffic") {
|
||||||
if ($CURUSER['uploaded'] > $dlamountlimit_bonus * 1073741824)//uploaded amount reach limit
|
if ($CURUSER['uploaded'] > $dlamountlimit_bonus * 1073741824)//uploaded amount reach limit
|
||||||
@@ -494,8 +495,9 @@ if ($action == "exchange") {
|
|||||||
else {
|
else {
|
||||||
$upload = $CURUSER['uploaded'];
|
$upload = $CURUSER['uploaded'];
|
||||||
$up = $upload + $bonusarray['menge'];
|
$up = $upload + $bonusarray['menge'];
|
||||||
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for upload bonus.\n " .$bonuscomment;
|
// $bonuscomment = date("Y-m-d") . " - " .$points. " Points for upload bonus.\n " .$bonuscomment;
|
||||||
sql_query("UPDATE users SET uploaded = ".sqlesc($up).", seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
|
// sql_query("UPDATE users SET uploaded = ".sqlesc($up).", seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_EXCHANGE_UPLOAD, $points. " Points for upload bonus.", ['uploaded' => $up]);
|
||||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=upload");
|
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=upload");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -507,9 +509,10 @@ if ($action == "exchange") {
|
|||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
$vip_until = date("Y-m-d H:i:s",(strtotime(date("Y-m-d H:i:s")) + 28*86400));
|
$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);
|
// $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, bonuscomment=".sqlesc($bonuscomment)." 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");
|
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_BUY_VIP, $points. " Points for 1 month VIP Status.", ['class' => UC_VIP, 'vip_added' => 'yes', 'vip_until' => $vip_until]);
|
||||||
|
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=vip");
|
||||||
}
|
}
|
||||||
//=== trade for invites
|
//=== trade for invites
|
||||||
elseif($art == "invite") {
|
elseif($art == "invite") {
|
||||||
@@ -517,9 +520,10 @@ if ($action == "exchange") {
|
|||||||
die(get_user_class_name($buyinvite_class,false,false,true).$lang_mybonus['text_plus_only']);
|
die(get_user_class_name($buyinvite_class,false,false,true).$lang_mybonus['text_plus_only']);
|
||||||
$invites = $CURUSER['invites'];
|
$invites = $CURUSER['invites'];
|
||||||
$inv = $invites+$bonusarray['menge'];
|
$inv = $invites+$bonusarray['menge'];
|
||||||
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for invites.\n " .htmlspecialchars($bonuscomment);
|
// $bonuscomment = date("Y-m-d") . " - " .$points. " Points for invites.\n " .htmlspecialchars($bonuscomment);
|
||||||
sql_query("UPDATE users SET invites = ".sqlesc($inv).", seedbonus = seedbonus - $points, bonuscomment=".sqlesc($bonuscomment)." 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");
|
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_EXCHANGE_INVITE, $points. " Points for invites.", ['invites' => $inv, ]);
|
||||||
|
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=invite");
|
||||||
}
|
}
|
||||||
//=== trade for special title
|
//=== trade for special title
|
||||||
/**** the $words array are words that you DO NOT want the user to have... use to filter "bad words" & user class...
|
/**** the $words array are words that you DO NOT want the user to have... use to filter "bad words" & user class...
|
||||||
@@ -528,21 +532,22 @@ if ($action == "exchange") {
|
|||||||
elseif($art == "title") {
|
elseif($art == "title") {
|
||||||
//===custom title
|
//===custom title
|
||||||
$title = $_POST["title"];
|
$title = $_POST["title"];
|
||||||
$title = sqlesc($title);
|
|
||||||
$words = array("fuck", "shit", "pussy", "cunt", "nigger", "Staff Leader","SysOp", "Administrator","Moderator","Uploader","Retiree","VIP","Nexus Master","Ultimate User","Extreme User","Veteran User","Insane User","Crazy User","Elite User","Power User","User","Peasant","Champion");
|
$words = array("fuck", "shit", "pussy", "cunt", "nigger", "Staff Leader","SysOp", "Administrator","Moderator","Uploader","Retiree","VIP","Nexus Master","Ultimate User","Extreme User","Veteran User","Insane User","Crazy User","Elite User","Power User","User","Peasant","Champion");
|
||||||
$title = str_replace($words, $lang_mybonus['text_wasted_karma'], $title);
|
$title = str_replace($words, $lang_mybonus['text_wasted_karma'], $title);
|
||||||
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for custom title. Old title is ".htmlspecialchars(trim($CURUSER["title"]))." and new title is $title\n " .htmlspecialchars($bonuscomment);
|
// $bonuscomment = date("Y-m-d") . " - " .$points. " Points for custom title. Old title is ".htmlspecialchars(trim($CURUSER["title"]))." and new title is $title\n " .htmlspecialchars($bonuscomment);
|
||||||
sql_query("UPDATE users SET title = $title, seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
|
// sql_query("UPDATE users SET title = ".sqlesc($title).", seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
|
||||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=title");
|
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_CUSTOM_TITLE, $points. " Points for custom title. Old title is ".htmlspecialchars(trim($CURUSER["title"]))." and new title is $title.", ['title' => $title, ]);
|
||||||
|
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=title");
|
||||||
}
|
}
|
||||||
elseif($art == "noad" && $enablead_advertisement == 'yes' && $enablebonusnoad_advertisement == 'yes') {
|
elseif($art == "noad" && $enablead_advertisement == 'yes' && $enablebonusnoad_advertisement == 'yes') {
|
||||||
if (($enablenoad_advertisement == 'yes' && get_user_class() >= $noad_advertisement) || strtotime($CURUSER['noaduntil']) >= TIMENOW || get_user_class() < $bonusnoad_advertisement)
|
if (($enablenoad_advertisement == 'yes' && get_user_class() >= $noad_advertisement) || strtotime($CURUSER['noaduntil']) >= TIMENOW || get_user_class() < $bonusnoad_advertisement)
|
||||||
die($lang_mybonus['text_cheat_alert']);
|
die($lang_mybonus['text_cheat_alert']);
|
||||||
else{
|
else{
|
||||||
$noaduntil = date("Y-m-d H:i:s",(TIMENOW + $bonusarray['menge']));
|
$noaduntil = date("Y-m-d H:i:s",(TIMENOW + $bonusarray['menge']));
|
||||||
$bonuscomment = date("Y-m-d") . " - " .$points. " Points for ".$bonusnoadtime_advertisement." days without ads.\n " .htmlspecialchars($bonuscomment);
|
// $bonuscomment = date("Y-m-d") . " - " .$points. " Points for ".$bonusnoadtime_advertisement." days without ads.\n " .htmlspecialchars($bonuscomment);
|
||||||
sql_query("UPDATE users SET noad='yes', noaduntil='".$noaduntil."', seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id=".sqlesc($userid));
|
// sql_query("UPDATE users SET noad='yes', noaduntil='".$noaduntil."', seedbonus = seedbonus - $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id=".sqlesc($userid));
|
||||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=noad");
|
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_NO_AD, $points. " Points for ".$bonusnoadtime_advertisement." days without ads.", ['noad' => 'yes', 'noaduntil' => $noaduntil]);
|
||||||
|
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=noad");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif($art == 'gift_2') // charity giving
|
elseif($art == 'gift_2') // charity giving
|
||||||
@@ -561,13 +566,14 @@ if ($action == "exchange") {
|
|||||||
}
|
}
|
||||||
if($CURUSER['seedbonus'] >= $points) {
|
if($CURUSER['seedbonus'] >= $points) {
|
||||||
$points2= number_format($points,1);
|
$points2= number_format($points,1);
|
||||||
$bonuscomment = date("Y-m-d") . " - " .$points2. " Points as charity to users with ratio below ".htmlspecialchars(trim($ratiocharity)).".\n " .htmlspecialchars($bonuscomment);
|
// $bonuscomment = date("Y-m-d") . " - " .$points2. " Points as charity to users with ratio below ".htmlspecialchars(trim($ratiocharity)).".\n " .htmlspecialchars($bonuscomment);
|
||||||
$charityReceiverCount = get_row_count("users", "WHERE enabled='yes' AND 10737418240 < downloaded AND $ratiocharity > uploaded/downloaded");
|
$charityReceiverCount = get_row_count("users", "WHERE enabled='yes' AND 10737418240 < downloaded AND $ratiocharity > uploaded/downloaded");
|
||||||
if ($charityReceiverCount) {
|
if ($charityReceiverCount) {
|
||||||
sql_query("UPDATE users SET seedbonus = seedbonus - $points, charity = charity + $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
|
// sql_query("UPDATE users SET seedbonus = seedbonus - $points, charity = charity + $points, bonuscomment = ".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
|
||||||
|
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_GIFT_TO_LOW_SHARE_RATIO, $points. " Points as charity to users with ratio below ".htmlspecialchars(trim($ratiocharity)).".", ['charity' => \Nexus\Database\NexusDB::raw("charity + $points"), ]);
|
||||||
$charityPerUser = $points/$charityReceiverCount;
|
$charityPerUser = $points/$charityReceiverCount;
|
||||||
sql_query("UPDATE users SET seedbonus = seedbonus + $charityPerUser WHERE enabled='yes' AND 10737418240 < downloaded AND $ratiocharity > uploaded/downloaded") or sqlerr(__FILE__, __LINE__);
|
sql_query("UPDATE users SET seedbonus = seedbonus + $charityPerUser WHERE enabled='yes' AND 10737418240 < downloaded AND $ratiocharity > uploaded/downloaded") or sqlerr(__FILE__, __LINE__);
|
||||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=charity");
|
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=charity");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -596,7 +602,7 @@ if ($action == "exchange") {
|
|||||||
}
|
}
|
||||||
if($CURUSER['seedbonus'] >= $points) {
|
if($CURUSER['seedbonus'] >= $points) {
|
||||||
$points2= number_format($points,1);
|
$points2= number_format($points,1);
|
||||||
$bonuscomment = date("Y-m-d") . " - " .$points2. " Points as gift to ".htmlspecialchars(trim($_POST["username"])).".\n " .htmlspecialchars($bonuscomment);
|
// $bonuscomment = date("Y-m-d") . " - " .$points2. " Points as gift to ".htmlspecialchars(trim($_POST["username"])).".\n " .htmlspecialchars($bonuscomment);
|
||||||
|
|
||||||
$aftertaxpoint = $points;
|
$aftertaxpoint = $points;
|
||||||
if ($taxpercentage_bonus)
|
if ($taxpercentage_bonus)
|
||||||
@@ -617,7 +623,8 @@ if ($action == "exchange") {
|
|||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
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"])));
|
||||||
sql_query("UPDATE users SET seedbonus = seedbonus + $aftertaxpoint, bonuscomment = ".sqlesc($newreceiverbonuscomment)." WHERE id = ".sqlesc($useridgift));
|
sql_query("UPDATE users SET seedbonus = seedbonus + $aftertaxpoint, bonuscomment = ".sqlesc($newreceiverbonuscomment)." WHERE id = ".sqlesc($useridgift));
|
||||||
|
|
||||||
//===send message
|
//===send message
|
||||||
@@ -640,7 +647,6 @@ if ($action == "exchange") {
|
|||||||
stderr("Error","Invalid H&R ID: " . ($_POST['hr_id'] ?? ''), false, false);
|
stderr("Error","Invalid H&R ID: " . ($_POST['hr_id'] ?? ''), false, false);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$bonusRep = new \App\Repositories\BonusRepository();
|
|
||||||
$bonusRep->consumeToCancelHitAndRun($userid, $_POST['hr_id']);
|
$bonusRep->consumeToCancelHitAndRun($userid, $_POST['hr_id']);
|
||||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=cancel_hr");
|
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=cancel_hr");
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
|
|||||||
Reference in New Issue
Block a user