我正在嘗試創建一個解析雲代碼函數,該函數將運行查詢,然後將查詢結果放入csv文件,最後使用mailgun插件將其發送給RECEIPIENT。在解析雲代碼中保存或創建解析文件
不幸的是我無法弄清楚如何在雲代碼中創建一個分析文件。建議?
Parse.cloud.define("exportDataViaEmail", function(request, response){
var query = new Parse.Query("Diaper");
var today = new Date();
var startTime = new Date(today - 1000 * 60 * 60 * 24 * (7*52+1));
query.lessThan("logCreationDate", today);
query.greaterThan("logCreationDate", startTime);
query.find({
success: {
//TODO I want store this in a Parse File but how?
},
error :{
}
});
})
/*
* Send email via mailgun
*/
Parse.Cloud.define("sendEmail", function(request, response){
Mailgun.sendEmail({
to: "[email protected]",
from: "[email protected]",
subject: "Hello From example App",
text: "Using Parse and Mailgun is great!"
}, {
success: function(httpResponse) {
console.log(httpResponse);
response.success("Email sent!");
},
error: function(httpResponse) {
console.error(httpResponse);
response.error("Uh oh, something went wrong");
}
});
})
一樣簡單。讓別人爲他們工作並找出他們已經嘗試的東西從來沒有樂趣 – soulshined
看到待辦事項部分..我找不到Parse.File或機制來創建Parse文件 – rOrlig