forked from Liquid-w/JD_tencent_scf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lxk0301
committed
Nov 25, 2020
1 parent
cdb10e1
commit 24c3969
Showing
1 changed file
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} | ||
} |