var finish = 1;
var page = 0;
$(function(){
$(window).scroll(function(){
var sTop = $(document).scrollTop();
var winH = $(window).height();
var pageH = $(document).height();
if((sTop >= pageH-winH) && finish== 1){
waterList();
}
})
})
function waterList(){
finish = 2;
var nowpage = "{$nowpage}";
var c = '{$c}';
var _type = '{$_type}';
var tag_id = '{$tag_id}';
$.ajax({
type:'get',
url:app+'/s-boxwater',
data:{page:++page,nowpage:nowpage,c:c,_type:_type,tag_id:tag_id},
dataType:'json',
beforeSend:function(){
var loading = '
$('#boxwater').append(loading);
},
success:function(r){
$('#loading-zj').remove();
if(r.status == 2){
$('#listpage').show();
finish = 2;
}else if(r.status == 3){
$('#boxwater').append(r.html);
$('#listpage').show();
finish = 2;
}else if(r.status == 1){
$('#boxwater').append(r.html);
finish = 1;
}else{
$('#listpage').show();
finish = 2;
}
}
});
}
/** /** ?php> 此代码有许多源码的数据,参数,望测试
* box查询列表 首次加载
*/
private function boxList(){
$data = $this->maplist();
$map = $data['map'];
$map['is_del'] = 0;
$_order = $data['_order'];
$count = model('Showbox')->where($map)->count();
import('ORG.Util.Page');
$page = new Page($count,48);
$this->assign('listpage',$page->show());
$this->assign('nowpage',$page->firstRow);
$list = model('Showbox')->where($map)->limit($page->firstRow.',12')->order($_order)->select();
foreach ($list as $k=>$v){
$list[$k]['user_info'] = getUserInfo($v['uid']);
$list[$k]['sid'] = getFirstid($v['id']);
}
$this->assign('list',$list);
}
* box列表滚动显示。 //滚动显示
*/
public function boxwater(){
$this->supportList('showbox');
$this->subscripList('showbox');
$supportList = array();
$var['login_uid'] = $this->uid;
if($this->uid){
$supportList = getSupport($this->uid,'showbox');
}
$var['supportList'] = $supportList;
$subscripList = array();
if($this->uid){
$subscripList = getSubscrip($this->uid,'showbox');
}
$var['subscripList'] = $subscripList;
$data = $this->maplist();
$map = $data['map'];
$map['is_del'] = 0;
$_order = $data['_order'];
$st_page = $_GET['page'];
$nowpage = $_GET['nowpage'];
$page = $nowpage+$st_page*12;
$c = $_GET['c'];
$list = model('Showbox')->where($map)->order($_order)->limit($page.',12')->select();
if(!empty($list)){
$html = '';
foreach ($list as $k=>$v){
$list[$k]['user_info'] = getUserInfo($v['uid']);
$list[$k]['sid'] = getFirstid($v['id']);
}
$var['list'] = $list;
$return['status'] = 1;
if($st_page == 3){
$return['status'] = 3;
}
$return['html'] = $this->fetchTpl('boxwater',$var);
}else{
$return['status'] = 2;
}
exit(json_encode($return));exit;
}