25 lines
993 B
TypeScript
25 lines
993 B
TypeScript
|
|
import { isEmpty } from "lodash";
|
|||
|
|
import { errorMessage, successMessage } from "./Public/generalTools";
|
|||
|
|
import { SoftWareServiceBasic } from "./Service/ServiceBasic/softwareServiceBasic";
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 初始化远程MJ的设置类型
|
|||
|
|
* @description 远程MJ的设置类型有两种:remote和local,remote表示远程代理模式,local表示本地模式
|
|||
|
|
*/
|
|||
|
|
export async function InitRemoteMjSettingType() {
|
|||
|
|
try {
|
|||
|
|
let softWareServiceBasic = new SoftWareServiceBasic()
|
|||
|
|
softWareServiceBasic.transaction((realm: any) => {
|
|||
|
|
let remoteMjs = realm.objects('RemoteMJ');
|
|||
|
|
for (let remoteMj of remoteMjs) {
|
|||
|
|
if (remoteMj.type == null || isEmpty(remoteMj.type)) {
|
|||
|
|
remoteMj.type = "remote" // 默认都是remote的;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
successMessage("", "初始化远程MJ的设置类型成功", "InitRemoteMjSettingType")
|
|||
|
|
} catch (error) {
|
|||
|
|
errorMessage("初始化远程MJ的设置类型失败," + error.toString(), "InitRemoteMjSettingType")
|
|||
|
|
}
|
|||
|
|
}
|