增加local模式自定义服务器url

This commit is contained in:
XieHaoLiang 2024-12-26 15:04:30 +08:00
parent 20838db718
commit f2c5ec5fed
2 changed files with 14 additions and 2 deletions

View File

@ -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,

View File

@ -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'