SokabeController.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. namespace addons\AvoidTax\backend\controllers;
  3. use addons\AvoidTax\common\service\OrderService;
  4. use addons\AvoidTax\common\service\SokabeService;
  5. /**
  6. * 测试
  7. * @package addons\AvoidTax\backend\controllers
  8. */
  9. class SokabeController extends BaseController
  10. {
  11. public $enableCsrfValidation = false;
  12. /**
  13. * @var SokabeService
  14. */
  15. protected $service;
  16. public function init()
  17. {
  18. parent::init();
  19. $this->service = new SokabeService(['mall_id' => $this->mall_id]);
  20. }
  21. /**
  22. * 手续费未成功提交列表
  23. *
  24. * @return void
  25. */
  26. public function actionTax()
  27. {
  28. if ($this->request->isAjax) {
  29. return $this->success(
  30. 'ok',
  31. $this->service->getTaxList(
  32. array_merge(
  33. $this->request->getBodyParams(),
  34. $this->request->get(),
  35. )
  36. )
  37. );
  38. }
  39. return $this->render($this->action->id);
  40. }
  41. /**
  42. * 失败列表
  43. *
  44. * @return void
  45. */
  46. public function actionFail()
  47. {
  48. if ($this->request->isAjax) {
  49. return $this->success(
  50. 'ok',
  51. $this->service->getOrderList()
  52. );
  53. }
  54. return $this->render($this->action->id);
  55. }
  56. /**
  57. * 重新提交
  58. *
  59. * @return void
  60. */
  61. public function actionResub()
  62. {
  63. if ($this->request->isAjax) {
  64. // id
  65. $id = $this->request->get('id');
  66. return $this->service->resub($id)
  67. ? $this->success('ok')
  68. : $this->error($this->service->getError());
  69. }
  70. }
  71. /**
  72. * 失败
  73. *
  74. * @return void
  75. */
  76. public function actionToFail(int $id)
  77. {
  78. return $this->service->toFail($id)
  79. ? $this->success('ok')
  80. : $this->error($this->service->getError());
  81. }
  82. /**
  83. * 成功
  84. *
  85. * @return void
  86. */
  87. public function actionSuccess(int $id)
  88. {
  89. $this->service->toSuccess($id);
  90. }
  91. /**
  92. * @return mixed
  93. */
  94. public function actionList()
  95. {
  96. if ($this->request->isAjax) {
  97. return $this->success(
  98. 'ok',
  99. $this->service->getList(
  100. array_merge(
  101. $this->request->get(),
  102. )
  103. )
  104. );
  105. }
  106. return $this->render($this->action->id);
  107. }
  108. /**
  109. * 提交成功
  110. *
  111. * @param integer $id
  112. * @return mixed
  113. */
  114. public function actionSubSuccess(int $id)
  115. {
  116. return $this->service->subSuccess($id)
  117. ? $this->success('ok')
  118. : $this->error($this->service->getError());
  119. }
  120. /**
  121. * 提交失败
  122. *
  123. * @param integer $id
  124. * @return mixed
  125. */
  126. public function actionSubFail(int $id)
  127. {
  128. return $this->service->subFial($id)
  129. ? $this->success('ok')
  130. : $this->error($this->service->getError());
  131. }
  132. }