欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

thinkPHP中怎么實現(xiàn)統(tǒng)計排行與分頁顯示功能-創(chuàng)新互聯(lián)

thinkPHP中怎么實現(xiàn)統(tǒng)計排行與分頁顯示功能,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

成都網(wǎng)站設計、成都網(wǎng)站建設的開發(fā),更需要了解用戶,從用戶角度來建設網(wǎng)站,獲得較好的用戶體驗。成都創(chuàng)新互聯(lián)公司多年互聯(lián)網(wǎng)經(jīng)驗,見的多,溝通容易、能幫助客戶提出的運營建議。作為成都一家網(wǎng)絡公司,打造的就是網(wǎng)站建設產(chǎn)品直銷的概念。選擇成都創(chuàng)新互聯(lián)公司,不只是建站,我們把建站作為產(chǎn)品,不斷的更新、完善,讓每位來訪用戶感受到浩方產(chǎn)品的價值服務。

1.分頁參數(shù)

count總數(shù)
firstRow起始行
listRows每一次獲取記錄數(shù)
list每一頁的記錄(要與count對應一致就行)

2.分頁對象

可以針對真實的數(shù)據(jù)表
也可以針對統(tǒng)計出來的數(shù)據(jù)表,或者說是虛擬的表
因為LIMIT是最后執(zhí)行的,哪怕你進行group操作,哪怕你進行子查詢

html

<include file="Public:head" title="" />
<style type="text/css">
.top {
  font-size: 18px;
  border-bottom: #ddd 1px solid;
  margin-bottom: -1px;
  font-weight: bold;
}
.top .title {
  margin:10px;
  border:1px solid #EF6C00;
  display:-webkit-box;
  border-radius: 3px;
}
.top .title .title_child {
  width: 50%;
  line-height:40px;
  -webkit-box-flex:1;
  display:block;
  color:#EF6C00;
  text-decoration:none;
}
.top .title .title_child.active {
  color:#FFF;
  background:#EF6C00;
}
.page{
  margin-right: 10px;
}
.ranknum{
  font-weight: bold;
  color:#F92672;
}
#myrank{
  color: #FFF;
  font-weight:bold;
  background-color: #FBC853;
}
</style>
<script type="text/javascript">
</script>
<body>
<div class="top text-center">
  <div class="title">
    <a class="title_child <if condition='$type neq 1'>active</if>" href="{sh::U('User/ranklist', array('type' => 0))}">月排行</a>
    <a class="title_child <if condition='$type eq 1'>active</if>" href="{sh::U('User/ranklist', array('type' => 1))}">總排行</a>
  </div>
</div>
<div id="myrank" class="alert alert-danger text-center">
  我的商戶數(shù):{sh:$my_user_count} &nbsp;&nbsp; 當前排名: {sh:$my_rank}
</div>
<div id="datalist">
<table class="table table-hover">
   <thead>
    <tr>
     <th>&nbsp;&nbsp;#</th>
     <th>姓名</th>
     <th>商戶數(shù)</th>
    </tr>
   </thead>
   <tbody>
     <volist name="list" id="vo">
    <tr>
     <th scope="row" class="ranknum">
     <if condition="$vo.rank eq 1"><img src="{sh::RES}public/img/gold.png" >
     <elseif condition="$vo.rank eq 2"/><img src="{sh::RES}public/img/silver.png" >
     <elseif condition="$vo.rank eq 3"/><img src="{sh::RES}public/img/copper.png" >
     <else />
     &nbsp;&nbsp;{sh:$vo.rank}
     </if>
     </th>
     <td>{sh:$vo.name}</td>
     <td>{sh:$vo.usercount}</td>
    </tr>
    </volist>
   </tbody>
</table>
<div class="page text-right">
    {sh:$page}
</div>
</div>
</body>
</html>

php

// 排行榜
public function ranklist(){
    $type = $this->_get('type','trim');
    $this->assign('type',$type);
    $opener_id = $this->opener_id;
    if($type == 0){ // 上月排行
      $arrLastMonth = $this->getLastMonthStartEndDay();
      $lastStartDay = $arrLastMonth['lastStartDay'];
      $lastEndDay = $arrLastMonth['lastEndDay'].' 23:59:59'; 
      $b_time = strtotime($lastStartDay);
      $e_time = strtotime($lastEndDay);
      $where['b.addtime'] = array(array('gt',$b_time),array('lt',$e_time),'and'); 
    }
    $where['a.status'] = array('eq','1');
    M()->query('SET @rank =0;');
    $subQuery = M()->table('sh_opener a')->join('sh_user b on a.id = b.opener_id')->where($where)->group('a.id')->order('usercount desc')->field('a.id,count(b.id) as usercount,a.name')->select(false);
    $all = M()->table(''.$subQuery.' a')->getField('a.id,a.usercount,a.name,(@rank:=IFNULL(@rank,0)+1) as rank');
    $count   = count($all);
    $Page    = new Page($count, 10);
    $list    = M()->table('sh_opener a')->join('sh_user b on a.id = b.opener_id')->where($where)->group('a.id')->order('usercount desc')->limit($Page->firstRow.','.$Page->listRows)->field('count(b.id) as usercount,a.name,a.id')->select();
    foreach ($list as $k => $v) {
      $list[$k]['rank'] = $k + 1 + $Page->firstRow;
    }
    // 我的商戶
    $my_user_count = $all[$opener_id]['usercount']?$all[$opener_id]['usercount']:0;
    $my_rank = $all[$opener_id]['rank']?$all[$opener_id]['rank']:'-';
    $this->assign('my_user_count',$my_user_count);
    $this->assign('my_rank',$my_rank);
    $this->assign('page',$Page->show());
    $this->assign('list', $list);
    $this->display();
}
// 獲取上一月開始與結束日期
private function getLastMonthStartEndDay(){
    $thismonth = date('m');
    $thisyear = date('Y');
    if ($thismonth == 1) {
      $lastmonth = 12;
      $lastyear = $thisyear - 1;
    } else {
      $lastmonth = $thismonth - 1;
      $lastyear = $thisyear;
    }
    $lastStartDay = $lastyear . '-' . $lastmonth . '-1';
    $lastEndDay  = $lastyear . '-' . $lastmonth . '-' . date('t', strtotime($lastStartDay)); //t 給定月份所應有的天數(shù),28到31
    return array('lastStartDay'=>$lastStartDay,'lastEndDay'=>$lastEndDay);
}

這里用的是thinkphp的分頁類實現(xiàn)的。

案例效果

thinkPHP中怎么實現(xiàn)統(tǒng)計排行與分頁顯示功能

關于thinkPHP中怎么實現(xiàn)統(tǒng)計排行與分頁顯示功能問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關知識。

新聞標題:thinkPHP中怎么實現(xiàn)統(tǒng)計排行與分頁顯示功能-創(chuàng)新互聯(lián)
標題來源:http://aaarwkj.com/article12/ieegc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供云服務器、全網(wǎng)營銷推廣、移動網(wǎng)站建設響應式網(wǎng)站、品牌網(wǎng)站建設虛擬主機

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化
亚洲日本乱码一区二区三| 欧美精品福利一区二区| 久久精品人妻少妇一区二| 中文字幕一区二区中文字幕| 亚洲欧美半夜激情一区二区| 国产欧美日韩精品久久久久久| 色哟哟亚洲精品一区二区| 国产一区二区三区午夜视频| 精品久久久久久亚洲野狼| 亚洲欧美日韩精品麻豆| 日本一区两区三区不卡视频 | 国产真实精品对白又爽欧美| 欧美一区二区国产精品日韩| 亚洲不卡在线视频免费| 亚洲av十八禁在线播放| 日本东京一区二区三区| 精品在欧美一区二区少妇| 99精品一二三日韩| 日本av高清视频在线观看| 亚洲综合欧美自偷自拍| 成年人三级黄色片视频| 天天免费日日夜夜夜夜| 在线免费观看国产黄色av| 打开网址国语一级黄色片| 天天日夜夜操人人干人人插| 不卡一区二区三区av电影| 欧美另类亚洲综合久青草| 亚洲欧洲日韩另类在线| 91久久福利国产成人精品| 国产一区二区黄色录像| 国产97成人亚洲综合在线| 国产情侣最新地址在线| 极品美女粉嫩啪啪高潮| 亚洲一区二区视频精品| 日本不卡一区二区在线观看| av影片在线观看亚洲天堂| 视频一区二区三区拍拍| 国产成人+亚洲欧洲综合| 亚洲理论在线观看电影| 人妖一区二区三区在线观看| 欧美一级午夜欧美午夜视频|