From 629075f38b867e08f644fda59962566f309db06f Mon Sep 17 00:00:00 2001 From: yanghongwei Date: Sat, 14 Jun 2025 13:17:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/UserEntity.cs | 6 ++++++ Service/UserService.cs | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Model/UserEntity.cs b/Model/UserEntity.cs index b530e9f..9ab48d8 100644 --- a/Model/UserEntity.cs +++ b/Model/UserEntity.cs @@ -41,6 +41,11 @@ namespace LY.App.Model /// 是否管理员,如果不是管理员,不可操作 /// public bool IsAdmin { get; set; } + /// + /// 用户关键防区数组 + /// + [SugarColumn(ColumnName = "position_id", ColumnDescription = "阵地ids", IsJson = true)] + public List positionId { get; set; } } public class AddUser { @@ -56,6 +61,7 @@ namespace LY.App.Model /// 是否管理员,如果不是管理员,不可操作 /// public bool IsAdmin { get; set; } + public List positionId { get; set; } } public class UpdateUser:AddUser { diff --git a/Service/UserService.cs b/Service/UserService.cs index ef9c47c..067d651 100644 --- a/Service/UserService.cs +++ b/Service/UserService.cs @@ -142,15 +142,17 @@ namespace LY.App.Service //加入redis await _redisService.SetAsync(RedisKeyList.TokenUser(input.username), token, TimeSpan.FromSeconds(60 * 60 * 24 * 7)); + var positionIds = entity.positionId?.Select(s => s.ToString()).ToList(); return new ApiResult() { code = 1, data = new { token, - expires = DateTime.UtcNow.AddSeconds(60*60*24*7), + expires = DateTime.UtcNow.AddSeconds(60 * 60 * 24 * 7), isAdmin = entity.IsAdmin, - userid = entity.Id.ToString() + userid = entity.Id.ToString(), + positionIds } }; }