collect jobSource when auto startup chat running

This commit is contained in:
geekgeekrun
2025-07-13 14:27:43 +08:00
parent b31224a81c
commit e867acb39d
3 changed files with 40 additions and 20 deletions
@@ -20,7 +20,7 @@ import {
import { default as jobFilterConditions } from './internal-config/job-filter-conditions-20241002.json' import { default as jobFilterConditions } from './internal-config/job-filter-conditions-20241002.json'
import { default as rawIndustryFilterExemption } from './internal-config/job-filter-industry-filter-exemption-20241002.json' import { default as rawIndustryFilterExemption } from './internal-config/job-filter-industry-filter-exemption-20241002.json'
import { ChatStartupFrom } from '@geekgeekrun/sqlite-plugin/dist/entity/ChatStartupLog' import { ChatStartupFrom } from '@geekgeekrun/sqlite-plugin/dist/entity/ChatStartupLog'
import { MarkAsNotSuitReason, MarkAsNotSuitOp, StrategyScopeOptionWhenMarkJobNotMatch, SalaryCalculateWay, JobDetailRegExpMatchLogic } from '@geekgeekrun/sqlite-plugin/dist/enums' import { MarkAsNotSuitReason, MarkAsNotSuitOp, StrategyScopeOptionWhenMarkJobNotMatch, SalaryCalculateWay, JobDetailRegExpMatchLogic, JobSource } from '@geekgeekrun/sqlite-plugin/dist/enums'
import { activeDescList } from './constant.mjs' import { activeDescList } from './constant.mjs'
import { parseSalary } from "@geekgeekrun/sqlite-plugin/dist/utils/parser" import { parseSalary } from "@geekgeekrun/sqlite-plugin/dist/utils/parser"
const jobFilterConditionsMapByCode = {} const jobFilterConditionsMapByCode = {}
@@ -938,7 +938,8 @@ async function toRecommendPage (hooks) {
markFrom: ChatStartupFrom.AutoFromRecommendList, markFrom: ChatStartupFrom.AutoFromRecommendList,
markReason: MarkAsNotSuitReason.BOSS_INACTIVE, markReason: MarkAsNotSuitReason.BOSS_INACTIVE,
extInfo: null, extInfo: null,
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -956,7 +957,8 @@ async function toRecommendPage (hooks) {
bossActiveTimeDesc: targetJobData.bossInfo.activeTimeDesc, bossActiveTimeDesc: targetJobData.bossInfo.activeTimeDesc,
chosenReasonInUi chosenReasonInUi
}, },
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -973,7 +975,8 @@ async function toRecommendPage (hooks) {
markFrom: ChatStartupFrom.AutoFromRecommendList, markFrom: ChatStartupFrom.AutoFromRecommendList,
markReason: MarkAsNotSuitReason.JOB_CITY_NOT_SUIT, markReason: MarkAsNotSuitReason.JOB_CITY_NOT_SUIT,
extInfo: null, extInfo: null,
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -990,7 +993,8 @@ async function toRecommendPage (hooks) {
extInfo: { extInfo: {
chosenReasonInUi chosenReasonInUi
}, },
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -1007,7 +1011,8 @@ async function toRecommendPage (hooks) {
markFrom: ChatStartupFrom.AutoFromRecommendList, markFrom: ChatStartupFrom.AutoFromRecommendList,
markReason: MarkAsNotSuitReason.JOB_WORK_EXP_NOT_SUIT, markReason: MarkAsNotSuitReason.JOB_WORK_EXP_NOT_SUIT,
extInfo: null, extInfo: null,
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -1024,7 +1029,8 @@ async function toRecommendPage (hooks) {
extInfo: { extInfo: {
chosenReasonInUi chosenReasonInUi
}, },
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -1041,7 +1047,8 @@ async function toRecommendPage (hooks) {
markFrom: ChatStartupFrom.AutoFromRecommendList, markFrom: ChatStartupFrom.AutoFromRecommendList,
markReason: MarkAsNotSuitReason.JOB_NOT_SUIT, markReason: MarkAsNotSuitReason.JOB_NOT_SUIT,
extInfo: null, extInfo: null,
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -1059,7 +1066,8 @@ async function toRecommendPage (hooks) {
bossActiveTimeDesc: targetJobData.bossInfo.activeTimeDesc, bossActiveTimeDesc: targetJobData.bossInfo.activeTimeDesc,
chosenReasonInUi chosenReasonInUi
}, },
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -1078,7 +1086,8 @@ async function toRecommendPage (hooks) {
extInfo: { extInfo: {
salaryDesc: selectedJobData.salaryDesc, salaryDesc: selectedJobData.salaryDesc,
}, },
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -1096,7 +1105,8 @@ async function toRecommendPage (hooks) {
salaryDesc: selectedJobData.salaryDesc, salaryDesc: selectedJobData.salaryDesc,
chosenReasonInUi chosenReasonInUi
}, },
markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS markOp: MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
} }
) )
} catch { } catch {
@@ -1226,7 +1236,13 @@ async function toRecommendPage (hooks) {
throw new Error('STARTUP_CHAT_ERROR_WITH_UNKNOWN_ERROR') throw new Error('STARTUP_CHAT_ERROR_WITH_UNKNOWN_ERROR')
} }
} else { } else {
await hooks.newChatStartup?.promise(targetJobData, { chatStartupFrom: ChatStartupFrom.AutoFromRecommendList }) await hooks.newChatStartup?.promise(
targetJobData,
{
chatStartupFrom: ChatStartupFrom.AutoFromRecommendList,
jobSource: JobSource[computedSourceList[currentSourceIndex]?.type]
}
)
blockBossNotNewChat.add(targetJobData.jobInfo.encryptUserId) blockBossNotNewChat.add(targetJobData.jobInfo.encryptUserId)
await storeStorage(page).catch(() => void 0) await storeStorage(page).catch(() => void 0)
+6 -4
View File
@@ -245,7 +245,7 @@ export async function saveChatStartupRecord(
ds: DataSource, ds: DataSource,
_jobInfo, _jobInfo,
{ encryptUserId }, { encryptUserId },
{ autoStartupChatRecordId = undefined, chatStartupFrom = undefined } = {} { autoStartupChatRecordId = undefined, chatStartupFrom = undefined, jobSource = undefined } = {}
) { ) {
const { jobInfo } = _jobInfo; const { jobInfo } = _jobInfo;
@@ -256,7 +256,8 @@ export async function saveChatStartupRecord(
encryptCurrentUserId: encryptUserId, encryptCurrentUserId: encryptUserId,
encryptJobId: jobInfo.encryptId, encryptJobId: jobInfo.encryptId,
autoStartupChatRecordId, autoStartupChatRecordId,
chatStartupFrom chatStartupFrom,
jobSource,
} }
Object.assign(chatStartupLog, chatStartupLogPayload) Object.assign(chatStartupLog, chatStartupLogPayload)
@@ -270,7 +271,7 @@ export async function saveMarkAsNotSuitRecord(
ds: DataSource, ds: DataSource,
_jobInfo, _jobInfo,
{ encryptUserId }, { encryptUserId },
{ autoStartupChatRecordId = undefined, markFrom = undefined, extInfo = undefined, markReason = undefined, markOp = undefined } = {} { autoStartupChatRecordId = undefined, markFrom = undefined, extInfo = undefined, markReason = undefined, markOp = undefined, jobSource = undefined } = {}
) { ) {
const { jobInfo } = _jobInfo; const { jobInfo } = _jobInfo;
@@ -284,7 +285,8 @@ export async function saveMarkAsNotSuitRecord(
markFrom, markFrom,
markReason, markReason,
extInfo: extInfo ? JSON.stringify(extInfo) : undefined, extInfo: extInfo ? JSON.stringify(extInfo) : undefined,
markOp markOp,
jobSource,
} }
Object.assign(markAsNotSuitLog, markAsNotSuitLogPayload) Object.assign(markAsNotSuitLog, markAsNotSuitLogPayload)
+6 -4
View File
@@ -188,22 +188,24 @@ export default class SqlitePlugin {
await saveJobInfoFromRecommendPage(ds, _jobInfo); await saveJobInfoFromRecommendPage(ds, _jobInfo);
}); });
hooks.newChatStartup.tapPromise("SqlitePlugin", async (_jobInfo, { chatStartupFrom = ChatStartupFrom.AutoFromRecommendList } = {}) => { hooks.newChatStartup.tapPromise("SqlitePlugin", async (_jobInfo, { chatStartupFrom = ChatStartupFrom.AutoFromRecommendList, jobSource = undefined } = {}) => {
const ds = await this.initPromise; const ds = await this.initPromise;
return await saveChatStartupRecord(ds, _jobInfo, this.userInfo, { return await saveChatStartupRecord(ds, _jobInfo, this.userInfo, {
autoStartupChatRecordId: this.runRecordId, autoStartupChatRecordId: this.runRecordId,
chatStartupFrom chatStartupFrom,
jobSource
}); });
}); });
hooks.jobMarkedAsNotSuit.tapPromise("SqlitePlugin", async (_jobInfo, { markFrom = ChatStartupFrom.AutoFromRecommendList, markReason = undefined, extInfo = undefined, markOp = undefined } = {}) => { hooks.jobMarkedAsNotSuit.tapPromise("SqlitePlugin", async (_jobInfo, { markFrom = ChatStartupFrom.AutoFromRecommendList, markReason = undefined, extInfo = undefined, markOp = undefined, jobSource = undefined } = {}) => {
const ds = await this.initPromise; const ds = await this.initPromise;
return await saveMarkAsNotSuitRecord(ds, _jobInfo, this.userInfo, { return await saveMarkAsNotSuitRecord(ds, _jobInfo, this.userInfo, {
autoStartupChatRecordId: this.runRecordId, autoStartupChatRecordId: this.runRecordId,
markFrom, markFrom,
markReason, markReason,
extInfo, extInfo,
markOp markOp,
jobSource
}); });
}); });
} }