RechargeController.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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\api\controller;
  15. use app\api\lists\recharge\RechargeLists;
  16. use app\api\logic\RechargeLogic;
  17. use app\api\validate\RechargeValidate;
  18. /**
  19. * 充值控制器
  20. * Class RechargeController
  21. * @package app\shopapi\controller
  22. */
  23. class RechargeController extends BaseApiController
  24. {
  25. /**
  26. * @notes 获取充值列表
  27. * @return \think\response\Json
  28. * @author 段誉
  29. * @date 2023/2/23 18:55
  30. */
  31. public function lists()
  32. {
  33. return $this->dataLists(new RechargeLists());
  34. }
  35. /**
  36. * @notes 充值
  37. * @return \think\response\Json
  38. * @author 段誉
  39. * @date 2023/2/23 18:56
  40. */
  41. public function recharge()
  42. {
  43. $params = (new RechargeValidate())->post()->goCheck('recharge', [
  44. 'user_id' => $this->userId,
  45. 'terminal' => $this->userInfo['terminal'],
  46. ]);
  47. $result = RechargeLogic::recharge($params);
  48. if (false === $result) {
  49. return $this->fail(RechargeLogic::getError());
  50. }
  51. return $this->data($result);
  52. }
  53. public function details()
  54. {
  55. $order_id = $this->request->get('order_id/d', 0);
  56. $result = RechargeLogic::detail($order_id);
  57. if (false === $result) {
  58. return $this->fail(RechargeLogic::getError());
  59. }
  60. return $this->data($result);
  61. }
  62. /**
  63. * @notes 充值配置
  64. * @return \think\response\Json
  65. * @author 段誉
  66. * @date 2023/2/24 16:56
  67. */
  68. public function config()
  69. {
  70. return $this->data(RechargeLogic::config($this->userId));
  71. }
  72. }