YS:接口更新

master
yangsai@163.com 8 months ago
parent d9e452bb40
commit 9b37879070
  1. 33
      application/controllers/Api/Basicinfo.php
  2. 2
      application/controllers/Api/Login.php
  3. 3
      application/models/Cage.php
  4. 15
      application/models/Gene.php
  5. 15
      application/models/Group.php
  6. 15
      application/models/Strains.php

@ -0,0 +1,33 @@
<?php
/**
* 基础信息接口
* @author YS
* @version 1.0
*/
class Api_BasicinfoController extends Ctrl_Api{
public $StrainsModel;
public $GeneModel;
public $GroupModel;
public function init(){
$this->StrainsModel=new StrainsModel();
$this->GeneModel=new GeneModel();
$this->GroupModel=new GroupModel();
}
//获取品系列表接口
public function strainsAction(){
$data = $this->StrainsModel->getModelList();
Tool_Fnc::apiMsg('获取成功', '200',$data);
}
//获取基因列表接口
public function geneAction(){
$data = $this->GeneModel->getModelList();
Tool_Fnc::apiMsg('获取成功', '200',$data);
}
//获取基因列表接口
public function groupAction(){
$data = $this->GroupModel->getModelList();
Tool_Fnc::apiMsg('获取成功', '200',$data);
}
}

@ -98,7 +98,7 @@
$Userinfo = $this->Usermodel->field('*')->where("username='{$username}' and type={$type} and is_delete=0")->fRow();
if(!empty($Userinfo)) Tool_Fnc::apiMsg('当前选择人员类型已存在此用户名,请重新填写用户名', '500');
$data['username'] = $username;
$data['password'] = $password;
$data['password'] = md5($password.Yaf_Registry::get("config")->psd->default->appsecret);
$data['realname'] = $realname;
$data['type'] = $type;
$data['faculties'] = $faculties;

@ -20,7 +20,7 @@ class CageModel extends Orm_Base{
$cagemodel = new CageSetModel();
$shownum = $cagemodel->field('line_num')->where("c_user_id='{$_SESSION['id']}'")->fRow();
$limmit = empty($shownum['line_num'])?20:$shownum['line_num']*5;
$sql = "select cage.id,cage.number,cage.color,strains.title strains from cage left join strains on cage.strains=strains.id";
$sql = "select cage.id,cage.number,cage.color,strains.title strains,cage.type from cage left join strains on cage.strains=strains.id";
if(!empty($params['keywords'])){
$sql .="cage.number like '%{$params['order']}%'";
}
@ -46,6 +46,7 @@ class CageModel extends Orm_Base{
if(!empty($womannum)){
$val['womannum'] = $womannum[0]['num'];
}
$val['type_color'] = $val['type']==2?'#FF0000':'';
}
$data['page'] = $params['page'];
return $data;

@ -0,0 +1,15 @@
<?php
class GeneModel extends Orm_Base{
public $table = 'Gene';
public $field = array(
'id' => array('type' => "int(11)",'comment' => ''),
'title' => array('type' => "varchar(45)",'comment' => '基因名称'),
'is_delete' => array('type' => "varchar(45)",'comment' => '是否删除'),
'created' => array('type' => "int(11)",'comment' => '添加时间'),
);
public $pk = 'id';
public function getModelList(){
return $this->field('id,title')->where('is_delete=0')->fList();
}
}

@ -0,0 +1,15 @@
<?php
class GroupModel extends Orm_Base{
public $table = 'groups';
public $field = array(
'id' => array('type' => "int(11)",'comment' => ''),
'title' => array('type' => "varchar(45)",'comment' => '实验室名称'),
'is_delete' => array('type' => "varchar(45)",'comment' => '是否删除'),
'created' => array('type' => "int(11)",'comment' => '添加时间'),
);
public $pk = 'id';
public function getModelList(){
return $this->field('id,title')->where('is_delete=0')->fList();
}
}

@ -0,0 +1,15 @@
<?php
class StrainsModel extends Orm_Base{
public $table = 'strains';
public $field = array(
'id' => array('type' => "int(11)",'comment' => ''),
'title' => array('type' => "varchar(45)",'comment' => '品系名称'),
'is_delete' => array('type' => "varchar(45)",'comment' => '是否删除'),
'created' => array('type' => "int(11)",'comment' => '添加时间'),
);
public $pk = 'id';
public function getModelList(){
return $this->field('id,title')->where('is_delete=0')->fList();
}
}
Loading…
Cancel
Save