YS:接口参数接收形式更改

master
yangsai@163.com 8 months ago
parent 8a8ddbdf3b
commit b94afdc8f2
  1. 1
      application/controllers/Api/Appoint.php
  2. 2
      application/controllers/Api/Basicinfo.php
  3. 18
      application/controllers/Api/Cage.php
  4. 24
      application/controllers/Api/Login.php
  5. 48
      application/controllers/Api/Squirrel.php
  6. 2
      application/controllers/Api/Sysset.php

@ -8,6 +8,7 @@
class Api_AppointController extends Ctrl_Api{
public $SoapUrl = 'https://192.168.90.116:1443/csp/hsb/DHC.Published.ZZJService.BS.ZZJService.CLS?WSDL=1';
public $POST;
/**
* 默认接口

@ -8,11 +8,13 @@
class Api_BasicinfoController extends Ctrl_Api{
public $StrainsModel;
public $GeneModel;
public $POST;
public $GroupModel;
public function init(){
if(empty($_SESSION['uid'])) {Tool_Fnc::apiMsg('非法调用', '500');}
$this->StrainsModel=new StrainsModel();
$this->GeneModel=new GeneModel();
$this->POST =json_decode(file_get_contents('php://input'),true);
$this->GroupModel=new GroupModel();
}
//获取品系列表接口

@ -7,10 +7,12 @@
*/
class Api_CageController extends Ctrl_Api{
public $Cagemodel;
public $POST;
public $Cagecolormodel;
public function init() {
if(empty($_SESSION['uid'])) {Tool_Fnc::apiMsg('非法调用', '500');}
$this->Cagemodel = new CageModel();
$this->POST =json_decode(file_get_contents('php://input'),true);
$this->Cagecolormodel = new CagecolorModel();
}
/**
@ -37,9 +39,9 @@ class Api_CageController extends Ctrl_Api{
* }
*/
public function listAction(){
$params['order'] = empty($_POST['order'])?'':$_POST['order'];
$params['keyword'] = empty($_POST['keyword'])?'':$_POST['keyword'];
$params['page'] = empty($_POST['page'])?1:$_POST['page'];
$params['order'] = empty($this->POST['order'])?'':$this->POST['order'];
$params['keyword'] = empty($this->POST['keyword'])?'':$this->POST['keyword'];
$params['page'] = empty($this->POST['page'])?1:$this->POST['page'];
$data = $this->Cagemodel->getModelList($params);
Tool_Fnc::apiMsg('笼位获取成功', '200',$data);
}
@ -62,15 +64,15 @@ class Api_CageController extends Ctrl_Api{
//查询笼位号
$CageNum = $this->Cagemodel->field('count(*) as num')->where("user_id={$_SESSION['uid']}")->fRow();
$CageNum = empty($CageNum)?1:(int) $CageNum['num']+1;
$data['type'] = $_POST['type'];
$data['type'] = $this->POST['type'];
$data['number'] = "NO.0000".$CageNum;
if($CageNum>9) $data['number'] = "NO.000".$CageNum;
if($CageNum>99) $data['number'] = "NO.00".$CageNum;
if($CageNum>999) $data['number'] = "NO.0".$CageNum;
$data['strains'] =empty($_POST['strains'])||!isset($_POST['strains'])?Tool_Fnc::apiMsg('请选择笼位品系', '500'):Tool_Fnc::safe_string($_POST['strains']);
$data['color'] =empty($_POST['color'])||!isset($_POST['color'])?Tool_Fnc::apiMsg('请选择笼位颜色', '500'):Tool_Fnc::safe_string($_POST['color']);
$data['group'] = empty($_POST['group'])||!isset($_POST['group'])?Tool_Fnc::apiMsg('请选择实验室', '500'):Tool_Fnc::safe_string($_POST['group']);
$data['user_id'] =empty($_POST['user_id'])||!isset($_POST['user_id'])?Tool_Fnc::apiMsg('请选择负责人', '500'):Tool_Fnc::safe_string($_POST['user_id']);
$data['strains'] =empty($this->POST['strains'])||!isset($this->POST['strains'])?Tool_Fnc::apiMsg('请选择笼位品系', '500'):Tool_Fnc::safe_string($this->POST['strains']);
$data['color'] =empty($this->POST['color'])||!isset($this->POST['color'])?Tool_Fnc::apiMsg('请选择笼位颜色', '500'):Tool_Fnc::safe_string($this->POST['color']);
$data['group'] = empty($this->POST['group'])||!isset($this->POST['group'])?Tool_Fnc::apiMsg('请选择实验室', '500'):Tool_Fnc::safe_string($this->POST['group']);
$data['user_id'] =empty($this->POST['user_id'])||!isset($this->POST['user_id'])?Tool_Fnc::apiMsg('请选择负责人', '500'):Tool_Fnc::safe_string($this->POST['user_id']);
$data['created'] = date('Y-m-d H:i:s',time());
$data['c_user_id'] = $_SESSION['uid'];
$ret = $this->Cagemodel->insert($data);

@ -7,8 +7,10 @@
*/
class Api_LoginController extends Ctrl_Api{
public $Usermodel;
public $POST;
public function init() {
$this->Usermodel = new UserModel();
$this->POST =json_decode(file_get_contents('php://input'),true);
}
/**
* 鼠笼系统登录接口
@ -35,10 +37,10 @@
*/
public function indexAction(){
//用户名
$Username = empty($_POST['Username'])||!isset($_POST['Username'])? Tool_Fnc::apiMsg('请输入正确的用户名或密码', '500'):Tool_fnc::safe_string($_POST['Username']);
$Username = empty($this->POST['Username'])||!isset($this->POST['Username'])? Tool_Fnc::apiMsg('请输入正确的用户名或密码', '500'):Tool_fnc::safe_string($this->POST['Username']);
//密码
$Password = empty($_POST['Password'])||!isset($_POST['Password'])? Tool_Fnc::apiMsg('请输入正确的用户名或密码', '500'):Tool_fnc::safe_string($_POST['Password']);
$Type = empty($_POST['Type'])||!isset($_POST['Type'])? Tool_Fnc::apiMsg('请选择登录的人员类型', '500'):Tool_fnc::safe_string($_POST['Type']);
$Password = empty($this->POST['Password'])||!isset($this->POST['Password'])? Tool_Fnc::apiMsg('请输入正确的用户名或密码', '500'):Tool_fnc::safe_string($this->POST['Password']);
$Type = empty($this->POST['Type'])||!isset($this->POST['Type'])? Tool_Fnc::apiMsg('请选择登录的人员类型', '500'):Tool_fnc::safe_string($this->POST['Type']);
$Userinfo = $this->Usermodel->field('*')->where("username='{$Username}' and status=1 and type={$Type}")->fRow();
empty($Userinfo)?Tool_Fnc::apiMsg('请输入正确的用户名或密码', '500'):$Userinfo;
$Userinfo['password']!=md5($Password.Yaf_Registry::get("config")->psd->default->appsecret)?Tool_Fnc::apiMsg('请输入正确的用户名或密码', '500'):$Userinfo['password'];
@ -79,21 +81,21 @@
*/
public function registerAction(){
//用户名
$username = empty($_POST['username'])||!isset($_POST['username'])? Tool_Fnc::apiMsg('请输入用户名', '500'):Tool_fnc::safe_string($_POST['username']);
$username = empty($this->POST['username'])||!isset($this->POST['username'])? Tool_Fnc::apiMsg('请输入用户名', '500'):Tool_fnc::safe_string($this->POST['username']);
//密码
$password = empty($_POST['password'])||!isset($_POST['password'])? Tool_Fnc::apiMsg('请输入密码', '500'):Tool_fnc::safe_string($_POST['password']);
$password = empty($this->POST['password'])||!isset($this->POST['password'])? Tool_Fnc::apiMsg('请输入密码', '500'):Tool_fnc::safe_string($this->POST['password']);
//用户类型
$type = empty($_POST['type'])||!isset($_POST['type'])? Tool_Fnc::apiMsg('请选择用户类型', '500'):Tool_fnc::safe_string($_POST['type']);
$type = empty($this->POST['type'])||!isset($this->POST['type'])? Tool_Fnc::apiMsg('请选择用户类型', '500'):Tool_fnc::safe_string($this->POST['type']);
//真实姓名
$realname = empty($_POST['realname'])||!isset($_POST['realname'])? Tool_Fnc::apiMsg('请输入真实姓名', '500'):Tool_fnc::safe_string($_POST['realname']);
$realname = empty($this->POST['realname'])||!isset($this->POST['realname'])? Tool_Fnc::apiMsg('请输入真实姓名', '500'):Tool_fnc::safe_string($this->POST['realname']);
//院系
$faculties = empty($_POST['faculties'])||!isset($_POST['faculties'])? Tool_Fnc::apiMsg('请选择院系', '500'):Tool_fnc::safe_string($_POST['faculties']);
$faculties = empty($this->POST['faculties'])||!isset($this->POST['faculties'])? Tool_Fnc::apiMsg('请选择院系', '500'):Tool_fnc::safe_string($this->POST['faculties']);
//专业
$specialized = empty($_POST['specialized'])||!isset($_POST['specialized'])? Tool_Fnc::apiMsg('请选择专业', '500'):Tool_fnc::safe_string($_POST['specialized']);
$specialized = empty($this->POST['specialized'])||!isset($this->POST['specialized'])? Tool_Fnc::apiMsg('请选择专业', '500'):Tool_fnc::safe_string($this->POST['specialized']);
//课题组
$group = empty($_POST['group'])||!isset($_POST['group'])? Tool_Fnc::apiMsg('请选择课题组', '500'):Tool_fnc::safe_string($_POST['group']);
$group = empty($this->POST['group'])||!isset($this->POST['group'])? Tool_Fnc::apiMsg('请选择课题组', '500'):Tool_fnc::safe_string($this->POST['group']);
//导师
$teacher = empty($_POST['teacher'])||!isset($_POST['teacher'])? Tool_Fnc::apiMsg('请选择导师', '500'):Tool_fnc::safe_string($_POST['teacher']);
$teacher = empty($this->POST['teacher'])||!isset($this->POST['teacher'])? Tool_Fnc::apiMsg('请选择导师', '500'):Tool_fnc::safe_string($this->POST['teacher']);
//查询用户名是否存在
$Userinfo = $this->Usermodel->field('*')->where("username='{$username}' and type={$type} and is_delete=0")->fRow();
if(!empty($Userinfo)) Tool_Fnc::apiMsg('当前选择人员类型已存在此用户名,请重新填写用户名', '500');

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

@ -7,12 +7,14 @@
*/
class Api_SyssetController extends Ctrl_Api{
public $CageSetModel;
public $POST;
public $SquirrelSetModel;
public $ExcelSetModel;
public function init(){
if(empty($_SESSION['uid'])) {Tool_Fnc::apiMsg('非法调用', '500');}
$this->CageSetModel=new CageSetModel();
$this->SquirrelSetModel=new SquirrelSetModel();
$this->POST =json_decode(file_get_contents('php://input'),true);
$this->ExcelSetModel=new ExcelSetModel();
}
/**

Loading…
Cancel
Save