BargainValidate.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\shopapi\validate;
  20. use app\common\validate\BaseValidate;
  21. /**
  22. * 砍价验证器
  23. * Class BargainValidate
  24. * @package app\shopapi\validate
  25. */
  26. class BargainValidate extends BaseValidate
  27. {
  28. protected $rule = [
  29. 'activity_id' => 'require',
  30. 'goods_id' => 'require',
  31. 'item_id' => 'require',
  32. 'goods_num' => 'require|integer',
  33. 'initiate_id' => 'require',
  34. 'type' => 'require',
  35. 'delivery_type' => 'require'
  36. ];
  37. protected $message = [
  38. 'activity_id.require' => '砍价活动id缺失',
  39. 'goods_id.require' => '商品id缺失',
  40. 'item_id.require' => '规格id缺失',
  41. 'goods_num.require' => '商品数量',
  42. 'goods_num.integer' => '商品数量须为整型',
  43. 'initiate_id.require' => '砍价记录id缺失',
  44. 'type.require' => '购买类型缺失',
  45. 'delivery_type.require' => '请选择配送方式',
  46. ];
  47. /**
  48. * @notes 砍价商品详情
  49. * @return BargainValidate
  50. * @author Tab
  51. * @date 2021/8/28 15:46
  52. */
  53. public function sceneDetail()
  54. {
  55. return $this->only(['activity_id', 'goods_id']);
  56. }
  57. /**
  58. * @notes 发起砍价场景
  59. * @return BargainValidate
  60. * @author Tab
  61. * @date 2021/8/28 16:36
  62. */
  63. public function sceneInitiate()
  64. {
  65. return $this->only(['activity_id', 'item_id', 'goods_num']);
  66. }
  67. /**
  68. * @notes 帮助砍价场景
  69. * @return BargainValidate
  70. * @author Tab
  71. * @date 2021/8/30 11:12
  72. */
  73. public function sceneHelp()
  74. {
  75. return $this->only(['initiate_id']);
  76. }
  77. /**
  78. * @notes 查看砍价进度
  79. * @return BargainValidate
  80. * @author Tab
  81. * @date 2021/9/18 14:39
  82. */
  83. public function sceneBargainProgress()
  84. {
  85. return $this->only(['initiate_id']);
  86. }
  87. /**
  88. * @notes 分享帮砍详情
  89. * @return BargainValidate
  90. * @author Tab
  91. * @date 2021/9/18 17:17
  92. */
  93. public function sceneShareDetail()
  94. {
  95. return $this->only(['initiate_id']);
  96. }
  97. /**
  98. * @notes 砍价结算
  99. * @return BargainValidate
  100. * @author Tab
  101. * @date 2021/9/18 18:09
  102. */
  103. public function sceneSettle()
  104. {
  105. return $this->only(['initiate_id', 'type']);
  106. }
  107. /**
  108. * @notes 砍价下单
  109. * @return BargainValidate
  110. * @author Tab
  111. * @date 2021/9/23 14:46
  112. */
  113. public function sceneBuy()
  114. {
  115. return $this->only(['initiate_id', 'type', 'delivery_type']);
  116. }
  117. }