新增 用户备注 管理员再用户编辑时可填

This commit is contained in:
lq1405 2024-10-30 15:34:18 +08:00
parent 3927fd21b5
commit 26d190afa1
7 changed files with 44 additions and 10 deletions

View File

@ -7,5 +7,4 @@ public class SimpleOptions
{ "ttsrole", ["EdgeTTsRoles"] }, { "ttsrole", ["EdgeTTsRoles"] },
{ "laitoolinfo", ["LaitoolHomePage", "LaitoolNotice", "LaitoolUpdateContent", "LaitoolVersion"] }, { "laitoolinfo", ["LaitoolHomePage", "LaitoolNotice", "LaitoolUpdateContent", "LaitoolVersion"] },
}; };
} }

View File

@ -56,6 +56,16 @@ namespace LMS.Repository.Models.DB
/// </summary> /// </summary>
public string AffiliateCode { get; set; } = string.Empty; public string AffiliateCode { get; set; } = string.Empty;
/// <summary>
/// 用户微信号
/// </summary>
public string? WXNumber { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remark { get; set; }
/// <summary> /// <summary>
/// 实际使用的Options /// 实际使用的Options
/// </summary> /// </summary>

View File

@ -13,5 +13,7 @@
public string LastLoginIp { get; set; } = string.Empty; public string LastLoginIp { get; set; } = string.Empty;
public string LastLoginDevice { get; set; } = string.Empty; public string LastLoginDevice { get; set; } = string.Empty;
public string Remark { get; set; } = string.Empty;
} }
} }

View File

@ -30,8 +30,16 @@ namespace LMS.Repository.DTO.UserDto
/// </summary> /// </summary>
public string AffiliateCode { get; set; } = string.Empty; public string AffiliateCode { get; set; } = string.Empty;
/// <summary>
/// 所属用户ID
/// </summary>
public long ParentId { get; set; } public long ParentId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remark { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 放一些操作信息 不能频繁的修改数据库使用的json格式存放 /// 放一些操作信息 不能频繁的修改数据库使用的json格式存放
/// </summary> /// </summary>

View File

@ -10,5 +10,7 @@
public string? UserName { get; set; } public string? UserName { get; set; }
public string? PhoneNumber { get; set; } public string? PhoneNumber { get; set; }
public List<string>? RoleNames { get; set; } public List<string>? RoleNames { get; set; }
public string? Remark { get; set; }
} }
} }

View File

@ -176,10 +176,10 @@ namespace LMS.service.Controllers
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[Authorize] [Authorize]
public async Task<ActionResult<APIResponseModel<CollectionResponse<UserCollectionDto>>>> QueryUserCollection([Required] int page, [Required] int pageSize, string userName, long? userId, string nickName, string phoneNumber, string email, string[] roleNames, long? parentId) public async Task<ActionResult<APIResponseModel<CollectionResponse<UserCollectionDto>>>> QueryUserCollection([Required] int page, [Required] int pageSize, string userName, long? userId, string nickName, string phoneNumber, string email, string[] roleNames, string remark, long? parentId)
{ {
long reuqertUserId = ConvertExtension.ObjectToLong(HttpContext.Items["UserId"] ?? 0); long reuqertUserId = ConvertExtension.ObjectToLong(HttpContext.Items["UserId"] ?? 0);
return await _userService.QueryUserCollection(page, pageSize, userName, userId, nickName, phoneNumber, email, roleNames, parentId, reuqertUserId); return await _userService.QueryUserCollection(page, pageSize, userName, userId, nickName, phoneNumber, email, roleNames, remark, parentId, reuqertUserId);
} }
#endregion #endregion
@ -199,7 +199,7 @@ namespace LMS.service.Controllers
} }
#endregion #endregion
#region #region
[HttpPost] [HttpPost]
[Authorize] [Authorize]

View File

@ -73,7 +73,8 @@ namespace LMS.service.Service.UserService
Options = user.OptionsJson, Options = user.OptionsJson,
AgentPercent = user.AgentPercent, AgentPercent = user.AgentPercent,
AffiliateCode = user.AffiliateCode, AffiliateCode = user.AffiliateCode,
ParentId = user.ParentId ?? 0 ParentId = user.ParentId ?? 0,
Remark = user.Remark ?? string.Empty
}; };
return APIResponseModel<UserDto>.CreateSuccessResponseModel(userDto); return APIResponseModel<UserDto>.CreateSuccessResponseModel(userDto);
} }
@ -87,7 +88,7 @@ namespace LMS.service.Service.UserService
#region #region
internal async Task<ActionResult<APIResponseModel<CollectionResponse<UserCollectionDto>>>> QueryUserCollection(int page, int pageSize, string userName, long? userId, string nickName, string phoneNumber, string email, string[] roleNames, long? parentId, long reuqertUserId) internal async Task<ActionResult<APIResponseModel<CollectionResponse<UserCollectionDto>>>> QueryUserCollection(int page, int pageSize, string userName, long? userId, string nickName, string phoneNumber, string email, string[] roleNames, string? remark, long? parentId, long reuqertUserId)
{ {
try try
{ {
@ -173,6 +174,11 @@ namespace LMS.service.Service.UserService
query = query.Where(x => !string.IsNullOrWhiteSpace(x.Email) && x.Email.Contains(email)); query = query.Where(x => !string.IsNullOrWhiteSpace(x.Email) && x.Email.Contains(email));
} }
if (!string.IsNullOrWhiteSpace(remark))
{
query = query.Where(x => !string.IsNullOrWhiteSpace(x.Remark) && x.Remark.Contains(remark));
}
if (roleIds.Count > 0) if (roleIds.Count > 0)
{ {
query = query.Where(x => userIds.Contains(x.Id)); query = query.Where(x => userIds.Contains(x.Id));
@ -199,9 +205,10 @@ namespace LMS.service.Service.UserService
PhoneNumber = x.PhoneNumber ?? string.Empty, PhoneNumber = x.PhoneNumber ?? string.Empty,
CreatedDate = x.CreatedDate, CreatedDate = x.CreatedDate,
LastLoginDate = x.LastLoginDate, LastLoginDate = x.LastLoginDate,
LastLoginIp = x.LastLoginIp, LastLoginIp = x.LastLoginIp ?? string.Empty,
LastLoginDevice = x.LastLoginDevice, LastLoginDevice = x.LastLoginDevice ?? string.Empty,
ParentId = x.ParentId ?? 0 ParentId = x.ParentId ?? 0,
Remark = x.Remark ?? string.Empty
}).ToList(); }).ToList();
for (int i = 0; i < userCollections.Count; i++) for (int i = 0; i < userCollections.Count; i++)
{ {
@ -262,6 +269,12 @@ namespace LMS.service.Service.UserService
return APIResponseModel<string>.CreateErrorResponseModel(ResponseCode.NotPermissionAction); return APIResponseModel<string>.CreateErrorResponseModel(ResponseCode.NotPermissionAction);
} }
if (string.IsNullOrWhiteSpace(userModel.Remark))
{
return APIResponseModel<string>.CreateErrorResponseModel(ResponseCode.ParameterError, "备注必填");
}
user.Remark = userModel.Remark;
// 开始修改用户信息 // 开始修改用户信息
if (userModel.AgentPercent != null) if (userModel.AgentPercent != null)
{ {