Advertisement
Guest User

Check withdraw (new)

a guest
Jan 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. app.get("/withdraw", ensureAuthenticated, function(req, res){
  2. var token = req.get("Authorization")
  3. , decoded = jwt.verify(token, secret)
  4. , steamId = decoded.steamid;
  5.  
  6. Mongo.query("withdraws", {"userId": steamId}, function(withdrawResult){
  7.  
  8. if(withdrawResult.length > 0){
  9.  
  10. var timestamp = new Date(withdrawResult[0]._created);
  11. var timestamp = new Date(timestamp.getTime() + 15*60000);
  12. var timestampObj = countTime(timestamp);
  13.  
  14. console.log(timestampObj);
  15.  
  16. if(timestampObj.minutes > 0){
  17. res.json({"successfull": false, "time": withdrawResult[0]._created});
  18. res.end();
  19. }else{
  20. res.json({"successfull": true});
  21. res.end();
  22. }
  23. }else{
  24. res.json({"successfull": true});
  25. res.end();
  26. }
  27. }, {"_created": -1});
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement