创作中心模块包含首页展示、个人中心、帖子审核。

“首页展示”支持广告轮播展示、推广帖子优先展示、分页显示所有帖子、导航栏便捷标签筛选帖子、全局标题模糊搜索帖子、点击帖子“查看更多”进入帖子详情页。帖子详情页展示帖子封面图片、作者时间、详细内容(可以插入种子链接对种子进行介绍与推广)等基本信息、对帖子点赞收藏举报评论回复、查看相关推荐帖子。相关推荐会推荐当前帖子作者的其他帖子(最多推荐5篇),还会推荐具有相似标签的其他帖子,两者总共最多推荐9篇帖子。

“个人中心”包含“我的中心”和“我的收藏”。
“我的中心”中可以管理已经成功发布的帖子(编辑、删除帖子),还可以发布新帖子。发布新帖子时除了填写帖子基本信息以外,帖子标签支持下拉多项选择,用户还可以选择帖子推广项目并进行支付。设置了多种推广项目,包含广告轮播推广、帖子置顶展示、限时优先展示、分类页首条展示。系统后台执行自动定时任务,每小时对帖子的推广时效性进行检查,如超出推广时限,则取消帖子的推广显示特权。用户点击发布帖子后帖子处于待审核状态,需要管理员审核通过才能正常发布在首页展示页面。编辑帖子时用户可以追加帖子推广,但如果帖子处于推广状态,则禁止修改推广项目。
“我的收藏”中可以便捷查看所有已收藏的帖子。

“帖子审核”包含“帖子发布管理”和“帖子举报管理”。“帖子审核”板块具有权限管理,只有管理员界面能够进入。
“帖子发布管理”对所有待审核帖子进行处理,支持预览待审核帖子详细内容,批准通过和拒绝通过选项。
“帖子举报管理”对所有用户的举报请求进行人工审核,如果举报内容属实,则将帖子下架处理,如果举报内容不属实,驳回举报请求。所有举报请求的处理结果均留存显示,方便后续再次审查。

Change-Id: If822351183e9d55a5a56ff5cf1e13b313fdbe231
diff --git a/src/services/post/index.ts b/src/services/post/index.ts
new file mode 100644
index 0000000..3452095
--- /dev/null
+++ b/src/services/post/index.ts
@@ -0,0 +1,262 @@
+import { request } from '@umijs/max';
+
+export interface PostListParams {
+  pageNum?: number;
+  pageSize?: number;
+  title?: string;
+  status?: string;
+  tags?: string;
+}
+
+export interface PostDetailResponse {
+  post: API.Post.PostInfo;
+  tags: API.Post.PostTag[];
+  comments: any[];
+  authorPosts: API.Post.PostInfo[];
+  similarPosts: API.Post.PostInfo[];
+  recommendedPosts: API.Post.PostInfo[];
+  favorited: boolean;
+}
+
+export interface CommentAddParams {
+  postId: number;
+  content: string;
+  parentId?: number;
+}
+
+// 获取帖子列表
+export async function getPostList(params: PostListParams) {
+    console.log('getPostList', params);    
+  return request<API.TableDataInfo>('/api/post-center/list', {
+    method: 'GET',
+    params,
+  });
+}
+
+// 获取帖子详情
+export async function getPostDetail(postId: number) {
+    console.log('getPostDetail', postId);
+  return request<API.AjaxResult<PostDetailResponse>>(`/api/post-center/${postId}`, {
+    method: 'GET',
+  });
+}
+
+// 添加评论
+export async function addComment(data: CommentAddParams) {
+    console.log('addComment', data);
+  return request<API.AjaxResult>('/api/post-center/comment', {
+    method: 'POST',
+    data,
+  });
+}
+
+// 收藏/取消收藏帖子
+export async function toggleFavorite(postId: number, favorite: boolean) {
+    console.log('toggleFavorite', postId, favorite);
+  return request<API.AjaxResult>(`/api/post-center/favorite/${postId}`, {
+    method: 'POST',
+    params: { favorite },
+  });
+}
+
+// 获取热门标签
+export async function getHotTags(): Promise<API.AjaxResult<API.Post.PostTag[]>> {
+  return request('/api/post-center/tags/hot', {
+    method: 'GET',
+  });
+}
+
+// 根据标签获取帖子
+export async function getPostsByTag(tagId: number) {
+    console.log('getPostsByTag', tagId);
+  return request<API.TableDataInfo>(`/api/post-center/bytag/${tagId}`, {
+    method: 'GET',
+  });
+}
+
+// 发布帖子
+export async function publishPost(data: {
+  title: string;
+  content: string;
+  summary: string;
+  tags: string;
+  promotionPlan?: number;
+}): Promise<API.AjaxResult> {
+  return request('/api/post-center/publish', {
+    method: 'POST',
+    data,
+  });
+}
+
+// 获取我的帖子列表
+export async function getMyPosts(params: {
+  pageNum?: number;
+  pageSize?: number;
+}): Promise<API.TableDataInfo<API.Post.PostInfo>> {
+  return request('/api/post-center/my-posts', {
+    method: 'GET',
+    params,
+  });
+}
+
+// 获取我的收藏列表
+export async function getMyFavorites(params: {
+  pageNum?: number;
+  pageSize?: number;
+}): Promise<API.TableDataInfo<API.Post.PostInfo>> {
+  return request('/api/post-center/my-favorites', {
+    method: 'GET',
+    params,
+  });
+}
+
+// 更新帖子
+export async function updatePost(data: API.Post.PostInfo): Promise<API.AjaxResult> {
+  return request('/api/post-center/update', {
+    method: 'PUT',
+    data,
+  });
+}
+
+// 删除帖子
+export async function deletePost(postId: number): Promise<API.AjaxResult> {
+  return request(`/api/post-center/delete/${postId}`, {
+    method: 'DELETE',
+  });
+}
+
+// 获取可用标签列表(用于下拉选择)
+export async function getAvailableTags(): Promise<API.AjaxResult<API.Post.PostTag[]>> {
+  return request('/api/post-center/tags/available', {
+    method: 'GET',
+  });
+}
+
+// 上传图片
+export async function uploadImage(file: FormData): Promise<API.AjaxResult<{url: string}>> {
+  return request('/api/post-center/upload', {
+    method: 'POST',
+    data: file,
+  });
+} 
+
+// 删除图片
+export async function deleteImage(filename: string): Promise<API.AjaxResult> {
+  return request('/api/post-center/upload', {
+    method: 'DELETE',
+    params: { filename },
+  });
+}
+
+// 获取推广计划列表
+export async function getPromotionPlans(): Promise<API.AjaxResult<any[]>> {
+  return request('/api/post-center/promotion-plans', {
+    method: 'GET',
+  });
+}
+
+// 创建支付记录
+export async function createPayment(data: {
+  postId: number;
+  planId: number;
+  amount: number;
+}): Promise<API.AjaxResult> {
+  return request('/api/post-center/payment', {
+    method: 'POST',
+    data,
+  });
+}
+
+// 点赞/取消点赞帖子
+export async function toggleLike(postId: number, like: boolean) {
+  console.log('toggleLike', postId, like);
+  return request<API.AjaxResult>(`/api/post-center/like/${postId}`, {
+    method: 'POST',
+    params: { like },
+  });
+}
+
+// 获取推广帖子列表(用于轮播展示)
+export async function getPromotionPosts(): Promise<API.AjaxResult<API.Post.PostInfo[]>> {
+  return request('/api/post-center/promotion', {
+    method: 'GET',
+  });
+}
+
+// 点赞/取消点赞评论
+export async function toggleCommentLike(commentId: number, like: boolean) {
+  console.log('toggleCommentLike', commentId, like);
+  return request<API.AjaxResult>(`/api/post-center/comment/like/${commentId}`, {
+    method: 'POST',
+    params: { like },
+  });
+}
+
+// 获取待审核帖子列表
+export async function getReviewPosts(params: PostListParams): Promise<API.TableDataInfo<API.Post.PostInfo>> {
+  return request('/api/post/review/list', {
+    method: 'GET',
+    params,
+  });
+}
+
+// 审核帖子(通过/拒绝)
+export async function reviewPost(postId: number, action: 'approve' | 'reject', reason?: string): Promise<API.AjaxResult> {
+  return request(`/api/post/review/${postId}`, {
+    method: 'PUT',
+    data: { action, reason },
+  });
+}
+
+// 强制下架帖子
+export async function takeDownPost(postId: number, reason?: string): Promise<API.AjaxResult> {
+  return request(`/api/post/takedown/${postId}`, {
+    method: 'PUT',
+    data: { reason },
+  });
+}
+
+// 检查帖子推广状态
+export async function getPromotionStatus(postId: number): Promise<API.AjaxResult> {
+  return request(`/api/post-center/promotion-status/${postId}`, {
+    method: 'GET',
+  });
+}
+
+// 确认支付成功
+export async function confirmPayment(paymentId: number): Promise<API.AjaxResult> {
+  return request(`/api/post-center/payment/confirm/${paymentId}`, {
+    method: 'POST',
+  });
+}
+
+// 取消支付
+export async function cancelPayment(paymentId: number): Promise<API.AjaxResult> {
+  return request(`/api/post-center/payment/cancel/${paymentId}`, {
+    method: 'POST',
+  });
+}
+
+// 举报帖子
+export async function reportPost(postId: number, reason: string): Promise<API.AjaxResult> {
+  return request(`/api/post-center/report/${postId}`, {
+    method: 'POST',
+    data: { reason },
+  });
+}
+
+// 获取举报列表
+export async function getReportList(params: PostListParams): Promise<API.TableDataInfo> {
+  return request('/api/post/report/list', {
+    method: 'GET',
+    params,
+  });
+}
+
+// 处理举报
+export async function handleReport(reportId: number, action: 'approve' | 'reject', postId: number, reason?: string): Promise<API.AjaxResult> {
+  return request(`/api/post/report/handle/${reportId}`, {
+    method: 'PUT',
+    data: { action, postId, reason },
+  });
+} 
\ No newline at end of file