From 24c3969f9db9f51a4a0012e5db9e226d2ad28261 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Wed, 25 Nov 2020 11:28:30 +0800 Subject: [PATCH] update --- index.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/index.js b/index.js index 3dcf74d4..be67f302 100644 --- a/index.js +++ b/index.js @@ -1,26 +1,26 @@ //'use strict'; exports.main_handler = async (event, context, callback) => { try { - //如果想在一个定时触发器里面执行多个js文件需要在定时触发器的【附加信息】里面填写对应的名称,用 & 链接 - //例如我想一个定时触发器里执行jd_speed.js和jd_bean_change.js,在定时触发器的【附加信息】里面就填写 jd_speed&jd_bean_change - for (const v of event["Message"].split("&")) { - console.log(v); - var request = require('request'); - //1.执行自己上传的js文件 - //delete require.cache[require.resolve('./'+v+'.js')]; - //require('./'+v+'.js') - - //2.执行国内gitee远端js文件如果部署,在国内节点,选择1或2的方式 - //request('https://gitee.com/lxk0301/jd_scripts/raw/master/'+v+'.js', function (error, response, body) { - // eval(response.body) - //}) + //如果想在一个定时触发器里面执行多个js文件需要在定时触发器的【附加信息】里面填写对应的名称,用 & 链接 + //例如我想一个定时触发器里执行jd_speed.js和jd_bean_change.js,在定时触发器的【附加信息】里面就填写 jd_speed&jd_bean_change + for (const v of event["Message"].split("&")) { + console.log(v); + var request = require('request'); + //1.执行自己上传的js文件 + //delete require.cache[require.resolve('./'+v+'.js')]; + //require('./'+v+'.js') - //3.执行github远端的js文件 - request('https://raw.githubusercontent.com/lxk0301/jd_scripts/master/'+v+'.js', function (error, response, body) { - eval(response.body) - }) - } - } catch (e) { + //2.执行国内gitee远端js文件如果部署,在国内节点,选择1或2的方式 + //request('https://gitee.com/lxk0301/jd_scripts/raw/master/'+v+'.js', function (error, response, body) { + // eval(response.body) + //}) + + //3.执行github远端的js文件(因github的raw类型的文件被墙,此方法云函数非) + request('https://raw.githubusercontent.com/lxk0301/jd_scripts/master/' + v + '.js', function (error, response, body) { + eval(response.body) + }) + } + } catch (e) { console.error(e) - } + } }