diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index f8d37e199..be9370936 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -90,7 +90,6 @@ class MemberController extends ThinkController //计算用户列表 $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) @@ -98,17 +97,26 @@ class MemberController extends ThinkController if($havs){ $data->having($havs); } + if($promoterSelect){ + $data->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left"); + }else{ + $data->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left"); + } $data = $data->select(); //计算累计充值总额 $now_count = 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); if($havs){ $now_count->having($havs); } + if($promoterSelect){ + $now_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left"); + }else{ + $now_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left"); + } $now_count = $now_count->find()['recharge_total']; //计算用户总数