123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\common\validate;
- use think\Db;
- use think\Validate;
- class HouseLabel extends Validate{
- protected $rule = [
- 'title|名称' => 'require',
- 'house_id' => 'require|gt:0',
- 'status' => 'require|in:0,1',
- 'end_time' => 'checkEndTime|date'
- ];
- protected $message = [
- 'house_id.require' => '参数错误',
- 'house_id.gt' => '参数错误',
- 'status.require' => '参数错误',
- 'status.gt' => '参数错误',
- 'end_time.date' => '日期格式错误',
- ];
- protected $scene = [
- ];
- protected function checkEndTime($value,$rule,$data=[])
- {
- if($data['status'] == 1 && !$data['end_time']){
- return '未选择提醒日期';
- }
- return true;
- }
- }
|