Add (ai gen)

This commit is contained in:
2023-10-01 04:35:44 +08:00
parent fcfd320215
commit 165328b7fd
3 changed files with 23 additions and 17 deletions

View File

@@ -52,15 +52,15 @@ function get_smartproxy_server()
}
if (! function_exists('calculate_smartproxy_cost')) {
function calculate_smartproxy_cost(float $kb, $amplifier = 1)
function calculate_smartproxy_cost(float $kb, $type = 'rotating_global')
{
$cost_per_gb = config('platform.proxy.smartproxy.rotating_global.cost_per_gb');
$cost_per_gb = config("platform.proxy.smartproxy.{$type}.cost_per_gb");
// Convert cost per GB to cost per KB
$cost_per_kb = $cost_per_gb / (1024 * 1024);
// Calculate total cost for the given $kb
$cost = ($cost_per_kb * $kb) * $amplifier;
$cost = ($cost_per_kb * $kb);
return round($cost, 3);
}