reward bonus options configurable

This commit is contained in:
xiaomlove
2025-09-08 11:22:55 +07:00
parent 928c371d6a
commit 6411cdc72e
6 changed files with 19 additions and 7 deletions

View File

@@ -308,5 +308,14 @@ class Setting extends NexusModel
return (int)self::get("bonus.min_size");
}
public static function getBonusRewardOptions(): array
{
$result = self::get("torrent.reward_bonus_options");
if (!empty($result)) {
return preg_split('/[,\s]+/', trim($result));
}
return Torrent::BONUS_REWARD_VALUES;
}
}

View File

@@ -821,6 +821,8 @@ $lang_settings = array
'row_min_size' => '起步体积',
'text_bonus_mini_size' => '要求种子的体积最小为',
'text_bonus_mini_size_help' => '。小于此体积的种子不参与魔力计算。单位:字节(Byte),如 1 Byte = 1024 KiB。',
'row_reward_bonus_options' => '魔力值奖励选项',
'text_reward_bonus_options_note' => '种子详情页的魔力值奖励选项,多个用英文逗号分割',
);
?>

View File

@@ -819,6 +819,8 @@ $lang_settings = array
'row_min_size' => '起步體積',
'text_bonus_mini_size' => '要求種子的體積最小爲',
'text_bonus_mini_size_help' => '。小於此體積的種子不參與魔力計算。單位:字節(Byte),如 1 Byte = 1024 KiB。',
'row_reward_bonus_options' => '魔力值獎勵選項',
'text_reward_bonus_options_note' => '種子詳情頁的魔力值獎勵選項,多個用英文逗號分割',
);
?>

View File

@@ -819,6 +819,8 @@ $lang_settings = array
'row_min_size' => 'Minimum volume',
'text_bonus_mini_size'=> 'The minimum volume required for torrent is',
'text_bonus_mini_size_help' => '. Torrent size smaller than this volume are not included in the bonus calculation. Unit: bytes (Byte), e.g., 1 Byte = 1024 KiB.',
'row_reward_bonus_options' => 'Reward Bonus Options',
'text_reward_bonus_options_note' => 'Reward bonus options on the torrent details page, multiple options separated by commas',
);
?>

View File

@@ -546,11 +546,7 @@ echo "</script>";
}
//Add 魔力值奖励功能
if(isset($magic_value_bonus)){
$bonus_array = $magic_value_bonus;
}else{
$bonus_array = implode(',', \App\Models\Torrent::BONUS_REWARD_VALUES);
}
$bonus_array = \App\Models\Setting::getBonusRewardOptions();
echo '<style type="text/css">
ul.magic
{
@@ -573,7 +569,7 @@ echo "</script>";
$magic_value_button = '';
if ($CURUSER['id'] <> $row['owner']) {
$arr_temp = explode(',',$bonus_array);
$arr_temp = $bonus_array;
$bonus_has = $CURUSER['seedbonus'];
if(intval($bonus_has) < intval($arr_temp[0])){
$error_bonus_message = $lang_details['magic_have_no_enough_bonus_value'];

View File

@@ -158,7 +158,7 @@ elseif($action == 'savesettings_torrent') // save account
'thirtypercentleechbecome', 'expirethirtypercentleech', 'sticky_first_level_background_color', 'sticky_second_level_background_color',
'download_support_passkey', 'claim_enabled', 'claim_torrent_ttl', 'claim_torrent_user_counts_up_limit', 'claim_user_torrent_counts_up_limit', 'claim_remove_deduct_user_bonus',
'claim_give_up_deduct_user_bonus', 'claim_bonus_multiplier', 'claim_reach_standard_seed_time', 'claim_reach_standard_uploaded', 'approval_status_icon_enabled', 'approval_status_none_visible',
'nfo_view_style_default', 'tax_factor', 'max_price', 'paid_torrent_enabled'
'nfo_view_style_default', 'tax_factor', 'max_price', 'paid_torrent_enabled', 'reward_bonus_options'
);
$validConfig = apply_filter('setting_valid_config', $validConfig);
GetVar($validConfig);
@@ -747,6 +747,7 @@ elseif ($action == 'torrentsettings')
yesorno($lang_settings['row_paid_torrent_enabled'], 'paid_torrent_enabled', $TORRENT["paid_torrent_enabled"], $lang_settings['text_paid_torrent_enabled_note']);
tr($lang_settings['row_tax_factor'],"<input type='number' name=tax_factor style=\"width: 100px\" value={$TORRENT['tax_factor']}> ".$lang_settings['text_tax_factor_note'], 1);
tr($lang_settings['row_max_price'],"<input type='number' name=max_price style=\"width: 100px\" value={$TORRENT['max_price']}> ".$lang_settings['text_max_price_note'], 1);
tr($lang_settings['row_reward_bonus_options'],"<input type='text' name=reward_bonus_options style=\"width: 200px\" value={$TORRENT['reward_bonus_options']}> ".$lang_settings['text_reward_bonus_options_note'], 1);
// yesorno($lang_settings['row_promotion_rules'], 'prorules', $TORRENT["prorules"], $lang_settings['text_promotion_rules_note']);
tr($lang_settings['row_random_promotion'], $lang_settings['text_random_promotion_note_one']."<ul><li><input type='text' style=\"width: 50px\" name=randomhalfleech value='".(isset($TORRENT["randomhalfleech"]) ? $TORRENT["randomhalfleech"] : 5 )."'>".$lang_settings['text_halfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomfree value='".(isset($TORRENT["randomfree"]) ? $TORRENT["randomfree"] : 2 )."'>".$lang_settings['text_free_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoup value='".(isset($TORRENT["randomtwoup"]) ? $TORRENT["randomtwoup"] : 2 )."'>".$lang_settings['text_twoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoupfree value='".(isset($TORRENT["randomtwoupfree"]) ? $TORRENT["randomtwoupfree"] : 1 )."'>".$lang_settings['text_freetwoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwouphalfdown value='".(isset($TORRENT["randomtwouphalfdown"]) ? $TORRENT["randomtwouphalfdown"] : 0 )."'>".$lang_settings['text_twouphalfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomthirtypercentdown value='".(isset($TORRENT["randomthirtypercentdown"]) ? $TORRENT["randomthirtypercentdown"] : 0 )."'>".$lang_settings['text_thirtypercentleech_chance_becoming']."</li></ul>".$lang_settings['text_random_promotion_note_two'], 1);