LaiTool/src/main/initFunc.ts
lq1405 c43abd6908 V 3.3.3
1. 修复MJ设置初始化问题
2. 添加MJ本地代理模式,可以本地部署的代理模式
2025-04-02 19:52:57 +08:00

25 lines
993 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { isEmpty } from "lodash";
import { errorMessage, successMessage } from "./Public/generalTools";
import { SoftWareServiceBasic } from "./Service/ServiceBasic/softwareServiceBasic";
/**
* 初始化远程MJ的设置类型
* @description 远程MJ的设置类型有两种remote和localremote表示远程代理模式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")
}
}