时间:2021-07-01 10:21:17 帮助过:33人阅读
/**
* @param $fee 投资金额
* @param $yield 收益率
* @return array 每级可获取的金钱:array('level' => 'money',...)
*/
public static function distribution($fee, $yield)
{
$money = array();
$total = 10; //分销最低等级:总共有多少个分销级
$money[1] = $fee * $yield;
if($fee < 50000)
{
$royalty = 1.3; //百分号
}
elseif($fee < 200000)
{
$royalty = 1.4;
}
elseif($fee < 500000)
{
$royalty = 1.55;
}
elseif($fee < 800000)
{
$royalty = 1.7;
}
elseif($fee < 1000000)
{
$royalty = 1.8;
}
else
{
$royalty = 2;
}
$money[2] = ($fee * $royalty)/100;
$sum = $money[2];
$money[3] = $sum * 0.005 /(1 - (1 - 0.005) ^ $total); //等比求和
$base = $money[3];
for($level = 4; $level <= $total; $level++)
{
$money[$level] = $base * (1 - 0.005);
}
return $money;
}
你看下对不对
等比求和那里的公式计算,不清楚php中支持多次方吗
等比求和那里的公式计算,不清楚php中支持多次方吗