import { $commonService } from "@/services/framework/dependency-injection-service"; declare let __APP_ENV__: any; export const UrlService = { install(app: any) { app.config.globalProperties.$urlService = new UrlServiceClass(); $commonService.$dependencyInjectionService.provideFun( "$urlService", app.config.globalProperties.$urlService ); }, }; class UrlServiceClass { constructor() {} getUrl(key: string, params?: { [key: string]: any }) { // 获取当前环境 const viteEnv = __APP_ENV__; let url = this.urls[key]; if (params !== undefined) { Object.keys(params).forEach((key) => { url = url.replace(":" + key, params[key]); }); } return viteEnv.VITE_HTTP_SERVER + url; } // 真实数据路径 urls: { [key: string]: string } = { "1_1": "/register/getRegCode", //用户注册获取短信验证码 "1_2": "/register", //用户注册 "1_3": "/login?", //账号密码登录 "1_4": "/weixinLogin?", //微信登录 "1_5": "/weixin/getBindCode", //微信绑定获取短信验证码 "1_6": "/weixinBind", //微信绑定 "1_7": "/resetPwd/getVerifyCode", //忘记密码—获取验证码 "1_8": "/resetPwd/checkCode", //忘记密码—检验验证码 "1_9": "/resetPwd", //忘记密码,重置新密码 "1_10": "/logout", //退出登录 "1_11": "/policies/:type/:updateTime", // 获取政策条款 "1_12": "/appleLogin?", //苹果授权登录 "1_13": "/apple/getBindCode", //苹果账号绑定获取验证码 "1_14": "/appleBind", //苹果账号绑定已有账号 "1_15": "/api/apphome/activeServiceSet", //首页修改主动售后 "2_1": "/api/appuser/users/:userId", //获取个人信息 "2_2": "/api/appuser/users/:userId/avatar", //获取个人头像 "2_3": "/api/appuser/users/:userId", //修改个人信息 "2_4": "/api/appuser/updatePwd", //修改密码 "2_5": "/api/appuser/updateTel", //修改手机号 "2_6": "/checkVersion", //检查新版本 "2_7": "/appuser/users/:userId/jgRegId", //修改极光注册id "2_8": "/api/appuser/bindWeixin/checkVerifyCode", //微信绑定-检查验证码 "2_9": "/api/appuser/bindWeixinByCode", //通过临时授权码绑定微信 "2_10": "/api/appuser/users/:userId/unbind", // 解除微信与已有账户的绑定 "2_11": "/api/appuser/cancelAccount/checkSafeStatus", //注销账号-检测是否处于安全状态 "2_12": "/api/appuser/cancelAccount/getVerifyCode", //注销账号-获取验证码 "2_13": "/api/appuser/cancelAccount", //注销账号 "2_14": "/api/appuser/cancelAccount/stop", //取消注销账号 post "2_15": "/api/appuser/bindApple/checkVerifyCode", //苹果绑定-检查验证码 "2_16": "/api/appuser/users/:userId/unbindApple", // 解除苹果与已有账户的绑定 "2_17": "/api/appuser/marketing/picture", //推广图片查询 "2_18": "/api/appuser/users/:userId/feedback", // 意见反馈 "2_19": "/api/appuser/css/:cssId/entrance", //7.2.20用户意见反馈及在线报修调用地址转发 "3_1": "/api/apphome/users/:userId/homes", //获取用户的家庭列表 "3_2": "/api/apphome/homes/:homeId", //获取家庭的全部信息 "3_3": "/api/apphome/homes", //创建家庭 "3_4": "/api/apphome/homes/:homeId/users/:deleteUserId", //退出家庭 "3_5": "/api/apphome/homes/:homeId/qrcode", //分享家庭 "3_6": "/api/apphome/homes/join/:homeId", //加入家庭 "3_7": "/api/apphome/homes/:homeId", //更改家庭名称 "3_8": "/api/apphome/homes/:homeId/loc", // 更改家庭位置信息 "3_9": "/api/apphome/homes/:homeId/deleteusers/:deleteUserId", // 删除成员 "3_10": "/api/apphome/homes/:homeId/homeInfo", //获取家庭详情 "3_11": "/api/apphome/homes/:homeId/adminId", // 移除管理员 "3_12": "/api/apphome/homes/homeList/deviceList", //获取用户所在所有家庭的NB设备列表 "3_13": "/api/apphome/homes/:homeId/energyLimitPlug", //更新插座耗电量上限阈值 PUT "3_14": "/api/apphome/homes/:homeId/energyLimitPlugFlg", //更新插座耗电提醒开关 PUT "3_15": "/api/apphome/homes/:homeId/activeServiceFlg", //家庭详情修改主动售后 "4_1": "/api/apphome/homes/:homeId/groups", //新建房间 "4_2": "/api/apphome/homes/:homeId/groups", //查询房间列表 "4_3": "/api/apphome/homes/:homeId/groups/:groupId", //修改单个房间信息 "4_4": "/api/apphome/homes/:homeId/groups/:groupId/:updateTime", //删除房间 "4_5": "/api/apphome/homes/:homeId/groups/:groupId", //查询房间详情 "4_6": "/api/apphome/homes/1/groups", //房间设备移动 "5_1": "/api/apptimer/homes/:homeId/smarts", // 获取智能列表 "5_2": "/api/apptimer/homes/:homeId/smarts", // 新建智能(手动、定时、预设、空气联动) "5_3": "/api/apptimer/homes/:homeId/smarts/:smartId", // 修改智能(手动、定时、预设、空气联动) "5_4": "/api/apptimer/homes/:homeId/smarts/:smartId/:type/:updateTime", //删除智能(手动、定时) "5_5": "/api/apptimer/homes/:homeId/smarts/:smartId", // 获取智能详情 "5_6": "/api/apptimer/homes/:homeId/smarts/:smartId/openFlg", //打开、关闭智能 "5_7": "/api/apptimer/homes/:homeId/smarts/:smartId/favoriteFlg", //收藏、取消收藏智能 "5_8": "/api/apptimer/homes/:homeId/smarts/delBatch", //批量删除场景 "5_9": "/api/apptimer/homes/:homeId/smarts/smartPanel", //智能面板获取场景列表 "5_10": "/api/apptimer/homes/:homeId/smartsSort", //保存场景排序 "5_11": "/api/apptimer/homes/:homeId/sleepcurves", // 新增睡眠曲线 "5_12": "/api/apptimer/homes/:homeId/sleepcurve/:curveId", // 更新睡眠曲线 "5_13": "/api/apptimer/homes/:homeId/sleepcurve/:curveId/:updateTime", // 删除睡眠曲线 "5_14": "/api/apptimer/homes/:homeId/sleepcurve/:curveId", // 获取睡眠曲线详情 "5_15": "/api/apptimer/homes/:homeId/sleepcurve/:curveId/openFlg", //更新睡眠曲线开关 "5_16": "/api/apptimer/homes/:homeId/boxScenes/boxList/:type/:addOrUpdate", //联动场景可添加的空气盒子 "5_17": "/api/apptimer/homes/:homeId/boxScenes/iuList/:type/:addOrUpdate/:boxcode", //联动场景可添加的空调室内机 "6_1": "/api/appdevice/homes/:homeId/equips/:iezCode/times/:ctrlTime", // 查询绑定设备信息 "6_2": "/api/appdevice/homes/:homeId/equips", // 添加设备 "6_3": "/api/appdevice/homes/:homeId/equips/:iezCode/searchIus/:ctrlTime", // 查询搜索的空调信息 "6_4": "/api/appdevice/homes/:homeId/equips/:iezCode/ius", // 保存空调机设置 "6_5": "/api/appdevice/homes/:homeId/equips/:iezCode/ius/:iuId", // 修改空调名称 //"6_6" 弃用 //"6_7" 弃用 "6_8": "/api/appdevice/homes/:homeId/equips/:iezCode/ius/:iuId", // 获取单个空调的信息 //"6_9" 弃用 "6_10": "/api/appdevice/homes/:homeId/equips/:iezCode", //删除NB设备 "6_11": "/api/appdevice/homes/:homeId/batteryStatus", //获取所选家庭内的NB设备的当前电池状态 "6_12": "/api/appdevice/homes/:homeId/equips/:iezCode/iezName", // 修改NB设备机组名称 "6_13": "/api/appdevice/homes/:homeId/plcs", // 添加PLC设备 "6_14": "/api/appdevice/equips/:iezCode/plcSyncStatus/:operateTime?versionModbusProtocol=:versionModbusProtocol", // 查询PLC设备添加结果 "6_15": "/api/appequip/homes/:homeId/plcs/:plcCode/:updateTime", // 删除PLC设备绑定信息 "6_16": "/api/appdevice/homes/:homeId/plcs/:plcCode", //查询PLC设备详情 GET "6_17": "/api/appdevice/homes/:homeId/plcs/:plcCode/simpleTimer?timerNo=:timerNo", //PLC设备设置简单定时 POST "6_18": "/api/appdevice/homes/:homeId/plcs/:plcCode/simpleTimer/:timerSimpleTime?timerNo=:timerNo", // 删除PLC设备简单定时 DELETE "6_19": "/api/appdevice/homes/:homeId/equips/:iezCode/plcs/:plcCode/elecCurve/day/:day", // PLC智能插座耗电量-日趋势图 GET "6_20": "/api/appdevice/homes/:homeId/equips/:iezCode/plcs/:plcCode/elecCurve/yearMonth/:yearMonth", //PLC智能插座耗电量-月趋势图 GET "6_21": "/api/appdevice/homes/:homeId/plcs/:plcCode", // 修改PLC设备名称 PUT "6_22": "/api/appdevice/homes/:homeId/plcs/:plcCode/panelSmartId", //智能面板按键配置 PUT //"6_23" 弃用 //"6_24" 弃用 //"6_25" 弃用 //"6_26" 弃用 "6_27": "/api/appdevice/homes/:homeId/equips/:iezCode/plcs/:plcCode/elecCurve/week/:week", //PLC智能插座耗电量-周趋势图 GET "6_28": "/api/appdevice/homes/:homeId/plugElecCurve/date/:date", //家庭下智能插座耗电量统计(日、周、月趋势) "6_29": "/api/appdevice/homes/:homeId/elecPlugList", //获取PLC智能插座列表列表 GET "6_30": "/api/appdevice/homes/:homeId/equips/:iezCode/plcs/:plcCode/check", // 校验PLC设备 "6_31": "/api/appdevice/homes/:homeId/smartbedrooms", // 添加智能枕 "6_32": "/api/appequip/homes/:homeId/smartbedroom/:mac/:updateTime", // 删除智能枕 "6_33": "/api/appdevice/homes/:homeId/smartbedroom/:mac/name", // 智能枕更名 "6_34": "/api/appdevice/homes/:homeId/smartbedroom/:mac/version", // 智能枕更新版本号 "6_35": "/api/appdevice/homes/:homeId/smartbedroom/:mac", // 查询智能枕设备详情 "6_36": "/api/appdevice/homes/:homeId/smartbedroom/:mac/sleepreport?type=:type&date=:date", //获取睡眠报告 "6_37": "/api/appdevice/homes/:homeId/smartbedroom/:mac/sleepscore?year=:year&month=:month", //获取睡眠得分报告 "6_38": "/api/appdevice/getOtas", // 获取家庭下的升级策略 POST "6_39": "/api/appdevice/homes/:homeId/otaCtrl", // 下发升级策略 POST "6_40": "/api/appdevice/homes/:homeId/box", // 添加空气盒子(青萍) "6_41": "/api/appdevice/homes/:homeId/box/:boxCode", //更新空气盒子(名称)PUT "6_42": "/api/appdevice/homes/:homeId/box/:boxCode", //删除空气盒子 "6_43": "/api/appdevice/homes/:homeId/box/:boxCode", //获取空气盒子信息 GET "6_44": "/api/appdevice/homes/:homeId/box/:boxCode/data/latest?timestamp=:timestamp", // 获取空气盒子最新状态数据(青萍) GET "6_45": "/api/appdevice/homes/:homeId/box/:boxCode/index/:indexFlag/:queryRange/:date", //查询空气盒子指标曲线数据(青萍) GET "6_46": "/api/appdevice/homes/:homeId/box/:boxCode/report?", //查询空气质量报告列表 GET "6_47": "/api/appdevice/homes/:homeId/box/:boxCode/report/:year/:month", //获取空气质量报告数据 GET "6_48": "/api/appdevice/homes/:homeId/box/:boxCode/remindFlg", //更新空气盒子提醒开关 "6_49": "/api/appdevice/homes/:homeId/plcs/:plcCode/panelSmartIdMulti", //智能面板按钮配置(批量) PUT //"7_1" 弃用 //"7_2" 弃用 //"7_3" 弃用 "7_20": "/api/appuser/css/:cssId/entrance", //7.2.20用户意见反馈及在线报修调用地址转发 "7_4": "/api/appcontrol/cmds/ctrlResult", // 控制指令执行结果查询 "7_5": "/api/appcontrol/cmds/onlineStatus", // 获取设备在线状态 //"7_6" 弃用 "7_7": "/api/appcontrol/cmds/bindControl", // 设备绑定控制指令 "7_8": "/api/appcontrol/cmds/searchControl", // 空调搜索控制指令 "7_9": "/api/appcontrol/cmds/batchControl", //空调全关控制指令 "7_10": "/api/appcontrol/cmds/locationCtrl", //设备定位控制指令 "7_11": "/api/appcontrol/cmds/multiIuOuCtrl", // 多类型设备多室内外机控制 "7_12": "/api/appcontrol/cmds/multiPlcCtrl", // plc设备操作控制指令 POST "7_13": "/api/appcontrol/cmds/multiBatchCtrl", // 多类型设备批量控制(空调&PLC)【预留】 "8_1": "/api/appstatus/homes/:homeId/status", //获取家庭下所有设备(空调、PLC设备等)当前状态 "8_2": "/api/appstatus/homes/:homeId/:groupId/status", // 获取房间下所有空调、plc 设备当前状态 "8_3": "/api/appstatus/homes/:homeId/statusCheck", //设备发现-获取符合设定状态的设备 "8_4": "/api/appstatus/homes/:homeId/locationCheck", //设备发现-校验位置是否符合绑定范围 "8_5": "/api/appstatus/otaProgress", // 关于页面-轮询 OTA 进度接口 "0_1": "/api/appweather/weather/:regionCode", // 获取天气信息 }; }