HouseLabel.php 794 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\common\validate;
  3. use think\Db;
  4. use think\Validate;
  5. class HouseLabel extends Validate{
  6. protected $rule = [
  7. 'title|名称' => 'require',
  8. 'house_id' => 'require|gt:0',
  9. 'status' => 'require|in:0,1',
  10. 'end_time' => 'checkEndTime|date'
  11. ];
  12. protected $message = [
  13. 'house_id.require' => '参数错误',
  14. 'house_id.gt' => '参数错误',
  15. 'status.require' => '参数错误',
  16. 'status.gt' => '参数错误',
  17. 'end_time.date' => '日期格式错误',
  18. ];
  19. protected $scene = [
  20. ];
  21. protected function checkEndTime($value,$rule,$data=[])
  22. {
  23. if($data['status'] == 1 && !$data['end_time']){
  24. return '未选择提醒日期';
  25. }
  26. return true;
  27. }
  28. }