时间:2021-07-01 10:21:17 帮助过:19人阅读
public function index(){
if(!empty($_POST['p'])){//点击加载更多
$p = $_POST['p'];//3 6 9
$amount = 3; //显示条数
//$count = M("micro_article")->count();//总数
$Model = new \Think\Model();
$list = $Model->query("SELECT * FROM `day_micro_article` ORDER BY addtime DESC LIMIT $p,$amount");
$this->ajaxReturn($list);
}
$count = M("micro_article")->count();
$Page = new \Think\Page($count, 3);
$show = $Page->show();
$Model = new \Think\Model();
//默认显示最新三条
$list = $Model->query("SELECT * FROM `day_micro_article` WHERE `status` = 1 AND `is_rec` = 1 ORDER BY `addtime` DESC LIMIT " . $Page->firstRow . ',' . $Page->listRows);
$shouyi= M("Micro_customlucre")->where(array("zid"=>1))->find();
$this->assign('list', $list);
$this->assign('vo1', $shouyi);
$this->assign('show', $show);
$this->display();
}
function getLocalTime(nS) {
var d = new Date(parseInt(nS) * 1000);
return d.getYear() + '/' + (d.getMonth()+1) + '/' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
}