Finance.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 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 app\admin\model\merchant\MerchantFlowingWater;
  17. use app\admin\model\merchant\MerchantBill;
  18. use app\admin\model\merchant\Merchant;
  19. use service\SystemConfigService;
  20. use service\FormBuilder as Form;
  21. use service\HookService;
  22. use think\Url;
  23. use app\admin\model\user\User;
  24. use app\admin\model\user\UserExtract;
  25. /**
  26. * 微信充值记录
  27. * Class Finance
  28. */
  29. class Finance extends AuthController
  30. {
  31. /**
  32. * 显示资金记录
  33. */
  34. public function bill()
  35. {
  36. $category = $this->request->param('category', 'now_money');
  37. $bill_where_op = FinanceModel::bill_where_op($category);
  38. $list = UserBill::where('type', $bill_where_op['type']['op'], $bill_where_op['type']['condition'])
  39. ->where('category', $bill_where_op['category']['op'], $bill_where_op['category']['condition'])
  40. ->field(['title', 'type'])
  41. ->group('type')
  42. ->distinct(true)
  43. ->select()
  44. ->toArray();
  45. $this->assign([
  46. 'selectList' => $list,
  47. 'category' => $category,
  48. 'gold_name' => $category == "gold_num" ? SystemConfigService::get("gold_name") : '金额'
  49. ]);
  50. return $this->fetch();
  51. }
  52. /**
  53. * 显示资金记录ajax列表
  54. */
  55. public function billlist()
  56. {
  57. $where = parent::getMore([
  58. ['start_time', ''],
  59. ['end_time', ''],
  60. ['nickname', ''],
  61. ['limit', 20],
  62. ['page', 1],
  63. ['type', ''],
  64. ['category', 'now_money']
  65. ]);
  66. return Json::successlayui(FinanceModel::getBillList($where));
  67. }
  68. /**
  69. *保存资金监控的excel表格
  70. */
  71. public function save_bell_export()
  72. {
  73. $where = parent::getMore([
  74. ['start_time', ''],
  75. ['end_time', ''],
  76. ['nickname', ''],
  77. ['type', ''],
  78. ['category', 'now_money'],
  79. ]);
  80. FinanceModel::SaveExport($where);
  81. }
  82. /**
  83. * 显示佣金记录
  84. */
  85. public function commission_list()
  86. {
  87. $this->assign('is_layui', true);
  88. return $this->fetch();
  89. }
  90. /**
  91. * 佣金记录异步获取
  92. */
  93. public function get_commission_list()
  94. {
  95. $get = parent::getMore([
  96. ['page', 1],
  97. ['limit', 20],
  98. ['nickname', ''],
  99. ['price_max', ''],
  100. ['price_min', ''],
  101. ['order', '']
  102. ]);
  103. return Json::successlayui(User::getCommissionList($get));
  104. }
  105. /**
  106. * 佣金详情
  107. */
  108. public function content_info($uid = '')
  109. {
  110. if ($uid == '') return $this->failed('缺少参数');
  111. $this->assign('userinfo', User::getUserinfo($uid));
  112. $this->assign('uid', $uid);
  113. return $this->fetch();
  114. }
  115. /**
  116. * 佣金提现记录个人列表
  117. */
  118. public function get_extract_list($uid = '')
  119. {
  120. if ($uid == '') return Json::fail('缺少参数');
  121. $where = parent::getMore([
  122. ['page', 1],
  123. ['limit', 20],
  124. ['start_time', ''],
  125. ['end_time', ''],
  126. ['nickname', '']
  127. ]);
  128. return Json::successlayui(UserBill::getExtrctOneList($where, $uid));
  129. }
  130. /**讲师流水
  131. * @return mixed
  132. * @throws \think\db\exception\DataNotFoundException
  133. * @throws \think\db\exception\ModelNotFoundException
  134. * @throws \think\exception\DbException
  135. */
  136. public function merbill()
  137. {
  138. $list = Merchant::getMerWhere()->select();
  139. $this->assign(['selectList' => $list]);
  140. return $this->fetch();
  141. }
  142. /**
  143. * 显示资金记录ajax列表
  144. */
  145. public function merbilllist()
  146. {
  147. $where = parent::getMore([
  148. ['start_time', ''],
  149. ['end_time', ''],
  150. ['category', 'now_money'],
  151. ['limit', 20],
  152. ['page', 1],
  153. ['mer_id', 0],
  154. ['excel', 0],
  155. ]);
  156. return Json::successlayui(MerchantBill::getBillList($where));
  157. }
  158. /**
  159. *保存资金监控的excel表格
  160. */
  161. public function save_mer_bell_export()
  162. {
  163. $where = parent::getMore([
  164. ['start_time', ''],
  165. ['end_time', ''],
  166. ['mer_id', 0],
  167. ['category', 'now_money'],
  168. ]);
  169. MerchantBill::SaveExport($where);
  170. }
  171. /**金币流水
  172. * @return mixed
  173. * @throws \think\db\exception\DataNotFoundException
  174. * @throws \think\db\exception\ModelNotFoundException
  175. * @throws \think\exception\DbException
  176. */
  177. public function mer_gold_bill()
  178. {
  179. $list = Merchant::getMerWhere()->select();
  180. $this->assign(['selectList' => $list]);
  181. return $this->fetch('mer_gold_bill');
  182. }
  183. /**订单分成
  184. * @return mixed
  185. * @throws \think\db\exception\DataNotFoundException
  186. * @throws \think\db\exception\ModelNotFoundException
  187. * @throws \think\exception\DbException
  188. */
  189. public function merOrderBill()
  190. {
  191. $list = Merchant::getMerWhere()->select();
  192. $this->assign(['selectList' => $list]);
  193. return $this->fetch('mer_order_bill');
  194. }
  195. /**
  196. * 订单分成列表
  197. */
  198. public function merOrderBillList()
  199. {
  200. $where = parent::getMore([
  201. ['start_time', ''],
  202. ['end_time', ''],
  203. ['nickname', ''],
  204. ['limit', 20],
  205. ['page', 1],
  206. ['mer_id', 0],
  207. ]);
  208. return Json::successlayui(MerchantFlowingWater::getBillList($where));
  209. }
  210. /**
  211. *保存资金监控的excel表格
  212. */
  213. public function save_mer_order_bell_export()
  214. {
  215. $where = parent::getMore([
  216. ['start_time', ''],
  217. ['end_time', ''],
  218. ['nickname', ''],
  219. ['mer_id', 0],
  220. ]);
  221. MerchantFlowingWater::SaveExport($where);
  222. }
  223. }