本文整理汇总了TypeScript中parse.Parse.Query.descending方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Parse.Query.descending方法的具体用法?TypeScript Parse.Query.descending怎么用?TypeScript Parse.Query.descending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parse.Parse.Query
的用法示例。
在下文中一共展示了Parse.Query.descending方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: userIsBack
userIsBack(user:any) : any
{
var today = new Date();
var tommorrow = new Date();
today.setHours(0,0,0,0);
tommorrow.setDate(today.getDate()+1);
tommorrow.setHours(0,0,0,0);
var ParseClass = Parse.Object.extend("Users");
var query = new Parse.Query(ParseClass);
query.equalTo("User", user);
query.greaterThan("createdAt", today);
query.lessThan("createdAt", tommorrow);
query.descending("createdAt");
query.find({
success: (query:any) => {
var objectId = query[0].id;
ParseClass = Parse.Object.extend("Users");
var update = new Parse.Query(ParseClass);
update.get(objectId, {
success: (update:any)=> {
update.set("Time", 0);
update.save();
},
error: (object:any, error:any) => {
}
});
},
error: (object:any, error:any) => {
}
});
}
示例2: checkIsAbscent
checkIsAbscent(messageSender:any, user:any): any{
var today = new Date();
var tommorrow = new Date();
today.setHours(0,0,0,0);
tommorrow.setDate(today.getDate()+1);
tommorrow.setHours(0,0,0,0);
var Class = Parse.Object.extend("Users");
var query = new Parse.Query(Class);
query.equalTo("User", user);
query.greaterThan("createdAt", today);
query.lessThan("createdAt", tommorrow);
query.descending("createdAt");
query.find({
success: (result:any) => {
var format = result[0].attributes.Format;
if(format == 'min')
{
today = new Date();
var abscenceStartTime = result[0].createdAt;
var abscenceEndTime = this.addMinutes(abscenceStartTime,result[0].attributes.Time);
if(today> abscenceStartTime && today<abscenceEndTime)
{
var date = new Date(abscenceEndTime.toString());
messageSender.send( result[0].attributes.User + " is abscent, will be back around " + moment(date).format('h:mm A'));
}
}else if(format == 'hour')
{
today = new Date();
var abscenceStartTime = result[0].createdAt;
var abscenceEndTime = this.addHours(abscenceStartTime,result[0].attributes.Time);
if(today> abscenceStartTime && today<abscenceEndTime)
{
var date = new Date(abscenceEndTime.toString());
messageSender.send(result[0].attributes.User + " is abscent, will be back around " + moment(date).format('h:mm A'));
}
}else if(format == 'day')
{
}
},
error: (error:any) => {
console.log(error.message);
}
});
}