diff --git a/common.js b/common.js index 44145de..17ccfbe 100644 --- a/common.js +++ b/common.js @@ -979,7 +979,16 @@ export async function parsingCharacteristicValue(binaryData) { // 获取配置 export function getConfig() { - let config = configs[this.env] + let config = {} + if (this.env === "LOCAL"){ + config = { + name: 'LOCAL', + baseUrl: this.url + } + }else{ + config = configs[this.env] + } + return { ...config, version, diff --git a/star-cloud.js b/star-cloud.js index 844ed77..b0d88da 100644 --- a/star-cloud.js +++ b/star-cloud.js @@ -80,6 +80,8 @@ class StarCloud { constructor() { // 环境 this.env = null + //sdk服务器地址 + this.url = '' // 客户端Id this.clientId = null // 客户端密码 @@ -137,7 +139,7 @@ class StarCloud { init(params) { Object.assign(StarCloud.prototype, device, lock, other, password, record, user, common) - const { clientId, clientSecret, env, platform, accounts } = params + const { clientId, clientSecret, env, platform, accounts,url } = params this.envVersion = 'release' if (platform !== 2) { const appInfo = uni.getAccountInfoSync() @@ -147,6 +149,7 @@ class StarCloud { onBLECharacteristicValueChange(this.listenCharacteristicValue.bind(this)) } + this.url = url this.isReportLog = params.isReportLog this.env = env || 'XHJ'