RechargeController.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. */
  29. public function lists()
  30. {
  31. return $this->dataLists(new RechargeLists());
  32. }
  33. /**
  34. * @notes 充值
  35. * @return \think\response\Json
  36. */
  37. public function recharge()
  38. {
  39. $params = (new RechargeValidate())->post()->goCheck('recharge', [
  40. 'user_id' => $this->userId,
  41. 'terminal' => $this->userInfo['terminal'],
  42. ]);
  43. $result = RechargeLogic::recharge($params);
  44. if (false === $result) {
  45. return $this->fail(RechargeLogic::getError());
  46. }
  47. return $this->data($result);
  48. }
  49. /**
  50. * @notes 充值配置
  51. * @return \think\response\Json
  52. * @author 段誉
  53. * @date 2023/2/24 16:56
  54. */
  55. public function config()
  56. {
  57. return $this->data(RechargeLogic::config($this->userId));
  58. }
  59. }