|
@@ -16,6 +16,22 @@ class CloudObject{
|
|
|
get(key){
|
|
|
return this.data[key] || null
|
|
|
}
|
|
|
+ greaterThan(key,value){
|
|
|
+ if(!this.whereOptions[key]) this.whereOptions[key] = {}
|
|
|
+ this.whereOptions[key]["$gt"] = value
|
|
|
+ }
|
|
|
+ greaterThanAndEqualTo(key,value){
|
|
|
+ if(!this.whereOptions[key]) this.whereOptions[key] = {}
|
|
|
+ this.whereOptions[key]["$gte"] = value
|
|
|
+ }
|
|
|
+ lessThan(key,value){
|
|
|
+ if(!this.whereOptions[key]) this.whereOptions[key] = {}
|
|
|
+ this.whereOptions[key]["$lt"] = value
|
|
|
+ }
|
|
|
+ lessThanAndEqualTo(key,value){
|
|
|
+ if(!this.whereOptions[key]) this.whereOptions[key] = {}
|
|
|
+ this.whereOptions[key]["$lte"] = value
|
|
|
+ }
|
|
|
// 更新
|
|
|
async save(){
|
|
|
let method = "POST"
|
|
@@ -36,13 +52,13 @@ class CloudObject{
|
|
|
"credentials": "omit"
|
|
|
});
|
|
|
let result = await response?.json();
|
|
|
- if(result?.objectId){this,id = result?.objectId}
|
|
|
+ if(result?.objectId){this.id = result?.objectId}
|
|
|
return this
|
|
|
}
|
|
|
// 删除
|
|
|
async destory(){
|
|
|
if(!this.id) return
|
|
|
- let response = await fetch("http://dev.fmode.cn:1337/parse/classes/ChatPartner/"+this.id, {
|
|
|
+ let response = await fetch("http://dev.fmode.cn:1337/parse/classes/"+this.id, {
|
|
|
"headers": {
|
|
|
"x-parse-application-id": "dev"
|
|
|
},
|
|
@@ -67,22 +83,6 @@ class CloudQuery{
|
|
|
|
|
|
}
|
|
|
whereOptions = {}
|
|
|
- greaterThan(key,value){
|
|
|
- if(!this.whereOptions[key]) this.whereOptions[key] = {}
|
|
|
- this.whereOptions[key]["$gt"] = value
|
|
|
- }
|
|
|
- greaterThanAndEqualTo(key,value){
|
|
|
- if(!this.whereOptions[key]) this.whereOptions[key] = {}
|
|
|
- this.whereOptions[key]["$gte"] = value
|
|
|
- }
|
|
|
- lessThan(key,value){
|
|
|
- if(!this.whereOptions[key]) this.whereOptions[key] = {}
|
|
|
- this.whereOptions[key]["$lt"] = value
|
|
|
- }
|
|
|
- lessThanAndEqualTo(key,value){
|
|
|
- if(!this.whereOptions[key]) this.whereOptions[key] = {}
|
|
|
- this.whereOptions[key]["$lte"] = value
|
|
|
- }
|
|
|
equalTo(key,value){
|
|
|
this.whereOptions[key] = value
|
|
|
}
|
|
@@ -122,4 +122,6 @@ class CloudQuery{
|
|
|
}
|
|
|
first(){ // 只查询第一项
|
|
|
}
|
|
|
-}
|
|
|
+}
|
|
|
+module.exports.CloudObject = CloudObject
|
|
|
+module.exports.CloudQuery = CloudQuery
|