gorden 10 місяців тому
батько
коміт
7dbc9cc9d6

+ 3 - 0
app/admin/controller/customer/IndexController.php

@@ -2,6 +2,7 @@
 
 namespace app\admin\controller\customer;
 
+use app\admin\validate\customer\IndexValidate;
 use app\controller\Curd;
 use app\model\Customer;
 use app\model\Member;
@@ -18,6 +19,8 @@ class IndexController extends Curd
     public function __construct()
     {
         $this->model = new Customer();
+        $this->validate = true;
+        $this->validateClass = new IndexValidate();
     }
 
     protected function afterQuery($items)

+ 5 - 5
app/admin/validate/customer/IndexValidate.php

@@ -7,15 +7,15 @@ use support\Validate;
 class IndexValidate extends Validate
 {
     protected $rule = [
-        'id'=>'require|integer',
-        'mobile'=>'mobile',
-        'card_id'=>'idCard'
+        'id|ID' => 'require|integer',
+        'mobile|手机号' => 'mobile',
+        'card_id|身份证号码' => 'idCard'
     ];
 
     protected $message = [];
 
     protected $scene = [
-        'add'=>['mobile','card_id'],
-        'update'=>[]
+        'add' => ['mobile', 'card_id'],
+        'update' => ['id', 'mobile', 'card_id']
     ];
 }