我有这个脚本,我每天都可以运行一次,但是每天结束时,我都会收到Google的一封电子邮件,称该脚本无法运行1440次。该脚本可以正常工作,但是我不知道如果时间不是17:00,如何结束脚本
function stockBot() {
var date = new Date();
var day = date.getDay();
var hrs = date.getHours();
var min = date.getMinutes();
if ((hrs >= 17) && (hrs <= 17) && (min >= 0) && (min <= 0 ))
// select the range from the Summary sheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Stock-Bot-Order");
// MAGHERAFELT List
var range = sheet.getRange(3,4,1,1).getValues();
var user = "Magherafelt";
// loop over range and send communication if "Yes" option chosen
for (var i = 0; i < range.length; i++) {
if (range[i][0] != "") {
// post message to slack
sendToSlack(range[i],user);
break;
};
}
// function to send message to Slack
function sendToSlack(item,user) {
// custom slack webhook
var url = "private";
var payload = {
"channel": "#stock-requests",
"icon_emoji": ":package:",
"link_names": 1,
"username" : user+" Stock Order",
"text": item[0]
};
var options = {
"method": "post",
"contentType": "application/json",
"payload": JSON.stringify(payload)
};
return UrlFetchApp.fetch(url,options);
}
答案 0 :(得分:0)
用于比较时间的逻辑语句看起来像是这里的错误源(第6行)。尝试更改为以下内容:
CREATE (`mediawiki-1.27`:Schema { key:'mediawiki-1.27', name:'mediawiki-1.27'})