为什么通过日期筛选云数据库记录返回空?
我想通过日期筛选数据库记录,但是筛选出的结果总是空?我很确定数据库中存在符合条件的记录 loadRank_db: function(date,matchName){
const startOfYear = new Date(`${date}-01-01T00:00:00.000Z`).getTime()/1000; // UTC时间,2024年第一天开始
const endOfYear = (new Date(`${parseInt(date) + 1}-01-01T00:00:00.000Z`).getTime()-1)/1000; // UTC时间,下一年第一天开始的前一刻
console.log(startOfYear)
console.log(endOfYear)
db.collection("matchInfo").where({
matchTime:db.command.gte(startOfYear).and(db.command.lt(endOfYear)),
event_name: matchName
}).get({
success: res=>{
console.log(res.date)
db.collection("team_match_participate").where({match_id:res.data.match_id}).get({
success:res=>{
db.collection("team").where({team_id:res.data.team_id}).orderBy("score","asc").get({
success:res=>{
let itemWithIndex = res.data.map((item, index) => ({
rank: index+1,
team: item.team_name,
gamePlayed: item.match_num,
win: item.vic_num,
draw: item.draw_num,
lose: item.lose_num,
gs_ga: `${item.goal_num}/${item.fumble_num}`,
points: item.score
}));
this.setData({
listRank:itemWithIndex
})
}
})
}
})
}
})
},