From 3e13b4f7b0874aed63c9a00a0cf2464e6143bf6e Mon Sep 17 00:00:00 2001 From: huang <1724659546@qq.com> Date: Fri, 19 Sep 2025 15:59:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0swagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/device.js | 10 +++++----- src/api/plan.js | 14 +++++++------- src/api/user.js | 4 ++-- src/config/api.js | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/api/device.js b/src/api/device.js index 17ab3b13..de076251 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -9,7 +9,7 @@ export class DeviceApi { * @returns {Promise} 设备列表 */ static list() { - return http.get('/devices'); + return http.get('/api/v1/devices'); } /** @@ -18,7 +18,7 @@ export class DeviceApi { * @returns {Promise} 创建结果 */ static create(deviceData) { - return http.post('/devices', deviceData); + return http.post('/api/v1/devices', deviceData); } /** @@ -27,7 +27,7 @@ export class DeviceApi { * @returns {Promise} 设备详情 */ static get(id) { - return http.get(`/devices/${id}`); + return http.get(`/api/v1/devices/${id}`); } /** @@ -37,7 +37,7 @@ export class DeviceApi { * @returns {Promise} 更新结果 */ static update(id, deviceData) { - return http.put(`/devices/${id}`, deviceData); + return http.put(`/api/v1/devices/${id}`, deviceData); } /** @@ -46,7 +46,7 @@ export class DeviceApi { * @returns {Promise} 删除结果 */ static delete(id) { - return http.delete(`/devices/${id}`); + return http.delete(`/api/v1/devices/${id}`); } } diff --git a/src/api/plan.js b/src/api/plan.js index d1f7a4e7..d665508f 100644 --- a/src/api/plan.js +++ b/src/api/plan.js @@ -9,7 +9,7 @@ export class PlanApi { * @returns {Promise} 计划列表 */ static list() { - return http.get('/plans'); + return http.get('/api/v1/plans'); } /** @@ -18,7 +18,7 @@ export class PlanApi { * @returns {Promise} 创建结果 */ static create(planData) { - return http.post('/plans', planData); + return http.post('/api/v1/plans', planData); } /** @@ -27,7 +27,7 @@ export class PlanApi { * @returns {Promise} 计划详情 */ static get(id) { - return http.get(`/plans/${id}`); + return http.get(`/api/v1/plans/${id}`); } /** @@ -37,7 +37,7 @@ export class PlanApi { * @returns {Promise} 更新结果 */ static update(id, planData) { - return http.put(`/plans/${id}`, planData); + return http.put(`/api/v1/plans/${id}`, planData); } /** @@ -46,7 +46,7 @@ export class PlanApi { * @returns {Promise} 删除结果 */ static delete(id) { - return http.delete(`/plans/${id}`); + return http.delete(`/api/v1/plans/${id}`); } /** @@ -55,7 +55,7 @@ export class PlanApi { * @returns {Promise} 启动结果 */ static start(id) { - return http.post(`/plans/${id}/start`); + return http.post(`/api/v1/plans/${id}/start`); } /** @@ -64,7 +64,7 @@ export class PlanApi { * @returns {Promise} 停止结果 */ static stop(id) { - return http.post(`/plans/${id}/stop`); + return http.post(`/api/v1/plans/${id}/stop`); } } diff --git a/src/api/user.js b/src/api/user.js index 93d6e33d..a99e716a 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -10,7 +10,7 @@ export class UserApi { * @returns {Promise} 创建结果 */ static create(userData) { - return http.post('/users', userData); + return http.post('/api/v1/users', userData); } /** @@ -19,7 +19,7 @@ export class UserApi { * @returns {Promise} 登录结果 */ static login(credentials) { - return http.post('/users/login', credentials); + return http.post('/api/v1/users/login', credentials); } } diff --git a/src/config/api.js b/src/config/api.js index aecee119..cc6991b2 100644 --- a/src/config/api.js +++ b/src/config/api.js @@ -5,7 +5,7 @@ const API_CONFIG = { // API端点 ENDPOINTS: { - DEVICES: '/devices' + DEVICES: '/api/v1/devices' }, // 请求超时时间(毫秒)