mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-07 00:17:17 +08:00
store job info when response
This commit is contained in:
@@ -97,6 +97,25 @@ export default class SqlitePlugin {
|
|||||||
userInfo = null
|
userInfo = null
|
||||||
|
|
||||||
apply(hooks) {
|
apply(hooks) {
|
||||||
|
hooks.pageGotten.tap(
|
||||||
|
'SqlitePlugin',
|
||||||
|
(page) => {
|
||||||
|
page.on('response', async (response) => {
|
||||||
|
const ds = await this.initPromise;
|
||||||
|
if (response.url().startsWith('https://www.zhipin.com/wapi/zpgeek/job/detail.json')) {
|
||||||
|
const data = await response.json()
|
||||||
|
if (data.code === 0) {
|
||||||
|
await saveJobInfoFromRecommendPage(await ds, data.zpData)
|
||||||
|
await saveJobHireStatusRecord(await ds, {
|
||||||
|
encryptJobId: data.zpData.jobInfo.encryptId,
|
||||||
|
hireStatus: JobHireStatus.HIRING,
|
||||||
|
lastSeenDate: new Date()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
hooks.userInfoResponse.tapPromise(
|
hooks.userInfoResponse.tapPromise(
|
||||||
"SqlitePlugin",
|
"SqlitePlugin",
|
||||||
async (userInfoResponse) => {
|
async (userInfoResponse) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user