Account.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 山西牛酷信息科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com.cn
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  9. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  10. * =========================================================
  11. */
  12. namespace app\admin\controller;
  13. use app\model\shop\ShopDeposit;
  14. use app\model\web\Account as AccountModel;
  15. use app\model\shop\Shop;
  16. use app\model\web\WebSite;
  17. use addon\fenxiao\model\FenxiaoData;
  18. /**
  19. * 账户数据控制器
  20. */
  21. class Account extends BaseAdmin
  22. {
  23. /**
  24. * 数据概况
  25. * @return mixed
  26. */
  27. public function index()
  28. {
  29. $account_model = new AccountModel();
  30. $website_model = new WebSite();
  31. //订单金额
  32. $order_sum = $account_model->getOrderSum();
  33. //店铺结算
  34. $shop_settlement_sum = $account_model->getShopSettlementSum();
  35. //店铺费用、店铺保证金、店铺提现、店铺余额
  36. $shop_sum = $account_model->getShopDataSum();
  37. //会员余额
  38. $member_balance_sum = $account_model->getMemberBalanceSum();
  39. $is_memberwithdraw = addon_is_exit('memberwithdraw');
  40. $this->assign('is_memberwithdraw',$is_memberwithdraw);
  41. if($is_memberwithdraw == 1){
  42. $this->assign('member_balance_sum',$member_balance_sum['data']);
  43. }else{
  44. $member_balance = number_format($member_balance_sum['data']['balance']+$member_balance_sum['data']['balance_money'],2, '.' , '');
  45. $this->assign('member_balance',$member_balance);
  46. }
  47. $settlement_sum = $shop_settlement_sum['data']['shop_money']-$shop_settlement_sum['data']['refund_shop_money']-$shop_settlement_sum['data']['commission'];
  48. $account = [
  49. 'order_sum' => $order_sum['data'],
  50. 'shop_settlement_sum' => number_format($settlement_sum,2, '.' , ''),
  51. 'shop_fee' => $shop_sum['data']['shop_open_fee'],
  52. 'shop_baozhrmb' => $shop_sum['data']['account'],
  53. 'account_withdraw' => $shop_sum['data']['account_withdraw'],
  54. 'account_withdraw_apply' => $shop_sum['data']['account_withdraw_apply'],
  55. 'account' => $shop_sum['data']['account']
  56. ];
  57. $this->assign('account', $account);
  58. return $this->fetch("account/index");
  59. }
  60. /**
  61. * 佣金列表
  62. */
  63. public function lists()
  64. {
  65. if (request()->isAjax()) {
  66. $page_index = input('page', 1);
  67. $page_size = input('page_size', PAGE_LIST_ROWS);
  68. $site_name = input("site_name", '');
  69. $start_time = input("start_time", '');
  70. $end_time = input("end_time", '');
  71. $condition = [
  72. [ "na.account_type", "=", 'account' ]
  73. ];
  74. if (!empty($site_name)) {
  75. $condition[] = [ 'no.site_name', 'like', '%' . $site_name . '%' ];
  76. }
  77. if (!empty($start_time) && empty($end_time)) {
  78. $condition[] = [ 'na.create_time', '>=', date_to_time($start_time) ];
  79. } elseif (empty($start_time) && !empty($end_time)) {
  80. $condition[] = [ "na.create_time", "<=", date_to_time($end_time) ];
  81. } elseif (!empty($start_time) && !empty($end_time)) {
  82. $condition[] = [ 'na.create_time', 'between', [ date_to_time($start_time), date_to_time($end_time) ] ];
  83. }
  84. $account_model = new AccountModel();
  85. $list = $account_model->getOrderAccountPageList($condition, $page_index, $page_size);
  86. return $list;
  87. }else{
  88. return $this->fetch("account/lists");
  89. }
  90. }
  91. /**
  92. * 订单列表
  93. */
  94. public function order()
  95. {
  96. return $this->fetch("account/order");
  97. }
  98. /**
  99. * 店铺余额
  100. */
  101. public function shopBalance()
  102. {
  103. if (request()->isAjax()) {
  104. $page_index = input('page', 1);
  105. $page_size = input('page_size', PAGE_LIST_ROWS);
  106. $site_name = input("site_name", '');
  107. $condition = [];
  108. $condition[] = [ 'site_name', 'like', '%' . $site_name . '%' ];
  109. $shop_model = new Shop();
  110. $list = $shop_model->getShopPageList($condition, $page_index, $page_size, '', 'site_id, site_name, category_name, group_name, account, account_withdraw, shop_open_fee, shop_baozhrmb, logo, is_own, account_withdraw_apply, shop_status');
  111. return $list;
  112. }else{
  113. return $this->fetch("account/shop_balance");
  114. }
  115. }
  116. /**
  117. * 店铺余额
  118. */
  119. public function shopDeposit()
  120. {
  121. if (request()->isAjax()) {
  122. $page_index = input('page', 1);
  123. $page_size = input('page_size', PAGE_LIST_ROWS);
  124. $site_name = input("site_name", '');
  125. $condition = [];
  126. $condition[] = [ 'site_name', 'like', '%' . $site_name . '%' ];
  127. $shop_model = new ShopDeposit();
  128. $list = $shop_model->getShopDepositPageList($condition, $page_index, $page_size, 'id desc');
  129. return $list;
  130. }else{
  131. return $this->fetch("account/shop_deposit");
  132. }
  133. }
  134. }