Pay.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\adminapi\controller\pay;
  12. use app\dict\common\ChannelDict;
  13. use app\dict\pay\PayDict;
  14. use app\service\admin\pay\PayService;
  15. use core\base\BaseAdminController;
  16. use think\Response;
  17. class Pay extends BaseAdminController
  18. {
  19. /**
  20. * 待审核支付记录
  21. * @return Response
  22. */
  23. public function lists(){
  24. $data = $this->request->params([
  25. ['create_time', []],
  26. ['out_trade_no', ''],
  27. ['type', ''],
  28. ['channel', '']
  29. ]);
  30. return success(data: (new PayService())->getPage($data));
  31. }
  32. /**
  33. * 待审核支付记录
  34. * @return Response
  35. */
  36. public function audit(){
  37. $data = $this->request->params([
  38. ['create_time', []],
  39. ['out_trade_no', ''],
  40. ['status', '']
  41. ]);
  42. return success(data: (new PayService())->getAuditPage($data));
  43. }
  44. /**
  45. * 查询详情
  46. * @param int $id
  47. * @return \think\Response
  48. */
  49. public function detail(int $id){
  50. return success(data: (new PayService())->getDetail($id));
  51. }
  52. /**
  53. * 支付审核通过
  54. * @param string $out_trade_no
  55. * @return \think\Response
  56. */
  57. public function pass(string $out_trade_no){
  58. return success(data: (new PayService())->pass($out_trade_no));
  59. }
  60. /**
  61. * 审核拒绝
  62. * @param string $out_trade_no
  63. * @return Response
  64. */
  65. public function refuse(string $out_trade_no){
  66. $reason = input('reason', '');
  67. return success(data: (new PayService())->refuse($out_trade_no, $reason));
  68. }
  69. /**
  70. * 获取支付方式列表
  71. * @return \think\Response
  72. */
  73. public function getTypeList()
  74. {
  75. $list = array_filter(PayDict::getPayType(), function($value){
  76. return $value['key'] !== PayDict::FRIENDSPAY;
  77. });
  78. return success(data: $list);
  79. }
  80. /**
  81. * 获取支付渠道
  82. * @return \think\Response
  83. */
  84. public function getChannelList()
  85. {
  86. return success(ChannelDict::getType());
  87. }
  88. /**
  89. * 按支付方式统计支付金额
  90. * @return \think\Response
  91. */
  92. public function typeStat()
  93. {
  94. return success((new PayService())->getPayTypeStat());
  95. }
  96. /**
  97. * 按支付渠道统计支付金额
  98. * @return \think\Response
  99. */
  100. public function channelStat()
  101. {
  102. return success((new PayService())->getChannelStat());
  103. }
  104. }