GoodsValidate.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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\goods;
  15. use app\common\validate\BaseValidate;
  16. /**
  17. * Goods验证器
  18. * Class GoodsValidate
  19. * @package app\adminapi\validate\goods
  20. */
  21. class GoodsValidate extends BaseValidate
  22. {
  23. /**
  24. * 设置校验规则
  25. * @var string[]
  26. */
  27. protected $rule = [
  28. 'id' => 'require',
  29. 'goods_category_ids' => 'require',
  30. 'goods_name' => 'require',
  31. 'goods_number' => 'require',
  32. 'base_service_fee' => 'require',
  33. 'service_total' => 'require',
  34. 'service_fee' => 'require',
  35. 'goods_status' => 'require',
  36. 'ids' => 'require',
  37. ];
  38. /**
  39. * 参数描述
  40. * @var string[]
  41. */
  42. protected $field = [
  43. 'id' => 'id',
  44. 'goods_category_ids' => '服务类目',
  45. 'goods_name' => '商品名称',
  46. 'goods_number' => '商品数量',
  47. 'base_service_fee' => '基础服务费',
  48. 'service_total' => '服务原价',
  49. 'service_fee' => '服务价格',
  50. 'goods_status' => '商品状态',
  51. 'ids' => '批量操作id',
  52. ];
  53. /**
  54. * @notes 添加场景
  55. * @return GoodsValidate
  56. * @author likeadmin
  57. * @date 2024/07/07 18:37
  58. */
  59. public function sceneAdd()
  60. {
  61. return $this->only(['goods_category_ids','goods_category_id','goods_name','goods_number','base_service_fee','service_total','service_fee','goods_status']);
  62. }
  63. /**
  64. * @notes 编辑场景
  65. * @return GoodsValidate
  66. * @author likeadmin
  67. * @date 2024/07/07 18:37
  68. */
  69. public function sceneEdit()
  70. {
  71. return $this->only(['id','goods_category_ids','goods_category_id','goods_name','goods_number','base_service_fee','service_total','service_fee','goods_status']);
  72. }
  73. /**
  74. * @notes 删除场景
  75. * @return GoodsValidate
  76. * @author likeadmin
  77. * @date 2024/07/07 18:37
  78. */
  79. public function sceneDelete()
  80. {
  81. return $this->only(['id']);
  82. }
  83. /**
  84. * @notes 详情场景
  85. * @return GoodsValidate
  86. * @author likeadmin
  87. * @date 2024/07/07 18:37
  88. */
  89. public function sceneDetail()
  90. {
  91. return $this->only(['id']);
  92. }
  93. /**
  94. * @notes 添加场景
  95. * @return GoodsValidate
  96. * @author likeadmin
  97. * @date 2024/07/07 18:37
  98. */
  99. public function sceneRules()
  100. {
  101. return $this->only(['ids','rate','type']);
  102. }
  103. }