yangsai@163.com 7 months ago
parent 8bc7259f05
commit bff2499620
  1. 2
      application/controllers/Api/Cage.php
  2. 4
      application/models/Cage.php

@ -101,7 +101,7 @@ class Api_CageController extends Ctrl_Api{
* 获取笼位类型接口 * 获取笼位类型接口
*/ */
public function getCagetypeAction(){ public function getCagetypeAction(){
$data = [1=>'库存笼',2=>'繁殖笼']; $data = array(['id'=>1,'title'=>'库存笼'],['id'=>2,'title'=>'繁殖笼']);
Tool_Fnc::apiMsg('获取笼位类型成功', '200',$data); Tool_Fnc::apiMsg('获取笼位类型成功', '200',$data);
} }
/** /**

@ -21,8 +21,8 @@ class CageModel extends Orm_Base{
$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"; $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['keyword'])){
$sql .=" where cage.number like '%{$params['keywords']}%'"; $sql .=" where cage.number like '%{$params['keyword']}%'";
} }
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