yangsai@163.com 6 months ago
parent 5ca5b6e350
commit 90499b82ac
  1. 4
      application/controllers/Api/Squirrel.php
  2. 4
      application/models/Squirrel.php

@ -91,7 +91,7 @@ class Api_SquirrelController extends Ctrl_Api{
$data['number'] =empty($this->POST['number'])||!isset($this->POST['number'])?Tool_Fnc::apiMsg('请输入编号', '500'):Tool_Fnc::safe_string($this->POST['number']); $data['number'] =empty($this->POST['number'])||!isset($this->POST['number'])?Tool_Fnc::apiMsg('请输入编号', '500'):Tool_Fnc::safe_string($this->POST['number']);
$number = $this->Squirrelmodel->field("type")->where("number='{$data['number']}'")->fRow(); $number = $this->Squirrelmodel->field("type")->where("number='{$data['number']}'")->fRow();
if(!empty($number)) Tool_Fnc::apiMsg('该编号已存在', '500'); if(!empty($number)) Tool_Fnc::apiMsg('该编号已存在', '500');
$data['sex'] =empty($this->POST['sex'])||!isset($this->POST['sex'])?Tool_Fnc::apiMsg('请选择性别', '500'):Tool_Fnc::safe_string($this->POST['sex']); $data['sex'] =empty($this->POST['sex'])||!isset($this->POST['sex'])?0:Tool_Fnc::safe_string($this->POST['sex']);
$data['birthday'] =empty($this->POST['birthday'])||!isset($this->POST['birthday'])?Tool_Fnc::apiMsg('请填写生日', '500'):Tool_Fnc::safe_string($this->POST['birthday']); $data['birthday'] =empty($this->POST['birthday'])||!isset($this->POST['birthday'])?Tool_Fnc::apiMsg('请填写生日', '500'):Tool_Fnc::safe_string($this->POST['birthday']);
$data['father'] = empty($this->POST['father'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['father']); $data['father'] = empty($this->POST['father'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['father']);
$data['mother'] = empty($this->POST['mother'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['mother']); $data['mother'] = empty($this->POST['mother'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['mother']);
@ -174,7 +174,7 @@ class Api_SquirrelController extends Ctrl_Api{
public function editAction(){ public function editAction(){
$data['uid'] = empty($this->POST['uid'])||!isset($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):Tool_Fnc::safe_string($this->POST['id']); $data['uid'] = empty($this->POST['uid'])||!isset($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):Tool_Fnc::safe_string($this->POST['id']);
$data['id'] = empty($this->POST['id'])||!isset($this->POST['id'])?Tool_Fnc::apiMsg('系统错误', '500'):Tool_Fnc::safe_string($this->POST['id']); $data['id'] = empty($this->POST['id'])||!isset($this->POST['id'])?Tool_Fnc::apiMsg('系统错误', '500'):Tool_Fnc::safe_string($this->POST['id']);
$data['sex'] =empty($this->POST['sex'])||!isset($this->POST['sex'])?Tool_Fnc::apiMsg('请选择性别', '500'):Tool_Fnc::safe_string($this->POST['sex']); $data['sex'] =empty($this->POST['sex'])||!isset($this->POST['sex'])?0:Tool_Fnc::safe_string($this->POST['sex']);
$data['birthday'] =empty($this->POST['birthday'])||!isset($this->POST['birthday'])?Tool_Fnc::apiMsg('请填写生日', '500'):Tool_Fnc::safe_string($this->POST['birthday']); $data['birthday'] =empty($this->POST['birthday'])||!isset($this->POST['birthday'])?Tool_Fnc::apiMsg('请填写生日', '500'):Tool_Fnc::safe_string($this->POST['birthday']);
$data['father'] = empty($this->POST['father'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['father']); $data['father'] = empty($this->POST['father'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['father']);
$data['mother'] = empty($this->POST['mother'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['mother']); $data['mother'] = empty($this->POST['mother'])||!isset($this->POST['father'])?0:Tool_Fnc::safe_string($this->POST['mother']);

@ -89,8 +89,8 @@ class SquirrelModel extends Orm_Base{
if($cageinfo['type']==2) $exec->where("cage={$cage}"); if($cageinfo['type']==2) $exec->where("cage={$cage}");
} }
$data = $exec->fList(); $data = $exec->fList();
$data[] = ['id'=>0,'number'=>"未知",'sex'=>2]; $data[] = ['id'=>0,'number'=>"其他",'sex'=>2];
$data[] = ['id'=>0,'number'=>"未知",'sex'=>1]; $data[] = ['id'=>0,'number'=>"其他",'sex'=>1];
return $data; return $data;
} }
public function getIcon($squirrel){ public function getIcon($squirrel){

Loading…
Cancel
Save