YS:笼位搜索

master
yangsai@163.com 7 months ago
parent 819487b384
commit 8bc7259f05
  1. 4
      application/models/Cage.php

@ -20,9 +20,9 @@ class CageModel extends Orm_Base{
$cagemodel = new CageSetModel(); $cagemodel = new CageSetModel();
$shownum = $cagemodel->field('line_num')->where("c_user_id='{$params['uid']}'")->fRow(); $shownum = $cagemodel->field('line_num')->where("c_user_id='{$params['uid']}'")->fRow();
$limmit = empty($shownum['line_num'])?20:$shownum['line_num']*5; $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 where 1 and "; $sql = "select cage.id,cage.number,cage.color,strains.title strains,cage.type from cage left join strains on cage.strains=strains.id";
if(!empty($params['keywords'])){ if(!empty($params['keywords'])){
$sql .="cage.number like '%{$params['keywords']}%'"; $sql .=" where cage.number like '%{$params['keywords']}%'";
} }
if(!empty($params['order'])){ if(!empty($params['order'])){
$sql .=" order by cage.{$params['order']} desc"; $sql .=" order by cage.{$params['order']} desc";

Loading…
Cancel
Save