yangsai@163.com 6 months ago
parent 24dc6c9e01
commit 8c5b8ad0ba
  1. 5
      application/controllers/Api/Squirrel.php

@ -88,7 +88,7 @@ class Api_SquirrelController extends Ctrl_Api{
// $CageNum = empty($CageNum)?1:(int) $CageNum['num']+1; // $CageNum = empty($CageNum)?1:(int) $CageNum['num']+1;
$data['c_user_id'] = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; $data['c_user_id'] = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid'];
$data['type'] = $this->POST['type']; $data['type'] = $this->POST['type'];
$data['number'] =empty($this->POST['number'])||!isset($this->POST['sex'])?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'])?Tool_Fnc::apiMsg('请选择性别', '500'):Tool_Fnc::safe_string($this->POST['sex']);
@ -182,6 +182,9 @@ class Api_SquirrelController extends Ctrl_Api{
$data['gene'] =empty($this->POST['gene'])||!isset($this->POST['gene'])?Tool_Fnc::apiMsg('请填写基因', '500'):Tool_Fnc::safe_string($this->POST['gene']); $data['gene'] =empty($this->POST['gene'])||!isset($this->POST['gene'])?Tool_Fnc::apiMsg('请填写基因', '500'):Tool_Fnc::safe_string($this->POST['gene']);
$data['hair_color'] =empty($this->POST['hair_color'])||!isset($this->POST['hair_color'])?Tool_Fnc::apiMsg('请选择毛色', '500'):Tool_Fnc::safe_string($this->POST['hair_color']); $data['hair_color'] =empty($this->POST['hair_color'])||!isset($this->POST['hair_color'])?Tool_Fnc::apiMsg('请选择毛色', '500'):Tool_Fnc::safe_string($this->POST['hair_color']);
$data['remark'] = empty($this->POST['remark'])||!isset($this->POST['remark'])?'':Tool_Fnc::safe_string($this->POST['remark']); $data['remark'] = empty($this->POST['remark'])||!isset($this->POST['remark'])?'':Tool_Fnc::safe_string($this->POST['remark']);
$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']}' and id!={$data['id'] }")->fRow();
if(!empty($number)) Tool_Fnc::apiMsg('该编号已存在', '500');
$data['created'] = date('Y-m-d H:i:s',time()); $data['created'] = date('Y-m-d H:i:s',time());
$squirrelinfo = $this->Squirrelmodel->field("*")->where("id={$data['id']}")->fRow(); $squirrelinfo = $this->Squirrelmodel->field("*")->where("id={$data['id']}")->fRow();
$cageinfo = $this->CageModel->field("id,type")->where("id={$squirrelinfo['cage']}")->fRow(); $cageinfo = $this->CageModel->field("id,type")->where("id={$squirrelinfo['cage']}")->fRow();

Loading…
Cancel
Save