Adv.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 验证器
  10. */
  11. class Adv extends Validate
  12. {
  13. protected $rule = [
  14. 'ap_name' => 'require',
  15. 'ap_width' => 'require',
  16. 'ap_height' => 'require',
  17. 'adv_title' => 'require',
  18. 'ap_id' => 'require',
  19. 'adv_startdate' => 'require',
  20. 'adv_enddate' => 'require',
  21. 'adv_typedate' => 'max:255'
  22. ];
  23. protected $message = [
  24. 'ap_name.require' => '广告位名称不能为空',
  25. 'ap_width.require' => '广告位宽度只能为数字形式',
  26. 'ap_height.require' => '广告位高度只能为数字形式',
  27. 'adv_title.require' => '名称不能为空',
  28. 'ap_id.require' => '必须选择一个广告位',
  29. 'adv_startdate.require' => '必须选择开始时间',
  30. 'adv_enddate.require' => '必须选择结束时间',
  31. 'adv_typedate.max' => '操作值必须小于255个字符'
  32. ];
  33. protected $scene = [
  34. 'ap_add' => ['ap_name', 'ap_width', 'ap_height'],
  35. 'ap_edit' => ['ap_name', 'ap_width', 'ap_height'],
  36. 'adv_add' => ['adv_title', 'ap_id', 'adv_startdate', 'adv_enddate'],
  37. 'adv_edit' => ['adv_title', 'adv_startdate', 'adv_enddate'],
  38. 'app_ap_add' => ['ap_name', 'ap_width', 'ap_height'],
  39. 'app_ap_edit' => ['ap_name', 'ap_width', 'ap_height'],
  40. 'app_adv_add' => ['adv_title', 'ap_id', 'adv_startdate', 'adv_enddate', 'adv_typedate'],
  41. 'app_adv_edit' => ['adv_title', 'adv_startdate', 'adv_enddate', 'adv_typedate'],
  42. ];
  43. }