首页用户注册充值信息修正

master
zyx 5 years ago
parent c9fead3389
commit 0112a0151c

@ -100,24 +100,48 @@ class PromoteController extends BaseController
$page = $this->ajax_page($count, 20, 'seach');
$this->assign("_page", $page);
$user_count = M("user", "tab_")->where("promote_id=" . get_pid())->count();
$total_money = $this->pay_total(0, 0);
$today_add_user_money = $this->pay_total(1);
$month_add_user_money = $this->pay_total(3);
$promote = M("promote","tab_")->field("parent_id,grand_id")->where("id=".get_pid())->find();
$promoteId = array(get_pid());
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());
} 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());
}
$promoteId = implode(',',$promoteId);
if ($promoteId) {
$user_count = M("user", "tab_")->where("promote_id IN({$promoteId})")->count();
} else {
$user_count = 0;
}
$total_money = $this->pay_total(0, 0,$promoteId);
$today_add_user_money = $this->pay_total(1,1,$promoteId);
$month_add_user_money = $this->pay_total(3,1,$promoteId);
$yesterday_start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
$yesterday_end = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$yesterday_user_regist_count = M("user", "tab_")->where(
array("promote_id" => get_pid(),
array("promote_id" => array('in',$promoteId),
"register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end))))
->count();
$yesterday_total_money = $this->pay_total(5, 0);
$yesterday_regist_user_count = M("user", "tab_")
->where(array("promote_id" => get_pid(),
"register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end))))
$yesterday_total_money = $this->pay_total(5, 0,$promoteId);
$today_start = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
$today_regist_user_count = M("user", "tab_")
->where(array("promote_id" => array('in',$promoteId),
"register_time" => array("BETWEEN", array($today_start, $today_end))))
->count();
$today_total_money = $this->pay_total(1, 0,$promoteId);
$yesterday_total_money = $this->pay_total(1, 0);
$this->assign("user_count", $user_count);
$this->assign("total_money", $total_money);
$this->assign("today_add_user_money", $today_add_user_money);
@ -126,6 +150,8 @@ class PromoteController extends BaseController
$this->assign("yesterday_total_money", $yesterday_total_money);
$this->assign("yesterday_regist_user_count", $yesterday_regist_user_count);
$this->assign("yesterday_total_money", $yesterday_total_money);
$this->assign("today_regist_user_count", $today_regist_user_count);
$this->assign("today_total_money", $today_total_money);
$this->assign("menu_list", $quick_menu_list);
$this->assign("gg_list", $gg_list);
@ -141,7 +167,7 @@ class PromoteController extends BaseController
$this->display();
}
private function pay_total($type = 0, $newadd = 1)
private function pay_total($type = 0, $newadd = 1,$promoteId="")
{
if ($_REQUEST['promote_id'] === null || $_REQUEST['promote_id'] === '0') {
$map['parent_id'] = get_pid();
@ -155,7 +181,7 @@ class PromoteController extends BaseController
} else {
$ids = array($_REQUEST['promote_id']);
}
$where['spend.promote_id'] = array('in', $ids);
$where['spend.promote_id'] = array('in', $promoteId);
$where['spend.pay_status'] = 1;
$where['spend.is_check'] = array('NEQ', 2);
switch ($type) {
@ -206,6 +232,7 @@ class PromoteController extends BaseController
$where['user.register_time'] = array("BETWEEN", array($start, $end));
}
}
if ($newadd == 1) {
$total = M('spend as spend', "tab_")->field("SUM(spend.pay_amount) as amount")->join("right join tab_user user on user.id=spend.user_id")->where($where)->select();
} else {

@ -13,8 +13,8 @@
<ul style="margin-top: 10px">
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi1.png"/></span></div> <div class="text text2"><p>昨日注册用户</p><span>{$yesterday_user_regist_count}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi2.png"/></span></div> <div class="text text1"><p>昨日充值金额</p><span>¥{$yesterday_total_money}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi3.png"/></span></div> <div class="text text3"><p>今日注册用户</p><span>{$yesterday_regist_user_count}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi5.png"/></span></div> <div class="text text5"><p>今日充值金额</p><span>¥{$yesterday_total_money}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi3.png"/></span></div> <div class="text text3"><p>今日注册用户</p><span>{$today_regist_user_count}</span></div> </li>
<li><div class="icon"><span class="placeholder-graphic"><img src="__IMG__/20180207/icon_chongzhi5.png"/></span></div> <div class="text text5"><p>今日充值金额</p><span>¥{$today_total_money}</span></div> </li>
</ul>
</div>
<div class="index-tab-list">

Loading…
Cancel
Save