yangsai@163.com 7 months ago
parent bb332ba6dc
commit 152d2a7d4c
  1. 7
      application/controllers/Api/Squirrel.php
  2. 2
      application/models/Cage.php
  3. 8
      application/models/Squirrel.php

@ -254,9 +254,10 @@ class Api_SquirrelController extends Ctrl_Api{
$return = $this->Squirrelmodel->partent();
Tool_Fnc::apiMsg('获取成功', '200',$return);
}
public function OperateAction(){
$params['id'] = empty($this->POST['id'])?Tool_Fnc::apiMsg('缺少小鼠id', '500'):$this->POST['id'];
public function getIconAction(){
$id= empty($this->POST['id'])?Tool_Fnc::apiMsg('缺少小鼠id', '500'):$this->POST['id'];
$data = $this->Squirrelmodel->getIcon($id);
Tool_Fnc::apiMsg('获取成功', '200',data);
}
}

@ -20,7 +20,7 @@ class CageModel extends Orm_Base{
$cagemodel = new CageSetModel();
$shownum = $cagemodel->field('line_num')->where("c_user_id='{$params['uid']}'")->fRow();
$limmit = empty($shownum['line_num'])?20:$shownum['line_num']*5;
$sql = "select id,number,color,strains,type from cage ";
$sql = "select id,number,color,strains,type from cage where c_user_id={$params['uid']}";
if(!empty($params['keyword'])){
$sql .=" where number like '%{$params['keyword']}%'";
}

@ -35,11 +35,7 @@ class SquirrelModel extends Orm_Base{
//获取仓鼠信息
$data['slist']=$this->field('id,number,sex,birthday,father,mother,strains_id as strains,gene,hair_color,cage,remark')->where("is_delete=0 and is_kill=0 {$params['where']}")->fList();
foreach($data['slist'] as $key => &$val){
// $father = $this->getOneInfo($val['father']);
// $mother = $this->getOneInfo($val['mother']);
$val['sex'] = $val['sex']=1?'公':'母';
// $val['father'] = empty($father)?$val['father']:$father['number'];
// $val['mother'] = empty($mother)?$val['mother']:$mother['number'];
//获取笼位号
$val['cage'] =$cageModel->getOneInfo($val['cage'])['number'];
}
@ -85,9 +81,9 @@ class SquirrelModel extends Orm_Base{
$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")->cangshu->url->small;
$data['icon'] = $_SERVER['HTTP_HOST'].Yaf_Registry::get("config")->cangshu->url->small;
}else{
$data['icon'] = Yaf_Registry::get("config")->cangshu->url->big;
$data['icon'] =$_SERVER['HTTP_HOST'].Yaf_Registry::get("config")->cangshu->url->big;
}
return $data;
}

Loading…
Cancel
Save