截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Recharge.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\basics\Api;
  4. use app\common\server\JsonServer;
  5. use app\api\logic\RechargeLogic;
  6. use app\api\validate\RechargeValidate;
  7. use think\exception\ValidateException;
  8. class Recharge extends Api
  9. {
  10. public $like_not_need_login = ['rechargetemplate'];
  11. /**
  12. * note 充值模板
  13. */
  14. public function rechargeTemplate(){
  15. $list = RechargeLogic::getTemplate();
  16. return JsonServer::success('', $list);
  17. }
  18. /**
  19. * 充值
  20. */
  21. public function recharge(){
  22. try{
  23. $post = $this->request->post();
  24. validate(RechargeValidate::class)->check($post);
  25. }catch(ValidateException $e) {
  26. return JsonServer::error($e->getError());
  27. }
  28. $result = RechargeLogic::recharge($this->user_id,$this->client,$post);
  29. if($result === false) {
  30. return JsonServer::error(RechargeLogic::getError());
  31. }
  32. return JsonServer::success('', $result);
  33. }
  34. /**
  35. * 充值记录
  36. */
  37. public function rechargeRecord()
  38. {
  39. $get = $this->request->get();
  40. $get['page_no'] = $get['page_no'] ?? $this->page_no;
  41. $get['page_size'] = $get['page_size'] ?? $this->page_size;
  42. $get['user_id'] = $this->user_id;
  43. $result = RechargeLogic::rechargeRecord($get);
  44. return JsonServer::success('', $result);
  45. }
  46. }