PcController.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LikeShop有特色的全开源社交分销电商系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 商业用途务必购买系统授权,以免引起不必要的法律纠纷
  7. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  8. // | 微信公众号:好象科技
  9. // | 访问官网:http://www.likemarket.net
  10. // | 访问社区:http://bbs.likemarket.net
  11. // | 访问手册:http://doc.likemarket.net
  12. // | 好象科技开发团队 版权所有 拥有最终解释权
  13. // +----------------------------------------------------------------------
  14. // | Author: LikeShopTeam-段誉
  15. // +----------------------------------------------------------------------
  16. namespace app\shopapi\controller;
  17. use app\common\enum\PcDecorateThemePageEnum;
  18. use app\common\service\JsonService;
  19. use app\shopapi\lists\GoodsCommentLists;
  20. use app\shopapi\logic\PcLogic;
  21. use app\shopapi\validate\PcValidate;
  22. /**
  23. * PC商城
  24. */
  25. class PcController extends BaseShopController
  26. {
  27. public array $notNeedLogin = ['commonData', 'goodsDetail', 'goodsCommentCategory', 'goodsCommentLists','getPage'];
  28. /**
  29. * @notes 获取公共数据
  30. * @author Tab
  31. * @date 2021/11/29 16:11
  32. */
  33. public function commonData()
  34. {
  35. $params['user_id'] = $this->userId;
  36. $params['user_info'] = $this->userInfo;
  37. $result = PcLogic::commonData($params);
  38. return JsonService::data($result);
  39. }
  40. /**
  41. * @notes 获取商品详情
  42. * @author Tab
  43. * @date 2021/11/30 11:11
  44. */
  45. public function goodsDetail()
  46. {
  47. $params = (new PcValidate())->goCheck('goodsDetail');
  48. $params['user_id'] = $this->userId;
  49. $result = PcLogic::goodsDetail($params);
  50. return JsonService::data($result);
  51. }
  52. /**
  53. * @notes 获取商品评论
  54. * @return \think\response\Json
  55. * @author Tab
  56. * @date 2021/11/30 11:57
  57. */
  58. public function goodsCommentCategory()
  59. {
  60. $params = (new PcValidate())->goCheck('goodsCommentCategory');
  61. $result = PcLogic::goodsCommentCategory($params);
  62. return JsonService::data($result);
  63. }
  64. /**
  65. * @notes 获取商品评论列表
  66. * @return \think\response\Json
  67. * @author Tab
  68. * @date 2021/11/30 14:17
  69. */
  70. public function goodsCommentLists()
  71. {
  72. return JsonService::dataLists(new GoodsCommentLists());
  73. }
  74. /**
  75. * @notes 设置用户信息
  76. * @author Tab
  77. * @date 2021/12/2 16:43
  78. */
  79. public function setUserInfo()
  80. {
  81. $params = (new PcValidate())->post()->goCheck('setUserInfo');
  82. $params['user_id'] = $this->userId;
  83. $result = PcLogic::setUserInfo($params);
  84. if ($result) {
  85. return JsonService::success('修改成功');
  86. }
  87. return JsonService::fail(PcLogic::getError());
  88. }
  89. /**
  90. * @notes 售后申请页信息
  91. * @author Tab
  92. * @date 2021/12/3 15:09
  93. */
  94. public function afterSaleApplyPage()
  95. {
  96. $params = (new PcValidate())->goCheck('afterSaleApplyPage');
  97. $result = PcLogic::afterSaleApplyPage($params);
  98. return JsonService::data($result);
  99. }
  100. /**
  101. * @notes 获取页面
  102. * @return \think\response\Json
  103. * @author cjhao
  104. * @date 2021/12/6 18:48
  105. */
  106. public function getPage()
  107. {
  108. $type = $this->request->get('type',PcDecorateThemePageEnum::TYPE_HOME);
  109. $result = (new PcLogic)->getPage($type);
  110. return JsonService::data($result);
  111. }
  112. }