mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-07-12 16:01:38 +08:00
add the feature when startup chat in LAUNCH_BOSS_SITE recommend, save the startup record
This commit is contained in:
@@ -15,7 +15,7 @@ import { VChatStartupLog } from "./entity/VChatStartupLog";
|
||||
|
||||
import sqlite3 from 'sqlite3';
|
||||
import * as cliHighlight from 'cli-highlight';
|
||||
import { saveJobInfoFromRecommendPage } from "./handlers";
|
||||
import { saveChatStartupRecord, saveJobInfoFromRecommendPage } from "./handlers";
|
||||
Boolean(cliHighlight);
|
||||
|
||||
export function initDb(dbFilePath) {
|
||||
@@ -76,26 +76,12 @@ export default class SqlitePlugin {
|
||||
|
||||
hooks.jobDetailIsGetFromRecommendList.tapPromise("SqlitePlugin", async (_jobInfo) => {
|
||||
const ds = await this.initPromise;
|
||||
saveJobInfoFromRecommendPage(ds, _jobInfo);
|
||||
await saveJobInfoFromRecommendPage(ds, _jobInfo);
|
||||
});
|
||||
|
||||
hooks.newChatStartup.tapPromise("SqlitePlugin", async (_jobInfo) => {
|
||||
const { jobInfo } = _jobInfo;
|
||||
|
||||
//#region chat-startup-log
|
||||
const chatStartupLog = new ChatStartupLog()
|
||||
const chatStartupLogPayload: Partial<ChatStartupLog> = {
|
||||
date: new Date(),
|
||||
encryptCurrentUserId: this.userInfo.encryptUserId,
|
||||
encryptJobId: jobInfo.encryptId,
|
||||
}
|
||||
Object.assign(chatStartupLog, chatStartupLogPayload)
|
||||
|
||||
const ds = await this.initPromise;
|
||||
const chatStartupLogRepository = ds.getRepository(ChatStartupLog);
|
||||
await chatStartupLogRepository.save(chatStartupLog);
|
||||
//#endregion
|
||||
return
|
||||
return await saveChatStartupRecord(ds, _jobInfo, this.userInfo);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user