/**
 * 系统任务逻辑
 * 作者:李欣鸣
 * 目前下发任务有 
 * 1: 每月1日0时0分，下发孵化器任务
 * 
 */

import { findTaskCountByKey } from "../data/fuHuaQi/task";
import { getTimeKey } from "../util/tools";
import { provideTask } from "./fuHuqQi/task";

export function initSystemTask() {
    fuHuaQiTask();
    setInterval(async function () {
        await fuHuaQiTask();
    }, 3600 * 1000);
    console.log(`systemTask init success`);
}

async function fuHuaQiTask() {
    const Key = getTimeKey();
    let count = await findTaskCountByKey(Key);
    if (count != 0) return;

    await provideTask();
}



