Finance.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\admin\controller\users;
  10. use app\admin\controller\Auth;
  11. use mall\response\Response;
  12. use think\facade\Request;
  13. use think\facade\View;
  14. use app\admin\service\users\Finance as FinanceService;
  15. class Finance extends Auth {
  16. private $type = ["1"=>"银行卡","2"=>"支付宝","3"=>"微信"];
  17. private $status = ["0"=>"审核中","1"=>"已提现","2"=>"未通过"];
  18. /**
  19. * 列表
  20. * @return string|\think\response\Json
  21. * @throws \think\db\exception\DataNotFoundException
  22. * @throws \think\db\exception\DbException
  23. * @throws \think\db\exception\ModelNotFoundException
  24. */
  25. public function index(){
  26. if(Request::isAjax()){
  27. $list = FinanceService::getList(Request::param(),["users_log.action"=>4]);
  28. return Response::returnArray("ok",0,$list['data'],$list['count']);
  29. }
  30. return View::fetch();
  31. }
  32. /**
  33. * 资金日志
  34. * @return string|\think\response\Json
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\DbException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. */
  39. public function fund(){
  40. if(Request::isAjax()){
  41. $list = FinanceService::getList(Request::param(),["users_log.action"=>0]);
  42. return Response::returnArray("ok",0,$list['data'],$list['count']);
  43. }
  44. return View::fetch();
  45. }
  46. /**
  47. * 退款日志
  48. * @return string|\think\response\Json
  49. * @throws \think\db\exception\DataNotFoundException
  50. * @throws \think\db\exception\DbException
  51. * @throws \think\db\exception\ModelNotFoundException
  52. */
  53. public function refund(){
  54. if(Request::isAjax()){
  55. $list = FinanceService::getList(Request::param(),["users_log.action"=>3]);
  56. return Response::returnArray("ok",0,$list['data'],$list['count']);
  57. }
  58. return View::fetch();
  59. }
  60. /**
  61. * 积分日志
  62. * @return string|\think\response\Json
  63. * @throws \think\db\exception\DataNotFoundException
  64. * @throws \think\db\exception\DbException
  65. * @throws \think\db\exception\ModelNotFoundException
  66. */
  67. public function point(){
  68. if(Request::isAjax()){
  69. $list = FinanceService::getList(Request::param(),["users_log.action"=>1]);
  70. return Response::returnArray("ok",0,$list['data'],$list['count']);
  71. }
  72. return View::fetch();
  73. }
  74. /**
  75. * 经验日志
  76. * @return string|\think\response\Json
  77. * @throws \think\db\exception\DataNotFoundException
  78. * @throws \think\db\exception\DbException
  79. * @throws \think\db\exception\ModelNotFoundException
  80. */
  81. public function exp(){
  82. if(Request::isAjax()){
  83. $list = FinanceService::getList(Request::param(),["users_log.action"=>2]);
  84. return Response::returnArray("ok",0,$list['data'],$list['count']);
  85. }
  86. return View::fetch();
  87. }
  88. /**
  89. * 提现申请
  90. * @return string|\think\response\Json
  91. * @throws \think\db\exception\DataNotFoundException
  92. * @throws \think\db\exception\DbException
  93. * @throws \think\db\exception\ModelNotFoundException
  94. */
  95. public function apply(){
  96. if(Request::isAjax()){
  97. $list = FinanceService::apply(Request::param());
  98. return Response::returnArray("ok",0,$list['data'],$list['count']);
  99. }
  100. return View::fetch();
  101. }
  102. /**
  103. * 提现
  104. * @return string|\think\response\Json
  105. */
  106. public function handle(){
  107. try{
  108. if(Request::isAjax()){
  109. FinanceService::save(Request::param());
  110. return Response::returnArray("操作成功!");
  111. }
  112. return View::fetch("",FinanceService::detail(Request::param("id",0,"intval")));
  113. }catch (\Exception $ex){
  114. if(Request::isAjax()) {
  115. return Response::returnArray($ex->getMessage(), 0);
  116. }
  117. $this->error($ex->getMessage());
  118. }
  119. }
  120. }