RefundController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace addons\QiJuhe\backend\controllers;
  3. use addons\QiJuhe\common\service\OrderService;
  4. use addons\QiJuhe\common\service\RefundService;
  5. /**
  6. * 售后
  7. */
  8. class RefundController extends BaseController
  9. {
  10. /**
  11. * 首页
  12. *
  13. * @return string
  14. */
  15. public function actionIndex()
  16. {
  17. if ($this->request->isAjax) {
  18. $params = $this->request->post();
  19. $service = new RefundService(['mall_id' => $this->mall_id]);
  20. return $this->success('ok', $service->getList($params));
  21. }
  22. return $this->render('index');
  23. }
  24. /**
  25. * 同意申请
  26. *
  27. * @return string
  28. */
  29. public function actionAgree()
  30. {
  31. if ($this->request->isAjax) {
  32. $id = $this->request->getBodyParam('id');
  33. $service = new RefundService(['mall_id' => $this->mall_id]);
  34. return $service->agree([$id], $this->request->getBodyParam('amount', 0), $this->request->getBodyParam('refund_way'))
  35. ? $this->success('ok')
  36. : $this->error('推送失败');
  37. }
  38. }
  39. /**
  40. * 驳回申请
  41. *
  42. * @return string
  43. */
  44. public function actionReject()
  45. {
  46. if ($this->request->isAjax) {
  47. $id = $this->request->getBodyParam('id');
  48. $service = new RefundService(['mall_id' => $this->mall_id]);
  49. return $service->reject([$id])
  50. ? $this->success('ok')
  51. : $this->error('操作失败');
  52. }
  53. }
  54. }