فهرست منبع

Wesmiler 校企小程序 更新 6.24

wesmiler 3 سال پیش
والد
کامیت
ab74e8f365
4فایلهای تغییر یافته به همراه122 افزوده شده و 0 حذف شده
  1. 1 0
      app/common/model/School.php
  2. 10 0
      app/store/model/School.php
  3. 55 0
      app/store/validate/schools/School.php
  4. 56 0
      app/store/validate/schools/User.php

+ 1 - 0
app/common/model/School.php

@@ -50,6 +50,7 @@ class School extends BaseModel
         // 排序条件
         $sort = $this->setQuerySort($param);
 
+        var_dump($sort);
         // 范围查询
         $field = '*';
         $lng = isset($param['longitude'])? $param['longitude'] : 0;

+ 10 - 0
app/store/model/School.php

@@ -107,6 +107,16 @@ class School extends SchoolModel
     {
         // 默认数据
         $data = array_merge($data, []);
+        // 验证数据
+        $validate = new \app\store\validate\schools\School();
+        if(!$validate->check($data)){
+            throwError($validate->getError());
+        }
+
+        $data = [
+
+        ];
+
         return $data;
     }
 

+ 55 - 0
app/store/validate/schools/School.php

@@ -0,0 +1,55 @@
+<?php
+// +----------------------------------------------------------------------
+// | 商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2017~2021 https://www.thinkphp.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
+// +----------------------------------------------------------------------
+// | Author: thinkphp <admin@yiovo.com>
+// +----------------------------------------------------------------------
+declare (strict_types = 1);
+
+namespace app\store\validate\schools;
+
+use think\Validate;
+
+/**
+ * 验证类:学校
+ * Class Schools
+ * @package app\store\validate\schools
+ */
+class School extends Validate
+{
+    /**
+     * 验证规则
+     * @var array
+     */
+    protected $rule = [
+        'school_name' => ['require','max:200'],
+        'logo'=> ['require'],
+        'stablish_time'=> ['require'],
+        'property'=> ['require'],
+        'education_levels'=> ['require'],
+        'address'=> ['require'],
+        'type'=> ['require'],
+        'level'=> ['require'],
+
+    ];
+
+    /**
+     * 验证提示
+     * @var string[]
+     */
+    protected $message  =   [
+        'school_name.require' => '学校名称不为空',
+        'school_name.max' => '学校名称字数最多200字符',
+        'logo.require' => '请上传学校logo',
+        'stablish_time.require' => '开办时间不为空',
+        'property.require' => '学校性质不为空',
+        'education_levels.require' => '学校层次不为空',
+        'type.require' => '学校类型不为空',
+        'level.require' => '学校等级不为空',
+        'address.require' => '学校地址不为空',
+    ];
+}

+ 56 - 0
app/store/validate/schools/User.php

@@ -0,0 +1,56 @@
+<?php
+// +----------------------------------------------------------------------
+// | 商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2017~2021 https://www.thinkphp.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
+// +----------------------------------------------------------------------
+// | Author: thinkphp <admin@yiovo.com>
+// +----------------------------------------------------------------------
+declare (strict_types = 1);
+
+namespace app\store\validate\schools;
+
+use think\Validate;
+
+/**
+ * 验证类:学校账号
+ * Class User
+ * @package app\store\validate\schools
+ */
+class User extends Validate
+{
+    /**
+     * 验证规则
+     * @var array
+     */
+    protected $rule = [
+        'user_name'=> ['require','max:20'],
+        'password'=> ['require','max:50'],
+        'real_name'=> ['require','max:20'],
+        'school_id'=> ['require'],
+        'user_type'=> ['require'],
+    ];
+
+    /**
+     * 验证提示
+     * @var string[]
+     */
+    protected $message  =   [
+        'qq.number' => 'QQ号格式不正确',
+        'idcard.require' => '身份证号不为空',
+        'idcard.idCard' => '身份证号格式不正确',
+        'idcard.max' => '身份证号格式不正确',
+        'mobile.require' => '手机号不为空',
+        'user_type.require' => '账号类型不为空',
+        'mobile.mobile' => '手机号格式不正确',
+        'user_login.require' => '账号不为空',
+        'user_login.max' => '账号格式不正确',
+        'nick_name.require' => '昵称不为空',
+        'nick_name.max' => '昵称格式不正确',
+        'real_name.require' => '姓名不为空',
+        'real_name.max' => '姓名格式不正确',
+        'gender.require' => '性别不为空',
+    ];
+}