fix: 分页转换int类型
This commit is contained in:
@@ -172,7 +172,7 @@ class AdminController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\ReflectionException $e) {}
|
} catch (\ReflectionException $e) {}
|
||||||
$subQuery = $this->model->field('id')->where($where)->order($order, 'desc')->limit($limit)->page($page)->buildSql();
|
$subQuery = $this->model->field('id')->where($where)->order($order, 'desc')->limit((int)$limit)->page((int)$page)->buildSql();
|
||||||
$subQuery = '( SELECT object.id FROM ' . $subQuery . ' AS object )';
|
$subQuery = '( SELECT object.id FROM ' . $subQuery . ' AS object )';
|
||||||
$list = $this->model->with($relation)->where('id in' . $subQuery)->order($order, 'desc')->select()->toArray();
|
$list = $this->model->with($relation)->where('id in' . $subQuery)->order($order, 'desc')->select()->toArray();
|
||||||
foreach ($list as $key => $value) {
|
foreach ($list as $key => $value) {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class Admin extends AdminController
|
|||||||
$where[] = ['status', '=', $status];
|
$where[] = ['status', '=', $status];
|
||||||
$count = $this->model->where($where)->count();
|
$count = $this->model->where($where)->count();
|
||||||
$page = ($count <= $limit) ? 1 : $page;
|
$page = ($count <= $limit) ? 1 : $page;
|
||||||
$list = $this->model->where($where)->order("id asc")->withoutField('pwd')->limit($limit)->page($page)->select()->toArray();
|
$list = $this->model->where($where)->order("id asc")->withoutField('pwd')->limit((int)$limit)->page((int)$page)->select()->toArray();
|
||||||
|
|
||||||
// 循环处理数据
|
// 循环处理数据
|
||||||
foreach ($list as $key => $value) {
|
foreach ($list as $key => $value) {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class Attachment extends AdminController
|
|||||||
$page = ($count <= $limit) ? 1 : $page;
|
$page = ($count <= $limit) ? 1 : $page;
|
||||||
|
|
||||||
// 生成查询数据
|
// 生成查询数据
|
||||||
$list = $this->model->where($where)->order("id desc")->limit($limit)->page($page)->select()->toArray();
|
$list = $this->model->where($where)->order("id desc")->limit((int)$limit)->page((int)$page)->select()->toArray();
|
||||||
return $this->success('查询成功', "", $list, $count);
|
return $this->success('查询成功', "", $list, $count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class Dictionary extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$count = $this->model->where($where)->count();
|
$count = $this->model->where($where)->count();
|
||||||
$list = $this->model->where($where)->limit($limit)->page($page)->select()
|
$list = $this->model->where($where)->limit((int)$limit)->page((int)$page)->select()
|
||||||
->each(function($item,$key) use ($pid){
|
->each(function($item,$key) use ($pid){
|
||||||
if ($key == 0 && $pid == '0') {
|
if ($key == 0 && $pid == '0') {
|
||||||
$item['LAY_CHECKED'] = true;
|
$item['LAY_CHECKED'] = true;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class Jobs extends AdminController
|
|||||||
$count = $this->model->where($where)->count();
|
$count = $this->model->where($where)->count();
|
||||||
$limit = empty($param['limit']) ? 10 : (int)$param['limit'];
|
$limit = empty($param['limit']) ? 10 : (int)$param['limit'];
|
||||||
$page = ($count <= $limit) ? 1 : $param['page'];
|
$page = ($count <= $limit) ? 1 : $param['page'];
|
||||||
$list = $this->model->where($where)->order("id asc")->limit($limit)->page($page)->select()->toArray();
|
$list = $this->model->where($where)->order("id asc")->limit((int)$limit)->page((int)$page)->select()->toArray();
|
||||||
foreach ($list as $key => $value) {
|
foreach ($list as $key => $value) {
|
||||||
$list[$key]['title'] = __($value['title']);
|
$list[$key]['title'] = __($value['title']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class SystemLog extends AdminController
|
|||||||
$where[] = ['status','=','1'];
|
$where[] = ['status','=','1'];
|
||||||
$count = $this->model->where($where)->count();
|
$count = $this->model->where($where)->count();
|
||||||
$page = ($count <= $limit) ? 1 : $page;
|
$page = ($count <= $limit) ? 1 : $page;
|
||||||
$list = $this->model->where($where)->order('id', 'desc')->limit($limit)->page($page)->select()->toArray();
|
$list = $this->model->where($where)->order('id', 'desc')->limit((int)$limit)->page((int)$page)->select()->toArray();
|
||||||
return $this->success('查询成功', "", $list, $count);
|
return $this->success('查询成功', "", $list, $count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class User extends AdminController
|
|||||||
$where[] = ['status', '=', $status];
|
$where[] = ['status', '=', $status];
|
||||||
$count = $this->model->where($where)->count();
|
$count = $this->model->where($where)->count();
|
||||||
$page = ($count <= $limit) ? 1 : $page;
|
$page = ($count <= $limit) ? 1 : $page;
|
||||||
$list = $this->model->where($where)->order("id asc")->limit($limit)->page($page)->select();
|
$list = $this->model->where($where)->order("id asc")->limit((int)$limit)->page((int)$page)->select();
|
||||||
|
|
||||||
// 循环处理数据
|
// 循环处理数据
|
||||||
foreach ($list as $key => $value) {
|
foreach ($list as $key => $value) {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class UserGroup extends AdminController
|
|||||||
$count = $this->model->where($where)->count();
|
$count = $this->model->where($where)->count();
|
||||||
$limit = empty($param['limit']) ? 10 : $param['limit'];
|
$limit = empty($param['limit']) ? 10 : $param['limit'];
|
||||||
$page = ($count <= $limit) ? 1 : $param['page'];
|
$page = ($count <= $limit) ? 1 : $param['page'];
|
||||||
$list = $this->model->where($where)->order("id asc")->limit($limit)->page((int)$page)->select()->toArray();
|
$list = $this->model->where($where)->order("id asc")->limit((int)$limit)->page((int)$page)->select()->toArray();
|
||||||
foreach ($list as $key => $value) {
|
foreach ($list as $key => $value) {
|
||||||
$list[$key]['title'] = __($value['title']);
|
$list[$key]['title'] = __($value['title']);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user