|
|
|
@ -20,14 +20,14 @@ class CageModel extends Orm_Base{ |
|
|
|
|
$cagemodel = new CageSetModel(); |
|
|
|
|
$shownum = $cagemodel->field('line_num')->where("c_user_id='{$params['uid']}'")->fRow(); |
|
|
|
|
$limmit = empty($shownum['line_num'])?20:$shownum['line_num']*5; |
|
|
|
|
$sql = "select cage.id,cage.number,cage.color,strains.title strains,cage.type from cage left join strains on cage.strains=strains.id"; |
|
|
|
|
$sql = "select id,number,color,strains,type from cage "; |
|
|
|
|
if(!empty($params['keyword'])){ |
|
|
|
|
$sql .=" where cage.number like '%{$params['keyword']}%'"; |
|
|
|
|
$sql .=" where number like '%{$params['keyword']}%'"; |
|
|
|
|
} |
|
|
|
|
if(!empty($params['order'])){ |
|
|
|
|
$sql .=" order by cage.{$params['order']} desc"; |
|
|
|
|
$sql .=" order by {$params['order']} desc"; |
|
|
|
|
}else{ |
|
|
|
|
$sql .=" order by cage.id desc"; |
|
|
|
|
$sql .=" order by id desc"; |
|
|
|
|
} |
|
|
|
|
$data['count'] = count($this->query($sql)); |
|
|
|
|
$offset = ($params['page']-1)*$limmit; |
|
|
|
|