|
@@ -173,7 +173,7 @@ namespace GxPress.Repository.Implement
|
|
|
if (groupChat == null)
|
|
|
return false;
|
|
|
//添加用户
|
|
|
-
|
|
|
+
|
|
|
foreach (var user in request.Users)
|
|
|
{
|
|
|
if (user.Id == groupChat.UserId)
|
|
@@ -432,5 +432,25 @@ namespace GxPress.Repository.Implement
|
|
|
return await _repository.UpdateAsync(Q.Set(nameof(groupChat.IsOpenQrCoder), !groupChat.IsOpenQrCoder)
|
|
|
.Where(nameof(groupChat.Id), groupChat.Id)) > 0;
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 获取用户加入的群
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="userId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<IEnumerable<GroupChat>> GetGroupChatsAsync(int userId)
|
|
|
+ {
|
|
|
+ string sql = $@"SELECT * FROM ccpph_tede.tede_group_chat where id in(
|
|
|
+ select GroupChatId from tede_group_chat_user where UserId={userId}) order by CreatedDate desc";
|
|
|
+ var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
+ var database = new Database(databaseType, _connectionString);
|
|
|
+ var connection = database.GetConnection();
|
|
|
+ var result = await connection.QueryAsync<GroupChat>(sql);
|
|
|
+ foreach (var item in result)
|
|
|
+ {
|
|
|
+ item.QRCoder = StringUtils.AddDomain(item.QRCoder);
|
|
|
+ item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
}
|