国外MOSE官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

145 lines
3.5 KiB

import request from '@/utils/http/request';
import type { ApiResponse } from '@/utils/http/types';
// 定义PageParams接口
export interface PageParams {
pageNo?: number;
pageSize?: number;
}
// 社交媒体账号接口
export interface OfficialMediaItem {
id: string;
title: string;
description?: string;
image: string;
link: string;
createBy?: string;
createTime?: string;
updateBy?: string;
updateTime?: string;
}
// 论坛信息接口
export interface ForumItem {
id: string;
title: string;
content: string;
image?: string;
createBy?: string;
createTime?: string;
updateBy?: string;
updateTime?: string;
}
// 评论信息接口
export interface CommentItem {
id?: string;
content: string;
forumId: string;
createBy?: string;
createTime?: string;
updateBy?: string;
updateTime?: string;
}
// 信息公示接口
export interface MessageItem {
id: string;
title: string;
content: string;
image?: string;
createBy?: string;
createTime?: string;
updateBy?: string;
updateTime?: string;
}
// 社区信息接口
export interface CommunityItem {
id: string;
title: string;
content: string;
image?: string;
createBy?: string;
createTime?: string;
updateBy?: string;
updateTime?: string;
}
// 处理API响应
function handleResponse<T>(response: any): T[] {
if (!response) return [];
// 检查响应结构
if (response.result && response.result.records) {
return response.result.records as T[];
} else if (response.records) {
return response.records as T[];
} else if (Array.isArray(response.result)) {
return response.result as T[];
} else if (Array.isArray(response)) {
return response as T[];
}
return [];
}
/**
* 获取官方社交媒体列表
* @param params 查询参数
* @returns 官方社交媒体列表
*/
export function queryOfficialMediaList(params?: PageParams & Partial<OfficialMediaItem>) {
return request.get<any>('/mose-admin/mose/community/queryOfficialMediaList', params)
.then(response => handleResponse<OfficialMediaItem>(response));
}
/**
* 获取论坛信息列表
* @param params 查询参数
* @returns 论坛信息列表
*/
export function queryForumList(params?: PageParams & Partial<ForumItem>) {
return request.get<any>('/mose-admin/mose/community/queryForumList', params)
.then(response => handleResponse<ForumItem>(response));
}
/**
* 获取评论信息列表
* @param params 查询参数
* @returns 评论信息列表
*/
export function queryCommentsList(params?: PageParams & Partial<CommentItem>) {
return request.get<any>('/mose-admin/mose/community/queryCommentsList', params)
.then(response => handleResponse<CommentItem>(response));
}
/**
* 获取信息公示列表
* @param params 查询参数
* @returns 信息公示列表
*/
export function queryMessageList(params?: PageParams & Partial<MessageItem>) {
return request.get<any>('/mose-admin/mose/community/queryMessageList', params)
.then(response => handleResponse<MessageItem>(response));
}
/**
* 获取社区列表
* @param params 查询参数
* @returns 社区列表
*/
export function queryCommunityList(params?: PageParams & Partial<CommunityItem>) {
return request.get<any>('/mose-admin/mose/community/queryCommunityList', params)
.then(response => handleResponse<CommunityItem>(response));
}
/**
* 添加论坛留言
* @param params 留言参数
* @returns 添加结果
*/
export function addComments(params: Partial<CommentItem>) {
return request.get<any>('/mose-admin/mose/community/addComments', params);
}