diff --git a/application/controllers/Api/Squirrel.php b/application/controllers/Api/Squirrel.php index 75e59e8..10333c2 100644 --- a/application/controllers/Api/Squirrel.php +++ b/application/controllers/Api/Squirrel.php @@ -418,5 +418,18 @@ class Api_SquirrelController extends Ctrl_Api{ } Tool_Fnc::apiMsg('设置失败', '500'); } + public function setgeneAction(){ + $cage = empty($this->POST['cage'])?Tool_Fnc::apiMsg('笼位号丢失', '500'):$this->POST['cage']; + $genedata = empty($this->POST['genedata'])?Tool_Fnc::apiMsg('未设置基因', '500'):$this->POST['genedata']; + $sql = ""; + foreach($genedata as $key => $val){ + $str = implode("','",$val['squirrel']); + $sql .= "update {$this->Squirrelmodel->table} set gene='{$val['gene']}' where number in ('{$str}') and type=2 and cage={$cage};"; + } + if($this->Squirrelmodel->exec($sql)){ + Tool_Fnc::apiMsg('设置成功', '1'); + } + Tool_Fnc::apiMsg('设置失败', '500'); + } }