kk
This commit is contained in:
parent
36d98298b1
commit
85d91de996
10
db.js
10
db.js
@ -20,14 +20,14 @@ module.exports = function(name){
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.db = dbc(name);
|
this.db = dbc(name);
|
||||||
|
|
||||||
this.get_chat = function(obj){
|
this.get_chat = function(cid){
|
||||||
|
|
||||||
return new Promise((resolve, reject)=>{
|
return new Promise((resolve, reject)=>{
|
||||||
let res = this.db.get("chats").find({ id: obj.chat_id }).value();
|
let res = this.db.get("chats").find({id:cid}).value();
|
||||||
if(res) return resolve(res);
|
if(res) return resolve(res);
|
||||||
|
|
||||||
this.db.get("chats").push({ id:obj.chat_id, lang: 0, geo:{lon:0,lat:0}}).write();
|
this.db.get("chats").push({id:cid, tracking:[]}).write();
|
||||||
res = this.db.get("chats").find({ id: obj.chat_id }).value();
|
res = this.db.get("chats").find({id:cid}).value();
|
||||||
if(res) return resolve(res);
|
if(res) return resolve(res);
|
||||||
|
|
||||||
return reject({error:true, msg:"Error With DB..."});
|
return reject({error:true, msg:"Error With DB..."});
|
||||||
@ -48,7 +48,7 @@ module.exports = function(name){
|
|||||||
|
|
||||||
this.get_v = function(cid){
|
this.get_v = function(cid){
|
||||||
return new Promise((resolve, reject)=>{
|
return new Promise((resolve, reject)=>{
|
||||||
resolve(this.db.find({id:cid}).get('tracking').value());
|
resolve(this.db.find({id:cid}).value().tracking);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user