Merge pull request #34 from AnonymousDotNet/lida_Dev

fix: NullReferenceException
This commit is contained in:
Haiping 2024-10-30 07:24:32 -05:00 committed by GitHub
commit d9f0328837
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -631,7 +631,7 @@ public class UserService : IUserService
var record = db.GetUserById(curUser.Id);
var existPhone = db.GetUserByPhone(phone);
if (record == null || existPhone != null)
if (record == null || (existPhone != null && existPhone.RegionCode == regionCode))
{
return false;
}

View file

@ -14,7 +14,7 @@ public partial class MongoRepository
public User? GetUserByPhone(string phone)
{
string phoneSecond = string.Empty;
if (phone.Substring(0, 3) != "+86")
if (phone.Length >= 4 && phone.Substring(0, 3) != "+86")
{
phoneSecond = $"+86{phone}";
}