first commit
This commit is contained in:
80
pgserver/application/common/validate/SurveyValidate.php
Normal file
80
pgserver/application/common/validate/SurveyValidate.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class SurveyValidate extends Validate
|
||||
{
|
||||
|
||||
const SCENE_ASSIGN = 1;
|
||||
const SCENE_RETURN = 2;
|
||||
const SCENE_APPOINT = 3;
|
||||
const SCENE_WAIT = 4;
|
||||
const SCENE_FINISH = 5;
|
||||
const SCENE_BACK = 6;
|
||||
const SCENE_SURVEYUSER = 7;
|
||||
const SCENE_SUBMIT = 8;
|
||||
const SURVEY_DETAIL = 9;
|
||||
const SCENE_TRANSFER_SURVEYUSER = 10;
|
||||
|
||||
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'survey_ids' => 'require|array',
|
||||
'user_id' => 'require',
|
||||
'survey_id' => 'require',
|
||||
'return_reason' => 'require|max:200',
|
||||
'workUsername' => 'max:20',
|
||||
'keyword' => 'max:20',
|
||||
'surveyUsername' => 'max:20',
|
||||
'page'=>'require',
|
||||
'limit'=>'require',
|
||||
'surveyUserId'=>'require',
|
||||
'surveyName'=>'require',
|
||||
'order_no'=>'require',
|
||||
'id'=>'require',
|
||||
'survey_ids' => 'require'
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'survey_ids.require' => '查勘记录必传',
|
||||
'survey_ids.array' => '查勘记录必须是数组类型',
|
||||
'user_id.require' => '用户id必传',
|
||||
'return_reason.require' => '退回理由必填',
|
||||
'return_reason.max' => '退回理由最多允许200字',
|
||||
'workUsername.max' => '业务员最多可输入20字',
|
||||
'keyword.max' => '物业名称、单号最多可输入20字',
|
||||
'surveyUsername.max' => '查勘员最多可输入20字',
|
||||
'page.require' => '页数必传',
|
||||
'limit.require' => '每页条数必传',
|
||||
'surveyUserId.require' => '查勘员id必传',
|
||||
'order_no.require' => '单号必传',
|
||||
'id.require' => 'id必传',
|
||||
'survey_ids.require' => '查勘记录必传'
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
self::SCENE_ASSIGN => ['survey_ids','user_id',],
|
||||
self::SCENE_RETURN => ['survey_id','return_reason',],
|
||||
self::SCENE_APPOINT => ['keyword','page','limit','workUsername',],
|
||||
self::SCENE_WAIT => ['keyword','page','limit','workUsername','surveyUsername'],
|
||||
self::SCENE_FINISH => ['keyword','page','limit','surveyUsername',],
|
||||
self::SCENE_BACK => ['keyword','page','limit','workUsername',],
|
||||
self::SCENE_SURVEYUSER => ['surveyUserId','survey_ids','surveyName',],
|
||||
self::SCENE_SUBMIT => ['survey_id'],
|
||||
self::SURVEY_DETAIL => ['order_no','id'],
|
||||
self::SCENE_TRANSFER_SURVEYUSER => ['surveyUserId','survey_id','surveyName',],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user