李昊 4 年之前
父节点
当前提交
c29f559bea

+ 12 - 1
gx_api/GxPress/Api/GxPress.Api/AppControllers/UserController.cs

@@ -458,8 +458,19 @@ namespace GxPress.Api.AppControllers
         [HttpPost("group-chat")]
         public async Task<IEnumerable<UserInfoResult>> GetGroupOrGroupChatUserInfosResult(UserInfoByGroupoRoGroupChatResult request)
         {
-            request.UserId=_loginContext.AccountId;
+            request.UserId = _loginContext.AccountId;
             return await _userService.GetGroupOrGroupChatUserInfosResult(request);
         }
+        /// <summary>
+        /// 获取好友列表
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <param name="keyWord"></param>
+        /// <returns></returns>
+        [HttpGet("friends/{keyWord}")]
+        public async Task<IEnumerable<UserInfoResult>> GetFriendUserInfoResult(int userId, string keyWord)
+        {
+            return await _userService.GetFriendUserInfoResult(_loginContext.AccountId, keyWord);
+        }
     }
 }

+ 8 - 0
gx_api/GxPress/Model/GxPress.Entity/Comment.cs

@@ -21,6 +21,14 @@ namespace GxPress.Entity
         /// </summary>
         [DataColumn] public string Content { get; set; }
         /// <summary>
+        /// 内容
+        /// </summary>
+        [DataColumn] public string HtmlContent { get; set; }
+        /// <summary>
+        /// 内容
+        /// </summary>
+        [DataColumn] public string JsonContent { get; set; }
+        /// <summary>
         /// 点赞次数
         /// </summary>
         [DataColumn] public int Laud { get; set; }

+ 10 - 2
gx_api/GxPress/Model/GxPress.Request/Comment/CommentInRequest.cs

@@ -29,13 +29,21 @@ namespace GxPress.Request.Comment
         /// 状态 文章100,话题2,收藏3,笔记4,通知5,站内信6,小组7,收藏文件夹12,笔记文件夹13,工作流审批14,文件300,图片301,会议纪要8,会议详情500,财务报表601,人事报表602,出版报表603,书籍20,课程30,音频40,期刊50,视频60,名栏90,公众号110,刊期120
         /// </summary>
         /// <value></value>
-        public int TypeValue{get;set;}
+        public int TypeValue { get; set; }
 
-         /// <summary>
+        /// <summary>
         /// 评分
         /// </summary>
         /// <value></value>
         public decimal Score { get; set; }
 
+        /// <summary>
+        /// HTML内容
+        /// </summary>
+        public string HtmlContent { get; set; }
+        /// <summary>
+        /// json内容
+        /// </summary>
+        public string JsonContent { get; set; }
     }
 }

+ 24 - 1
gx_api/GxPress/Model/GxPress.Result/Comment/CommentPageResult.cs

@@ -23,6 +23,14 @@ namespace GxPress.Result.Comment
         /// </summary>
         public string Content { get; set; }
         /// <summary>
+        /// HTML内容
+        /// </summary>
+        public string HtmlContent { get; set; }
+        /// <summary>
+        /// json内容
+        /// </summary>
+        public string JsonContent { get; set; }
+        /// <summary>
         /// 时间
         /// </summary>
         public DateTime? CreatedTime { get; set; }
@@ -80,6 +88,14 @@ namespace GxPress.Result.Comment
         /// </summary>
         public string Content { get; set; }
         /// <summary>
+        /// HTML内容
+        /// </summary>
+        public string HtmlContent { get; set; }
+        /// <summary>
+        /// json内容
+        /// </summary>
+        public string JsonContent { get; set; }
+        /// <summary>
         /// 时间
         /// </summary>
         public DateTime? CreatedTime { get; set; }
@@ -126,7 +142,14 @@ namespace GxPress.Result.Comment
         /// </summary>
         public string Content { get; set; }
 
-
+        /// <summary>
+        /// HTML内容
+        /// </summary>
+        public string HtmlContent { get; set; }
+        /// <summary>
+        /// json内容
+        /// </summary>
+        public string JsonContent { get; set; }
         /// <summary>
         /// 状态 文章100,话题2,收藏3,笔记4,通知5,站内信6,小组7,收藏文件夹12,笔记文件夹13,工作流审批14,文件300,图片301,会议纪要8,会议详情500,财务报表601,人事报表602,出版报表603,书籍20,课程30,音频40,期刊50,视频60,名栏90,公众号110,刊期120
         /// </summary>

+ 5 - 0
gx_api/GxPress/Model/GxPress.Result/User/UserResult.cs

@@ -68,6 +68,11 @@ namespace GxPress.Result.User
         /// </summary>
         /// <value></value>
         public IEnumerable<UserInfoResult> FriendUsers { get; set; }
+        /// <summary>
+        /// 最近聊天用户
+        /// </summary>
+        /// <value></value>
+        public IEnumerable<UserInfoResult> LatelyChatUsers { get; set; }
     }
     /// <summary>
     /// 

+ 8 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/CommentRepository.cs

@@ -62,7 +62,9 @@ namespace GxPress.Repository.Implement
                 UserId = request.UserId,
                 Pid = request.Pid,
                 TypeValue = request.TypeValue,
-                Score = request.Score
+                Score = request.Score,
+                JsonContent = request.JsonContent,
+                HtmlContent = request.HtmlContent
             };
             //是否被回复
             if (request.Pid > 0)
@@ -158,6 +160,8 @@ namespace GxPress.Repository.Implement
                     CreatedTime = item.CreatedDate,
                     LaudCount = await LaudCommentAsync(item.Id),
                     UserId = item.UserId,
+                    JsonContent = item.JsonContent,
+                    HtmlContent = item.HtmlContent,
                     //是否点赞
                     IsLaud = await IsLaudCommentAsync(item.Id, item.UserId),
                     Score = item.Score
@@ -216,7 +220,9 @@ namespace GxPress.Repository.Implement
                 {
                     Id = item.Id,
                     Content = item.Content,
-                    CreatedTime = item.CreatedDate
+                    CreatedTime = item.CreatedDate,
+                    JsonContent = item.JsonContent,
+                    HtmlContent = item.HtmlContent
                 };
                 var user = await _userRepository.GetAsync(item.UserId);
                 if (user == null)

+ 9 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/OftenContactRepository.cs

@@ -272,6 +272,15 @@ namespace GxPress.Repository.Implement
         {
             return await _repository.GetAllAsync(query);
         }
+        /// <summary>
+        /// 根据用户ID获取最近聊天用户
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<int>> GetAllAsync(int userId)
+        {
+            return await _repository.GetAllAsync<int>(Q.Select(nameof(OftenContact.ContactUserId)).Where(nameof(OftenContact.UserId), userId).Where(nameof(OftenContact.ChatType), 1));
+        }
         public async Task<IEnumerable<OftenContactInfo>> GetContactInfosAsync(OftenContactSearchRequest request)
         {
             var sql =

+ 17 - 3
gx_api/GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -976,9 +976,23 @@ namespace GxPress.Repository.Implement
         /// </summary>
         /// <param name="userIds"></param>
         /// <returns></returns>
-        public async Task<IEnumerable<UserInfoResult>> GetUserInfoResultsAsync(IEnumerable<int> userIds)
+        public async Task<IEnumerable<UserInfoResult>> GetUserInfoResultsAsync(IEnumerable<int> userIds, string keyWord = "")
         {
-            return await _repository.GetAllAsync<UserInfoResult>(Q.WhereIn(nameof(User.Id), userIds));
+            userIds = userIds.Distinct();
+            var sqlStr = "";
+            foreach (var item in userIds)
+                sqlStr += $"{item},";
+            sqlStr = sqlStr.Remove(sqlStr.Length - 1, 1);
+            var sql = $@"select * from tede_user where id  in({sqlStr})";
+            if (!string.IsNullOrEmpty(keyWord))
+                sql += $@" and (Name like '%{keyWord}%' or phone like '%{keyWord}%' or Email like '%{keyWord}%')";
+            var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
+            var database = new Database(databaseType, _connectionString);
+            var connection = database.GetConnection();
+            var result = await connection.QueryAsync<UserInfoResult>(sql);
+            foreach (var item in result)
+                item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
+            return result;
         }
         /// <summary>
         /// 获取不是好友的用户 排除部门
@@ -1026,6 +1040,6 @@ namespace GxPress.Repository.Implement
             return result;
         }
 
-       
+
     }
 }

+ 6 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/IOftenContactRepository.cs

@@ -94,5 +94,11 @@ namespace GxPress.Repository.Interface
         Task<List<JobChatResult>> ElasticSearchChat();
 
         Task<IEnumerable<OftenContactInfo>> GetContactInfoAllAsync(OftenContactSearchRequest request);
+         /// <summary>
+        /// 根据用户ID获取最近聊天用户
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <returns></returns>
+        Task<IEnumerable<int>> GetAllAsync(int userId);
     }
 }

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Interface/IUserRepository.cs

@@ -248,7 +248,7 @@ namespace GxPress.Repository.Interface
         /// </summary>
         /// <param name="userIds"></param>
         /// <returns></returns>
-        Task<IEnumerable<UserInfoResult>> GetUserInfoResultsAsync(IEnumerable<int> userIds);
+        Task<IEnumerable<UserInfoResult>> GetUserInfoResultsAsync(IEnumerable<int> userIds,string keyWord="");
         /// <summary>
         /// 获取不是好友的用户 排除部门
         /// </summary>

文件差异内容过多而无法显示
+ 44 - 12
gx_api/GxPress/Service/GxPress.Service.Implement/UserService.cs


+ 9 - 2
gx_api/GxPress/Service/GxPress.Service.Interface/IUserService.cs

@@ -83,13 +83,20 @@ namespace GxPress.Service.Interface
         /// <param name="departentId"></param>
         /// <returns></returns>
         Task<IEnumerable<UserInfoResult>> GetUserInfoByDepartentResult(int departentId);
-         /// <summary>
+        /// <summary>
         /// 获取群聊和小组的用户
         /// </summary>
         /// <param name="typeValue"></param>
         /// <param name="id"></param>
         /// <param name="keyword"></param>
         /// <returns></returns>
-         Task<IEnumerable<UserInfoResult>> GetGroupOrGroupChatUserInfosResult(UserInfoByGroupoRoGroupChatResult request);
+        Task<IEnumerable<UserInfoResult>> GetGroupOrGroupChatUserInfosResult(UserInfoByGroupoRoGroupChatResult request);
+        /// <summary>
+        /// 获取好友列表
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <param name="keyWord"></param>
+        /// <returns></returns>
+        Task<IEnumerable<UserInfoResult>> GetFriendUserInfoResult(int userId, string keyWord);
     }
 }