代码整理

This commit is contained in:
jianzhichu
2026-01-23 22:24:00 +08:00
parent 60f6e3847d
commit 3f6b1874eb
60 changed files with 348 additions and 991 deletions
+10 -10
View File
@@ -38,8 +38,8 @@ namespace dy.net.repository
var newpassword = loginUser.Password.Md5();
user.Password = newpassword;
user.UserName = loginUser.UserName;
var res = await this.UpdateAsync(user);
return (res?0:-1,res ?"更新成功" : "更新失败");
var res = await this.UpdateAsync(user);
return (res ? 0 : -1, res ? "更新成功" : "更新失败");
}
}
else
@@ -50,11 +50,11 @@ namespace dy.net.repository
}
public async Task<AdminUserInfo> GetUser(string userName=null)
public async Task<AdminUserInfo> GetUser(string userName = null)
{
if (string.IsNullOrWhiteSpace(userName))
{
return await this.GetFirstAsync(x=>!string.IsNullOrWhiteSpace(x.Id));
return await this.GetFirstAsync(x => !string.IsNullOrWhiteSpace(x.Id));
}
else
{
@@ -80,7 +80,7 @@ namespace dy.net.repository
{
user.Avatar = avatar;
var update = await UpdateAsync(user);
return update ;
return update;
}
}
@@ -89,10 +89,10 @@ namespace dy.net.repository
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public (int code, string erro) InitUser(AdminUserInfo userInfo)
public (int code, string erro) InitUser(AdminUserInfo userInfo)
{
var isInit = this.GetFirst(x=>!string.IsNullOrWhiteSpace(x.Id));
if (isInit!=null)
var isInit = this.GetFirst(x => !string.IsNullOrWhiteSpace(x.Id));
if (isInit != null)
{
return (-1, "系统用户已存在");
}
@@ -102,8 +102,8 @@ namespace dy.net.repository
userInfo.CreateTime = DateTime.Now;
userInfo.Password = Md5Util.Md5(userInfo.Password);
var res = this.Insert(userInfo);
return (res ? 0 : -1, res ? "初始用户成功" : "初始化用户失败");
var res = this.Insert(userInfo);
return (res ? 0 : -1, res ? "初始用户成功" : "初始化用户失败");
}
}
}