Update add log wiki
This commit is contained in:
parent
64e2046402
commit
55b52e2ea9
|
|
@ -14,3 +14,12 @@ export const checkSpecialVersion = (paragraph: string): string => {
|
|||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
export const checkDateWiki = (logString:string) => {
|
||||
const now = new Date();
|
||||
const currentDate = `ngay ${String(now.getDate()).padStart(2, "0")}/${String(now.getMonth() + 1).padStart(2, "0")}/${now.getFullYear()}`;
|
||||
|
||||
const lines = logString.split("<br/>").slice(0,3);
|
||||
const lineDate = lines?.length > 1 ? lines[1] : ""
|
||||
return lineDate === currentDate
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ import { sendDeviceInfora } from "App/utils/sendDeviceInfor";
|
|||
import InfoDevice from "App/Models/InfoDevice";
|
||||
import LogReport from "App/Models/LogReport";
|
||||
import Cache from "@ioc:Kaperskyguru/Adonis-Cache";
|
||||
import { checkDateWiki } from "App/utils/helper";
|
||||
const util = require("util");
|
||||
const exec = util.promisify(require("child_process").exec);
|
||||
const { DocumentProcessorServiceClient } =
|
||||
|
|
@ -407,7 +408,10 @@ License: ${license ?? ""}
|
|||
const oldContent = pageJson.query.pages[pageId]?.revisions?.[0]?.['*'] ?? ''
|
||||
|
||||
// nối nội dung mới vào
|
||||
const newText = `${text}\n\n${oldContent}`
|
||||
const now = new Date();
|
||||
const lineDate = `${String(now.getDate()).padStart(2, "0")}/${String(now.getMonth() + 1).padStart(2, "0")}/${now.getFullYear()}`;
|
||||
const scopeDate = `-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*<br/>ngay ${lineDate}<br/>-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*<br/><br/>`
|
||||
const newText = `${scopeDate}${text}\n\n${checkDateWiki(oldContent) ? oldContent.replace(scopeDate, "") : oldContent}`
|
||||
|
||||
// ============ EDIT PAGE ============
|
||||
const formData = new FormData()
|
||||
|
|
|
|||
Loading…
Reference in New Issue