@ -136,10 +136,23 @@ class Api_CageController extends Ctrl_Api{
if(!$this->SquirrelModel->update($data)) Tool_Fnc::apiMsg('笼位未发生变化', '500');
if(!$this->SquirrelModel->update($data)) Tool_Fnc::apiMsg('笼位未发生变化', '500');
Tool_Fnc::apiMsg('转移成功', '200');
Tool_Fnc::apiMsg('转移成功', '200');
}
}
public function cageMoreMoveAction(){
$uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid'];
$id = empty($this->POST['id'])?Tool_Fnc::apiMsg('小鼠ID', '500'):implode(",",$this->POST['id']);
$cage = empty($this->POST['cage'])?Tool_Fnc::apiMsg('笼位ID', '500'):$this->POST['cage'];
$sql = "update {$this->SquirrelModel->table} set cage={$cage},type=1 where id in ({$id})";
if(!$this->SquirrelModel->exec($sql)) Tool_Fnc::apiMsg('转移失败', '500');
Tool_Fnc::apiMsg('转移成功', '200');
}
//获取转移笼位列表
//获取转移笼位列表
public function cagemovellistAction(){
public function cagemovellistAction(){
$uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid'];
$uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid'];
$id = empty($this->POST['id'])?Tool_Fnc::apiMsg('小鼠ID', '500'):$this->POST['id'];
$id = empty($this->POST['id'])?Tool_Fnc::apiMsg('小鼠ID', '500'):$this->POST['id'];
$count = 1;
if(is_array($id)){
$count = count($id);
$id = $id[0];
}
$order = empty($this->POST['order'])?'id':$this->POST['order'];
$order = empty($this->POST['order'])?'id':$this->POST['order'];
$keyword = empty($this->POST['keyword'])?'':$this->POST['keyword'];
$keyword = empty($this->POST['keyword'])?'':$this->POST['keyword'];
$squirrel = $this->SquirrelModel->getOneInfo($id);
$squirrel = $this->SquirrelModel->getOneInfo($id);
@ -152,7 +165,7 @@ class Api_CageController extends Ctrl_Api{
$data = $data->fList();
$data = $data->fList();
foreach($data as $key => $val){
foreach($data as $key => $val){
$data[$key]['type_color'] = $data[$key]['type']==2?'#FF0000':'';
$data[$key]['type_color'] = $data[$key]['type']==2?'#FF0000':'';
if($this->SquirrelModel->isFull($val['cage'],$uid)) {
if($this->SquirrelModel->isFull($val['cage'],$uid,($count-1) )) {
$data[$key]['squirrel'] = $this->SquirrelModel->query("select number from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and type=1 limit 0,6");
$data[$key]['squirrel'] = $this->SquirrelModel->query("select number from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and type=1 limit 0,6");
//查询公鼠
//查询公鼠
$sql = "select count(*) num from squirrel where cage={$data[$key]['id']} and is_kill=0 and is_delete=0 and sex=1 and type=1";
$sql = "select count(*) num from squirrel where cage={$data[$key]['id']} and is_kill=0 and is_delete=0 and sex=1 and type=1";