PlayValidate.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\admin\validate\life;
  3. use think\Validate;
  4. class PlayValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'play_name' => 'require|max:20',
  8. 'play_id' => 'require',
  9. 'play_content' => 'require',
  10. 'play_img' => 'require',
  11. 'play_valid' => 'require',
  12. 'play_price' => 'require',
  13. 'play_category' => 'require',
  14. 'play_label' => 'require',
  15. 'play_type' => 'require',
  16. 'play_status' => 'require',
  17. 'play_shop_id' => 'require',
  18. 'play_time' => 'require',
  19. ];
  20. protected $message = [
  21. 'play_id.require' => 'ID不能为空',
  22. 'play_name.require' => '名称不能为空',
  23. 'play_content.require'=> '详情不能为空',
  24. 'play_img.require' => '图片不能为空',
  25. 'play_name.max' => '名称不能超过20字',
  26. 'play_valid.require' => '有效期不能为空',
  27. 'play_price.require' => '价格不能为空',
  28. 'play_category.require' => '分类不能为空',
  29. 'play_label.require' => '标签不能为空',
  30. 'play_type.require' => '类型不能为空',
  31. 'play_status.require' => '状态不能为空',
  32. 'play_shop_id.require' => '店铺id不能为空',
  33. 'play_time.require' => '使用时间不能为空',
  34. ];
  35. //场景
  36. protected $scene = [
  37. 'create' => ['play_name','play_img','play_price','play_category','play_shop_id','play_label','play_content','play_type','play_status','play_valid','play_time'],
  38. 'update' => ['play_id','play_name','play_img','play_price','play_category','play_shop_id','play_label','play_content','play_type','play_status','play_valid','play_time'],
  39. 'info' => ['play_id']
  40. ];
  41. }