鼠笼管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
4.8 KiB

7 months ago
<?php
/**
* 待办接口
* @author YS
* @version 1.0
*/
class Api_RemindController extends Ctrl_Api{
public $SquirrelModel;
public $newSquirrelModel;
public $SquirrelSetModel;
public $CageModel;
public function init(){
$SquirrelModel = new SquirrelModel();
$newSquirrelModel = new NewSquirrelModel();
$SquirrelSetModel = new SquirrelSetModel();
$CageModel = new CageModel();
$this->POST =json_decode(file_get_contents('php://input'),true);
}
public function getListAction(){
$uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid'];
//查询鼠提示信息
$Squirrel = $this->SquirrelModel->field('*')->where("c_user_id={$uid} and is_kill = 0 and is_delete=0")->fList();
$newSquirrel = $this->newSquirrelModel->field('*')->where("c_user_id={$uid} and is_kill = 0 and is_delete=0")->fList();
foreach($Squirrel as $key => $val){
//获取笼位号
$cage = $this->CageModel->field("number,type")->where("cage={$val['cage']}")->fRow();
$type = $cage['type']==1?"库存笼":"繁殖笼";
//断奶提醒
if($val['weaning_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】里{$val['number']}于{$val['weaning_time']}断奶";
}
//护理结束提醒
if($val['weaning_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】里{$val['number']}于{$val['weaning_time']}结束护理";
}
//性成熟时间提醒
if($val['grow_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】里{$val['number']}于{$val['weaning_time']}成熟";
}
//不育鼠时间提醒
if($val['infertility_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】里{$val['number']}于{$val['weaning_time']}结束不育时间";
}
//处死提醒
if($val['kill_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】里{$val['number']}{$val['weaning_time']}已到处死时间";
}
//删除提醒
if($val['del_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】里{$val['number']}{$val['weaning_time']}已到删除时间";
}
//剪尾提醒
if($val['jianwei_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】里{$val['number']}{$val['weaning_time']}改进行剪尾";
}
//实验提醒
if($val['test_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】里{$val['number']}已到可实验时间{$val['weaning_time']}";
}
}
foreach($newSquirrel as $key => $v){
//获取笼位号
$cage = $this->CageModel->field("number,type")->where("cage={$v['cage']}")->fRow();
$type = $cage['type']==1?"库存笼":"繁殖笼";
//断奶提醒
if($v['weaning_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】幼崽已到{$v['weaning_time']}断奶";
}
//护理结束提醒
if($v['weaning_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】幼崽已到{$v['weaning_time']}结束护理";
}
//性成熟时间提醒
if($v['grow_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】幼崽已到{$v['weaning_time']}成熟";
}
//不育鼠时间提醒
if($v['infertility_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】幼崽已到{$v['weaning_time']}结束不育时间";
}
//处死提醒
if($v['kill_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】幼崽已到{$v['weaning_time']}已到处死时间";
}
//删除提醒
if($v['del_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】幼崽已到{$v['weaning_time']}已到删除时间";
}
//剪尾提醒
if($v['jianwei_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】幼崽已到{$v['weaning_time']}改进行剪尾";
}
//实验提醒
if($v['test_time']==date("Y-m-d",time())){
$remind[] = "{$type}【{$cage['number']}】幼崽已到可实验时间{$v['weaning_time']}";
}
}
Tool_Fnc::apiMsg('获取成功', '200');
}
}