diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index c25b0d376..5dbe83932 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -101,27 +101,14 @@ class PromoteController extends BaseController $this->assign("_page", $page); - $promote = M("promote","tab_")->field("parent_id,grand_id")->where("id=".get_pid())->find(); $promoteId = array(get_pid()); -// $map = "promote_id = {$promote_id} "; -// if ($promote['parent_id'] == 1) { -// $promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid()." or grand_id=". get_pid())->select(); -// $promoteId = array_column($promoteId,'id'); -// array_push($promoteId,get_pid()); + //计算当日用户充值数据 $map['_string'] = "promote_id = {$promote_id} or tab_promote.parent_id = {$promote_id} or tab_promote.grand_id = {$promote_id} "; $pay_time = " between 0 and ".time(); $spendData = $this->caculateSpend($pay_time,$map['_string']); -// } elseif ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) { -// $promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid())->select(); -// $promoteId = array_column($promoteId,'id'); -// array_push($promoteId,get_pid()); -// -// $map = "promote_id = {$promote_id} or tab_promote.parent_id = {$promote_id} "; -// } -// var_dump($map); $promoteId = implode(',',$promoteId); if ($promoteId) { $user_count = M("user", "tab_")->where("promote_id IN({$promoteId})")->count(); @@ -137,6 +124,7 @@ class PromoteController extends BaseController $data=M('User','tab_') ->field('promote_account,promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count, IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1 , + count(IF(register_time '.$yesterdays.',1,null)) as yesterday, count(IF(register_time '.$today.',1,null)) as today, count(IF(register_time '.$week.',1,null)) as week, count(IF(register_time '.$mounth.',1,null)) as mounth') @@ -146,6 +134,7 @@ class PromoteController extends BaseController ->having('promote_id != 0') ->order('count desc,register_time') ->find(); +// echo M('User','tab_')->_sql();die(); $total_money = $this->pay_total(0, 0,$promoteId); $today_add_user_money = $this->pay_total(1,1,$promoteId); @@ -162,25 +151,6 @@ class PromoteController extends BaseController $mounthAddSpendData = $this->caculateSpend($pay_time,$map['_string'],[],2); -// var_dump($mounthAddSpendData);die(); - -// $map['register_time'] = ['between',array($yesterday_start,$yesterday_end-1)]; - - $yesterdayData = M('User','tab_') - ->field('promote_account,promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count, - IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1 , - count(IF(register_time '.$yesterdays.',1,null)) as today, - count(IF(register_time '.$week.',1,null)) as week, - count(IF(register_time '.$mounth.',1,null)) as mounth') - ->join('tab_promote on promote_id = tab_promote.id','left') - ->where($map) - ->group('promote_id1') - ->having('promote_id != 0') - ->order('count desc,register_time') - ->find(); -// echo M('User','tab_')->_sql();die(); -// var_dump($yesterdayData);die(); - $yesterday_user_regist_count = M("user", "tab_")->where( array("promote_id" => array('in',$promoteId), "register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end)))) @@ -197,7 +167,7 @@ class PromoteController extends BaseController $today_total_money = $this->pay_total(1, 0,$promoteId); $this->assign('data',$data); - $this->assign('yesterdayData',$yesterdayData); +// $this->assign('yesterdayData',$yesterdayData); $this->assign('spendData',$spendData); $this->assign('yesterdaySpendData',$yesterdaySpendData); $this->assign('todayAddSpendData',$todayAddSpendData); diff --git a/Application/Home/View/default/Promote/index.html b/Application/Home/View/default/Promote/index.html index bd5a9aece..e6f4b96b8 100644 --- a/Application/Home/View/default/Promote/index.html +++ b/Application/Home/View/default/Promote/index.html @@ -11,7 +11,7 @@
当月新增用户充值
¥{$mounthAddSpendData.mounth}昨日注册用户
{$yesterdayData.today}昨日注册用户
{$data.yesterday}昨日充值金额
¥{$yesterdaySpendData.count}今日注册用户
{$data.today}今日充值金额
¥{$spendData.today}