MedicalCareProductValidate.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\admin\validate\medical;
  3. use think\Validate;
  4. class MedicalCareProductValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'product_id' => 'require',
  8. 'product_name' => 'require',
  9. 'product_category_id' => 'require',
  10. 'product_shop_id' => 'require',
  11. 'product_is_show' => 'require',
  12. 'product_sort' => 'require',
  13. 'product_sales' => 'require',
  14. 'product_price' => 'require',
  15. 'product_cost' => 'require',
  16. 'product_ot_price' => 'require',
  17. 'product_stock' => 'require',
  18. 'product_ficti' => 'require',
  19. 'product_image' => 'require',
  20. 'product_type' => 'require',
  21. 'product_postage_id' => 'require',
  22. ];
  23. protected $message = [
  24. 'product_id.require' => '产品ID不能为空',
  25. 'product_shop_id.require' => '店铺ID不能为空',
  26. 'product_category_id.require' => '产品分类编号不能为空',
  27. 'product_name.require' => '产品名称不能为空',
  28. 'product_is_show.require' => '产品状态不能为空',
  29. 'product_sort.require' => '产品排序不能为空',
  30. 'product_sales.require' => '产品销量不能为空',
  31. 'product_cost.require' => '成本价格不能为空',
  32. 'product_ot_price.require' => '产品原价不能为空',
  33. 'product_stock.require' => '产品总库存不能为空',
  34. 'product_ficti.require' => '产品虚拟销量不能为空',
  35. 'product_image.require' => '产品主图不能为空',
  36. 'product_type.require' => '产品类型不能为空',
  37. 'product_postage_id.require' => '运费模板不能为空1',
  38. ];
  39. //场景
  40. protected $scene = [
  41. 'add' => [
  42. 'product_sales','product_cost','product_ot_price',
  43. 'product_stock','product_ficti','product_image',
  44. 'product_name','product_is_show','product_sort',
  45. 'product_type','product_shop_id','product_category_id',
  46. 'product_postage_id'
  47. ],
  48. 'update' => [
  49. 'product_sales','product_cost','product_ot_price',
  50. 'product_stock','product_ficti','product_image',
  51. 'product_name','product_is_show','product_sort',
  52. 'product_type','product_id','product_shop_id','product_category_id',
  53. 'product_postage_id'
  54. ],
  55. 'info' => ['product_id'],
  56. 'del' => ['product_id']
  57. ];
  58. }