提交 a1104505 authored 作者: chengye's avatar chengye

测试sql

上级 6740271a
...@@ -33,13 +33,13 @@ class Index extends Base ...@@ -33,13 +33,13 @@ class Index extends Base
$this->assign('search_text',''); $this->assign('search_text','');
} }
$page =Request::param('page')?Request::param('page'):0; $page =Request::param('page')?Request::param('page'):1;
$limit = Request::param('limit')?Request::param('limit'):30; $limit = Request::param('limit')?Request::param('limit'):30;
$model = new \app\jz\model\Index(); $model = new \app\jz\model\Index();
$data = $model->getList($map,$page,$limit); $data = $model->getList($map,$page,$limit);
$count = $model->getCount($map); $count = $model->getCount($map);
if(Request::param('page') === false){ if(Request::param('page')){
return ['code'=>0,'msg'=>'','count'=>$count,'data'=>$data]; return ['code'=>0,'msg'=>'','count'=>$count,'data'=>$data];
} }
return $this->fetch(); return $this->fetch();
......
...@@ -7,10 +7,10 @@ class Index extends Model ...@@ -7,10 +7,10 @@ class Index extends Model
{ {
protected $table = 'jz_message'; protected $table = 'jz_message';
public function getList($map='',$page=0,$limit = 30){ public function getList($map='',$page=1,$limit = 30){
$where = ''; $where = '';
if(!empty($map)) $where = ' and '.$map; if(!empty($map)) $where = ' and '.$map;
$where .= ' order by aa.create_date desc limit '.$page*$limit.','.$limit; $where .= ' order by aa.create_date desc limit '.($page-1)*$limit.','.$limit;
$sql = "select aa.business_id, aa.jz_code, aa.jz_name,aa.project_code, aa.business_line,bb.yys, cc.ywx, dd.qy, $sql = "select aa.business_id, aa.jz_code, aa.jz_name,aa.project_code, aa.business_line,bb.yys, cc.ywx, dd.qy,
aa.project_address,aa.create_date, aa.update_date aa.project_address,aa.create_date, aa.update_date
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论