mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-09 09:27:07 +08:00
add jobDetailRegExpMatchLogic option related flow in core script
This commit is contained in:
@@ -16,7 +16,7 @@ import { calculateTotalCombinations, combineFiltersWithConstraintsGenerator } fr
|
|||||||
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 } from '@geekgeekrun/sqlite-plugin/dist/enums'
|
import { MarkAsNotSuitReason, MarkAsNotSuitOp, StrategyScopeOptionWhenMarkJobNotMatch, SalaryCalculateWay, JobDetailRegExpMatchLogic } 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 = {}
|
||||||
@@ -99,6 +99,8 @@ const expectWorkExpList = readConfigFile('boss.json').expectWorkExpList ?? []
|
|||||||
const expectWorkExpNotMatchStrategy = readConfigFile('boss.json').expectWorkExpNotMatchStrategy ?? MarkAsNotSuitOp.NO_OP
|
const expectWorkExpNotMatchStrategy = readConfigFile('boss.json').expectWorkExpNotMatchStrategy ?? MarkAsNotSuitOp.NO_OP
|
||||||
const strategyScopeOptionWhenMarkJobWorkExpNotMatch = readConfigFile('boss.json').strategyScopeOptionWhenMarkJobWorkExpNotMatch ?? StrategyScopeOptionWhenMarkJobNotMatch.ONLY_COMPANY_MATCHED_JOB
|
const strategyScopeOptionWhenMarkJobWorkExpNotMatch = readConfigFile('boss.json').strategyScopeOptionWhenMarkJobWorkExpNotMatch ?? StrategyScopeOptionWhenMarkJobNotMatch.ONLY_COMPANY_MATCHED_JOB
|
||||||
|
|
||||||
|
let jobDetailRegExpMatchLogic = readConfigFile('boss.json').jobDetailRegExpMatchLogic ?? JobDetailRegExpMatchLogic.EVERY
|
||||||
|
|
||||||
const markAsNotActiveSelectedTimeRange = (() => {
|
const markAsNotActiveSelectedTimeRange = (() => {
|
||||||
let n = readConfigFile('boss.json').markAsNotActiveSelectedTimeRange
|
let n = readConfigFile('boss.json').markAsNotActiveSelectedTimeRange
|
||||||
if (
|
if (
|
||||||
@@ -132,6 +134,16 @@ if (
|
|||||||
expectJobDescRegExpStr = expectJobRegExpStr
|
expectJobDescRegExpStr = expectJobRegExpStr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
[
|
||||||
|
expectJobNameRegExpStr,
|
||||||
|
expectJobTypeRegExpStr,
|
||||||
|
expectJobDescRegExpStr,
|
||||||
|
].map(it => Boolean(it?.trim())).every(it => !it)
|
||||||
|
) {
|
||||||
|
jobDetailRegExpMatchLogic = JobDetailRegExpMatchLogic.EVERY
|
||||||
|
}
|
||||||
|
|
||||||
const localStoragePageUrl = `https://www.zhipin.com/desktop/`
|
const localStoragePageUrl = `https://www.zhipin.com/desktop/`
|
||||||
const recommendJobPageUrl = `https://www.zhipin.com/web/geek/jobs`
|
const recommendJobPageUrl = `https://www.zhipin.com/web/geek/jobs`
|
||||||
|
|
||||||
@@ -262,8 +274,8 @@ async function markJobAsNotSuitInRecommendPage (reasonCode) {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
export function testIfJobTitleOrDescriptionSuit (jobInfo) {
|
export function testIfJobTitleOrDescriptionSuit (jobInfo, matchLogic) {
|
||||||
let isJobNameSuit = true
|
let isJobNameSuit = matchLogic === JobDetailRegExpMatchLogic.SOME ? false : true
|
||||||
try {
|
try {
|
||||||
if (expectJobNameRegExpStr.trim()) {
|
if (expectJobNameRegExpStr.trim()) {
|
||||||
const regExp = new RegExp(expectJobNameRegExpStr, 'i')
|
const regExp = new RegExp(expectJobNameRegExpStr, 'i')
|
||||||
@@ -271,7 +283,7 @@ export function testIfJobTitleOrDescriptionSuit (jobInfo) {
|
|||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
let isJobTypeSuit = true
|
let isJobTypeSuit = matchLogic === JobDetailRegExpMatchLogic.SOME ? false : true
|
||||||
try {
|
try {
|
||||||
if (expectJobTypeRegExpStr.trim()) {
|
if (expectJobTypeRegExpStr.trim()) {
|
||||||
const regExp = new RegExp(expectJobTypeRegExpStr, 'i')
|
const regExp = new RegExp(expectJobTypeRegExpStr, 'i')
|
||||||
@@ -279,7 +291,7 @@ export function testIfJobTitleOrDescriptionSuit (jobInfo) {
|
|||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
let isJobDescSuit = true
|
let isJobDescSuit = matchLogic === JobDetailRegExpMatchLogic.SOME ? false : true
|
||||||
try {
|
try {
|
||||||
if (expectJobDescRegExpStr.trim()) {
|
if (expectJobDescRegExpStr.trim()) {
|
||||||
const regExp = new RegExp(expectJobDescRegExpStr, 'i')
|
const regExp = new RegExp(expectJobDescRegExpStr, 'i')
|
||||||
@@ -287,7 +299,12 @@ export function testIfJobTitleOrDescriptionSuit (jobInfo) {
|
|||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
|
if (matchLogic === JobDetailRegExpMatchLogic.SOME) {
|
||||||
|
return isJobNameSuit || isJobTypeSuit || isJobDescSuit
|
||||||
|
}
|
||||||
|
else {
|
||||||
return isJobNameSuit && isJobTypeSuit && isJobDescSuit
|
return isJobNameSuit && isJobTypeSuit && isJobDescSuit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setFilterCondition (selectedFilters) {
|
async function setFilterCondition (selectedFilters) {
|
||||||
@@ -938,7 +955,7 @@ async function toRecommendPage (hooks) {
|
|||||||
notSuitReasonIdToStrategyMap.workExp = expectWorkExpNotMatchStrategy
|
notSuitReasonIdToStrategyMap.workExp = expectWorkExpNotMatchStrategy
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
!testIfJobTitleOrDescriptionSuit(targetJobData.jobInfo)
|
!testIfJobTitleOrDescriptionSuit(targetJobData.jobInfo, jobDetailRegExpMatchLogic)
|
||||||
) {
|
) {
|
||||||
notSuitReasonIdToStrategyMap.jobDetail = jobNotMatchStrategy
|
notSuitReasonIdToStrategyMap.jobDetail = jobNotMatchStrategy
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user