fix article detail api

This commit is contained in:
Timi
2026-10-15 23:52:36 +08:00
parent 7fc24008cd
commit bfee2e6de6
4 changed files with 121 additions and 87 deletions
+7 -11
View File
@@ -2,24 +2,20 @@ import type { Article } from "../types";
import { axios } from "./BaseAPI";
export const ArticleAPI = {
/**
* 获取文章
*
* @param id 文章 ID
* @returns 文章数据
*/
async view(id: string): Promise<Article> {
return axios.get(`/article/${id}`);
async detail(id: string): Promise<Article> {
return axios.post(`/article/detail`, null, {
params: {
id
}
});
},
/**
* 喜欢文章,后端有限调用,1240ms 一次
*
* @param id 文章 ID
* @returns 最新喜欢数量
*/
async like(id: string): Promise<number> {
return axios.get(`/article/like/${id}`);
}
};
export default ArticleAPI;
+15 -3
View File
@@ -1,5 +1,13 @@
import { axios } from "./BaseAPI";
import type { CaptchaData, Notify, NotifyDetail, NotifyManagementItem, Page, PageResult } from "../types";
import type {
CaptchaData,
Notify,
NotifyDetail,
NotifyInternalCategory,
NotifyManagementItem,
Page,
PageResult
} from "../types";
const BASE_URI = "/notify/internal";
const MANAGEMENT_BASE_URI = "/notify/management";
@@ -49,9 +57,13 @@ export const NotifyAPI = {
},
/** 查询当前用户的站内通知。 */
async listInternal(page?: Page<NotifyDetail>, unreadOnly = false): Promise<PageResult<NotifyDetail>> {
async listInternal(
page?: Page<NotifyDetail>,
unreadOnly = false,
category?: NotifyInternalCategory
): Promise<PageResult<NotifyDetail>> {
return await axios.post(`${BASE_URI}/internal`, page, {
params: { unreadOnly }
params: { unreadOnly, category }
});
},
+3
View File
@@ -11,6 +11,9 @@ export type NotifyStatus = "WAITING" | "REMINDED" | "TIMEOUT" | "CANCEL" | "FAIL
/** 通知内容类型 */
export type NotifyContentType = "TEXT" | "TIP_TAP";
/** 站内通知分类。未传分类时查询全部通知。 */
export type NotifyInternalCategory = "SYSTEM" | "ORDER" | "FOLLOW_UP";
/** 通知 */
export type Notify = {
/** 业务类型 */