yangsai@163.com 6 months ago
parent da233c58a9
commit 2a8efa7652
  1. 13
      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');
}
}

Loading…
Cancel
Save