Merge branch 'feature/ui'

This commit is contained in:
geekgeekrun
2025-08-17 13:51:09 +08:00
5 changed files with 71 additions and 40 deletions

View File

@@ -251,33 +251,43 @@ async function markJobAsNotSuitInRecommendPage (reasonCode) {
await writeStorageFile('job-not-suit-reason-code-to-text-cache.json', reasonCodeToTextMap)
await sleepWithRandomDelay(2000)
const chooseReasonDialogProxy = await(async() => {
const alls = await page.$$('.zp-dialog-wrap.zp-feedback-dialog.v-transfer-dom')
const alls = await page.$$('.zp-dialog-wrap.zp-feedback-dialog')
return alls?.[alls.length - 1]
})()
let isOptionChosen = false
if (chooseReasonDialogProxy) {
switch (reasonCode) {
case MarkAsNotSuitReason.BOSS_INACTIVE: {
const bossNotActiveOptionProxy = await chooseReasonDialogProxy.$(`.zp-type-item[title="BOSS活跃度低"]`)
if (bossNotActiveOptionProxy) {
await bossNotActiveOptionProxy.click()
const opProxy = (await chooseReasonDialogProxy.$(`.zp-type-item[title="BOSS活跃度低"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="职位停招/招满"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="面试过/入职过"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="重复推荐"]`))
if (opProxy) {
await opProxy.click()
isOptionChosen = true
} else {
const recruitStoppedOptionProxy = await chooseReasonDialogProxy.$(`.zp-type-item[title="职位停招/招满"]`)
if (recruitStoppedOptionProxy) {
await recruitStoppedOptionProxy.click()
isOptionChosen = true
}
}
break
}
case MarkAsNotSuitReason.JOB_WORK_EXP_NOT_SUIT:
case MarkAsNotSuitReason.JOB_CITY_NOT_SUIT:
case MarkAsNotSuitReason.JOB_SALARY_NOT_SUIT: {
case MarkAsNotSuitReason.JOB_CITY_NOT_SUIT: {
const opProxy = (await chooseReasonDialogProxy.$(`.zp-type-item[title$="城市"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="同城距离远"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title$="距离远"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="公司不感兴趣"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="面试过/入职过"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="重复推荐"]`))
if (opProxy) {
await opProxy.click()
isOptionChosen = true
}
break
}
case MarkAsNotSuitReason.JOB_SALARY_NOT_SUIT: {
const opProxy = (await chooseReasonDialogProxy.$(`xpath///*[contains(@class,'zp-type-item')][contains(@title, "薪资")]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title$="城市"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title$="距离远"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="公司不感兴趣"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="面试过/入职过"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="重复推荐"]`))
if (opProxy) {
await opProxy.click()
isOptionChosen = true
@@ -286,7 +296,9 @@ async function markJobAsNotSuitInRecommendPage (reasonCode) {
}
case MarkAsNotSuitReason.JOB_NOT_SUIT:
default: {
const jobNotSuitOptionProxy = (await chooseReasonDialogProxy.$(`.zp-type-item[title$="职位"]`)) ?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="面试过/入职过"]`))
const jobNotSuitOptionProxy = (await chooseReasonDialogProxy.$(`.zp-type-item[title$="职位"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="面试过/入职过"]`))
?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="重复推荐"]`))
if (jobNotSuitOptionProxy) {
await jobNotSuitOptionProxy.click()
isOptionChosen = true
@@ -511,6 +523,11 @@ async function toRecommendPage (hooks) {
) {
throw new Error("ACCESS_IS_DENIED")
}
await page.waitForFunction(({ recommendJobPageUrl }) => {
return location.href.startsWith(recommendJobPageUrl) && document.readyState === 'complete'
}, undefined, { recommendJobPageUrl })
hooks.pageLoaded?.call()
let userInfoResponse = await userInfoPromise
@@ -525,20 +542,6 @@ async function toRecommendPage (hooks) {
await storeStorage(page).catch(() => void 0)
}
// check set security question tip modal
let setSecurityQuestionTipModelProxy = await page.$('.dialog-wrap.dialog-account-safe')
if (
setSecurityQuestionTipModelProxy
) {
await sleep(1000)
setSecurityQuestionTipModelProxy = await page.$('.dialog-wrap.dialog-account-safe')
const closeButtonProxy = await setSecurityQuestionTipModelProxy?.$('.close')
if (setSecurityQuestionTipModelProxy && closeButtonProxy) {
await closeButtonProxy.click()
}
}
const computedSourceList = []
for (const source of normalizedJobSource) {
switch (source.type) {
@@ -628,6 +631,26 @@ async function toRecommendPage (hooks) {
let currentSourceIndex = 0
afterPageLoad: while (true) {
// check set security question tip modal
let setSecurityQuestionTipModelProxy
try {
setSecurityQuestionTipModelProxy = await page.waitForSelector('.dialog-wrap.dialog-account-safe', { timeout: 3 * 1000 })
}
catch(err) {
console.log(`cannot find set security question tip modal, just continue`)
}
if (
setSecurityQuestionTipModelProxy
) {
await sleep(1000)
setSecurityQuestionTipModelProxy = await page.$('.dialog-wrap.dialog-account-safe')
const closeButtonProxy = await setSecurityQuestionTipModelProxy?.$('.close')
if (setSecurityQuestionTipModelProxy && closeButtonProxy) {
await closeButtonProxy.click()
}
}
let expectJobList
iterateFilterCondition: for (
const filterCondition of combineFiltersWithConstraintsGenerator(

View File

@@ -1,7 +1,6 @@
import "reflect-metadata";
import { type DataSource } from "typeorm";
import { requireTypeorm } from "./utils/module-loader";
import fs from 'node:fs'
import { BossInfo } from "./entity/BossInfo";
import { BossInfoChangeLog } from "./entity/BossInfoChangeLog";
@@ -38,6 +37,7 @@ import { MarkAsNotSuitOp, MarkAsNotSuitReason } from "./enums";
import { AddColumnForMarkAsNotSuitLog1746092370665 } from "./migrations/1746092370665-AddColumnForMarkAsNotSuitLog";
import { Init1000000000000 } from "./migrations/1000000000000-Init";
import { AddJobSourceColumnForChatStartupLogAndMarkAsNotSuitLog1752380078526 } from "./migrations/1752380078526-AddJobSourceColumnForChatStartupLogAndMarkAsNotSuitLog";
const lodashImportPromise = import('lodash-es')
export function initDb(dbFilePath) {
const { DataSource } = requireTypeorm()
@@ -175,7 +175,16 @@ export default class SqlitePlugin {
}
const last30DayChatStartupRecords = (await getChatStartupRecordsInLastSomeDays(ds, 30)) ?? [];
const chattedJobIds = last30DayChatStartupRecords.map(it => it.encryptJobId)
const chattedBossIds = ((await getBossIdsByJobIds(ds, chattedJobIds)) ?? []).map(it => it.encryptBossId)
if (chattedJobIds.length === 0) {
return
}
const { chunk } = await lodashImportPromise
const chattedJobIdChunks = chunk(chattedJobIds, 200)
const chattedBossIds = [];
for (const chattedJobIdChunk of chattedJobIdChunks) {
const chattedBossIdChunk = ((await getBossIdsByJobIds(ds, chattedJobIdChunk)) ?? []).map(it => it.encryptBossId)
chattedBossIds.push(...chattedBossIdChunk)
}
for (const id of chattedBossIds) {
blockBossNotNewChat.add(id)
}

View File

@@ -1,6 +1,6 @@
{
"name": "geekgeekrun-ui",
"version": "0.9.0",
"version": "0.9.2",
"description": "Boss 炸弹 - 自动开聊Boss助力每位打工人求职",
"main": "./out/main/index.js",
"author": "geekgeekrun",
@@ -38,6 +38,7 @@
"JSONStream": "^1.3.5",
"diff": "^7.0.0",
"electron-updater": "^6.1.7",
"lodash-es": "^4.17.21",
"minimist": "^1.2.8",
"mitt": "^3.0.1",
"node-machine-id": "^1.1.12",
@@ -72,7 +73,6 @@
"eslint-plugin-vue": "^9.20.1",
"find-chrome-bin": "^2.0.1",
"js-yaml": "^4.1.0",
"lodash-es": "^4.17.21",
"normalize.css": "^8.0.1",
"prettier": "^3.2.4",
"sass": "^1.70.0",

View File

@@ -1,7 +1,7 @@
{
"version": "0.9.0",
"buildVersion": 16,
"buildTime": 1752412320912,
"buildHash": "d3e086f32184dd2a36819c0f9697228fa1316ada",
"version": "0.9.2",
"buildVersion": 18,
"buildTime": 1755400602067,
"buildHash": "a25b047f99f7b1ac0c8ee55f1e121991e1dd6402",
"name": "geekgeekrun-ui"
}

7
pnpm-lock.yaml generated
View File

@@ -129,6 +129,9 @@ importers:
electron-updater:
specifier: ^6.1.7
version: 6.1.7
lodash-es:
specifier: ^4.17.21
version: 4.17.21
minimist:
specifier: ^1.2.8
version: 1.2.8
@@ -226,9 +229,6 @@ importers:
js-yaml:
specifier: ^4.1.0
version: 4.1.0
lodash-es:
specifier: ^4.17.21
version: 4.17.21
normalize.css:
specifier: ^8.0.1
version: 8.0.1
@@ -4570,7 +4570,6 @@ packages:
/lodash-es@4.17.21:
resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
dev: true
/lodash-unified@1.0.3(@types/lodash-es@4.17.12)(lodash-es@4.17.21)(lodash@4.17.21):
resolution: {integrity: sha512-WK9qSozxXOD7ZJQlpSqOT+om2ZfcT4yO+03FuzAHD0wF6S0l0090LRPDx3vhTTLZ8cFKpBn+IOcVXK6qOcIlfQ==}