Product.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace addons\qingdongams\validate;
  3. use think\Validate;
  4. class Product extends Validate {
  5. /**
  6. * 验证规则
  7. */
  8. protected $rule = [
  9. 'create_staff_id' => 'number',
  10. 'name' => 'require|max:50',
  11. 'num' => 'max:50',
  12. 'unit' => 'max:50',
  13. 'product_line' => 'max:50',
  14. 'bar_code' => 'max:50',
  15. 'price' => 'max:50',
  16. 'tax_price' => 'max:250',
  17. 'status' => 'number|between:0,1',
  18. ];
  19. /**
  20. * 提示消息
  21. */
  22. protected $message = [];
  23. /**
  24. * 字段描述
  25. */
  26. protected $field = [
  27. 'create_staff_id' => '创建人',
  28. 'name' => '产品名称',
  29. 'num' => '产品编码',
  30. 'unit' => '产品单位',
  31. 'product_line' => '产品线',
  32. 'bar_code' => '条形码',
  33. 'price' => '标准价格',
  34. 'tax_price' => '含税价格',
  35. 'status' => '是否上架',
  36. ];
  37. /**
  38. * 验证场景
  39. */
  40. protected $scene = [
  41. 'create' => [
  42. 'create_staff_id',
  43. 'name',
  44. 'num',
  45. 'unit',
  46. 'product_line',
  47. 'bar_code',
  48. 'price',
  49. 'tax_price',
  50. 'status'
  51. ],
  52. 'edit' => [],
  53. ];
  54. }