From c01a0fc9ef8426c9fd337487d425bc526b78fb86 Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Wed, 5 Jun 2024 10:42:05 +0800 Subject: [PATCH] YS --- application/controllers/Api/Cage.php | 12 +++--------- application/models/Cage.php | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/application/controllers/Api/Cage.php b/application/controllers/Api/Cage.php index b48085e..31c5d74 100644 --- a/application/controllers/Api/Cage.php +++ b/application/controllers/Api/Cage.php @@ -70,10 +70,7 @@ class Api_CageController extends Ctrl_Api{ $CageNum = $this->Cagemodel->field('count(*) as num')->where("c_user_id={$data['c_user_id']}")->fRow(); $CageNum = empty($CageNum)?1:(int) $CageNum['num']+1; $data['type'] = $this->POST['type']; - $data['number'] = "NO.0000".$CageNum; - if($CageNum>9) $data['number'] = "NO.000".$CageNum; - if($CageNum>99) $data['number'] = "NO.00".$CageNum; - if($CageNum>999) $data['number'] = "NO.0".$CageNum; + $data['number'] = $CageNum; $data['strains'] =empty($this->POST['strains'])||!isset($this->POST['strains'])?Tool_Fnc::apiMsg('请选择笼位品系', '500'):Tool_Fnc::safe_string($this->POST['strains']); $data['color'] =empty($this->POST['color'])||!isset($this->POST['color'])?Tool_Fnc::apiMsg('请选择笼位颜色', '500'):Tool_Fnc::safe_string($this->POST['color']); $data['group'] = empty($this->POST['group'])||!isset($this->POST['group'])?Tool_Fnc::apiMsg('请选择实验室', '500'):Tool_Fnc::safe_string($this->POST['group']); @@ -90,17 +87,14 @@ class Api_CageController extends Ctrl_Api{ $uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; $CageNum = $this->Cagemodel->field('count(*) as num')->where("user_id={$uid}")->fRow(); $CageNum = empty($CageNum)?1:(int) $CageNum['num']+1; - $data['number'] = "NO.0000".$CageNum; - if($CageNum>9) $data['number'] = "NO.000".$CageNum; - if($CageNum>99) $data['number'] = "NO.00".$CageNum; - if($CageNum>999) $data['number'] = "NO.0".$CageNum; + $data['number'] = $CageNum; Tool_Fnc::apiMsg('获取笼位号成功', '200',$data); } /** * 获取笼位类型接口 */ public function getCagetypeAction(){ - $data = array(['id'=>1,'title'=>'库存笼'],['id'=>2,'title'=>'繁殖笼']); + $data = array(['id'=>1,'title'=>'库存笼'],['id'=>2,'title'=>'繁殖笼'],['id'=>3,'title'=>'其他']); Tool_Fnc::apiMsg('获取笼位类型成功', '200',$data); } /** diff --git a/application/models/Cage.php b/application/models/Cage.php index 79bfcfd..66d6797 100644 --- a/application/models/Cage.php +++ b/application/models/Cage.php @@ -22,7 +22,7 @@ class CageModel extends Orm_Base{ $limmit = empty($shownum['line_num'])?20:$shownum['line_num']*4; $sql = "select id,number,color,strains,type from cage where c_user_id={$params['uid']}"; if(!empty($params['keyword'])){ - $sql .=" and number like '%{$params['keyword']}%'"; + $sql .=" and (number like '%{$params['keyword']}%' or strains_id like '%{$params['keyword']}%')"; } if(!empty($params['order'])){ $sql .=" order by {$params['order']} desc";