209 lines
3.6 KiB
TypeScript
209 lines
3.6 KiB
TypeScript
import request from '@/utils/http'
|
|
|
|
/**
|
|
* 更新日志相关 API
|
|
*/
|
|
|
|
/**
|
|
* 获取更新日志列表
|
|
*/
|
|
export function fetchGetUpgradeLogs(params: { page?: number; pageSize?: number }) {
|
|
return request.get<{
|
|
list: Array<{
|
|
id: string
|
|
version: string
|
|
title: string
|
|
date: string
|
|
detail: string[]
|
|
requireReLogin: boolean
|
|
remark?: string
|
|
createAt: string
|
|
}>
|
|
total: number
|
|
page: number
|
|
pageSize: number
|
|
}>({
|
|
url: '/web/system/upgrade-logs',
|
|
params
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取所有更新日志(用于变更日志页面展示)
|
|
*/
|
|
export function fetchGetAllUpgradeLogs() {
|
|
return request.get<
|
|
Array<{
|
|
version: string
|
|
title: string
|
|
date: string
|
|
detail: string[]
|
|
requireReLogin: boolean
|
|
remark?: string
|
|
}>
|
|
>({
|
|
url: '/web/system/upgrade-logs/all'
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取最新一条更新日志(用于升级检测)
|
|
*/
|
|
export function fetchGetLatestUpgradeLog() {
|
|
return request.get<{
|
|
version: string
|
|
title: string
|
|
date: string
|
|
detail: string[]
|
|
requireReLogin: boolean
|
|
remark?: string
|
|
} | null>({
|
|
url: '/web/system/upgrade-logs/latest'
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 创建更新日志
|
|
*/
|
|
export function fetchCreateUpgradeLog(data: {
|
|
version: string
|
|
title: string
|
|
date: string
|
|
detail?: string
|
|
require_re_login?: boolean
|
|
remark?: string
|
|
}) {
|
|
return request.post<{ id: string }>({
|
|
url: '/web/system/upgrade-logs',
|
|
data
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 更新更新日志
|
|
*/
|
|
export function fetchUpdateUpgradeLog(
|
|
logId: string,
|
|
data: {
|
|
version?: string
|
|
title?: string
|
|
date?: string
|
|
detail?: string
|
|
require_re_login?: boolean
|
|
remark?: string
|
|
}
|
|
) {
|
|
return request.put<{ id: string }>({
|
|
url: `/web/system/upgrade-logs/${logId}`,
|
|
data
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 删除更新日志
|
|
*/
|
|
export function fetchDeleteUpgradeLog(logId: string) {
|
|
return request.delete<{ id: string }>({
|
|
url: `/web/system/upgrade-logs/${logId}`
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 评论相关 API
|
|
*/
|
|
|
|
/**
|
|
* 获取评论列表
|
|
*/
|
|
export function fetchGetComments(params: {
|
|
target_type?: string
|
|
target_id?: string
|
|
page?: number
|
|
pageSize?: number
|
|
}) {
|
|
return request.get<{
|
|
list: CommentItem[]
|
|
total: number
|
|
page: number
|
|
pageSize: number
|
|
}>({
|
|
url: '/web/system/comments',
|
|
params
|
|
})
|
|
}
|
|
|
|
export interface CommentItem {
|
|
id: string
|
|
parentId?: string
|
|
author: string
|
|
authorId?: string
|
|
content: string
|
|
targetType?: string
|
|
targetId?: string
|
|
timestamp: string
|
|
replies: CommentItem[]
|
|
}
|
|
|
|
/**
|
|
* 创建评论
|
|
*/
|
|
export function fetchCreateComment(data: {
|
|
author: string
|
|
content: string
|
|
parent_id?: string
|
|
author_id?: string
|
|
target_type?: string
|
|
target_id?: string
|
|
}) {
|
|
return request.post<CommentItem>({
|
|
url: '/web/system/comments',
|
|
data
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 删除评论
|
|
*/
|
|
export function fetchDeleteComment(commentId: string) {
|
|
return request.delete<{ id: string }>({
|
|
url: `/web/system/comments/${commentId}`
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 系统配置相关 API
|
|
*/
|
|
|
|
/**
|
|
* 获取中国地图GeoJSON数据
|
|
*/
|
|
export function fetchGetChinaMapData() {
|
|
return request.get<any>({
|
|
url: '/web/system/china-map'
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取系统配置
|
|
*/
|
|
export function fetchGetSystemConfig(configKey: string) {
|
|
return request.get<{
|
|
key: string
|
|
value: unknown
|
|
name: string
|
|
type: string
|
|
description?: string
|
|
} | null>({
|
|
url: `/web/system/config/${configKey}`
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取当前系统版本号
|
|
*/
|
|
export function fetchGetCurrentVersion() {
|
|
return request.get<{ version: string }>({
|
|
url: '/web/system/version'
|
|
})
|
|
}
|