RechargeController.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\recharge;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\recharge\RechargeLists;
  17. use app\adminapi\logic\recharge\RechargeLogic;
  18. use app\adminapi\validate\recharge\RechargeRefundValidate;
  19. /**
  20. * 充值控制器
  21. * Class RechargeController
  22. * @package app\adminapi\controller\recharge
  23. */
  24. class RechargeController extends BaseAdminController
  25. {
  26. /**
  27. * @notes 获取充值设置
  28. * @return \think\response\Json
  29. * @author 段誉
  30. * @date 2023/2/22 16:48
  31. */
  32. public function getConfig()
  33. {
  34. $result = RechargeLogic::getConfig();
  35. return $this->data($result);
  36. }
  37. /**
  38. * @notes 充值设置
  39. * @return \think\response\Json
  40. * @author 段誉
  41. * @date 2023/2/22 16:48
  42. */
  43. public function setConfig()
  44. {
  45. $params = $this->request->post();
  46. $result = RechargeLogic::setConfig($params);
  47. if($result) {
  48. return $this->success('操作成功', [], 1, 1);
  49. }
  50. return $this->fail(RechargeLogic::getError());
  51. }
  52. /**
  53. * @notes 充值记录
  54. * @return \think\response\Json
  55. * @author 段誉
  56. * @date 2023/2/24 16:01
  57. */
  58. public function lists()
  59. {
  60. return $this->dataLists(new RechargeLists());
  61. }
  62. /**
  63. * @notes 退款
  64. * @return \think\response\Json
  65. * @author 段誉
  66. * @date 2023/2/28 17:29
  67. */
  68. public function refund()
  69. {
  70. $params = (new RechargeRefundValidate())->post()->goCheck('refund');
  71. $result = RechargeLogic::refund($params, $this->adminId);
  72. list($flag, $msg) = $result;
  73. if(false === $flag) {
  74. return $this->fail($msg);
  75. }
  76. return $this->success($msg, [], 1, 1);
  77. }
  78. /**
  79. * @notes 重新退款
  80. * @return \think\response\Json
  81. * @author 段誉
  82. * @date 2023/2/28 19:17
  83. */
  84. public function refundAgain()
  85. {
  86. $params = (new RechargeRefundValidate())->post()->goCheck('again');
  87. $result = RechargeLogic::refundAgain($params, $this->adminId);
  88. list($flag, $msg) = $result;
  89. if(false === $flag) {
  90. return $this->fail($msg);
  91. }
  92. return $this->success($msg, [], 1, 1);
  93. }
  94. }