/// <summary> /// 创建 <see cref="PeoplePage"/> /// </summary> /// <param name="userId">用户 ID</param> /// <param name="currentUserId">当前登录用户 ID</param> /// <param name="dbContext"><see cref="KeylolDbContext"/></param> /// <param name="cachedData"><see cref="CachedDataProvider"/></param> /// <returns><see cref="PeoplePage"/></returns> public static async Task <PeoplePage> CreateAsync(string userId, string currentUserId, KeylolDbContext dbContext, CachedDataProvider cachedData) { var friends = await UserEntryList.CreateAsync(userId, currentUserId, UserRelationship.Friend, true, 1, dbContext, cachedData); var subscribedUsers = await UserEntryList.CreateAsync(userId, currentUserId, UserRelationship.SubscribedUser, true, 1, dbContext, cachedData); var subscribers = await UserEntryList.CreateAsync(userId, currentUserId, UserRelationship.Subscriber, true, 1, dbContext, cachedData); return(new PeoplePage { FriendPageCount = friends.Item2, Friends = friends.Item1, SubscribedUserPageCount = subscribedUsers.Item2, SubscribedUsers = subscribedUsers.Item1, SubscriberPageCount = subscribers.Item2, Subscribers = subscribers.Item1 }); }
/// <summary> /// 获取用户听众列表 /// </summary> /// <param name="userId">用户 ID</param> /// <param name="page">分页页码</param> /// <param name="dbContext"><see cref="KeylolDbContext"/></param> /// <param name="cachedData"><see cref="CachedDataProvider"/></param> /// <returns><see cref="UserEntryList"/></returns> public static async Task <UserEntryList> GetSubscribers(string userId, int page, [Injected] KeylolDbContext dbContext, [Injected] CachedDataProvider cachedData) { return((await UserEntryList.CreateAsync(userId, StateTreeHelper.GetCurrentUserId(), UserRelationship.Subscriber, false, page, dbContext, cachedData)).Item1); }