update: add speedlimit

This commit is contained in:
tokumeikoi 2022-11-18 15:36:15 +08:00
parent fc85fd0606
commit c5d714d64d
8 changed files with 27 additions and 12 deletions

View File

@ -41,10 +41,13 @@ class PlanController extends Controller
DB::beginTransaction(); DB::beginTransaction();
// update user group id and transfer // update user group id and transfer
try { try {
User::where('plan_id', $plan->id)->update([ if ($request->input('force_update')) {
'group_id' => $params['group_id'], User::where('plan_id', $plan->id)->update([
'transfer_enable' => $params['transfer_enable'] * 1073741824 'group_id' => $params['group_id'],
]); 'transfer_enable' => $params['transfer_enable'] * 1073741824,
'speed_limit' => $params['speed_limit']
]);
}
$plan->update($params); $plan->update($params);
} catch (\Exception $e) { } catch (\Exception $e) {
DB::rollBack(); DB::rollBack();

View File

@ -27,7 +27,8 @@ class PlanSave extends FormRequest
'onetime_price' => 'nullable|integer', 'onetime_price' => 'nullable|integer',
'reset_price' => 'nullable|integer', 'reset_price' => 'nullable|integer',
'reset_traffic_method' => 'nullable|integer|in:0,1,2,3,4', 'reset_traffic_method' => 'nullable|integer|in:0,1,2,3,4',
'capacity_limit' => 'nullable|integer' 'capacity_limit' => 'nullable|integer',
'speed_limit' => 'nullable|integer'
]; ];
} }
@ -49,7 +50,8 @@ class PlanSave extends FormRequest
'reset_price.integer' => '流量重置包金额有误', 'reset_price.integer' => '流量重置包金额有误',
'reset_traffic_method.integer' => '流量重置方式格式有误', 'reset_traffic_method.integer' => '流量重置方式格式有误',
'reset_traffic_method.in' => '流量重置方式格式有误', 'reset_traffic_method.in' => '流量重置方式格式有误',
'capacity_limit.integer' => '容纳用户量限制格式有误' 'capacity_limit.integer' => '容纳用户量限制格式有误',
'speed_limit.integer' => '限速格式有误'
]; ];
} }
} }

View File

@ -29,7 +29,8 @@ class UserUpdate extends FormRequest
'balance' => 'integer', 'balance' => 'integer',
'commission_type' => 'integer', 'commission_type' => 'integer',
'commission_balance' => 'integer', 'commission_balance' => 'integer',
'remarks' => 'nullable' 'remarks' => 'nullable',
'speed_limit' => 'nullable|integer'
]; ];
} }
@ -59,7 +60,8 @@ class UserUpdate extends FormRequest
'd.integer' => '下行流量格式不正确', 'd.integer' => '下行流量格式不正确',
'balance.integer' => '余额格式不正确', 'balance.integer' => '余额格式不正确',
'commission_balance.integer' => '佣金格式不正确', 'commission_balance.integer' => '佣金格式不正确',
'password.min' => '密码长度最小8位' 'password.min' => '密码长度最小8位',
'speed_limit.integer' => '限速格式不正确'
]; ];
} }
} }

View File

@ -237,5 +237,5 @@ return [
| The only modification by laravel config | The only modification by laravel config
| |
*/ */
'version' => '1.6.2.1667025085276' 'version' => '1.6.2.1668756940000'
]; ];

View File

@ -162,6 +162,7 @@ CREATE TABLE `v2_plan` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL, `group_id` int(11) NOT NULL,
`transfer_enable` int(11) NOT NULL, `transfer_enable` int(11) NOT NULL,
`speed_limit` int(11) DEFAULT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 NOT NULL, `name` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`show` tinyint(1) NOT NULL DEFAULT '0', `show` tinyint(1) NOT NULL DEFAULT '0',
`sort` int(11) DEFAULT NULL, `sort` int(11) DEFAULT NULL,
@ -367,6 +368,7 @@ CREATE TABLE `v2_user` (
`uuid` varchar(36) NOT NULL, `uuid` varchar(36) NOT NULL,
`group_id` int(11) DEFAULT NULL, `group_id` int(11) DEFAULT NULL,
`plan_id` int(11) DEFAULT NULL, `plan_id` int(11) DEFAULT NULL,
`speed_limit` int(11) DEFAULT NULL,
`remind_expire` tinyint(4) DEFAULT '1', `remind_expire` tinyint(4) DEFAULT '1',
`remind_traffic` tinyint(4) DEFAULT '1', `remind_traffic` tinyint(4) DEFAULT '1',
`token` char(32) NOT NULL, `token` char(32) NOT NULL,
@ -379,4 +381,4 @@ CREATE TABLE `v2_user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 2022-07-07 18:23:17 -- 2022-11-18 07:29:50

View File

@ -592,3 +592,9 @@ ALTER TABLE `v2_plan`
ALTER TABLE `v2_plan` ALTER TABLE `v2_plan`
CHANGE `inventory_limit` `capacity_limit` int(11) NULL AFTER `reset_traffic_method`; CHANGE `inventory_limit` `capacity_limit` int(11) NULL AFTER `reset_traffic_method`;
ALTER TABLE `v2_user`
ADD `speed_limit` int(11) NULL AFTER `plan_id`;
ALTER TABLE `v2_plan`
ADD `speed_limit` int(11) NULL AFTER `transfer_enable`;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long