From 4aa9ac67678f102f34eada6c763a1348fa7186ad Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 5 Dec 2019 17:04:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=A1=A8=E4=BC=98=E5=8C=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/MemberController.class.php | 97 ++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index b24903687..d35a8e86d 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -11,7 +11,102 @@ class MemberController extends ThinkController /** *玩家列表信息 */ - public function user_info($p = 0) + public function user_info($p=0){ + //基础信息 + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + //累计充值,账户平台币排序 + $order = ''; + if (I('key') == 1) { + if (I('balance_status') == 1) { + $order = 'balance,'; + } elseif (I('balance_status') == 2) { + $order = 'balance desc,'; + } + } else { + if (I('recharge_status') == 1) { + $order .= 'recharge_total,'; + } elseif (I('recharge_status') == 2) { + $order .= 'recharge_total desc,'; + } + } + $order .= 'tab_user.id desc'; + //条件筛选 + $map = []; + $map['puid'] = array('eq', 0); + $map['is_platform'] = 0; + $havs=false; + //user表相关 + if (isset($_REQUEST['user_id'])) { + $map['tab_user.id'] = $_REQUEST['user_id']; + } + if (isset($_REQUEST['account'])) { + $map['tab_user.account'] = ['like',I('account') . "%"]; + } + if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { + $map['tab_user.register_time'] = ['between', [strtotime(I('time_start')), strtotime(I('time_end')) + 86399]]; + } elseif (isset($_REQUEST['time_start'])) { + $map['tab_user.register_time'] = ['GT', strtotime(I('time_start'))]; + } elseif (isset($_REQUEST['time_end'])) { + $map['tab_user.register_time'] = ['LT', strtotime(I('time_end')) + 86399]; + } + if (isset($_GET['register_way'])) { + $map['tab_user.register_type'] = $_GET['register_way']; + } + if (isset($_REQUEST['status'])) { + $map['lock_status'] = $_REQUEST['status']; + } + if (isset($_REQUEST['viplevel'])) { + $havs = get_vip_level_limit('recharge_total', $_REQUEST['viplevel']); + } + + $data = M("user","tab_") + ->field("tab_user.id,`device_number`,`age_status`,`account`,`balance`,`gold_coin`,`alipay`,tab_user.promote_id,`register_type`,tab_user.promote_account,`register_time`,`lock_status`,`register_way`,`register_ip`,`login_time`,`check_status`,IFNULL(sum(ss.pay_amount), 0) AS recharge_total") + ->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left") + ->where($map) + ->group("tab_user.id") + ->page($page, $row) + ->order($order); + if($havs){ + $data->having($havs); + } + $data = $data->select(); + + // echo($data);die(); + //计算总数 + $countsql = M("user","tab_") + ->field("IFNULL(sum(ss.pay_amount), 0) AS recharge_total") + ->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left") + ->where($map) + ->group("tab_user.id"); + if($havs){ + $countsql->having($havs); + } + + $countsql = $countsql->select(false); + // dump($countsql);die(); + + $countres = M()->table('(' . $countsql . ') as a ')->field("count(*) user_count,sum(recharge_total) recharge_total")->find(); + + $this->assign('user_count',$countres['user_count']); + $this->assign('now_count', $countres['recharge_total']?:0); + + $page = set_pagination($countres['user_count'], $row); + if ($page) { + $this->assign('_page', $page); + } + $this->assign('list_data', $data); + $this->display(); + } + + + public function user_info2($p = 0) { $hav = ''; if ($_REQUEST['promote_id'] != '') {