gpt4 book ai didi

ios - 同时应用过滤器和排序 firebase

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:54:15 25 4
gpt4 key购买 nike

<分区>

我的 firebase json 树是这样的

{
"-KZVOY6qU29fJlRSwRNo" : {
"fedStateDetails" : "Fasted",
"targetkcal" : 596,
"timestamp" : 1.482307285673975E9,
"userid" : "816",
"workout_id" : "123"
},
"-KZVSmeW94XetROs0nsN" : {
"fedStateDetails" : "Fasted",
"targetkcal" : 1874,
"timestamp" : 1.482308270356936E9,
"userid" : "47",
"workout_id" : "129"
},
"-KZWGdx-j1q7J37x0wck" : {
"fedStateDetails" : "Fasted",
"targetkcal" : 0,
"timestamp" : 1.482321866382767E9,
"userid" : "47",
"workout_id" : "40"
}
}

所以我需要的是让那些“userid”为 47 且“timestamp”在给定范围之间的用户,我的代码如下所示。

let startTime = Date().timeIntervalSince1970 - 10800.0
let endTime = Date().timeIntervalSince1970
self.dbRef.child(FireBaseTable.workOutInfoTable)
.queryOrdered(byChild: "timestamp")
.queryStarting(atValue: startTime, childKey: "timestamp")
.queryEnding(atValue: endTime, childKey: "timestamp")
.queryEqual(toValue: "47")
.observe(.value) { (snapshot1 :FIRDataSnapshot?) in
if let value : Dictionary<String,AnyObject> = snapshot1?.value as? Dictionary<String,AnyObject>
{
print("*********")
print(value)
}
}

但是我不能同时应用两个 order by。请帮忙。提前致谢。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com