Browse Source

update: add speedlimit

tokumeikoi 2 years ago
parent
commit
c5d714d64d

+ 7 - 4
app/Http/Controllers/Admin/PlanController.php

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

+ 4 - 2
app/Http/Requests/Admin/PlanSave.php

@@ -27,7 +27,8 @@ class PlanSave extends FormRequest
             'onetime_price' => 'nullable|integer',
             'reset_price' => 'nullable|integer',
             '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_traffic_method.integer' => '流量重置方式格式有误',
             'reset_traffic_method.in' => '流量重置方式格式有误',
-            'capacity_limit.integer' => '容纳用户量限制格式有误'
+            'capacity_limit.integer' => '容纳用户量限制格式有误',
+            'speed_limit.integer' => '限速格式有误'
         ];
     }
 }

+ 4 - 2
app/Http/Requests/Admin/UserUpdate.php

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

+ 1 - 1
config/app.php

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

+ 3 - 1
database/install.sql

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

+ 6 - 0
database/update.sql

@@ -592,3 +592,9 @@ ALTER TABLE `v2_plan`
 
 ALTER TABLE `v2_plan`
     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 it is too large
+ 0 - 0
public/assets/admin/components.async.js


File diff suppressed because it is too large
+ 0 - 0
public/assets/admin/umi.js


Some files were not shown because too many files changed in this diff