123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace app\api\validate;
- use think\Validate;
- class Agent extends Validate
- {
- protected $rule = [
- 'page' => 'integer|egt:1',
- 'page_size' => 'integer|between:1,100',
- 'time_filter' => 'in:all,recent_7_days,recent_30_days,recent_90_days,current_year,custom',
- 'start_date' => 'date|requireIf:time_filter,custom',
- 'end_date' => 'date|requireIf:time_filter,custom|afterWith:start_date',
- ];
- protected $message = [
- 'page.integer' => '页码必须为整数',
- 'page.egt' => '页码必须大于等于1',
- 'page_size.integer' => '分页大小必须为整数',
- 'page_size.between' => '分页大小必须在1-100之间',
- 'time_filter.in' => '时间筛选参数无效,必须为:all、recent_7_days、recent_30_days、recent_90_days、current_year、custom中的一个',
- 'start_date.date' => '开始日期格式不正确',
- 'start_date.requireIf' => '选择自定义时间段时,开始日期不能为空',
- 'end_date.date' => '结束日期格式不正确',
- 'end_date.requireIf' => '选择自定义时间段时,结束日期不能为空',
- 'end_date.afterWith' => '结束日期必须大于等于开始日期',
- ];
- protected $scene = [
- 'team' => ['page', 'page_size', 'time_filter', 'start_date', 'end_date'],
- ];
- }
|