1. Node 12.13.0 (node –version)

2. vs2019 16.8.3 以上

3. (没用到nodejs第三方插件情况无需安装)在根目录下面创建node_modules文件夹,然后cmd切换到node_modules,执行 npm install request


const dayjs = require('../../Plugins/dayjs/dayjs.min.js');
const request = require('request');
//const request = require('../../Plugins/request/request');

//var crypto = require('crypto');
// crypto.createHash('md5').update(plaintext).digest("hex");
module.exports = async function (callback, result, params, args) {
    let resultT = JSON.parse(result);
    let resultN = {};
    if (resultT.error_code === "00") {
        resultN.success = true;

        resultN.data = {};

        for (let key in resultT.data) {
            resultN.data[key] = resultT.data[key];
            resultN.data[dayjs.unix(key).format('YYYY-MM-DD HH')] = resultT.data[key];
        }

        resultN.success = true;

    } else {
        resultN.success = false;
        resultN.error = { error_text: resultT["err_msg"], error_code: resultT["err_code"] };
    }
    try {
        let url = "http://{ip}/api/v2/auth/sso/login";
        let dataP = {
            "userId": "19",
            "account": "账号",
            "userName": "用户名",
            "password": "密码"
        }

        request({
            url: url,
            method: "POST",
            json: true,
            headers: {
                "content-type": "application/json",
            },
            body: dataP
        }, function (error, response, body) {
            //if (!error && response.statusCode === 200) {
            //    resultN, r = response;
            //    callback(null, resultN);
            //} else {

            //    callback(null, resultN);
            //}
            resultN.r = response;
            callback(null, resultN);
        });

    } catch (e) {
        if (!resultN.error) resultN.error = {};
        resultN.error.error_text_web = e;
        resultN.success = false;
        callback(null, resultN);
    }
};
文档更新时间: 2021-07-04 08:00   作者:admin