Adv.php 1.9 KB

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