mirror of
https://github.com/v2board/v2board.git
synced 2025-02-25 14:50:26 +08:00
update
This commit is contained in:
parent
64f379d99d
commit
bb1ad02cf8
@ -86,7 +86,6 @@ class OrderController extends Controller
|
|||||||
|
|
||||||
private function getSurplusValueByOneTime(User $user, Plan $plan)
|
private function getSurplusValueByOneTime(User $user, Plan $plan)
|
||||||
{
|
{
|
||||||
$trafficUnitPrice = 0;
|
|
||||||
$trafficUnitPrice = $plan->onetime_price / $plan->transfer_enable;
|
$trafficUnitPrice = $plan->onetime_price / $plan->transfer_enable;
|
||||||
if ($user->discount && $trafficUnitPrice) {
|
if ($user->discount && $trafficUnitPrice) {
|
||||||
$trafficUnitPrice = $trafficUnitPrice - ($trafficUnitPrice * $user->discount / 100);
|
$trafficUnitPrice = $trafficUnitPrice - ($trafficUnitPrice * $user->discount / 100);
|
||||||
@ -98,25 +97,26 @@ class OrderController extends Controller
|
|||||||
|
|
||||||
private function getSurplusValueByCycle(User $user, Plan $plan)
|
private function getSurplusValueByCycle(User $user, Plan $plan)
|
||||||
{
|
{
|
||||||
$dayPrice = 0;
|
$price = 0;
|
||||||
$day = ($user->expired_at - time()) / 86400;
|
$sec = 31536000;
|
||||||
if ($day <= 0) {
|
if (!((int)date('Y') % 4)) {
|
||||||
return 0;
|
$sec = 31622400;
|
||||||
}
|
}
|
||||||
if ($plan->month_price) {
|
if ($plan->month_price) {
|
||||||
$dayPrice = $plan->month_price / $day;
|
$price = $plan->month_price / (31536000 / 12);
|
||||||
} else if ($plan->quarter_price) {
|
} else if ($plan->quarter_price) {
|
||||||
$dayPrice = $plan->quarter_price / $day;
|
$price = $plan->quarter_price / (31536000 / 4);
|
||||||
} else if ($plan->half_year_price) {
|
} else if ($plan->half_year_price) {
|
||||||
$dayPrice = $plan->half_year_price / $day;
|
$price = $plan->half_year_price / (31536000 / 2);
|
||||||
} else if ($plan->year_price) {
|
} else if ($plan->year_price) {
|
||||||
$dayPrice = $plan->year_price / $day;
|
$price = $plan->year_price / 31536000;
|
||||||
}
|
}
|
||||||
// exclude discount
|
// exclude discount
|
||||||
if ($user->discount && $dayPrice) {
|
if ($user->discount && $price) {
|
||||||
$dayPrice = $dayPrice - ($dayPrice * $user->discount / 100);
|
$price = $price - ($price * $user->discount / 100);
|
||||||
}
|
}
|
||||||
$result = $day * $dayPrice;
|
$remainingDay = $user->expired_at - time();
|
||||||
|
$result = $remainingDay * $price;
|
||||||
return $result > 0 ? $result : 0;
|
return $result > 0 ? $result : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user