Finance.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xurongyao <763569752@qq.com>
  5. * Date: 2018/6/14 下午5:25
  6. */
  7. namespace app\admin\controller\finance;
  8. use app\admin\controller\AuthController;
  9. use app\admin\model\order\StoreOrder;
  10. use app\admin\model\user\{User,UserBill};
  11. use app\admin\model\finance\FinanceModel;
  12. use crmeb\services\{UtilService as Util,JsonService as Json};
  13. /**
  14. * 微信充值记录
  15. * Class UserRecharge
  16. * @package app\admin\controller\user
  17. */
  18. class Finance extends AuthController
  19. {
  20. /**
  21. * 显示资金记录
  22. */
  23. public function bill()
  24. {
  25. $list = UserBill::where('type', 'not in', ['gain', 'system_sub', 'deduction', 'sign'])
  26. ->where('category', 'not in', 'integral')
  27. ->field(['title', 'type'])
  28. ->group('type')
  29. ->distinct(true)
  30. ->select()
  31. ->toArray();
  32. $data['order_number'] = StoreOrder::where('paid', 1)->sum('pay_price');//订单总数
  33. $data['today_number'] = StoreOrder::where('paid', 1)->whereBetweenTime('add_time', strtotime('today'), strtotime('tomorrow'))->sum('pay_price');//今天订单
  34. $data['yu_number'] = StoreOrder::where('paid', 1)->where('pay_type', 'yue')->sum('pay_price');//余额订单
  35. $data['ali_number'] = StoreOrder::where('paid', 1)->where('pay_type', 'alipay_wap')->sum('pay_price');//支付宝订单
  36. $data['zt_integral'] = UserBill::where('type', 'zt_dynamic_integral')->sum('number');//直推
  37. $data['td_integral'] = UserBill::where('type', 'team')->where('category', 'dynamic_integral')->sum('number');//支付宝订单
  38. $this->assign('data', $data);
  39. $this->assign('selectList', $list);
  40. return $this->fetch();
  41. }
  42. /**
  43. * 显示资金记录ajax列表
  44. */
  45. public function billlist()
  46. {
  47. $where = Util::getMore([
  48. ['start_time', ''],
  49. ['end_time', ''],
  50. ['nickname', ''],
  51. ['limit', 20],
  52. ['page', 1],
  53. ['type', ''],
  54. ]);
  55. return Json::successlayui(FinanceModel::getBillList($where));
  56. }
  57. /**
  58. *保存资金监控的excel表格
  59. */
  60. public function save_bell_export()
  61. {
  62. $where = Util::getMore([
  63. ['start_time', ''],
  64. ['end_time', ''],
  65. ['nickname', ''],
  66. ['type', ''],
  67. ]);
  68. FinanceModel::SaveExport($where);
  69. }
  70. /**
  71. * 显示佣金记录
  72. */
  73. public function commission_list()
  74. {
  75. $this->assign('is_layui', true);
  76. return $this->fetch();
  77. }
  78. /**
  79. * 佣金记录异步获取
  80. */
  81. public function get_commission_list()
  82. {
  83. $get = Util::getMore([
  84. ['page', 1],
  85. ['limit', 20],
  86. ['nickname', ''],
  87. ['price_max', ''],
  88. ['price_min', ''],
  89. ['order', ''],
  90. ['excel', ''],
  91. ]);
  92. return Json::successlayui(User::getCommissionList($get));
  93. }
  94. /**
  95. * 显示操作记录
  96. */
  97. public function index3()
  98. {
  99. }
  100. /**
  101. * 佣金详情
  102. */
  103. public function content_info($uid = '')
  104. {
  105. if ($uid == '') return $this->failed('缺少参数');
  106. $this->assign('userinfo', User::getUserinfo($uid));
  107. $this->assign('uid', $uid);
  108. return $this->fetch();
  109. }
  110. /**
  111. * 佣金提现记录个人列表
  112. */
  113. public function get_extract_list($uid = '')
  114. {
  115. if ($uid == '') return Json::fail('缺少参数');
  116. $where = Util::getMore([
  117. ['page', 1],
  118. ['limit', 20],
  119. ['start_time', ''],
  120. ['end_time', ''],
  121. ['nickname', '']
  122. ]);
  123. return Json::successlayui(UserBill::getExtrctOneList($where, $uid));
  124. }
  125. }