hookehuyr

fix(api): 修复 OpenAPI 生成器识别 title 字段

修改内容:
- 修复 generateApiFromOpenAPI.js 同时支持 description 和 title 字段
- 更新 plan/add.md 文档格式(application/json,使用 title 字段)
- 重新生成 plan.js 和 user.js API 文件

影响:
- API 参数描述现在能正确显示中文名称(从 title 字段提取)
- 修正了参数类型(如 customer_age 从 string 改为 integer)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
......@@ -39,63 +39,83 @@ paths:
type: string
requestBody:
content:
application/x-www-form-urlencoded:
application/json:
schema:
type: object
properties:
customer_name:
description: 客户姓名
example: 冬一
type: string
title: 申请人
customer_gender:
description: 客户性别
example:
type: string
title: 性别
customer_age:
description: 客户年龄
example: '20'
type: integer
title: 年龄
customer_birthday:
type: string
title: 出生年月日
annual_premium:
description: 年缴保费
example: '5000'
type: string
type: integer
title: 保额
payment_years:
description: 缴费年限
example: '10'
type: string
title: 繳費年期
currency_type:
description: 币种
example: CNY
type: string
product_id:
description: 产品id
example: '2769884'
type: string
customer_birthday:
description: 出生年月日
example: ''
type: string
title: 币种
allow_reduce_amount:
description: 是否容许减少名义金额
example: ''
type: string
title: 是否容许减少名义金额
withdrawal_option:
description: 提取选项
example: ''
type: string
title: 提取选项
withdrawal_start_age:
description: 提取开始年龄
example: ''
type: string
type: integer
title: 提取开始年龄
withdrawal_period:
description: 提取期(年)
example: ''
type: integer
title: 提取期(年)
smoking_status:
type: string
title: 是否吸烟
total_premium:
description: 总保费金额
example: ''
type: string
examples: {}
type: integer
title: 总保费金额
product_id:
type: integer
title: 产品id
required:
- customer_name
- customer_gender
- customer_age
- customer_birthday
- annual_premium
- payment_years
- currency_type
- allow_reduce_amount
- withdrawal_option
- withdrawal_start_age
- withdrawal_period
- smoking_status
- total_premium
- product_id
x-apifox-orders:
- customer_name
- customer_gender
- customer_age
- annual_premium
- payment_years
- currency_type
- product_id
- customer_birthday
- allow_reduce_amount
- withdrawal_option
- withdrawal_start_age
- withdrawal_period
- smoking_status
- total_premium
example: "{\r\n customer_name: '张三',\r\n customer_gender: 'male',\r\n customer_age: 30,\r\n annual_premium: 5000,\r\n payment_years: '10年',\r\n currency_type: 'CNY',\r\n product_id: 1\r\n }"
responses:
'200':
description: ''
......
......@@ -313,7 +313,7 @@ function extractRequestParams(requestBody) {
params.push({
name: key,
type: value.type || 'any',
description: value.description || '',
description: value.description || value.title || '', // 同时支持 title 和 description
example: value.example || '',
required: content.schema.required?.includes(key) || false,
});
......
......@@ -9,19 +9,20 @@ const Api = {
* @description 新增计划书
* @remark
* @param {Object} params 请求参数
* @param {string} params.customer_name (可选) 客户姓名
* @param {string} params.customer_gender (可选) 客户性别
* @param {string} params.customer_age (可选) 客户年龄
* @param {string} params.annual_premium (可选) 年缴保费
* @param {string} params.payment_years (可选) 缴费年限
* @param {string} params.currency_type (可选) 币种
* @param {string} params.product_id (可选) 产品id
* @param {string} params.customer_birthday (可选) 出生年月日
* @param {string} params.allow_reduce_amount (可选) 是否容许减少名义金额
* @param {string} params.withdrawal_option (可选) 提取选项
* @param {string} params.withdrawal_start_age (可选) 提取开始年龄
* @param {string} params.withdrawal_period (可选) 提取期(年)
* @param {string} params.total_premium (可选) 总保费金额
* @param {string} params.customer_name 申请人
* @param {string} params.customer_gender 性别
* @param {integer} params.customer_age 年龄
* @param {string} params.customer_birthday 出生年月日
* @param {integer} params.annual_premium 保额
* @param {string} params.payment_years 繳費年期
* @param {string} params.currency_type 币种
* @param {string} params.allow_reduce_amount 是否容许减少名义金额
* @param {string} params.withdrawal_option 提取选项
* @param {integer} params.withdrawal_start_age 提取开始年龄
* @param {integer} params.withdrawal_period 提取期(年)
* @param {string} params.smoking_status 是否吸烟
* @param {integer} params.total_premium 总保费金额
* @param {integer} params.product_id 产品id
* @returns {Promise<{
* code: number; // 状态码
* msg: string; // 消息
......
......@@ -79,7 +79,7 @@ export const logoutAPI = (params) => fn(fetch.post(Api.Logout, params));
* @description 更新个人资料
* @remark
* @param {Object} params 请求参数
* @param {object} params.avatar
* @param {object} params.avatar 头像
* @returns {Promise<{
* code: number; // 状态码
* msg: string; // 消息
......