mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-05-11 18:09:50 +08:00
add exit auto chat logic in ui.
This commit is contained in:
@@ -11,7 +11,7 @@ export default class DingtalkPlugin {
|
||||
setSendQueueTimer () {
|
||||
const _this = this
|
||||
const interval = 2 * 60 * 1000
|
||||
sendQueueTimer = setTimeout(function sendMergedMessage () {
|
||||
function sendMergedMessage () {
|
||||
if (collectedMessageList.length === 0) {
|
||||
} else if (collectedMessageList.length === 1) {
|
||||
collectedMessageList[0].dingtalkRequestBody.text.content += `\n${dayjs(collectedMessageList[0].insertedTime).format('MM-DD HH:mm:ss')}\n\n【bossgeekgo】`
|
||||
@@ -29,7 +29,15 @@ export default class DingtalkPlugin {
|
||||
}
|
||||
collectedMessageList.length = 0
|
||||
sendQueueTimer = setTimeout(sendMergedMessage, interval)
|
||||
}, interval)
|
||||
}
|
||||
sendQueueTimer = setTimeout(sendMergedMessage, interval)
|
||||
// FIXME: exit immediate without wait
|
||||
process.on('SIGINT', () => {
|
||||
sendMergedMessage()
|
||||
setTimeout(() => {
|
||||
process.exit(0)
|
||||
}, 5000)
|
||||
})
|
||||
}
|
||||
destroySendQueueTimer () {
|
||||
clearTimeout(sendQueueTimer)
|
||||
|
||||
@@ -80,8 +80,11 @@ export function createMainWindow(): void {
|
||||
// const currentExecutablePath = app.getPath('exe')
|
||||
// console.log(currentExecutablePath)
|
||||
|
||||
let subProcessOfPuppeteer: ChildProcess
|
||||
let subProcessOfPuppeteer: ChildProcess | null = null
|
||||
ipcMain.handle('run-geek-auto-start-chat-with-boss', async () => {
|
||||
if (subProcessOfPuppeteer) {
|
||||
return
|
||||
}
|
||||
console.log(process)
|
||||
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
||||
env: {
|
||||
@@ -89,6 +92,16 @@ export function createMainWindow(): void {
|
||||
MAIN_BOSSGEEKGO_RUN_MODE: 'geekAutoStartWithBoss'
|
||||
}
|
||||
})
|
||||
ipcMain.emit('geek-auto-start-chat-with-boss-started')
|
||||
subProcessOfPuppeteer.once('exit', () => {
|
||||
mainWindow.webContents.send('geek-auto-start-chat-with-boss-stopped')
|
||||
|
||||
subProcessOfPuppeteer = null
|
||||
})
|
||||
console.log(subProcessOfPuppeteer)
|
||||
})
|
||||
ipcMain.handle('stop-geek-auto-start-chat-with-boss', async () => {
|
||||
mainWindow.webContents.send('geek-auto-start-chat-with-boss-stopping')
|
||||
subProcessOfPuppeteer?.kill('SIGINT')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
import { ref } from 'vue'
|
||||
import JSON5 from 'json5'
|
||||
import { ElForm, ElMessage } from 'element-plus'
|
||||
import router from '../../router/index';
|
||||
|
||||
const formContent = ref({
|
||||
bossZhipinCookies: '',
|
||||
@@ -78,6 +79,7 @@ const handleSubmit = async () => {
|
||||
await formRef.value!.validate()
|
||||
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
||||
await electron.ipcRenderer.invoke('run-geek-auto-start-chat-with-boss', JSON.stringify(formContent.value))
|
||||
router.replace('/geekAutoStartChatWithBoss/runningStatus')
|
||||
}
|
||||
const handleSave = async () => {
|
||||
await formRef.value!.validate()
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<div class="geek-auto-start-chat-with-boss__running-status">
|
||||
<article>
|
||||
<h1>Hi buddy!</h1>
|
||||
<p>I'm finding your expected job and will start a chat with recruiter.</p>
|
||||
<p>You can view the positions I've chatted with in BossZhipin App on your cellphone.</p>
|
||||
<p>Good luck to you!</p>
|
||||
</article>
|
||||
<el-button :disabled="isStopping" @click="handleStop">Stop</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const { ipcRenderer } = electron
|
||||
const router = useRouter()
|
||||
|
||||
const isStopping = ref(false)
|
||||
const handleStop = async () => {
|
||||
ipcRenderer.once('geek-auto-start-chat-with-boss-stopping', () => {
|
||||
isStopping.value = true
|
||||
ipcRenderer.once('geek-auto-start-chat-with-boss-stopped', () => {
|
||||
router.replace('/configuration/GeekAutoStartChatWithBoss')
|
||||
})
|
||||
})
|
||||
ipcRenderer.invoke('stop-geek-auto-start-chat-with-boss')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
@@ -0,0 +1 @@
|
||||
<template><RouterView /></template>
|
||||
@@ -21,6 +21,19 @@ const routes: Array<RouteRecordRaw> = [
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/geekAutoStartChatWithBoss',
|
||||
component: () => import('@renderer/page/GeekAutoStartChatWithBoss/index.vue'),
|
||||
children: [
|
||||
{
|
||||
path: 'runningStatus',
|
||||
component: () => import('@renderer/page/GeekAutoStartChatWithBoss/RunningStatus.vue'),
|
||||
meta: {
|
||||
title: 'geek auto start chat with boss is running!'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user