12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace app\api\validate;
- use think\Validate;
- class UndertakeValidate extends Validate
- {
- protected $rule = [
- 'task_id' => ['require', 'integer', 'get:0'],//任务id
- 'bear_id' => ['require', 'integer', 'get:0'],//抽样机构
- 'check_id' => ['require', 'integer', 'get:0'],//检测机构
- 'report_id' => ['require', 'integer', 'get:0'],//报告上传单位
- 'sample_number' => ['require', 'integer', 'get:0'],//样本数量
- 'address'=>['require'],
- 'year' => ['require', 'date'], //年度
- 'ispublic' => ['require', 'in' => '0,1,2,3,4,5'],//任务状态:0:未发布,1:执行中,2:已结束未完成,3:已结束已完成
- 'upload_time' => ['require', 'date'],//报告上传时间
- 'starttime' => ['require', 'date'],//任务开始时间
- 'endtime' => ['require', 'date'],//任务结束时间
- 'task_name' => ['require', 'chsDash', 'length:4,50'],//任务名称
- ];
- protected $message = [
- 'task_id' => [
- 'require' => [700000, '传参错误'],//任务id
- 'integer' => [700001, '传参错误'],
- 'gt' => [700002, '传参错误'],
- ],
- 'bear_id' => [
- 'require' => [700000, '传参错误'],//抽样机构
- 'integer' => [700001, '传参错误'],
- 'gt' => [700002, '传参错误'],
- ],
- 'check_id' => [
- 'require' => [700000, '传参错误'],//检测机构
- 'integer' => [700001, '传参错误'],
- 'gt' => [700002, '传参错误'],
- ],
- 'report_id' => [
- 'require' => [700000, '传参错误'],//报告上传单位
- 'integer' => [700001, '传参错误'],
- 'gt' => [700002, '传参错误'],
- ],
- 'sample_number' => [
- 'require' => [700000, '传参错误'],//样本数量
- 'integer' => [700001, '传参错误'],
- 'gt' => [700002, '传参错误'],
- ],
- 'address'=>[
- 'require'=>[700100,'地址必须']//地址
- ],
- 'year' => [
- 'require' => [700400, '任务年度不能为空'],//年度
- 'date' => [700401, '任务年度格式错误'],
- ],
- 'ispublic' => [
- 'require' => [700500, '任务状态不能为空'],//任务状态:0:未发布,1:执行中,2:已结束未完成,3:已结束已完成
- 'in' => [700501, '任务状态选择错误'],
- ],
- 'upload_time' => [
- 'require' => [700600, '上传时间错误'],//任务开始时间
- 'date' => [700600, '上传时间错误'],//任务开始时间
- ],
- 'starttime' => [
- 'require' => [700600, '任务开始时间不能为空'],//任务开始时间
- 'date' => [700601, '任务开始时间格式错误'],
- ],
- 'endtime' => [
- 'require' => [700600, '任务结束时间不能为空'],//任务结束时间
- 'date' => [700601, '任务结束时间格式错误'],
- ],
- 'task_name' => [
- 'require' => [700800, '任务名称不能为空'],//任务名称
- 'chsDash' => [700801, '任务名称只能是汉字、字母、数字和下划线_及破折号-'],//任务名称
- 'length' => [700802, '任务名称长度在4至50个字符之间'],//任务名称
- ],
- ];
- public function sceneCreateUnderTaker()
- {
- return $this->only(['task_id', 'bear_id', 'check_id', 'report_id', 'address', 'upload_time', 'sample_number',]);
- }
- }
|