diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index b04f7d97c..18617c0af 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -66,9 +66,17 @@ class PromoteController extends BaseController ->join("left join tab_game gm on gm.id=sv.game_id") ->field('sv.*,gm.icon') ->order("sv.start_time desc") - //->page(1, 20) + ->page(1, 5) ->select(); + $count = M("server", "tab_") + ->where( + array("start_time"=>array("BETWEEN", array($today_start, $today_end)), + "show_status"=>1)) + ->count(); + + $page = $this->ajax_page($count,5,'seach'); + $this->assign("_page",$page); $user_count = M("user","tab_")->where("promote_id=".get_pid())->count(); $total_money = $this->pay_total(0,0); @@ -88,7 +96,6 @@ class PromoteController extends BaseController ->count(); $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); @@ -199,24 +206,37 @@ class PromoteController extends BaseController public function home_read_data(){ $type = I("type","0"); $game_id = I("game_id"); - $start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); - $end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; + $pg = I("page","0"); + $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; if($game_id){ - $map['game_id'] = $game_id; + $map['sv.game_id'] = $game_id; + $count_map['game_id']= $game_id; } if($type>0){ - $map['sv.start_time']=array("GT", $end); + $map['sv.start_time']=array("GT", $today_end); + $count_map['start_time']= array("GT", $today_end); }else{ - $map['sv.start_time']=array("BETWEEN", array($start, $end)); + $map['sv.start_time']=array("BETWEEN", array($today_start, $today_end)); + $count_map['start_time']= array("BETWEEN", array($today_start, $today_end)); } $map['sv.show_status'] = 1; + $count_map['show_status'] = 1; $open_server_list = M("server as sv","tab_")->where($map) ->join("left join tab_game gm on gm.id=sv.game_id") ->field('sv.*,gm.icon') ->order("sv.start_time desc") - //->page(1, 20) - ->select();; + ->page($pg, 5) + ->select(); + + $count = M("server", "tab_") + ->where($count_map) + ->count(); + //var_dump($count); + $page = $this->ajax_page($count,5,'seach',$pg); + //$this->assign("_page",$page); + //$count = M("server", "tab_")->where($map)->count(); foreach ($open_server_list as $key => $server){ $open_server_list[$key]['icon']=get_cover($server['icon'],'path'); if($server['pay_type']==1){ @@ -229,7 +249,8 @@ class PromoteController extends BaseController $open_server_list[$key]['pay_type']; $open_server_list[$key]['start_time'] = date('Y-m-s h:i',$server['start_time']); } - $this->ajaxReturn(['status'=>1,'info'=>'调用成功','data'=>$open_server_list],"JSON"); + //$content = $this->fetch('Promote/home_read_data'); + $this->ajaxReturn(['status'=>1,'info'=>'调用成功','data'=>$open_server_list,'_page'=>$page],"JSON"); } @@ -1780,6 +1801,24 @@ class PromoteController extends BaseController } } } + + + function ajax_page($count, $row,$ajax_func='index',$current=1) { + $aside = ''; + $count=$count?$count:0; + $row=$row?$row:10; + if ($count > $row) { + $p = new \Think\AjaxPage($count,$row,$ajax_func); + $p->nowpage($count,$row,$current,$ajax_func); + $p->setConfig('theme', '%first% %upPage% %linkPage% %downPage% %end% %header%'); + //产生分页信息 + $html=$p->show(); + return "
推广总用户
{$user_count}推广总充值
¥{$total_money}当日新增用户充值
¥{$today_add_user_money}当月新增用户充值
¥{$month_add_user_money}昨日注册用户
{$yesterday_user_regist_count}昨日充值金额
¥{$yesterday_total_money}今日注册用户
{$yesterday_regist_user_count}今日充值金额
¥{$yesterday_total_money}暂无数据
暂无数据