//tag规则 release-v188.22.*

const TaskBase = require("../../task.base");
const system = require("../../../system");
var settings = require("../../../../config/settings");
class TmMonitorRiskTask extends TaskBase {
    constructor() {
        super(TaskBase.getServiceName(TmMonitorRiskTask));
        this.restclient = system.getObject("util.restClient");
    }
    /**
     * 每2分钟检查一次
     * @param {*} taskName
     */
    formatedTaskName (taskName) {
        console.log("formatedTaskName", taskName)
        return taskName + "|i|5"
    }
    async subDoTask () {
        console.log("--------------");
        console.log("TestTask1.....");
        try {
            let urldev = "https://oapidev.gongsibao.com/open-task/"+ "api/action/tmMonitor/getRisk";
            let urlprod = "https://oapi.gongsibao.com/open-task/"+ "api/action/tmMonitor/getRisk";
            for (let i = 1; i < 4; i++) {
                let obj = {
                    "monitorType": i.toString()
                }
                this.restclient.execPost(obj, urldev);
                this.restclient.execPost(obj, urlprod);

            }
            return system.getResultSuccess();
        } catch (error) {
            console.log(error);
            return null;
        }
    }
}
module.exports = TmMonitorRiskTask;
