yangsai@163.com 5 months ago
parent 819ee8a5c3
commit 519ef1464d
  1. 7
      application/controllers/Api/Remind.php
  2. 15
      application/models/Squirrel.php

@ -47,10 +47,11 @@ class Api_RemindController extends Ctrl_Api{
$RemindModel = new RemindModel();
$uid= empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid'];
$id= empty($this->POST['id'])?Tool_Fnc::apiMsg('待办ID缺失', '500'):$this->POST['id'];
$status = $RemindModel->field('status')->where("id={$id} and user_id={$uid}")->fRow();
$data['id'] = $id;
$data['status'] = 1;
if(!$RemindModel->update($data)) Tool_Fnc::apiMsg('删除失败', '500');
Tool_Fnc::apiMsg('成功', '200');
$data['status'] = $status==0?"1":0;
if(!$RemindModel->update($data)) Tool_Fnc::apiMsg('设置失败', '500');
Tool_Fnc::apiMsg('设置成功', '200');
}
function time_tran($the_time) {
$now_time = time();

@ -86,15 +86,20 @@ class SquirrelModel extends Orm_Base{
public function partent($cage){
$time = date('Y-m-d',time());
$exec=$this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}'");
$data=$this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}' and sex in (1,2)")->fList();
$data[] = ['id'=>0,'number'=>"未知",'sex'=>2];
$data[] = ['id'=>0,'number'=>"未知",'sex'=>1];
if(!empty($cage)){
$CageModel = new CageModel();
$cageinfo = $CageModel->field("type")->where("id={$cage}")->fRow();
if($cageinfo['type']==2) $exec->where("cage={$cage}");
if($cageinfo['type']==2) {
$data = [];
$n = $this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}' and sex=1 and cage={$cage}")->fRow();
$m = $this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}' and sex=2 and cage={$cage}")->fList();
$data[]=empty($n)?['id'=>0,'number'=>"未知",'sex'=>1]:$n;
$data[]=empty($m)?['id'=>0,'number'=>"未知",'sex'=>2]:$m;
}
}
$data = $exec->fList();
$data[] = ['id'=>0,'number'=>"未知",'sex'=>2];
$data[] = ['id'=>0,'number'=>"未知",'sex'=>1];
return $data;
}
public function getIcon($squirrel){

Loading…
Cancel
Save