我想开个彩票投注战,tp6model层分页query无效

浏览:129 发布日期:2019/09/10 分类:求助交流 关键字: tp6,分页,model
今天在练习tp6,遇到一个问题,分页的时候query加不上参数,以下是我的代码,请各位帮我看看,
C层: public function admin_user_record(){
$username = input("get.username");
$starttime = input("get.datemin");
$endtime = input("get.datemax");

$users = UserList::user_record($username,$starttime,$endtime);

$count = $users->total();
View::assign('username',$username);
View::assign('starttime',$starttime);
View::assign('endtime',$endtime);

View::assign('count',$count);
View::assign('users',$users);


return View::fetch();
}
M层:public static function user_record($username,$starttime,$endtime){
if ($starttime == "")
{
$starttime = '1975-01-01 00:00:00';
}
if ($endtime == "") {
$endtime = date('Y-m-d H:i:s',time());
}
$users = Db::name('user_record')
->field('username,id,FROM_UNIXTIME(time, "%Y-%m-%d %H:%m:%s") AS time')
->where('username','like','%'.$username.'%')
->whereTime('time',"between",[$starttime,$endtime])
->order("time",'desc')
->paginate(5,false,[
'query' => request()->param(),
]);
// echo Db::table('admin_user_record')->getlastSql();
return $users;
}
V层:<form action="{:url('index/admin_user_record')}" method="get">
<div class="text-c"> 日期范围:
<input type="text" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" name="datemin" id="datemin" class="input-text Wdate" style="width:206px;" value="{$starttime}">
-
<input type="text" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" name="datemax" id="datemax" class="input-text Wdate" style="width:206px;" value="{$endtime}">
<input type="text" class="input-text" style="width:250px" placeholder="输入管理员名称" id="" name="username" value="{$username}">
<button type="submit" class="btn btn-success" id="search" name=""><i class="Hui-iconfont"></i> 搜索</button>
</div>

</form>
请各位帮我看下,怎么能在分页的时候,把搜索条件也加上
最佳答案
评论( 相关
后面还有条评论,点击查看>>