From 8c5b8ad0baa9b008e78b607ecb2bce77edb4705f Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Thu, 6 Jun 2024 15:50:07 +0800 Subject: [PATCH] YS --- application/controllers/Api/Squirrel.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/controllers/Api/Squirrel.php b/application/controllers/Api/Squirrel.php index 54de3ad..ae60f3d 100644 --- a/application/controllers/Api/Squirrel.php +++ b/application/controllers/Api/Squirrel.php @@ -88,7 +88,7 @@ class Api_SquirrelController extends Ctrl_Api{ // $CageNum = empty($CageNum)?1:(int) $CageNum['num']+1; $data['c_user_id'] = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; $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(); 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']); @@ -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['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['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()); $squirrelinfo = $this->Squirrelmodel->field("*")->where("id={$data['id']}")->fRow(); $cageinfo = $this->CageModel->field("id,type")->where("id={$squirrelinfo['cage']}")->fRow();