diff --git a/app/common/logic/AuthLogic.php b/app/common/logic/AuthLogic.php index 9857df8..c79b1d1 100644 --- a/app/common/logic/AuthLogic.php +++ b/app/common/logic/AuthLogic.php @@ -87,13 +87,21 @@ class AuthLogic try { $phone = $this->sanitizePhone($feishuUserInfo['mobile'] ?? ''); $email = $feishuUserInfo['enterprise_email']; - $user = User::where('corp_id', $feishuUserInfo['corp_id']) - ->where(function($query) use ($phone, $email) { - $query->where('phone', $phone) - ->orWhere('email', $email); - }) - ->first(); - + // $user = User::where('corp_id', $feishuUserInfo['corp_id']) + // ->where(function($query) use ($phone, $email) { + // $query->where('phone', $phone) + // ->orWhere('email', $email); + // }) + // ->first(); + $userByPhone = User::where('corp_id', $feishuUserInfo['corp_id']) + ->where('phone', $phone) + ->where('phone', '!=', '') + ->first(); + $userByEmail = User::where('corp_id', $feishuUserInfo['corp_id']) + ->where('email', $email) + ->where('email', '!=', '') + ->first(); + $user = $userByPhone ?: $userByEmail; if (!$user) { // 获取编号 $userSn = $this->getAvailableUserSn();