mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
feature: more cycle
This commit is contained in:
parent
8a44ccb3fc
commit
85c4e477d2
@ -153,6 +153,10 @@ class CheckOrder extends Command
|
||||
return strtotime('+6 month', $timestamp);
|
||||
case 'year_price':
|
||||
return strtotime('+12 month', $timestamp);
|
||||
case 'two_year_price':
|
||||
return strtotime('+24 month', $timestamp);
|
||||
case 'three_year_price':
|
||||
return strtotime('+36 month', $timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ class PlanSave extends FormRequest
|
||||
'quarter_price' => 'nullable|integer',
|
||||
'half_year_price' => 'nullable|integer',
|
||||
'year_price' => 'nullable|integer',
|
||||
'two_year_price' => 'nullable|integer',
|
||||
'three_year_price' => 'nullable|integer',
|
||||
'onetime_price' => 'nullable|integer',
|
||||
'reset_price' => 'nullable|integer'
|
||||
];
|
||||
@ -39,6 +41,8 @@ class PlanSave extends FormRequest
|
||||
'quarter_price.integer' => '季付金额格式有误',
|
||||
'half_year_price.integer' => '半年付金额格式有误',
|
||||
'year_price.integer' => '年付金额格式有误',
|
||||
'two_year_price.integer' => '两年付金额格式有误',
|
||||
'three_year_price.integer' => '三年付金额格式有误',
|
||||
'onetime_price.integer' => '一次性金额有误',
|
||||
'reset_price.integer' => '流量重置包金额有误'
|
||||
];
|
||||
|
@ -15,7 +15,7 @@ class OrderSave extends FormRequest
|
||||
{
|
||||
return [
|
||||
'plan_id' => 'required',
|
||||
'cycle' => 'required|in:month_price,quarter_price,half_year_price,year_price,onetime_price,reset_price'
|
||||
'cycle' => 'required|in:month_price,quarter_price,half_year_price,year_price,two_year_price,three_year_price,onetime_price,reset_price'
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ class OrderService
|
||||
$result = $trafficUnitPrice * $notUsedTrafficPrice;
|
||||
$orderModel = Order::where('user_id', $user->id)->where('cycle', '!=', 'reset_price')->where('status', 3);
|
||||
$order->surplus_amount = $result > 0 ? $result : 0;
|
||||
$order->surplus_order_ids = json_encode(array_map(function ($v) { return $v['id'];}, $orderModel->get()->toArray()));
|
||||
$order->surplus_order_ids = json_encode(array_column($orderModel->get()->toArray(), 'id'));
|
||||
}
|
||||
|
||||
private function getSurplusValueByCycle(User $user, Order $order)
|
||||
@ -145,7 +145,7 @@ class OrderService
|
||||
return;
|
||||
}
|
||||
$order->surplus_amount = $orderSurplusAmount > 0 ? $orderSurplusAmount : 0;
|
||||
$order->surplus_order_ids = json_encode(array_map(function ($v) { return $v['id'];}, $orderModel->get()->toArray()));
|
||||
$order->surplus_order_ids = json_encode(array_column($orderModel->get()->toArray(), 'id'));
|
||||
}
|
||||
|
||||
public function success(string $callbackNo)
|
||||
|
@ -113,6 +113,8 @@ CREATE TABLE `v2_plan` (
|
||||
`quarter_price` int(11) DEFAULT NULL,
|
||||
`half_year_price` int(11) DEFAULT NULL,
|
||||
`year_price` int(11) DEFAULT NULL,
|
||||
`two_year_price` int(11) DEFAULT NULL,
|
||||
`three_year_price` int(11) DEFAULT NULL,
|
||||
`onetime_price` int(11) DEFAULT NULL,
|
||||
`reset_price` int(11) DEFAULT NULL,
|
||||
`created_at` int(11) NOT NULL,
|
||||
@ -286,4 +288,4 @@ CREATE TABLE `v2_user` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- 2020-07-01 07:01:59
|
||||
-- 2020-09-04 07:38:57
|
||||
|
@ -300,3 +300,7 @@ ADD `server_name` varchar(255) NULL AFTER `allow_insecure`;
|
||||
UPDATE `v2_server` SET
|
||||
`ruleSettings` = NULL
|
||||
WHERE `ruleSettings` = '{}';
|
||||
|
||||
ALTER TABLE `v2_plan`
|
||||
ADD `two_year_price` int(11) NULL AFTER `year_price`,
|
||||
ADD `three_year_price` int(11) NULL AFTER `two_year_price`;
|
||||
|
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
2
public/assets/user/umi.css
vendored
2
public/assets/user/umi.css
vendored
File diff suppressed because one or more lines are too long
2
public/assets/user/umi.js
vendored
2
public/assets/user/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user