我试图根据id给出匹配网址,因为我不知道给定的id是对象id / title / shorturl代码。
var promises = [];
var id = request.params.id;
//short url
queryShortUrl = new Parse.Query("books");
queryShortUrl.limit = 1;
queryShortUrl.equalTo('shortURLcode',id);
promises.push(queryShortUrl.find());
//title
queryTitle = new Parse.Query("books");
queryTitle.limit = 1;
queryTitle.equalTo('bookTitle',id);
promises.push(queryNickname.find());
//objectId
queryObjectId = new Parse.Query("books");
promises.push(queryObjectId.get(request.params.genuid));
// run these
Parse.Promise.when(promises).then(function() {
console.log('res');
response.success(arguments);
})