From 51ed65efb6bcc18d684b703dfac931dd5f88b813 Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Wed, 19 Jun 2024 17:39:41 +0800 Subject: [PATCH] YS --- application/controllers/Api/Squirrel.php | 14 ++++++++++++-- application/models/Cage.php | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/application/controllers/Api/Squirrel.php b/application/controllers/Api/Squirrel.php index d8d5a5b..459dde4 100644 --- a/application/controllers/Api/Squirrel.php +++ b/application/controllers/Api/Squirrel.php @@ -440,9 +440,19 @@ class Api_SquirrelController extends Ctrl_Api{ $uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请登录', '500'):$this->POST['uid']; $id = empty($this->POST['id'])?Tool_Fnc::apiMsg('幼崽信息获取失败', '500'):$this->POST['id']; if(!$this->NewSquirrelmodel->where("id={$id} and c_user_id={$uid}")->del()){ - Tool_Fnc::apiMsg('删除失败', '1'); + Tool_Fnc::apiMsg('删除失败', '500'); } - Tool_Fnc::apiMsg('删除成功', '500'); + Tool_Fnc::apiMsg('删除成功', '1'); + } + public function deletesAction(){ + $uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请登录', '500'):$this->POST['uid']; + $id = empty($this->POST['id'])?Tool_Fnc::apiMsg('幼崽信息获取失败', '500'):$this->POST['id']; + $id = implode(",",$id); + $sql = "update {$this->Squirrelmodel->table} set is_delete=1 where id in ({$id}) and c_user_id={$uid}"; + if(!$this->NewSquirrelmodel->exec($sql)){ + Tool_Fnc::apiMsg('删除失败', '500'); + } + Tool_Fnc::apiMsg('删除成功', '1'); } } diff --git a/application/models/Cage.php b/application/models/Cage.php index 6089376..466488d 100644 --- a/application/models/Cage.php +++ b/application/models/Cage.php @@ -63,7 +63,7 @@ class CageModel extends Orm_Base{ $UserModel = new UserModel(); $info = $this->field('*')->where("id='{$id}'")->fRow(); //负责人id - $info['user'] = $UserModel->field('realname')->fRow()['realname']; + $info['user'] = $UserModel->field('realname')->where("id={$info['user_id']}")->fRow()['realname']; return $info; } }