|
|
@ -10,6 +10,7 @@ class Api_SquirrelController extends Ctrl_Api{ |
|
|
|
public $CageModel; |
|
|
|
public $CageModel; |
|
|
|
public $CageSetModel; |
|
|
|
public $CageSetModel; |
|
|
|
public $SquirrelSetModel; |
|
|
|
public $SquirrelSetModel; |
|
|
|
|
|
|
|
public $POST; |
|
|
|
public $ExcelSetModel; |
|
|
|
public $ExcelSetModel; |
|
|
|
public function init() { |
|
|
|
public function init() { |
|
|
|
if(empty($_SESSION['uid'])) {Tool_Fnc::apiMsg('非法调用', '500');} |
|
|
|
if(empty($_SESSION['uid'])) {Tool_Fnc::apiMsg('非法调用', '500');} |
|
|
@ -18,6 +19,7 @@ class Api_SquirrelController extends Ctrl_Api{ |
|
|
|
$this->CageSetModel=new CageSetModel(); |
|
|
|
$this->CageSetModel=new CageSetModel(); |
|
|
|
$this->SquirrelSetModel=new SquirrelSetModel(); |
|
|
|
$this->SquirrelSetModel=new SquirrelSetModel(); |
|
|
|
$this->ExcelSetModel=new ExcelSetModel(); |
|
|
|
$this->ExcelSetModel=new ExcelSetModel(); |
|
|
|
|
|
|
|
$this->POST =json_decode(file_get_contents('php://input'),true); |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 鼠笼列表接口 |
|
|
|
* 鼠笼列表接口 |
|
|
@ -43,8 +45,8 @@ class Api_SquirrelController extends Ctrl_Api{ |
|
|
|
* } |
|
|
|
* } |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function listAction(){ |
|
|
|
public function listAction(){ |
|
|
|
$cage = empty($_POST['cage_id'])||!isset($_POST['cage_id'])?Tool_Fnc::apiMsg('缺少重要参数', '500'):Tool_Fnc::safe_string($_POST['cage_id']); |
|
|
|
$cage = empty($this->POST['cage_id'])||!isset($this->POST['cage_id'])?Tool_Fnc::apiMsg('缺少重要参数', '500'):Tool_Fnc::safe_string($this->POST['cage_id']); |
|
|
|
$type = empty($_POST['type'])||!isset($_POST['type'])?1:Tool_Fnc::safe_string($_POST['type']); |
|
|
|
$type = empty($this->POST['type'])||!isset($this->POST['type'])?1:Tool_Fnc::safe_string($this->POST['type']); |
|
|
|
$params['where'] = "and cage = {$cage}"; |
|
|
|
$params['where'] = "and cage = {$cage}"; |
|
|
|
$params['type'] =$type; |
|
|
|
$params['type'] =$type; |
|
|
|
$data = $this->Squirrelmodel->getModelList($params); |
|
|
|
$data = $this->Squirrelmodel->getModelList($params); |
|
|
@ -83,21 +85,21 @@ class Api_SquirrelController extends Ctrl_Api{ |
|
|
|
$CageNum = $this->Squirrelmodel->field('count(*) as num')->fRow(); |
|
|
|
$CageNum = $this->Squirrelmodel->field('count(*) as num')->fRow(); |
|
|
|
$CageNum = empty($CageNum)?1:(int) $CageNum['num']+1; |
|
|
|
$CageNum = empty($CageNum)?1:(int) $CageNum['num']+1; |
|
|
|
|
|
|
|
|
|
|
|
$data['type'] = $_POST['type']; |
|
|
|
$data['type'] = $this->POST['type']; |
|
|
|
$data['number'] = "SN00000".$CageNum; |
|
|
|
$data['number'] = "SN00000".$CageNum; |
|
|
|
if($CageNum>9) $data['number'] = "SN0000".$CageNum; |
|
|
|
if($CageNum>9) $data['number'] = "SN0000".$CageNum; |
|
|
|
if($CageNum>99) $data['number'] = "SN000".$CageNum; |
|
|
|
if($CageNum>99) $data['number'] = "SN000".$CageNum; |
|
|
|
if($CageNum>999) $data['number'] = "SN00".$CageNum; |
|
|
|
if($CageNum>999) $data['number'] = "SN00".$CageNum; |
|
|
|
if($CageNum>9999) $data['number'] = "SN0".$CageNum; |
|
|
|
if($CageNum>9999) $data['number'] = "SN0".$CageNum; |
|
|
|
$data['sex'] =empty($_POST['sex'])||!isset($_POST['sex'])?Tool_Fnc::apiMsg('请选择性别', '500'):Tool_Fnc::safe_string($_POST['sex']); |
|
|
|
$data['sex'] =empty($this->POST['sex'])||!isset($this->POST['sex'])?Tool_Fnc::apiMsg('请选择性别', '500'):Tool_Fnc::safe_string($this->POST['sex']); |
|
|
|
$data['birthday'] =empty($_POST['birthday'])||!isset($_POST['birthday'])?Tool_Fnc::apiMsg('请填写生日', '500'):Tool_Fnc::safe_string($_POST['birthday']); |
|
|
|
$data['birthday'] =empty($this->POST['birthday'])||!isset($this->POST['birthday'])?Tool_Fnc::apiMsg('请填写生日', '500'):Tool_Fnc::safe_string($this->POST['birthday']); |
|
|
|
$data['father'] = empty($_POST['father'])||!isset($_POST['father'])?0:Tool_Fnc::safe_string($_POST['father']); |
|
|
|
$data['father'] = empty($this->POST['father'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['father']); |
|
|
|
$data['mother'] = empty($_POST['mother'])||!isset($_POST['father'])?0:Tool_Fnc::safe_string($_POST['mother']); |
|
|
|
$data['mother'] = empty($this->POST['mother'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['mother']); |
|
|
|
$data['strains_id'] =empty($_POST['strains_id'])||!isset($_POST['strains_id'])?Tool_Fnc::apiMsg('请选择品系', '500'):Tool_Fnc::safe_string($_POST['strains_id']); |
|
|
|
$data['strains_id'] =empty($this->POST['strains_id'])||!isset($this->POST['strains_id'])?Tool_Fnc::apiMsg('请选择品系', '500'):Tool_Fnc::safe_string($this->POST['strains_id']); |
|
|
|
$data['gene'] =empty($_POST['gene'])||!isset($_POST['gene'])?Tool_Fnc::apiMsg('请填写基因', '500'):Tool_Fnc::safe_string($_POST['gene']); |
|
|
|
$data['gene'] =empty($this->POST['gene'])||!isset($this->POST['gene'])?Tool_Fnc::apiMsg('请填写基因', '500'):Tool_Fnc::safe_string($this->POST['gene']); |
|
|
|
$data['hair_color'] =empty($_POST['hair_color'])||!isset($_POST['hair_color'])?Tool_Fnc::apiMsg('请选择毛色', '500'):Tool_Fnc::safe_string($_POST['hair_color']); |
|
|
|
$data['hair_color'] =empty($this->POST['hair_color'])||!isset($this->POST['hair_color'])?Tool_Fnc::apiMsg('请选择毛色', '500'):Tool_Fnc::safe_string($this->POST['hair_color']); |
|
|
|
$data['remark'] = empty($_POST['remark'])||!isset($_POST['remark'])?Tool_Fnc::apiMsg('请填写备注', '500'):Tool_Fnc::safe_string($_POST['remark']); |
|
|
|
$data['remark'] = empty($this->POST['remark'])||!isset($this->POST['remark'])?Tool_Fnc::apiMsg('请填写备注', '500'):Tool_Fnc::safe_string($this->POST['remark']); |
|
|
|
$data['cage'] =empty($_POST['cage'])||!isset($_POST['cage'])?Tool_Fnc::apiMsg('未找到当前笼位ID', '500'):Tool_Fnc::safe_string($_POST['cage']); |
|
|
|
$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()); |
|
|
|
$data['created'] = date('Y-m-d H:i:s',time()); |
|
|
|
$data['c_user_id'] = $_SESSION['uid']; |
|
|
|
$data['c_user_id'] = $_SESSION['uid']; |
|
|
|
//判断鼠笼鼠的数量是否可以容纳 |
|
|
|
//判断鼠笼鼠的数量是否可以容纳 |
|
|
@ -144,16 +146,16 @@ class Api_SquirrelController extends Ctrl_Api{ |
|
|
|
* } |
|
|
|
* } |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function editAction(){ |
|
|
|
public function editAction(){ |
|
|
|
$data['id'] = empty($_POST['id'])||!isset($_POST['id'])?Tool_Fnc::apiMsg('系统错误', '500'):Tool_Fnc::safe_string($_POST['id']); |
|
|
|
$data['id'] = empty($this->POST['id'])||!isset($this->POST['id'])?Tool_Fnc::apiMsg('系统错误', '500'):Tool_Fnc::safe_string($this->POST['id']); |
|
|
|
$data['sex'] =empty($_POST['sex'])||!isset($_POST['sex'])?Tool_Fnc::apiMsg('请选择性别', '500'):Tool_Fnc::safe_string($_POST['sex']); |
|
|
|
$data['sex'] =empty($this->POST['sex'])||!isset($this->POST['sex'])?Tool_Fnc::apiMsg('请选择性别', '500'):Tool_Fnc::safe_string($this->POST['sex']); |
|
|
|
$data['birthday'] =empty($_POST['birthday'])||!isset($_POST['birthday'])?Tool_Fnc::apiMsg('请填写生日', '500'):Tool_Fnc::safe_string($_POST['birthday']); |
|
|
|
$data['birthday'] =empty($this->POST['birthday'])||!isset($this->POST['birthday'])?Tool_Fnc::apiMsg('请填写生日', '500'):Tool_Fnc::safe_string($this->POST['birthday']); |
|
|
|
$data['father'] = empty($_POST['father'])||!isset($_POST['father'])?0:Tool_Fnc::safe_string($_POST['father']); |
|
|
|
$data['father'] = empty($this->POST['father'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['father']); |
|
|
|
$data['mother'] = empty($_POST['mother'])||!isset($_POST['father'])?0:Tool_Fnc::safe_string($_POST['mother']); |
|
|
|
$data['mother'] = empty($this->POST['mother'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['mother']); |
|
|
|
$data['strains_id'] =empty($_POST['strains_id'])||!isset($_POST['strains_id'])?Tool_Fnc::apiMsg('请选择品系', '500'):Tool_Fnc::safe_string($_POST['strains_id']); |
|
|
|
$data['strains_id'] =empty($this->POST['strains_id'])||!isset($this->POST['strains_id'])?Tool_Fnc::apiMsg('请选择品系', '500'):Tool_Fnc::safe_string($this->POST['strains_id']); |
|
|
|
$data['gene'] =empty($_POST['gene'])||!isset($_POST['gene'])?Tool_Fnc::apiMsg('请填写基因', '500'):Tool_Fnc::safe_string($_POST['gene']); |
|
|
|
$data['gene'] =empty($this->POST['gene'])||!isset($this->POST['gene'])?Tool_Fnc::apiMsg('请填写基因', '500'):Tool_Fnc::safe_string($this->POST['gene']); |
|
|
|
$data['hair_color'] =empty($_POST['hair_color'])||!isset($_POST['hair_color'])?Tool_Fnc::apiMsg('请选择毛色', '500'):Tool_Fnc::safe_string($_POST['hair_color']); |
|
|
|
$data['hair_color'] =empty($this->POST['hair_color'])||!isset($this->POST['hair_color'])?Tool_Fnc::apiMsg('请选择毛色', '500'):Tool_Fnc::safe_string($this->POST['hair_color']); |
|
|
|
$data['remark'] = empty($_POST['remark'])||!isset($_POST['remark'])?'':Tool_Fnc::safe_string($_POST['remark']); |
|
|
|
$data['remark'] = empty($this->POST['remark'])||!isset($this->POST['remark'])?'':Tool_Fnc::safe_string($this->POST['remark']); |
|
|
|
// $data['cage'] =empty($_POST['cage'])||!isset($_POST['cage'])?Tool_Fnc::apiMsg('未找到当前笼位ID', '500'):Tool_Fnc::safe_string($_POST['cage']); |
|
|
|
// $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()); |
|
|
|
$data['created'] = date('Y-m-d H:i:s',time()); |
|
|
|
// $data['c_user_id'] = $_SESSION['uid']; |
|
|
|
// $data['c_user_id'] = $_SESSION['uid']; |
|
|
|
// //判断鼠笼鼠的数量是否可以容纳 |
|
|
|
// //判断鼠笼鼠的数量是否可以容纳 |
|
|
@ -192,7 +194,7 @@ class Api_SquirrelController extends Ctrl_Api{ |
|
|
|
* } |
|
|
|
* } |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getInfoAction(){ |
|
|
|
public function getInfoAction(){ |
|
|
|
$id = $_POST['id']; |
|
|
|
$id = $this->POST['id']; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|