OrderMerchant.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author Qinii
  6. * @day 2020-07-18
  7. *
  8. *
  9. */
  10. namespace app\controller\admin\system\merchant;
  11. use app\common\repositories\merchant\apply\MerchantHaikeApplyRepository;
  12. use app\common\repositories\merchant\order\OrderMerchantRepository;
  13. use think\App;
  14. use crmeb\basic\BaseController;
  15. /**
  16. * 线下充值列表
  17. * Class OrderMerchant
  18. * @package app\controller\admin\system\merchant
  19. * @author php迷途小书童
  20. * @created 2021/2/3 13:38
  21. */
  22. class OrderMerchant extends BaseController
  23. {
  24. /**
  25. * @var OrderMerchantRepository
  26. */
  27. protected $repository;
  28. /**
  29. * MerchantIntention constructor.
  30. * @param App $app
  31. * @param OrderMerchantRepository $repository
  32. */
  33. public function __construct(App $app, OrderMerchantRepository $repository)
  34. {
  35. parent::__construct($app);
  36. $this->repository = $repository;
  37. }
  38. /**
  39. * 线下充值列表
  40. * @return mixed
  41. * @author php迷途小书童
  42. * @created 2021/2/3 13:38
  43. */
  44. public function lst()
  45. {
  46. [$page, $limit] = $this->getPage();
  47. $where = $this->request->params(['keyword', 'date']);
  48. return app('json')->success($this->repository->getList($where, $page, $limit));
  49. }
  50. /**
  51. * 发起退款
  52. * @return mixed
  53. * @author php迷途小书童
  54. * @created 2021/2/3 13:38
  55. */
  56. public function refund($id)
  57. {
  58. $detail = $this->repository->getOneById($id);
  59. if (!$detail)
  60. return app('json')->fail('数据不存在');
  61. try {
  62. $haikeRepository = app()->make(MerchantHaikeApplyRepository::class);
  63. $return = $haikeRepository->haikeRefundApply(['recharge_id' => $id]);
  64. if ($return['return_code'] != 200) {
  65. return app('json')->fail($return['return_msg']);
  66. }
  67. } catch (\Throwable $e) {
  68. return app('json')->fail($e->getMessage());
  69. }
  70. return app('json')->success('发起申请成功');
  71. }
  72. /**
  73. * 线下充值详情
  74. * @return mixed
  75. * @author php迷途小书童
  76. * @created 2021/2/3 13:37
  77. */
  78. public function detail($id){
  79. $detail = $this->repository->getOne($id);
  80. if (!$detail)
  81. return app('json')->fail('数据不存在');
  82. return app("json")->success("获取成功", $detail);
  83. }
  84. }