From 29d6290f8a831f1044a72ebf4bce297d4072ad09 Mon Sep 17 00:00:00 2001 From: limu <610543851@qq.com> Date: Fri, 19 Jan 2024 20:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E8=8D=90=E4=BA=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/user/User.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controller/api/user/User.php b/app/controller/api/user/User.php index f6d0c6b..a5fb6d9 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -381,14 +381,20 @@ class User extends BaseController if(!$a){ return app('json')->fail('查无此辅导员'); } + if($this->user->uid == $a->uid){ + return app('json')->fail('辅导员不能是自己'); + } $user->spread_uid = $a->uid; } if(!empty($spread_uid2)){ - $a = userModel::getDB()->where('uid',$spread_uid2)->find(); - if(!$a){ + $b = userModel::getDB()->where('phone',$spread_uid2)->find(); + if(!$b){ return app('json')->fail('查无此推荐人'); } - $user->spread_uid2 = $spread_uid2; + if($this->user->uid == $b->uid){ + return app('json')->fail('推荐人不能是自己'); + } + $user->spread_uid2 = $b->uid; } $user->save();