Finance.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\controller\finance;
  12. use app\admin\controller\AuthController;
  13. use app\admin\model\user\UserBill;
  14. use service\JsonService as Json;
  15. use app\admin\model\finance\FinanceModel;
  16. use service\SystemConfigService;
  17. use service\FormBuilder as Form;
  18. use service\HookService;
  19. use think\Url;
  20. use app\admin\model\user\User;
  21. use app\admin\model\user\UserExtract;
  22. /**
  23. * 微信充值记录
  24. * Class UserRecharge
  25. * @package app\admin\controller\user
  26. */
  27. class Finance extends AuthController
  28. {
  29. /**
  30. * 显示资金记录
  31. */
  32. public function bill()
  33. {
  34. $category = $this->request->param('category','now_money');
  35. $bill_where_op = FinanceModel::bill_where_op($category);
  36. $list = UserBill::where('type', $bill_where_op['type']['op'], $bill_where_op['type']['condition'])
  37. ->where('category', $bill_where_op['category']['op'], $bill_where_op['category']['condition'])
  38. ->field(['title', 'type'])
  39. ->group('type')
  40. ->distinct(true)
  41. ->select()
  42. ->toArray();
  43. $this->assign('selectList', $list);
  44. $this->assign('category', $category);
  45. $this->assign('gold_name', $category == "now_money" ? "金额" : SystemConfigService::get("gold_name"));
  46. return $this->fetch();
  47. }
  48. /**
  49. * 显示资金记录ajax列表
  50. */
  51. public function billlist()
  52. {
  53. $where = parent::getMore([
  54. ['start_time', ''],
  55. ['end_time', ''],
  56. ['nickname', ''],
  57. ['limit', 20],
  58. ['page', 1],
  59. ['type', ''],
  60. ['category', 'now_money'],
  61. ]);
  62. return Json::successlayui(FinanceModel::getBillList($where));
  63. }
  64. /**
  65. *保存资金监控的excel表格
  66. */
  67. public function save_bell_export()
  68. {
  69. $where = parent::getMore([
  70. ['start_time', ''],
  71. ['end_time', ''],
  72. ['nickname', ''],
  73. ['type', ''],
  74. ['category', 'now_money'],
  75. ]);
  76. FinanceModel::SaveExport($where);
  77. }
  78. /**
  79. * 显示佣金记录
  80. */
  81. public function commission_list()
  82. {
  83. $this->assign('is_layui', true);
  84. return $this->fetch();
  85. }
  86. /**
  87. * 佣金记录异步获取
  88. */
  89. public function get_commission_list()
  90. {
  91. $get = parent::getMore([
  92. ['page', 1],
  93. ['limit', 20],
  94. ['nickname', ''],
  95. ['price_max', ''],
  96. ['price_min', ''],
  97. ['order', '']
  98. ]);
  99. return Json::successlayui(User::getCommissionList($get));
  100. }
  101. /**
  102. * 佣金详情
  103. */
  104. public function content_info($uid = '')
  105. {
  106. if ($uid == '') return $this->failed('缺少参数');
  107. $this->assign('userinfo', User::getUserinfo($uid));
  108. $this->assign('uid', $uid);
  109. return $this->fetch();
  110. }
  111. /**
  112. * 佣金提现记录个人列表
  113. */
  114. public function get_extract_list($uid = '')
  115. {
  116. if ($uid == '') return Json::fail('缺少参数');
  117. $where = parent::getMore([
  118. ['page', 1],
  119. ['limit', 20],
  120. ['start_time', ''],
  121. ['end_time', ''],
  122. ['nickname', '']
  123. ]);
  124. return Json::successlayui(UserBill::getExtrctOneList($where, $uid));
  125. }
  126. }