yangsai@163.com 7 months ago
parent d698006e44
commit de5c377524
  1. 11
      application/controllers/Api/Squirrel.php
  2. 15
      application/models/Squirrel.php

@ -192,7 +192,10 @@ class Api_SquirrelController extends Ctrl_Api{
* }
*/
public function getInfoAction(){
$id = $this->POST['id'];
$id = empty($this->POST['id'])||!isset($this->POST['id'])?Tool_Fnc::apiMsg('小鼠ID缺失', '500'):Tool_Fnc::safe_string($this->POST['id']);
$data = $this->Squirrelmodel->getOneInfo($id);
Tool_Fnc::apiMsg('获取成功', '200',$data);
}
/**
* 幼崽信息添加接口
@ -248,8 +251,12 @@ class Api_SquirrelController extends Ctrl_Api{
Tool_Fnc::apiMsg('添加成功', '200');
}
public function getparentsAction(){
$return = $this->Squirrelmodel->partent($data);
$return = $this->Squirrelmodel->partent();
Tool_Fnc::apiMsg('获取成功', '200',$return);
}
public function OperateAction(){
$params['squirrel_id'] = empty($this->POST['squirrel_id'])?Tool_Fnc::apiMsg('缺少小鼠id', '500'):$this->POST['squirrel_id'];
}
}

@ -73,13 +73,22 @@ class SquirrelModel extends Orm_Base{
}
return $data;
}
public function getOneInfo($cage){
return $this->field('*')->where("id={$cage}")->fRow();
public function getOneInfo($squirrel){
return $this->field('id,number,sex,birthday,father,mother,strains_id as strains,gene,hair_color,cage,remark')->where("id={$squirrel}")->fRow();
}
public function partent($params){
public function partent(){
$time = date('Y-m-d',time());
$data=$this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}'")->fList();
return $data;
}
public function getIcon($squirrel){
$date = strtotime(date('Y-m-d',time()));
$info = $this->field('nusring_time')->where("id={$squirrel}")->fRow();
if(strotime($info['nusring_time'])>$date){
$data['icon'] = Yaf_Registry::get("config")->psd->default->appsecret;
}else{
}
}
}

Loading…
Cancel
Save