修正新员工在没有企业邮箱时,不能创建的问题

This commit is contained in:
mzl
2025-08-21 14:31:37 +08:00
parent 60dcc3399f
commit d41fc55e61
+15 -7
View File
@@ -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();