問題是您在過濾器的值後缺少逗號。以下是您的代碼的更正版本:
// ====================================================================================================
//
// Cloud Code for trignotif, write your code here to customise the GameSparks platform.
//
// For details of the GameSparks Cloud Code API see https://portal.gamesparks.net/docs.htm
//
// ====================================================================================================
var lat = Spark.getData().lat
var long = Spark.getData().long
SendNewNotification()
function SendNewNotification() {
var jsonBody = {
app_id: "asdf-safd-fasd-asfd-sadf",
filters: [{field: "location", radius: "5000", lat: lat, long: long}],
contents: {en: "5000 meters test NYC"}
};
var promise = Spark.getHttp("https://onesignal.com/api/v1/notifications").setHeaders({
"Content-Type": "application/json;charset=utf-8",
"Authorization": "Basic fasdasfd"
}).postJson(jsonBody);
return promise;
}
var response = SendNewNotification().getResponseJson();
Spark.setScriptData("response", response)
哇。我發現了一個不同的工作,但噢我的。 – wvPinky19wv
有點鹹。 ty男人 – wvPinky19wv