mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
fix CalculateUserSeedBonus reset user seedbouns/seed_points
This commit is contained in:
@@ -63,7 +63,7 @@ class TorrentController extends Controller
|
|||||||
$resource = new TorrentResource($torrent);
|
$resource = new TorrentResource($torrent);
|
||||||
$additional = [];
|
$additional = [];
|
||||||
if ($this->hasExtraField('bonus_reward_values')) {
|
if ($this->hasExtraField('bonus_reward_values')) {
|
||||||
$additional['bonus_reward_values'] = Torrent::BONUS_REWARD_VALUES;
|
$additional['bonus_reward_values'] = Setting::getBonusRewardOptions();
|
||||||
}
|
}
|
||||||
$extraSettingsNames = ['torrent.claim_torrent_user_counts_up_limit'];
|
$extraSettingsNames = ['torrent.claim_torrent_user_counts_up_limit'];
|
||||||
$this->appendExtraSettings($additional, $extraSettingsNames);
|
$this->appendExtraSettings($additional, $extraSettingsNames);
|
||||||
|
|||||||
@@ -107,10 +107,15 @@ class CalculateUserSeedBonus implements ShouldQueue
|
|||||||
$bonusLog = "[CLEANUP_CLI_CALCULATE_SEED_BONUS_HANDLE_USER], user: $uid, seedBonusResult: " . nexus_json_encode($seedBonusResult);
|
$bonusLog = "[CLEANUP_CLI_CALCULATE_SEED_BONUS_HANDLE_USER], user: $uid, seedBonusResult: " . nexus_json_encode($seedBonusResult);
|
||||||
$all_bonus = $basicBonus = $seedBonusResult['seed_bonus'];
|
$all_bonus = $basicBonus = $seedBonusResult['seed_bonus'];
|
||||||
$bonusLog .= ", all_bonus: $all_bonus";
|
$bonusLog .= ", all_bonus: $all_bonus";
|
||||||
if ($all_bonus == 0) {
|
/**
|
||||||
do_log("$bonusLog, all_bonus is zero, skip");
|
* BUG: can't add this, case when not include info in where condition $idStr will be reset to 0
|
||||||
continue;
|
* // BUG: 不能添加这部分,case when 不包含某些 uid 的数据,而 $idStr 里面又有,会被重置为 0
|
||||||
}
|
* // 而且 seed_points_per_hour, seeding count/size 这些也是要实时更新为0的,不能添加这个跳过。
|
||||||
|
*/
|
||||||
|
// if ($all_bonus == 0) {
|
||||||
|
// do_log("$bonusLog, all_bonus is zero, skip");
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
if ($isDonor && $donortimes_bonus != 0) {
|
if ($isDonor && $donortimes_bonus != 0) {
|
||||||
$donorAddition = $basicBonus * $donortimes_bonus;
|
$donorAddition = $basicBonus * $donortimes_bonus;
|
||||||
$all_bonus += $donorAddition;
|
$all_bonus += $donorAddition;
|
||||||
@@ -146,7 +151,7 @@ class CalculateUserSeedBonus implements ShouldQueue
|
|||||||
$seedingTorrentSizeUpdates[] = sprintf("when %d then %f", $uid, $seedBonusResult['size']);
|
$seedingTorrentSizeUpdates[] = sprintf("when %d then %f", $uid, $seedBonusResult['size']);
|
||||||
$seedBonusUpdates[] = sprintf("when %d then seedbonus + %f", $uid, $all_bonus);
|
$seedBonusUpdates[] = sprintf("when %d then seedbonus + %f", $uid, $all_bonus);
|
||||||
//here before/after not correct, don't record it, fill with -1
|
//here before/after not correct, don't record it, fill with -1
|
||||||
$this->appendBonusLogInsert($bonusLogInsert, $uid, [
|
$this->appendBonusLogInsert($bonusLogInsert, $userInfo, [
|
||||||
BonusLogs::BUSINESS_TYPE_SEEDING_BASIC => $basicBonus,
|
BonusLogs::BUSINESS_TYPE_SEEDING_BASIC => $basicBonus,
|
||||||
BonusLogs::BUSINESS_TYPE_SEEDING_DONOR_ADDITION => $donorAddition,
|
BonusLogs::BUSINESS_TYPE_SEEDING_DONOR_ADDITION => $donorAddition,
|
||||||
BonusLogs::BUSINESS_TYPE_SEEDING_OFFICIAL_ADDITION => $officialAddition,
|
BonusLogs::BUSINESS_TYPE_SEEDING_OFFICIAL_ADDITION => $officialAddition,
|
||||||
@@ -198,13 +203,13 @@ class CalculateUserSeedBonus implements ShouldQueue
|
|||||||
do_log("failed: " . $exception->getMessage() . $exception->getTraceAsString(), 'error');
|
do_log("failed: " . $exception->getMessage() . $exception->getTraceAsString(), 'error');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function appendBonusLogInsert(array &$bonusLogInsert, int $userId, array $typeValues): void
|
private function appendBonusLogInsert(array &$bonusLogInsert, array $userInfo, array $typeValues): void
|
||||||
{
|
{
|
||||||
foreach ($typeValues as $type => $value) {
|
foreach ($typeValues as $type => $value) {
|
||||||
if ($value > 0) {
|
if ($value > 0) {
|
||||||
$bonusLogInsert[] = [
|
$bonusLogInsert[] = [
|
||||||
'business_type' => $type,
|
'business_type' => $type,
|
||||||
'uid' => $userId,
|
'uid' => $userInfo['id'],
|
||||||
'old_total_value' => -1,
|
'old_total_value' => -1,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'new_total_value' => -1,
|
'new_total_value' => -1,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.9.7');
|
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.9.7');
|
||||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-09-08');
|
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-09-11');
|
||||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||||
|
|||||||
Reference in New Issue
Block a user