Browse Source

add onetime plan

Tokumeikoi 5 years ago
parent
commit
637bacd62f
3 changed files with 20 additions and 3 deletions
  1. 7 2
      app/Http/Requests/Admin/PlanSave.php
  2. 3 1
      config/app.php
  3. 10 0
      database/update.sql

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

@@ -10,11 +10,13 @@ class PlanSave extends FormRequest
         'name' => 'required',
         'content' => '',
         'group_id' => 'required',
+        'type' => 'required|in:0,1',
         'transfer_enable' => 'required',
         'month_price' => 'nullable|integer',
         'quarter_price' => 'nullable|integer',
         'half_year_price' => 'nullable|integer',
-        'year_price' => 'nullable|integer'
+        'year_price' => 'nullable|integer',
+        'onetime_price' => 'nullable|integer'
     ];
     /**
      * Get the validation rules that apply to the request.
@@ -30,12 +32,15 @@ class PlanSave extends FormRequest
     {
         return [
             'name.required' => '套餐名称不能为空',
+            'type.required' => '套餐类型不能为空',
+            'type.in' => '套餐类型格式有误',
             'group_id.required' => '权限组不能为空',
             'transfer_enable.required' => '流量不能为空',
             'month_price.integer' => '月付金额格式有误',
             'quarter_price.integer' => '季付金额格式有误',
             'half_year_price.integer' => '半年付金额格式有误',
-            'year_price.integer' => '年付金额格式有误'
+            'year_price.integer' => '年付金额格式有误',
+            'onetime_price.integer' => '一次性金额有误'
         ];
     }
 }

+ 3 - 1
config/app.php

@@ -232,7 +232,9 @@ return [
     |--------------------------------------------------------------------------
     | V2board version
     |--------------------------------------------------------------------------
+    |
+    | The only modification by laravel config
+    |
     */
-
     'version' => '1.1.3'
 ];

+ 10 - 0
database/update.sql

@@ -168,3 +168,13 @@ ADD `category_id` int(11) NOT NULL AFTER `id`;
 
 ALTER TABLE `v2_tutorial`
 DROP `description`;
+
+ALTER TABLE `v2_plan`
+ADD `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0: 周期 1:一次性' AFTER `name`;
+
+ALTER TABLE `v2_plan`
+CHANGE `month_price` `month_price` int(11) NULL AFTER `content`,
+CHANGE `quarter_price` `quarter_price` int(11) NULL AFTER `month_price`,
+CHANGE `half_year_price` `half_year_price` int(11) NULL AFTER `quarter_price`,
+CHANGE `year_price` `year_price` int(11) NULL AFTER `half_year_price`,
+ADD `onetime_price` int(11) NULL AFTER `year_price`;