1
0

GoodsValidate.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace app\api\validate;
  3. use app\common\validate\BaseValidate;
  4. /**
  5. * Goods验证器
  6. * Class GoodsValidate
  7. * @package app\adminapi\validate\goods
  8. */
  9. class GoodsValidate extends BaseValidate
  10. {
  11. /**
  12. * 设置校验规则
  13. * @var string[]
  14. */
  15. protected $rule = [
  16. 'id' => 'require',
  17. 'goods_category_ids' => 'require',
  18. 'goods_category_id'=>'require',
  19. 'goods_name' => 'require',
  20. 'goods_number' => 'require',
  21. 'base_service_fee' => 'require',
  22. 'service_total' => 'require',
  23. 'service_fee' => 'require',
  24. 'goods_status' => 'require',
  25. 'property_activity_id' => 'require',
  26. ];
  27. /**
  28. * 参数描述
  29. * @var string[]
  30. */
  31. protected $field = [
  32. 'id' => 'id',
  33. 'goods_category_ids' => '服务类目',
  34. 'goods_category_id' => '服务类目',
  35. 'goods_name' => '商品名称',
  36. 'goods_number' => '商品数量',
  37. 'base_service_fee' => '基础服务费',
  38. 'service_total' => '服务原价',
  39. 'service_fee' => '服务价格',
  40. 'goods_status' => '商品状态',
  41. 'property_activity_id' => '代理商活动id',
  42. ];
  43. /**
  44. * @notes 详情场景
  45. * @return GoodsValidate
  46. */
  47. public function sceneCategory()
  48. {
  49. return $this->only(['goods_category_id']);
  50. }
  51. public function sceneSubmitGood()
  52. {
  53. return $this->only(['goods_category_ids','goods_name','goods_number','base_service_fee','service_total','service_fee']);
  54. }
  55. /**
  56. * @notes 详情场景
  57. * @return GoodsValidate
  58. */
  59. public function sceneGoods()
  60. {
  61. return $this->only(['id']);
  62. }
  63. public function sceneActivity()
  64. {
  65. return $this->only(['property_activity_id']);
  66. }
  67. }