diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index a20bc258a..c89d06dc9 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -223,9 +223,11 @@ class MemberController extends ThinkController ->group('tab_user.id') ->where($hav) ->having($havs)->select(false); + + $allcountsql = str_replace("tab_user.promote_id","ss.promote_id",$sql); //获取总额 - $allcount = M()->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $sql . ') as a')->select(); - $this->assign('history_count', $allcount[0]['recharge_total']); + $allcount = M()->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $allcountsql . ') as a')->select(); + $this->assign('history_count', $allcount[0]['recharge_total']?:0); //替换为新表 if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){ @@ -240,10 +242,10 @@ class MemberController extends ThinkController } $jcount = M('User', 'tab_')->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $sql . ') as a')->select(); - $count = $jcount[0]['count']; - //var_dump(M('User', 'tab_')->getLastSql());die(); + $count = $jcount[0]['count'] ?:0 ; $this->assign('user_count', $count); - $this->assign('now_count', $jcount[0]['recharge_total']); + // var_dump($jcount);die(); + $this->assign('now_count', $jcount[0]['recharge_total']?:0); $model = M('Model')->getByName('user');