dev #5

Merged
lan merged 38 commits from dev into master 2026-03-25 20:54:10 +08:00
Showing only changes of commit cee120a6f8 - Show all commits

View File

@@ -53,10 +53,13 @@ interface PostApiResponse {
* API帖子列表响应类型 * API帖子列表响应类型
*/ */
interface PostsListApiResponse { interface PostsListApiResponse {
posts: PostApiResponse[]; list: PostApiResponse[];
has_more: boolean; has_more?: boolean;
next_cursor?: string; next_cursor?: string;
total?: number; total?: number;
page?: number;
page_size?: number;
total_pages?: number;
} }
/** /**
@@ -242,7 +245,7 @@ export class PostRepository implements IPostRepository {
const response = await this.api.get<PostsListApiResponse>('/posts', queryParams); const response = await this.api.get<PostsListApiResponse>('/posts', queryParams);
const posts = response.posts.map(p => this.mapToPost(p)); const posts = (response.list || []).map(p => this.mapToPost(p));
// 缓存帖子 // 缓存帖子
posts.forEach(post => { posts.forEach(post => {
@@ -252,7 +255,7 @@ export class PostRepository implements IPostRepository {
return { return {
posts, posts,
hasMore: response.has_more, hasMore: response.has_more ?? false,
nextCursor: response.next_cursor, nextCursor: response.next_cursor,
total: response.total, total: response.total,
}; };
@@ -315,7 +318,7 @@ export class PostRepository implements IPostRepository {
const response = await this.api.get<PostsListApiResponse>(`/users/${userId}/posts`, queryParams); const response = await this.api.get<PostsListApiResponse>(`/users/${userId}/posts`, queryParams);
const posts = response.posts.map(p => this.mapToPost(p)); const posts = (response.list || []).map(p => this.mapToPost(p));
// 缓存帖子 // 缓存帖子
posts.forEach(post => { posts.forEach(post => {
@@ -325,7 +328,7 @@ export class PostRepository implements IPostRepository {
return { return {
posts, posts,
hasMore: response.has_more, hasMore: response.has_more ?? false,
nextCursor: response.next_cursor, nextCursor: response.next_cursor,
total: response.total, total: response.total,
}; };
@@ -350,7 +353,7 @@ export class PostRepository implements IPostRepository {
const response = await this.api.get<PostsListApiResponse>('/posts/search', queryParams); const response = await this.api.get<PostsListApiResponse>('/posts/search', queryParams);
const posts = response.posts.map(p => this.mapToPost(p)); const posts = (response.list || []).map(p => this.mapToPost(p));
// 缓存帖子 // 缓存帖子
posts.forEach(post => { posts.forEach(post => {
@@ -360,7 +363,7 @@ export class PostRepository implements IPostRepository {
return { return {
posts, posts,
hasMore: response.has_more, hasMore: response.has_more ?? false,
nextCursor: response.next_cursor, nextCursor: response.next_cursor,
total: response.total, total: response.total,
}; };