Parts.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace addons\qingdongams\validate;
  3. use think\Validate;
  4. class Parts extends Validate
  5. {
  6. /**
  7. * 验证规则
  8. */
  9. protected $rule = [
  10. 'create_staff_id' => 'number',
  11. 'name' => 'require|max:50',
  12. 'num' => 'max:50',
  13. 'unit' => 'max:50',
  14. 'img' => 'max:32',
  15. 'banners' => 'max:64',
  16. 'stock' => 'number',
  17. 'price' => 'max:50',
  18. 'tax_price' => 'max:250',
  19. 'status' => 'number|between:0,1',
  20. 'description' => 'max:1000',
  21. ];
  22. /**
  23. * 提示消息
  24. */
  25. protected $message = [];
  26. /**
  27. * 字段描述
  28. */
  29. protected $field = [
  30. 'create_staff_id' => '创建人',
  31. 'name' => '零件名称',
  32. 'num' => '零件编码',
  33. 'unit' => '零件单位',
  34. 'img' => '零件图片',
  35. 'banners' => '零件轮播图',
  36. 'stock' => '库存',
  37. 'price' => '零件价格',
  38. 'status' => '是否上架',
  39. 'description' => '零件介绍',
  40. ];
  41. /**
  42. * 验证场景
  43. */
  44. protected $scene = [
  45. 'create' => [
  46. 'create_staff_id',
  47. 'name',
  48. 'num',
  49. 'unit',
  50. 'img',
  51. 'banners',
  52. 'stock',
  53. 'price',
  54. 'status',
  55. 'description',
  56. ],
  57. 'edit' => [],
  58. ];
  59. }