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.
1 +# 文章收藏列表
2 +
3 +## OpenAPI Specification
4 +
5 +```yaml
6 +openapi: 3.0.1
7 +info:
8 + title: ''
9 + version: 1.0.0
10 +paths:
11 + /srv/:
12 + get:
13 + summary: 文章收藏列表
14 + deprecated: false
15 + description: ''
16 + tags:
17 + - 文章
18 + parameters:
19 + - name: f
20 + in: query
21 + description: ''
22 + required: true
23 + example: manulife
24 + schema:
25 + type: string
26 + - name: a
27 + in: query
28 + description: ''
29 + required: true
30 + example: article
31 + schema:
32 + type: string
33 + - name: t
34 + in: query
35 + description: ''
36 + required: false
37 + example: favorite
38 + schema:
39 + type: string
40 + - name: limit
41 + in: query
42 + description: ''
43 + required: false
44 + example: '10'
45 + schema:
46 + type: string
47 + - name: page
48 + in: query
49 + description: ''
50 + required: false
51 + example: '0'
52 + schema:
53 + type: string
54 + - name: keyword
55 + in: query
56 + description: 搜索关键词
57 + required: false
58 + schema:
59 + type: string
60 + responses:
61 + '200':
62 + description: ''
63 + content:
64 + application/json:
65 + schema:
66 + type: object
67 + properties:
68 + code:
69 + type: integer
70 + msg:
71 + type: string
72 + data:
73 + type: object
74 + properties:
75 + list:
76 + type: array
77 + items:
78 + type: object
79 + properties:
80 + id:
81 + type: integer
82 + post_title:
83 + type: string
84 + title: 文章表头
85 + post_excerpt:
86 + type: string
87 + title: 简介
88 + post_link:
89 + type: string
90 + title: 外部链接
91 + post_date:
92 + type: string
93 + title: 发布时间
94 + favorite_time:
95 + type: string
96 + title: 收藏时间
97 + x-apifox-orders:
98 + - id
99 + - post_title
100 + - post_excerpt
101 + - post_link
102 + - post_date
103 + - favorite_time
104 + total:
105 + type: integer
106 + required:
107 + - list
108 + - total
109 + x-apifox-orders:
110 + - list
111 + - total
112 + required:
113 + - code
114 + - msg
115 + - data
116 + x-apifox-orders:
117 + - code
118 + - msg
119 + - data
120 + example:
121 + code: 1
122 + msg: 成功
123 + data:
124 + list:
125 + - id: 2742443
126 + post_title: 2025年8月闭关出关回顾 | 守住底线,不说他过
127 + post_excerpt: 一扇扇关房的门被轻轻推开,莲友们不畏末伏的酷热,迈着沉静的步伐排队从关房走向大雄宝殿,进行出关大回向。
128 + post_link: ''
129 + post_date: '2025-08-19 06:25:46'
130 + open_num: 47
131 + file_sn: null
132 + favorite_time: '2026-02-26 18:29:56.688486+08'
133 + total: 1
134 + headers: {}
135 + x-apifox-name: 成功
136 + x-apifox-ordering: 0
137 + security: []
138 + x-apifox-folder: 文章
139 + x-apifox-status: released
140 + x-run-in-apifox: https://app.apifox.com/web/project/7792797/apis/api-420078655-run
141 +components:
142 + schemas: {}
143 + responses: {}
144 + securitySchemes: {}
145 +servers:
146 + - url: https://manulife.onwall.cn
147 + description: 正式环境
148 +security: []
149 +
150 +```
This diff is collapsed. Click to expand it.
1 +# 热门文章
2 +
3 +## OpenAPI Specification
4 +
5 +```yaml
6 +openapi: 3.0.1
7 +info:
8 + title: ''
9 + version: 1.0.0
10 +paths:
11 + /srv/:
12 + get:
13 + summary: 热门文章
14 + deprecated: false
15 + description: ''
16 + tags:
17 + - 文章
18 + parameters:
19 + - name: f
20 + in: query
21 + description: ''
22 + required: true
23 + example: manulife
24 + schema:
25 + type: string
26 + - name: a
27 + in: query
28 + description: ''
29 + required: true
30 + example: article
31 + schema:
32 + type: string
33 + - name: t
34 + in: query
35 + description: ''
36 + required: false
37 + example: week_hot
38 + schema:
39 + type: string
40 + - name: limit
41 + in: query
42 + description: ''
43 + required: false
44 + example: '10'
45 + schema:
46 + type: string
47 + - name: page
48 + in: query
49 + description: ''
50 + required: false
51 + example: '0'
52 + schema:
53 + type: string
54 + - name: cid
55 + in: query
56 + description: 分类id
57 + required: false
58 + example: '2768724'
59 + schema:
60 + type: string
61 + - name: keyword
62 + in: query
63 + description: 搜索关键词
64 + required: false
65 + schema:
66 + type: string
67 + responses:
68 + '200':
69 + description: ''
70 + content:
71 + application/json:
72 + schema:
73 + type: object
74 + properties:
75 + code:
76 + type: integer
77 + msg:
78 + type: string
79 + data:
80 + type: object
81 + properties:
82 + list:
83 + type: array
84 + items:
85 + type: object
86 + properties:
87 + id:
88 + type: integer
89 + post_title:
90 + type: string
91 + title: 标题
92 + post_excerpt:
93 + type: 'null'
94 + title: 简介
95 + post_link:
96 + type: string
97 + title: 外部链接
98 + post_date:
99 + type: string
100 + title: 发布日期
101 + is_favorite:
102 + type: integer
103 + title: 是否收藏
104 + read_people_count:
105 + type: string
106 + title: 学习人数
107 + read_people_percent:
108 + type: string
109 + title: 学习人数比例
110 + x-apifox-orders:
111 + - id
112 + - post_title
113 + - post_excerpt
114 + - post_link
115 + - post_date
116 + - is_favorite
117 + - read_people_count
118 + - read_people_percent
119 + required:
120 + - read_people_count
121 + - read_people_percent
122 + total:
123 + type: integer
124 + required:
125 + - list
126 + - total
127 + x-apifox-orders:
128 + - list
129 + - total
130 + required:
131 + - code
132 + - msg
133 + - data
134 + x-apifox-orders:
135 + - code
136 + - msg
137 + - data
138 + example:
139 + code: 1
140 + msg: 成功
141 + data:
142 + list:
143 + - id: 2767726
144 + post_title: '东台弥陀寺2025年9月闭关报名公告 '
145 + post_excerpt: null
146 + post_link: ''
147 + post_date: '2025-09-01 20:35:42+08'
148 + open_num: 49
149 + is_favorite: 0
150 + total: 1
151 + headers: {}
152 + x-apifox-name: 成功
153 + x-apifox-ordering: 0
154 + security: []
155 + x-apifox-folder: 文章
156 + x-apifox-status: released
157 + x-run-in-apifox: https://app.apifox.com/web/project/7792797/apis/api-420251865-run
158 +components:
159 + schemas: {}
160 + responses: {}
161 + securitySchemes: {}
162 +servers:
163 + - url: https://manulife.onwall.cn
164 + description: 正式环境
165 +security: []
166 +
167 +```
...@@ -834,8 +834,8 @@ function compareAPIChanges(openAPIDir) { ...@@ -834,8 +834,8 @@ function compareAPIChanges(openAPIDir) {
834 } 834 }
835 835
836 // 执行生成 836 // 执行生成
837 -const openAPIDir = path.resolve(__dirname, '../docs/api-specs'); 837 +const openAPIDir = path.resolve(__dirname, '../../docs/api-specs');
838 -const outputDir = path.resolve(__dirname, '../src/api'); 838 +const outputDir = path.resolve(__dirname, '../../src/api');
839 839
840 console.log('=== OpenAPI 转 API 文档生成器 ===\n'); 840 console.log('=== OpenAPI 转 API 文档生成器 ===\n');
841 console.log(`输入目录: ${openAPIDir}`); 841 console.log(`输入目录: ${openAPIDir}`);
......
1 +import { fn, fetch } from '@/api/fn';
2 +
3 +const Api = {
4 + ArticleDetail: '/srv/?a=article&t=article_detail',
5 + Favorite: '/srv/?a=article&t=favorite',
6 + List: '/srv/?a=article&t=list',
7 + WeekHot: '/srv/?a=article&t=week_hot',
8 +}
9 +
10 +/**
11 + * @description 文章详情
12 + * @remark
13 + * @param {Object} params 请求参数
14 + * @param {string} params.i (可选)
15 + * @returns {Promise<{
16 + * code: number; // 状态码
17 + * msg: string; // 消息
18 + * data: {
19 + id: integer; // 文章id
20 + post_title: string; // 标题
21 + post_content: string; // 内容
22 + post_excerpt: string; // 简介
23 + post_link: string; // 外部链接
24 + post_date: string; // 发布日期
25 + post_author: integer; // 发布人id
26 + author_name: string; // 发布人
27 + file_list: {
28 + icon: {
29 + meta_type: string; //
30 + id: integer; //
31 + object_id: null; //
32 + name: string; //
33 + value: string; //
34 + description: null; //
35 + extension: string; //
36 + post_date: string; //
37 + icon: null; //
38 + master_client_id: null; //
39 + hash: string; //
40 + height: string; //
41 + width: string; //
42 + author: integer; //
43 + size: null; //
44 + };
45 + };
46 + is_favorite: integer; //
47 + * };
48 + * }>}
49 + */
50 +export const articleDetailAPI = (params) => fn(fetch.get(Api.ArticleDetail, params));
51 +
52 +/**
53 + * @description 文章收藏列表
54 + * @remark
55 + * @param {Object} params 请求参数
56 + * @param {string} params.limit (可选)
57 + * @param {string} params.page (可选)
58 + * @param {string} params.keyword (可选) 搜索关键词
59 + * @returns {Promise<{
60 + * code: number; // 状态码
61 + * msg: string; // 消息
62 + * data: {
63 + list: Array<{
64 + id: integer; //
65 + post_title: string; // 文章表头
66 + post_excerpt: string; // 简介
67 + post_link: string; // 外部链接
68 + post_date: string; // 发布时间
69 + favorite_time: string; // 收藏时间
70 + }>;
71 + total: integer; //
72 + * };
73 + * }>}
74 + */
75 +export const favoriteAPI = (params) => fn(fetch.get(Api.Favorite, params));
76 +
77 +/**
78 + * @description 文章列表
79 + * @remark
80 + * @param {Object} params 请求参数
81 + * @param {string} params.limit (可选)
82 + * @param {string} params.page (可选)
83 + * @param {string} params.cid (可选) 分类id
84 + * @param {string} params.child_id (可选) 只有一层分类时,筛选数据用
85 + * @param {string} params.keyword (可选) 搜索关键词
86 + * @returns {Promise<{
87 + * code: number; // 状态码
88 + * msg: string; // 消息
89 + * data: {
90 + cate: {
91 + id: integer; // 分类id
92 + category_name: string; // 分类名称
93 + category_parent: integer; // 分类父级
94 + category_description: null; // 分类描述
95 + };
96 + children: Array<{
97 + id: integer; // 二级分类id
98 + category_name: string; // 二级分类名
99 + category_parent: integer; // 二级分类名父级id
100 + level: integer; //
101 + category_description: null; // 二级分类描述
102 + icon: null; //
103 + max_depth: integer; //
104 + list: Array<{
105 + name: string; // 附件名称
106 + value: string; // 附件地址
107 + extension: string; // 后缀名
108 + post_date: string; // 发布时间
109 + size: string; // 附件大小
110 + is_favorite: integer; // 是否收藏
111 + id: string; // 附件id
112 + }>;
113 + children: Array<{
114 + id: integer; // 三级分类id
115 + category_name: string; // 三级分类名
116 + category_parent: integer; // 三级分类名父级id
117 + category_description: null; // 三级分类描述
118 + icon: string; // 二级分类图标
119 + }>;
120 + }>;
121 + list: Array<{
122 + id: integer; //
123 + post_title: string; // 标题
124 + post_excerpt: string; // 简介
125 + post_link: string; // 如果有就是去外部链接
126 + post_date: string; // 发布时间
127 + is_favorite: integer; // 是否收藏
128 + }>;
129 + total: integer; // 主分类文章数量
130 + max_level: integer; // 页面需要层级
131 + * };
132 + * }>}
133 + */
134 +export const listAPI = (params) => fn(fetch.get(Api.List, params));
135 +
136 +/**
137 + * @description 热门文章
138 + * @remark
139 + * @param {Object} params 请求参数
140 + * @param {string} params.limit (可选)
141 + * @param {string} params.page (可选)
142 + * @param {string} params.cid (可选) 分类id
143 + * @param {string} params.keyword (可选) 搜索关键词
144 + * @returns {Promise<{
145 + * code: number; // 状态码
146 + * msg: string; // 消息
147 + * data: {
148 + list: Array<{
149 + id: integer; //
150 + post_title: string; // 标题
151 + post_excerpt: null; // 简介
152 + post_link: string; // 外部链接
153 + post_date: string; // 发布日期
154 + is_favorite: integer; // 是否收藏
155 + read_people_count: string; // 学习人数
156 + read_people_percent: string; // 学习人数比例
157 + }>;
158 + total: integer; //
159 + * };
160 + * }>}
161 + */
162 +export const weekHotAPI = (params) => fn(fetch.get(Api.WeekHot, params));