34 lines
943 B
TypeScript
34 lines
943 B
TypeScript
import { ipcMain } from 'electron'
|
|||
|
|
import { DEFINE_STRING } from '../../define/define_string'
|
||
|
|
import OptionHandle from '../Service/Options/index'
|
||
|
|
import { OptionType } from '@/define/enum/option'
|
||
|
|
|
||
|
|
function OptionsIpc() {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取指定的Option,通过key,不存在返回null
|
||
|
|
*/
|
||
|
|
ipcMain.handle(
|
||
|
|
DEFINE_STRING.OPTIONS.GET_OPTION_BY_KEY,
|
||
|
|
async (_, key: string) => await OptionHandle.GetOptionByKey(key)
|
||
|
|
)
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 修改指定的Option,通过key,不存在则创建
|
||
|
|
*/
|
||
|
|
ipcMain.handle(
|
||
|
|
DEFINE_STRING.OPTIONS.MODIFY_OPTION_BY_KEY,
|
||
|
|
async (_, key: string, value: string, type: OptionType) =>
|
||
|
|
await OptionHandle.ModifyOptionByKey(key, value, type)
|
||
|
|
)
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 同步文案处理中的AI设置旧数据到新的数据表中
|
||
|
|
*/
|
||
|
|
ipcMain.handle(
|
||
|
|
DEFINE_STRING.OPTIONS.INIT_COPY_WRITING_AI_SETTING,
|
||
|
|
async () => await OptionHandle.InitCopyWritingAISetting()
|
||
|
|
)
|
||
|
|
}
|
||
|
|
export { OptionsIpc }
|