截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LiveGoodsValidate.php 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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\admin\validate\live;
  20. use app\common\basics\Validate;
  21. use app\common\enum\LiveGoodsEnum;
  22. use app\common\model\live\LiveGoods;
  23. /**
  24. * 直播商品验证器
  25. * Class LiveGoodsValidate
  26. * @package app\admin\validate\live
  27. */
  28. class LiveGoodsValidate extends Validate
  29. {
  30. protected $rule = [
  31. 'id' => 'require|checkLiveGoods',
  32. 'status' => 'require|in:' . LiveGoodsEnum::SYS_AUDIT_STATUS_WAIT_WECHAT . ',' . LiveGoodsEnum::SYS_AUDIT_STATUS_FAIL,
  33. ];
  34. protected $message = [
  35. 'id.require' => '参数缺失',
  36. 'status.require' => '状态参数缺失',
  37. 'status.in' => '状态参数异常',
  38. ];
  39. protected function sceneAudit()
  40. {
  41. return $this->only(['id', 'status']);
  42. }
  43. protected function sceneDel()
  44. {
  45. return $this->only(['id']);
  46. }
  47. protected function sceneDetail()
  48. {
  49. return $this->only(['id']);
  50. }
  51. /**
  52. * @notes 校验直播商品
  53. * @param $value
  54. * @param $rule
  55. * @param $data
  56. * @return bool|string
  57. * @author 段誉
  58. * @date 2023/2/16 11:10
  59. */
  60. protected function checkLiveGoods($value, $rule, $data)
  61. {
  62. $room = LiveGoods::where([
  63. 'id' => $value,
  64. 'del' => 0
  65. ])->findOrEmpty();
  66. if ($room->isEmpty()) {
  67. return '直播商品不存在';
  68. }
  69. return true;
  70. }
  71. }