AfterSaleController.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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\controller;
  20. use app\common\service\after_sale\AfterSaleService;
  21. use app\shopapi\logic\AfterSaleLogic;
  22. use app\shopapi\validate\AfterSaleValidate;
  23. use think\facade\Db;
  24. use think\Validate;
  25. /**
  26. * 售后控制器
  27. * Class AfterSaleController
  28. * @package app\shopapi\controller
  29. */
  30. class AfterSaleController extends BaseShopController
  31. {
  32. /**
  33. * @notes 子订单商品信息
  34. * @return \think\response\Json
  35. * @author Tab
  36. * @date 2021/7/31 17:52
  37. */
  38. public function orderGoodsInfo()
  39. {
  40. $params = (new AfterSaleValidate())->goCheck('orderGoodsInfo');
  41. $result = AfterSaleLogic::orderGoodsInfo($params);
  42. return $this->data($result);
  43. }
  44. /**
  45. * @notes 申请商品售后
  46. * @return \think\response\Json
  47. * @author Tab
  48. * @date 2021/8/2 11:34
  49. */
  50. public function apply()
  51. {
  52. $params = (new AfterSaleValidate())->post()->goCheck('apply');
  53. $params['user_id'] = $this->userId;
  54. $result = AfterSaleLogic::apply($params);
  55. if($result === false) {
  56. return $this->fail(AfterSaleLogic::getError());
  57. }
  58. return $this->success('申请商品售后成功', $result);
  59. }
  60. /**
  61. * @notes 买家取消售后
  62. * @return \think\response\Json
  63. * @author Tab
  64. * @date 2021/8/3 10:05
  65. */
  66. public function cancel()
  67. {
  68. $params = (new AfterSaleValidate())->post()->goCheck('cancel');
  69. $params['user_id'] = $this->userId;
  70. $result = AfterSaleLogic::cancel($params);
  71. if($result) {
  72. return $this->success('买家取消售后成功');
  73. }
  74. return $this->fail(AfterSaleLogic::getError());
  75. }
  76. /**
  77. * @notes 买家确认退货
  78. * @return \think\response\Json
  79. * @author Tab
  80. * @date 2021/8/3 11:25
  81. */
  82. public function returnGoods()
  83. {
  84. $params = (new AfterSaleValidate())->post()->goCheck('returnGoods');
  85. $params['user_id'] = $this->userId;
  86. $result = AfterSaleLogic::returnGoods($params);
  87. if($result) {
  88. return $this->success('买家确认退货');
  89. }
  90. return $this->fail(AfterSaleLogic::getError());
  91. }
  92. /**
  93. * @notes 查看售后列表
  94. * @return \think\response\Json
  95. * @author Tab
  96. * @date 2021/8/10 10:09
  97. */
  98. public function lists()
  99. {
  100. $params = (new AfterSaleValidate())->goCheck('lists');
  101. $params['user_id'] = $this->userId;
  102. $params['page_no'] = $params['page_no'] ?? 1;
  103. $params['page_size'] = $params['page_size'] ?? 25;
  104. $result = AfterSaleLogic::lists($params);
  105. return $this->data($result);
  106. }
  107. /**
  108. * @notes 查看售后详情
  109. * @return \think\response\Json
  110. * @author Tab
  111. * @date 2021/8/10 15:07
  112. */
  113. public function detail()
  114. {
  115. $params = (new AfterSaleValidate())->goCheck('detail');
  116. $result = AfterSaleLogic::detail($params);
  117. return $this->data($result);
  118. }
  119. }