@@ -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);
+ }
@@ -21,6 +21,14 @@ namespace GxPress.Entity
/// </summary>
[DataColumn] public string Content { get; set; }
/// <summary>
+ /// 内容
+ [DataColumn] public string HtmlContent { get; set; }
+ [DataColumn] public string JsonContent { get; set; }
/// 点赞次数
[DataColumn] public int Laud { get; set; }
@@ -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
/// <value></value>
- public int TypeValue{get;set;}
+ public int TypeValue { get; set; }
- /// <summary>
/// 评分
public decimal Score { get; set; }
+ /// HTML内容
+ public string HtmlContent { get; set; }
+ /// json内容
+ public string JsonContent { get; set; }
@@ -23,6 +23,14 @@ namespace GxPress.Result.Comment
public string Content { get; set; }
/// 时间
public DateTime? CreatedTime { get; set; }
@@ -80,6 +88,14 @@ namespace GxPress.Result.Comment
@@ -126,7 +142,14 @@ namespace GxPress.Result.Comment
-
@@ -68,6 +68,11 @@ namespace GxPress.Result.User
public IEnumerable<UserInfoResult> FriendUsers { get; set; }
+ /// 最近聊天用户
+ /// <value></value>
+ public IEnumerable<UserInfoResult> LatelyChatUsers { get; set; }
///
@@ -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,
+ HtmlContent = item.HtmlContent
var user = await _userRepository.GetAsync(item.UserId);
if (user == null)
@@ -272,6 +272,15 @@ namespace GxPress.Repository.Implement
return await _repository.GetAllAsync(query);
+ /// 根据用户ID获取最近聊天用户
+ 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 =
@@ -976,9 +976,23 @@ namespace GxPress.Repository.Implement
/// <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;
/// 获取不是好友的用户 排除部门
@@ -1026,6 +1040,6 @@ namespace GxPress.Repository.Implement
return result;
+
@@ -94,5 +94,11 @@ namespace GxPress.Repository.Interface
Task<List<JobChatResult>> ElasticSearchChat();
Task<IEnumerable<OftenContactInfo>> GetContactInfoAllAsync(OftenContactSearchRequest request);
+ Task<IEnumerable<int>> GetAllAsync(int userId);
@@ -248,7 +248,7 @@ namespace GxPress.Repository.Interface
- Task<IEnumerable<UserInfoResult>> GetUserInfoResultsAsync(IEnumerable<int> userIds);
+ Task<IEnumerable<UserInfoResult>> GetUserInfoResultsAsync(IEnumerable<int> userIds,string keyWord="");
@@ -83,13 +83,20 @@ namespace GxPress.Service.Interface
/// <param name="departentId"></param>
Task<IEnumerable<UserInfoResult>> GetUserInfoByDepartentResult(int departentId);
/// 获取群聊和小组的用户
/// <param name="typeValue"></param>
/// <param name="id"></param>
/// <param name="keyword"></param>
- Task<IEnumerable<UserInfoResult>> GetGroupOrGroupChatUserInfosResult(UserInfoByGroupoRoGroupChatResult request);
+ Task<IEnumerable<UserInfoResult>> GetGroupOrGroupChatUserInfosResult(UserInfoByGroupoRoGroupChatResult request);
+ Task<IEnumerable<UserInfoResult>> GetFriendUserInfoResult(int userId, string keyWord);