|
|
|
@ -168,7 +168,7 @@ class Api_SquirrelController extends Ctrl_Api{ |
|
|
|
|
$data['infertility_time'] = date("Y-m-d",strtotime("+{$squirrelSet['infertility_time']} month",strtotime($data['birthday']))); |
|
|
|
|
$data['dose_time'] = date("Y-m-d",strtotime("+{$squirrelSet['dose_time']} day",strtotime($data['birthday']))); |
|
|
|
|
$ret = $this->Squirrelmodel->update($data); |
|
|
|
|
if(!$ret) Tool_Fnc::apiMsg('信息更新失败', '500'); |
|
|
|
|
if(!$ret) Tool_Fnc::apiMsg('信息未变更', '500'); |
|
|
|
|
Tool_Fnc::apiMsg('信息更新成功', '200'); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
@ -250,6 +250,37 @@ class Api_SquirrelController extends Ctrl_Api{ |
|
|
|
|
if(!$ret) Tool_Fnc::apiMsg('添加失败', '500'); |
|
|
|
|
Tool_Fnc::apiMsg('添加成功', '200'); |
|
|
|
|
} |
|
|
|
|
public function editNewSquirrelAction(){ |
|
|
|
|
//查询笼位号 |
|
|
|
|
$data['c_user_id'] = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; |
|
|
|
|
$data['id'] = empty($this->POST['id'])||!isset($this->POST['id'])?Tool_Fnc::apiMsg('系统错误', '500'):Tool_Fnc::safe_string($this->POST['id']); |
|
|
|
|
$data['count'] =empty($this->POST['count'])||!isset($this->POST['birthday'])?Tool_Fnc::apiMsg('填写幼崽数量', '500'):Tool_Fnc::safe_string($this->POST['count']); |
|
|
|
|
$data['birthday'] =empty($this->POST['birthday'])||!isset($this->POST['birthday'])?Tool_Fnc::apiMsg('请选择生日', '500'):Tool_Fnc::safe_string($this->POST['birthday']); |
|
|
|
|
$data['father'] = empty($this->POST['father'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['father']); |
|
|
|
|
$data['mother'] = empty($this->POST['mother'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['mother']); |
|
|
|
|
$data['strains'] =empty($this->POST['strains'])||!isset($this->POST['strains'])?Tool_Fnc::apiMsg('请填写品系', '500'):Tool_Fnc::safe_string($this->POST['strains']); |
|
|
|
|
$data['gene'] =empty($this->POST['gene'])||!isset($this->POST['gene'])?Tool_Fnc::apiMsg('请填写基因', '500'):Tool_Fnc::safe_string($this->POST['gene']); |
|
|
|
|
$data['remark'] = empty($this->POST['remark'])||!isset($this->POST['remark'])?'':Tool_Fnc::safe_string($this->POST['remark']); |
|
|
|
|
$data['cage'] =empty($this->POST['cage'])||!isset($this->POST['cage'])?Tool_Fnc::apiMsg('未找到当前笼位ID', '500'):Tool_Fnc::safe_string($this->POST['cage']); |
|
|
|
|
$data['created'] = date('Y-m-d H:i:s',time()); |
|
|
|
|
//获取当前用户仓鼠的配置 |
|
|
|
|
$params['user_id'] = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; |
|
|
|
|
$squirrelSet = $this->SquirrelSetModel->getsetinfo($params); |
|
|
|
|
//根据生日获取各个提醒时间 |
|
|
|
|
$data['weaning_time'] = date("Y-m-d",strtotime("+{$squirrelSet['weaning_time']} day",strtotime($data['birthday']))); |
|
|
|
|
$data['nursing_time'] = date("Y-m-d",strtotime("+{$squirrelSet['nursing_time']} day",strtotime($data['birthday']))); |
|
|
|
|
$data['grow_time'] =$data['sex']==1? date("Y-m-d",strtotime("+{$squirrelSet['male_grow_time']} days",strtotime($data['birthday']))):date("Y-m-d",strtotime("+{$squirrelSet['female_grow_time']} days",strtotime($data['birthday']))); |
|
|
|
|
$data['infertility_time'] = date("Y-m-d",strtotime("+{$squirrelSet['infertility_time']} month",strtotime($data['birthday']))); |
|
|
|
|
$data['dose_time'] = date("Y-m-d",strtotime("+{$squirrelSet['dose_time']} day",strtotime($data['birthday']))); |
|
|
|
|
$ret = $this->NewSquirrelmodel->update($data); |
|
|
|
|
if(!$ret) Tool_Fnc::apiMsg('信息未变更', '500'); |
|
|
|
|
Tool_Fnc::apiMsg('编辑成功', '200'); |
|
|
|
|
} |
|
|
|
|
public function getNewSquirrelAction(){ |
|
|
|
|
$id = empty($this->POST['id'])||!isset($this->POST['id'])?Tool_Fnc::apiMsg('幼崽ID缺失', '500'):Tool_Fnc::safe_string($this->POST['id']); |
|
|
|
|
$data = $this->NewSquirrelmodel->getOneInfo($id); |
|
|
|
|
Tool_Fnc::apiMsg('获取成功', '200',$data); |
|
|
|
|
} |
|
|
|
|
public function getparentsAction(){ |
|
|
|
|
$return = $this->Squirrelmodel->partent(); |
|
|
|
|
Tool_Fnc::apiMsg('获取成功', '200',$return); |
|
|
|
@ -272,5 +303,10 @@ class Api_SquirrelController extends Ctrl_Api{ |
|
|
|
|
$this->Squirrelmodel->operate($data); |
|
|
|
|
Tool_Fnc::apiMsg('操作已更新', '200'); |
|
|
|
|
} |
|
|
|
|
public function getoperateAction(){ |
|
|
|
|
$id = empty($this->POST['id'])?Tool_Fnc::apiMsg('小鼠ID缺失', '500'):$this->POST['id']; |
|
|
|
|
$data = $this->Squirrelmodel->field('id,jianwei_time,jianwei_show,kill_time,kill_show,test_time,test_show,del_time,del_show')->where("id={$id}")->fRow(); |
|
|
|
|
Tool_Fnc::apiMsg('获取成功', '200',$data); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|