FarmGoodsValidate.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\admin\validate\life;
  3. use support\Validate;
  4. class FarmGoodsValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'goods_id' => 'require|integer',
  8. 'join_goods_category_id' => 'require|integer',
  9. 'goods_classify' => '',
  10. 'goods_status' => 'integer', // 产品状态 PENDING=待处理|ON=上架(已激活)|OFF=下架|DISABLED=已禁用
  11. 'goods_category' => '',
  12. 'goods_prefix' => '',
  13. 'goods_name' => 'require',
  14. 'goods_market_price' => '',
  15. 'goods_sales_price' => '',
  16. 'goods_sku_json' => '',
  17. 'goods_attribute_json' => '',
  18. 'goods_service_json' => '',
  19. 'goods_title' => '',
  20. 'goods_cover' => '',
  21. 'goods_on_addtimes' => '',
  22. 'goods_img' => 'require|regex:/^[0-9a-zA-Z\.\/]+$/',
  23. 'food_slide' => 'regex:/^[0-9a-zA-Z\.\/\,]+$/',
  24. 'goods_shop_id' => 'require|integer',
  25. 'goods_is_new' => 'integer',
  26. 'goods_price' => 'require|float',
  27. 'goods_sell_num' => 'require|integer',
  28. 'goods_postage_id' => 'require|integer',
  29. 'goods_weight' => 'float',
  30. 'goods_storage' => 'max:255',
  31. 'goods_packaging' => 'max:255',
  32. 'goods_varieties' => 'max:255',
  33. 'goods_attr' => 'max:255',
  34. 'goods_sort' => 'require|integer'
  35. ];
  36. protected $message = [];
  37. protected $scene = [
  38. 'add' => ['goods_name', 'goods_img', 'food_slide', 'goods_category_id', 'goods_shop_id', 'goods_is_new', 'goods_price', 'goods_sell_num', 'goods_postage_id', 'goods_status', 'goods_weight', 'goods_storage', 'goods_packaging', 'goods_varieties', 'goods_attr', 'goods_sort'],
  39. 'update' => ['goods_id', 'goods_name', 'goods_img', 'food_slide', 'goods_category_id', 'goods_shop_id', 'goods_is_new', 'goods_price', 'goods_sell_num', 'goods_postage_id', 'goods_status', 'goods_weight', 'goods_storage', 'goods_packaging', 'goods_varieties', 'goods_attr', 'goods_sort'],
  40. ];
  41. }