Commit 3fd93875 by lixinming

no message

parent 70b7d73d
import { awaitData } from "../biz/dataInit";
import { OPERATIONALDATATYPE, TABLENAME } from "../config/enum/dbEnum";
import { selectData } from "./operationalData";
import { updateQCCDataTask } from "../biz/qccInit";
// 初始化数据文件结构
async function initDataFile() {
let enterpriseList = await selectData(OPERATIONALDATATYPE.查询多个, TABLENAME.企业基础信息表, {}, ["eId", "uscc", "enterpriseName"]);
let currentData = {};
let usccData = await awaitData("91310115MADM8EA654");
currentData["91310115MADM8EA654"] = usccData;
for (let i = 0; i < enterpriseList.length; i++) {
let info = enterpriseList[i];
console.log("开始同步企查查数据");
let usccData = await awaitData(info.uscc);
currentData[info.uscc] = usccData;
console.log(`${info.enterpriseName} 同步成功, eId:${info.eId},下标 ${i}`);
}
console.log("刷新缓存数据结束")
}
/** /**
...@@ -28,9 +7,9 @@ async function initDataFile() { ...@@ -28,9 +7,9 @@ async function initDataFile() {
* 设置定时器,每天刷新一次数据 * 设置定时器,每天刷新一次数据
*/ */
export async function initApiDataStorage() { export async function initApiDataStorage() {
await initDataFile(); await updateQCCDataTask();
setInterval(async function () { setInterval(async function () {
await initDataFile(); await updateQCCDataTask();
}, 3600 * 1000 * 24); }, 3600 * 1000 * 24);
} }
......
...@@ -9,7 +9,7 @@ async function lanuch() { ...@@ -9,7 +9,7 @@ async function lanuch() {
httpServer.createServer(systemConfig.port); httpServer.createServer(systemConfig.port);
console.log('This indicates that the server is started successfully.'); console.log('This indicates that the server is started successfully.');
// await initApiDataStorage(); await initApiDataStorage();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment