ShopGoodsValidate.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\validate\shops;
  15. use app\common\validate\BaseValidate;
  16. /**
  17. * ShopGoods验证器
  18. * Class ShopGoodsValidate
  19. * @package app\adminapi\validate\shops
  20. */
  21. class ShopGoodsValidate extends BaseValidate
  22. {
  23. /**
  24. * 设置校验规则
  25. * @var string[]
  26. */
  27. protected $rule = [
  28. 'id' => 'require',
  29. 'delivery_type' => 'require',
  30. 'shop_goods_type' => 'require',
  31. 'goods_category_ids' => 'require',
  32. // 'goods_category_id' => 'require',
  33. 'goods_name' => 'require',
  34. 'goods_image' => 'require',
  35. 'goods_status' => 'require',
  36. 'goodSpecsInventory' => 'require|array',
  37. ];
  38. /**
  39. * 参数描述
  40. * @var string[]
  41. */
  42. protected $field = [
  43. 'id' => 'id',
  44. 'delivery_type' => '配送类型',
  45. 'shop_goods_type' => '商品类别',
  46. 'goods_category_ids' => '服务类目',
  47. // 'goods_category_id' => '服务产品',
  48. 'goods_name' => '商品名称',
  49. 'goods_image' => '商品图片',
  50. 'goods_status' => '商品状态',
  51. 'goodSpecsInventory' => '规格库存'
  52. ];
  53. /**
  54. * @notes 添加场景
  55. * @return ShopGoodsValidate
  56. * @author likeadmin
  57. * @date 2024/08/04 11:07
  58. */
  59. public function sceneAdd()
  60. {
  61. return $this->only(['delivery_type','shop_goods_type','goods_category_ids','goods_category_id','goods_name','goods_image','goods_status','goodSpecsInventory']);
  62. }
  63. /**
  64. * @notes 编辑场景
  65. * @return ShopGoodsValidate
  66. * @author likeadmin
  67. * @date 2024/08/04 11:07
  68. */
  69. public function sceneEdit()
  70. {
  71. return $this->only(['id','delivery_type','shop_goods_type','goods_category_ids','goods_category_id','goods_name','goods_image','goods_status','goodSpecsInventory']);
  72. }
  73. /**
  74. * @notes 删除场景
  75. * @return ShopGoodsValidate
  76. * @author likeadmin
  77. * @date 2024/08/04 11:07
  78. */
  79. public function sceneDelete()
  80. {
  81. return $this->only(['id']);
  82. }
  83. /**
  84. * @notes 详情场景
  85. * @return ShopGoodsValidate
  86. * @author likeadmin
  87. * @date 2024/08/04 11:07
  88. */
  89. public function sceneDetail()
  90. {
  91. return $this->only(['id']);
  92. }
  93. }