add mock api

master
old易 2025-07-22 10:56:06 +08:00
parent cd5cd205bf
commit c737e0719a
5 changed files with 388 additions and 1 deletions

7
YI_LIUYANG Normal file
View File

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACA20GNyqm4LjDk1gVVnW1B8LnWw8pbZdDCwI+5wU4ishgAAAJDiZuP+4mbj
/gAAAAtzc2gtZWQyNTUxOQAAACA20GNyqm4LjDk1gVVnW1B8LnWw8pbZdDCwI+5wU4ishg
AAAECr8W4FkpVwEtReeKxc7PoSe3q089fPxreRPvGDI3+o9TbQY3KqbguMOTWBVWdbUHwu
dbDyltl0MLAj7nBTiKyGAAAACllJX0xJVVlBTkcBAgM=
-----END OPENSSH PRIVATE KEY-----

View File

@ -1076,9 +1076,207 @@
} }
} }
} }
},{
"method": "GET",
"path": "/api/travel/list",
"response": {
"code": 200,
"message": "ok",
"data": {
"banner": {
"title": "银发生活 从一场舒适的旅行开始",
"image": "https://res.klyj.jinzejk.com/travel/banner01.png"
},
"highlights": [
{ "title": "环境宜人", "subtitle": "精选康养目的地", "icon": "🌿" },
{ "title": "专业守护", "subtitle": "全程医护陪伴", "icon": "👩‍⚕️" },
{ "title": "节奏舒缓", "subtitle": "慢下来才更享受", "icon": "🧳" },
{ "title": "适老贴心", "subtitle": "服务细节全覆盖", "icon": "❤️" }
],
"categories": ["文化导向", "身心养护", "怀旧主题", "艺术体验"],
"products": [
{
"id": 1,
"title": "书香故里·曲阜三孔文化朝圣2日游",
"tags": ["中原文化", "历史爱好者"],
"image": "https://res.klyj.jinzejk.com/travel/product1.png",
"price": 120.00
},
{
"id": 2,
"title": "文化朝圣·齐鲁经典孔文化朝圣3日游",
"tags": ["中原文化", "历史爱好者"],
"image": "https://res.klyj.jinzejk.com/travel/product2.png",
"price": 540.00
},
{
"id": 3,
"title": "青岛经典海岸线2日游",
"tags": ["海滨旅行", "舒适休闲"],
"image": "https://res.klyj.jinzejk.com/travel/product3.png",
"price": 260.00
},
{
"id": 4,
"title": "欧风老街·青岛德式建筑文化游",
"tags": ["欧式建筑", "复古怀旧"],
"image": "https://res.klyj.jinzejk.com/travel/product4.png",
"price": 180.00
}
]
}
}
},
{
"method": "GET",
"path": "/api/nursing/hospital-companion/list",
"response": {
"code": 200,
"message": "ok",
"data": [
{
"id": 1,
"title": "住院夜间陪护8小时",
"rating": 4.8,
"price": 150.0,
"unit": "起",
"purchasedCount": 55,
"image": "https://res.klyj.jinzejk.com/nursing/8h.png"
},
{
"id": 2,
"title": "住院夜间陪护6小时",
"rating": 4.8,
"price": 120.0,
"unit": "起",
"purchasedCount": 42,
"image": "https://res.klyj.jinzejk.com/nursing/6h.png"
},
{
"id": 3,
"title": "住院陪护24小时",
"rating": 4.8,
"price": 680.0,
"unit": "起",
"purchasedCount": 36,
"image": "https://res.klyj.jinzejk.com/nursing/24h.png"
},
{
"id": 4,
"title": "住院陪护2小时",
"rating": 4.8,
"price": 120.0,
"unit": "起",
"purchasedCount": 100,
"image": "https://res.klyj.jinzejk.com/nursing/2h.png"
}
]
}, "swagger": {
"summary": "获取住院陪护详情",
"description": "返回指定 ID 的住院陪护服务详情,包括服务名称、评分、价格、购买人数、图片等信息。",
"parameters": [
{
"name": "id",
"in": "query",
"required": true,
"schema": {
"type": "integer"
},
"description": "服务ID"
}
],
"responses": {
"200": {
"description": "返回住院陪护服务详情",
"content": {
"application/json": {
"example": {
"code": 200,
"message": "ok",
"data": {
"id": 1,
"title": "住院夜间陪护8小时",
"rating": 4.8,
"price": 120.0,
"unit": "起",
"purchasedCount": 73,
"image": "https://res.klyj.jinzejk.com/images/nursing-8h.jpg"
}
}
}
}
}
}
}
},
{
"method": "GET",
"path": "/api/service/detail",
"response": {
"id": 101,
"title": "住院陪护服务",
"cover": "https://res.klyj.jinzejk.com/nursing/cover.png",
"price": 268.00,
"unit": "元/天",
"serviceTime": "08:00 - 18:00",
"serviceContent": "提供协助就医、喂饭、翻身拍背、换洗衣物等服务。",
"nurseType": "专业护理员",
"orgName": "锦泽康养中心",
"orgAddress": "北京市朝阳区阳光路 88 号",
"contactPhone": "400-123-4567",
"images": [
"https://res.klyj.jinzejk.com/nursing/service01.png",
"https://res.klyj.jinzejk.com/nursing/service02.png",
"https://res.klyj.jinzejk.com/nursing/service03.png",
"https://res.klyj.jinzejk.com/nursing/service04.png"
]
},
"swagger": {
"summary": "获取康养服务详情",
"description": "根据 ID 获取某项康养服务的详细信息,包括价格、时间、服务内容等。",
"parameters": [
{
"name": "id",
"in": "query",
"required": true,
"schema": {
"type": "integer"
},
"description": "服务ID"
}
],
"responses": {
"200": {
"description": "康养服务详情",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": { "type": "integer" },
"title": { "type": "string" },
"cover": { "type": "string" },
"price": { "type": "number" },
"unit": { "type": "string" },
"serviceTime": { "type": "string" },
"serviceContent": { "type": "string" },
"nurseType": { "type": "string" },
"orgName": { "type": "string" },
"orgAddress": { "type": "string" },
"contactPhone": { "type": "string" },
"images": {
"type": "array",
"items": { "type": "string" }
}
}
}
}
}
}
}
}
} }
] ]

153
package-lock.json generated
View File

@ -15,6 +15,8 @@
"fs-extra": "^11.3.0", "fs-extra": "^11.3.0",
"lowdb": "^3.0.0", "lowdb": "^3.0.0",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"node-ssh": "^13.2.1",
"ssh2": "^1.16.0",
"swagger-jsdoc": "^6.2.8", "swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.1" "swagger-ui-express": "^5.0.1"
} }
@ -101,12 +103,30 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"license": "Python-2.0" "license": "Python-2.0"
}, },
"node_modules/asn1": {
"version": "0.2.6",
"resolved": "https://registry.npmmirror.com/asn1/-/asn1-0.2.6.tgz",
"integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
"license": "MIT",
"dependencies": {
"safer-buffer": "~2.1.0"
}
},
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
"license": "BSD-3-Clause",
"dependencies": {
"tweetnacl": "^0.14.3"
}
},
"node_modules/body-parser": { "node_modules/body-parser": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-2.2.0.tgz", "resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-2.2.0.tgz",
@ -137,6 +157,15 @@
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
"node_modules/buildcheck": {
"version": "0.0.6",
"resolved": "https://registry.npmmirror.com/buildcheck/-/buildcheck-0.0.6.tgz",
"integrity": "sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==",
"optional": true,
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/bytes": { "node_modules/bytes": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz", "resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz",
@ -250,6 +279,20 @@
"node": ">=6.6.0" "node": ">=6.6.0"
} }
}, },
"node_modules/cpu-features": {
"version": "0.0.10",
"resolved": "https://registry.npmmirror.com/cpu-features/-/cpu-features-0.0.10.tgz",
"integrity": "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA==",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"buildcheck": "~0.0.6",
"nan": "^2.19.0"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/dayjs": { "node_modules/dayjs": {
"version": "1.11.13", "version": "1.11.13",
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz", "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz",
@ -652,6 +695,18 @@
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/is-stream/-/is-stream-2.0.1.tgz",
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
"license": "MIT",
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/js-yaml": { "node_modules/js-yaml": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmmirror.com/js-yaml/-/js-yaml-4.1.0.tgz", "resolved": "https://registry.npmmirror.com/js-yaml/-/js-yaml-4.1.0.tgz",
@ -711,6 +766,21 @@
"url": "https://github.com/sponsors/typicode" "url": "https://github.com/sponsors/typicode"
} }
}, },
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmmirror.com/make-dir/-/make-dir-3.1.0.tgz",
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
"license": "MIT",
"dependencies": {
"semver": "^6.0.0"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/math-intrinsics": { "node_modules/math-intrinsics": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@ -791,6 +861,13 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/nan": {
"version": "2.23.0",
"resolved": "https://registry.npmmirror.com/nan/-/nan-2.23.0.tgz",
"integrity": "sha512-1UxuyYGdoQHcGg87Lkqm3FzefucTa0NAiOcuRsDmysep3c1LVCRK2krrUDafMWtjSG04htvAmvg96+SDknOmgQ==",
"license": "MIT",
"optional": true
},
"node_modules/negotiator": { "node_modules/negotiator": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-1.0.0.tgz",
@ -800,6 +877,23 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/node-ssh": {
"version": "13.2.1",
"resolved": "https://registry.npmmirror.com/node-ssh/-/node-ssh-13.2.1.tgz",
"integrity": "sha512-rfl4GWMygQfzlExPkQ2LWyya5n2jOBm5vhEnup+4mdw7tQhNpJWbP5ldr09Jfj93k5SfY5lxcn8od5qrQ/6mBg==",
"license": "MIT",
"dependencies": {
"is-stream": "^2.0.0",
"make-dir": "^3.1.0",
"sb-promise-queue": "^2.1.0",
"sb-scandir": "^3.1.0",
"shell-escape": "^0.2.0",
"ssh2": "^1.14.0"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/object-inspect": { "node_modules/object-inspect": {
"version": "1.13.4", "version": "1.13.4",
"resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz", "resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz",
@ -974,6 +1068,36 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/sb-promise-queue": {
"version": "2.1.1",
"resolved": "https://registry.npmmirror.com/sb-promise-queue/-/sb-promise-queue-2.1.1.tgz",
"integrity": "sha512-qXfdcJQMxMljxmPprn4Q4hl3pJmoljSCzUvvEBa9Kscewnv56n0KqrO6yWSrGLOL9E021wcGdPa39CHGKA6G0w==",
"license": "MIT",
"engines": {
"node": ">= 8"
}
},
"node_modules/sb-scandir": {
"version": "3.1.1",
"resolved": "https://registry.npmmirror.com/sb-scandir/-/sb-scandir-3.1.1.tgz",
"integrity": "sha512-Q5xiQMtoragW9z8YsVYTAZcew+cRzdVBefPbb9theaIKw6cBo34WonP9qOCTKgyAmn/Ch5gmtAxT/krUgMILpA==",
"license": "MIT",
"dependencies": {
"sb-promise-queue": "^2.1.0"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/send": { "node_modules/send": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmmirror.com/send/-/send-1.2.0.tgz", "resolved": "https://registry.npmmirror.com/send/-/send-1.2.0.tgz",
@ -1017,6 +1141,12 @@
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/shell-escape": {
"version": "0.2.0",
"resolved": "https://registry.npmmirror.com/shell-escape/-/shell-escape-0.2.0.tgz",
"integrity": "sha512-uRRBT2MfEOyxuECseCZd28jC1AJ8hmqqneWQ4VWUTgCAFvb3wKU1jLqj6egC4Exrr88ogg3dp+zroH4wJuaXzw==",
"license": "MIT"
},
"node_modules/side-channel": { "node_modules/side-channel": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.0.tgz",
@ -1089,6 +1219,23 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/ssh2": {
"version": "1.16.0",
"resolved": "https://registry.npmmirror.com/ssh2/-/ssh2-1.16.0.tgz",
"integrity": "sha512-r1X4KsBGedJqo7h8F5c4Ybpcr5RjyP+aWIG007uBPRjmdQWfEiVLzSK71Zji1B9sKxwaCvD8y8cwSkYrlLiRRg==",
"hasInstallScript": true,
"dependencies": {
"asn1": "^0.2.6",
"bcrypt-pbkdf": "^1.0.2"
},
"engines": {
"node": ">=10.16.0"
},
"optionalDependencies": {
"cpu-features": "~0.0.10",
"nan": "^2.20.0"
}
},
"node_modules/statuses": { "node_modules/statuses": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.2.tgz", "resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.2.tgz",
@ -1184,6 +1331,12 @@
"node": ">=0.6" "node": ">=0.6"
} }
}, },
"node_modules/tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmmirror.com/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
"license": "Unlicense"
},
"node_modules/type-is": { "node_modules/type-is": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmmirror.com/type-is/-/type-is-2.0.1.tgz", "resolved": "https://registry.npmmirror.com/type-is/-/type-is-2.0.1.tgz",

View File

@ -17,6 +17,8 @@
"fs-extra": "^11.3.0", "fs-extra": "^11.3.0",
"lowdb": "^3.0.0", "lowdb": "^3.0.0",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"node-ssh": "^13.2.1",
"ssh2": "^1.16.0",
"swagger-jsdoc": "^6.2.8", "swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.1" "swagger-ui-express": "^5.0.1"
} }

27
upload.js Normal file
View File

@ -0,0 +1,27 @@
const { NodeSSH } = require('node-ssh');
const path = require('path');
const ssh = new NodeSSH();
async function uploadFile() {
try {
await ssh.connect({
host: '192.168.104.102',
username: 'root',
privateKey: path.resolve(__dirname, 'YI_LIUYANG'), // 私钥文件路径
});
console.log('SSH 连接成功');
const localPath = path.resolve(__dirname, 'mock-config.json');
const remotePath = '/root/mock-config.json'; // 服务器上的目标路径
await ssh.putFile(localPath, remotePath);
console.log('文件上传成功:', remotePath);
ssh.dispose();
} catch (err) {
console.error('上传失败:', err);
}
}
uploadFile();