hookehuyr

fix(api): 修复 API 生成器路径配置错误

- 修复 openAPIDir 路径:../docs/api-specs → ../../docs/api-specs
- 修复 outputDir 路径:../src/api → ../../src/api
- 新增 article 模块 API(文章详情、收藏、列表、热门)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This diff is collapsed. Click to expand it.
# 文章收藏列表
## OpenAPI Specification
```yaml
openapi: 3.0.1
info:
title: ''
version: 1.0.0
paths:
/srv/:
get:
summary: 文章收藏列表
deprecated: false
description: ''
tags:
- 文章
parameters:
- name: f
in: query
description: ''
required: true
example: manulife
schema:
type: string
- name: a
in: query
description: ''
required: true
example: article
schema:
type: string
- name: t
in: query
description: ''
required: false
example: favorite
schema:
type: string
- name: limit
in: query
description: ''
required: false
example: '10'
schema:
type: string
- name: page
in: query
description: ''
required: false
example: '0'
schema:
type: string
- name: keyword
in: query
description: 搜索关键词
required: false
schema:
type: string
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
code:
type: integer
msg:
type: string
data:
type: object
properties:
list:
type: array
items:
type: object
properties:
id:
type: integer
post_title:
type: string
title: 文章表头
post_excerpt:
type: string
title: 简介
post_link:
type: string
title: 外部链接
post_date:
type: string
title: 发布时间
favorite_time:
type: string
title: 收藏时间
x-apifox-orders:
- id
- post_title
- post_excerpt
- post_link
- post_date
- favorite_time
total:
type: integer
required:
- list
- total
x-apifox-orders:
- list
- total
required:
- code
- msg
- data
x-apifox-orders:
- code
- msg
- data
example:
code: 1
msg: 成功
data:
list:
- id: 2742443
post_title: 2025年8月闭关出关回顾 | 守住底线,不说他过
post_excerpt: 一扇扇关房的门被轻轻推开,莲友们不畏末伏的酷热,迈着沉静的步伐排队从关房走向大雄宝殿,进行出关大回向。
post_link: ''
post_date: '2025-08-19 06:25:46'
open_num: 47
file_sn: null
favorite_time: '2026-02-26 18:29:56.688486+08'
total: 1
headers: {}
x-apifox-name: 成功
x-apifox-ordering: 0
security: []
x-apifox-folder: 文章
x-apifox-status: released
x-run-in-apifox: https://app.apifox.com/web/project/7792797/apis/api-420078655-run
components:
schemas: {}
responses: {}
securitySchemes: {}
servers:
- url: https://manulife.onwall.cn
description: 正式环境
security: []
```
This diff is collapsed. Click to expand it.
# 热门文章
## OpenAPI Specification
```yaml
openapi: 3.0.1
info:
title: ''
version: 1.0.0
paths:
/srv/:
get:
summary: 热门文章
deprecated: false
description: ''
tags:
- 文章
parameters:
- name: f
in: query
description: ''
required: true
example: manulife
schema:
type: string
- name: a
in: query
description: ''
required: true
example: article
schema:
type: string
- name: t
in: query
description: ''
required: false
example: week_hot
schema:
type: string
- name: limit
in: query
description: ''
required: false
example: '10'
schema:
type: string
- name: page
in: query
description: ''
required: false
example: '0'
schema:
type: string
- name: cid
in: query
description: 分类id
required: false
example: '2768724'
schema:
type: string
- name: keyword
in: query
description: 搜索关键词
required: false
schema:
type: string
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
code:
type: integer
msg:
type: string
data:
type: object
properties:
list:
type: array
items:
type: object
properties:
id:
type: integer
post_title:
type: string
title: 标题
post_excerpt:
type: 'null'
title: 简介
post_link:
type: string
title: 外部链接
post_date:
type: string
title: 发布日期
is_favorite:
type: integer
title: 是否收藏
read_people_count:
type: string
title: 学习人数
read_people_percent:
type: string
title: 学习人数比例
x-apifox-orders:
- id
- post_title
- post_excerpt
- post_link
- post_date
- is_favorite
- read_people_count
- read_people_percent
required:
- read_people_count
- read_people_percent
total:
type: integer
required:
- list
- total
x-apifox-orders:
- list
- total
required:
- code
- msg
- data
x-apifox-orders:
- code
- msg
- data
example:
code: 1
msg: 成功
data:
list:
- id: 2767726
post_title: '东台弥陀寺2025年9月闭关报名公告 '
post_excerpt: null
post_link: ''
post_date: '2025-09-01 20:35:42+08'
open_num: 49
is_favorite: 0
total: 1
headers: {}
x-apifox-name: 成功
x-apifox-ordering: 0
security: []
x-apifox-folder: 文章
x-apifox-status: released
x-run-in-apifox: https://app.apifox.com/web/project/7792797/apis/api-420251865-run
components:
schemas: {}
responses: {}
securitySchemes: {}
servers:
- url: https://manulife.onwall.cn
description: 正式环境
security: []
```
......@@ -834,8 +834,8 @@ function compareAPIChanges(openAPIDir) {
}
// 执行生成
const openAPIDir = path.resolve(__dirname, '../docs/api-specs');
const outputDir = path.resolve(__dirname, '../src/api');
const openAPIDir = path.resolve(__dirname, '../../docs/api-specs');
const outputDir = path.resolve(__dirname, '../../src/api');
console.log('=== OpenAPI 转 API 文档生成器 ===\n');
console.log(`输入目录: ${openAPIDir}`);
......
import { fn, fetch } from '@/api/fn';
const Api = {
ArticleDetail: '/srv/?a=article&t=article_detail',
Favorite: '/srv/?a=article&t=favorite',
List: '/srv/?a=article&t=list',
WeekHot: '/srv/?a=article&t=week_hot',
}
/**
* @description 文章详情
* @remark
* @param {Object} params 请求参数
* @param {string} params.i (可选)
* @returns {Promise<{
* code: number; // 状态码
* msg: string; // 消息
* data: {
id: integer; // 文章id
post_title: string; // 标题
post_content: string; // 内容
post_excerpt: string; // 简介
post_link: string; // 外部链接
post_date: string; // 发布日期
post_author: integer; // 发布人id
author_name: string; // 发布人
file_list: {
icon: {
meta_type: string; //
id: integer; //
object_id: null; //
name: string; //
value: string; //
description: null; //
extension: string; //
post_date: string; //
icon: null; //
master_client_id: null; //
hash: string; //
height: string; //
width: string; //
author: integer; //
size: null; //
};
};
is_favorite: integer; //
* };
* }>}
*/
export const articleDetailAPI = (params) => fn(fetch.get(Api.ArticleDetail, params));
/**
* @description 文章收藏列表
* @remark
* @param {Object} params 请求参数
* @param {string} params.limit (可选)
* @param {string} params.page (可选)
* @param {string} params.keyword (可选) 搜索关键词
* @returns {Promise<{
* code: number; // 状态码
* msg: string; // 消息
* data: {
list: Array<{
id: integer; //
post_title: string; // 文章表头
post_excerpt: string; // 简介
post_link: string; // 外部链接
post_date: string; // 发布时间
favorite_time: string; // 收藏时间
}>;
total: integer; //
* };
* }>}
*/
export const favoriteAPI = (params) => fn(fetch.get(Api.Favorite, params));
/**
* @description 文章列表
* @remark
* @param {Object} params 请求参数
* @param {string} params.limit (可选)
* @param {string} params.page (可选)
* @param {string} params.cid (可选) 分类id
* @param {string} params.child_id (可选) 只有一层分类时,筛选数据用
* @param {string} params.keyword (可选) 搜索关键词
* @returns {Promise<{
* code: number; // 状态码
* msg: string; // 消息
* data: {
cate: {
id: integer; // 分类id
category_name: string; // 分类名称
category_parent: integer; // 分类父级
category_description: null; // 分类描述
};
children: Array<{
id: integer; // 二级分类id
category_name: string; // 二级分类名
category_parent: integer; // 二级分类名父级id
level: integer; //
category_description: null; // 二级分类描述
icon: null; //
max_depth: integer; //
list: Array<{
name: string; // 附件名称
value: string; // 附件地址
extension: string; // 后缀名
post_date: string; // 发布时间
size: string; // 附件大小
is_favorite: integer; // 是否收藏
id: string; // 附件id
}>;
children: Array<{
id: integer; // 三级分类id
category_name: string; // 三级分类名
category_parent: integer; // 三级分类名父级id
category_description: null; // 三级分类描述
icon: string; // 二级分类图标
}>;
}>;
list: Array<{
id: integer; //
post_title: string; // 标题
post_excerpt: string; // 简介
post_link: string; // 如果有就是去外部链接
post_date: string; // 发布时间
is_favorite: integer; // 是否收藏
}>;
total: integer; // 主分类文章数量
max_level: integer; // 页面需要层级
* };
* }>}
*/
export const listAPI = (params) => fn(fetch.get(Api.List, params));
/**
* @description 热门文章
* @remark
* @param {Object} params 请求参数
* @param {string} params.limit (可选)
* @param {string} params.page (可选)
* @param {string} params.cid (可选) 分类id
* @param {string} params.keyword (可选) 搜索关键词
* @returns {Promise<{
* code: number; // 状态码
* msg: string; // 消息
* data: {
list: Array<{
id: integer; //
post_title: string; // 标题
post_excerpt: null; // 简介
post_link: string; // 外部链接
post_date: string; // 发布日期
is_favorite: integer; // 是否收藏
read_people_count: string; // 学习人数
read_people_percent: string; // 学习人数比例
}>;
total: integer; //
* };
* }>}
*/
export const weekHotAPI = (params) => fn(fetch.get(Api.WeekHot, params));