master
old易 2025-07-28 14:25:09 +08:00
parent 2554bf8441
commit bbdee9d7d7
2 changed files with 107 additions and 12 deletions

View File

@ -1333,6 +1333,7 @@
{
"method": "GET",
"path": "/api/nursing/hospital-companion/list",
"query": { "type": "1" },
"response": {
"code": 200,
"message": "ok",
@ -1374,20 +1375,10 @@
"image": "https://res.klyj.jinzejk.com/nursing/2h.png"
}
]
}, "swagger": {
},
"swagger": {
"summary": "获取住院陪护详情",
"description": "返回指定 ID 的住院陪护服务详情,包括服务名称、评分、价格、购买人数、图片等信息。",
"parameters": [
{
"name": "id",
"in": "query",
"required": true,
"schema": {
"type": "integer"
},
"description": "服务ID"
}
],
"responses": {
"200": {
"description": "返回住院陪护服务详情",
@ -1412,6 +1403,100 @@
}
}
},
{
"method": "GET",
"path": "/api/nursing/hospital-companion/list",
"query": { "type": "2" },
"response": {
"services": [
{
"id": "1",
"title": "住院陪护4小时",
"rating": 4.8,
"price": 120.0,
"unit": "起",
"purchasedCount": 73,
"image": "https://res.klyj.jinzejk.com/nursing/hospital1.png"
},
{
"id": "2",
"title": "住院陪护8小时",
"rating": 4.8,
"price": 230.0,
"unit": "起",
"purchasedCount": 73,
"image": "https://res.klyj.jinzejk.com/nursing/hospital2.png"
}
]
}
},
{
"method": "GET",
"path": "/api/nursing/hospital-companion/list",
"query": {
"type": "3"
},
"response": {
"list": [
{
"id": 1,
"title": "上门助浴2人",
"cover": "https://res.klyj.jinzejk.com/nursing/bathing/2.png",
"rating": 4.8,
"price": 120,
"unit": "起",
"purchasedCount": 73
},
{
"id": 2,
"title": "上门助浴4人",
"image": "https://res.klyj.jinzejk.com/nursing/bathing/4.png",
"rating": 4.8,
"price": 230,
"unit": "起",
"purchasedCount": 73
}
]
}
},
{
"method": "GET",
"path": "/api/nursing/hospital-companion/list",
"query": {
"type": "4"
},
"response": {
"list": [
{
"id": 1,
"title": "4小时陪诊",
"image": "https://res.klyj.jinzejk.com/nursing/4h.png",
"rating": 4.8,
"price": 120,
"unit": "起",
"purchasedCount": 73
},
{
"id": 2,
"title": "8小时陪诊",
"image": "https://res.klyj.jinzejk.com/nursing/8h.png",
"rating": 4.8,
"price": 230,
"unit": "起",
"purchasedCount": 73
},
{
"id": 3,
"title": "12小时陪诊",
"image": "https://res.klyj.jinzejk.com/nursing/12h.png",
"rating": 4.8,
"price": 230,
"unit": "起",
"purchasedCount": 73
}
]
}
},
{
"method": "GET",
"path": "/api/service/detail",

View File

@ -42,6 +42,16 @@ function registerMockApi(config) {
return res.json(formatResponse(defaultConfig.response));
}
}
if (path === '/api/nursing/hospital-companion/list' && Object.keys(req.query).length === 0) {
const defaultConfig = global.mockConfigs.find(c =>
c.path === path && c.query?.type === 'home'
);
if (defaultConfig) {
console.log(`[MOCK] Fallback to default (home)`);
return res.json(formatResponse(defaultConfig.response));
}
}
// 精确 query 匹配
if (query) {