| Line 6... |
Line 6... |
| 6 |
from dtr.main import client
|
6 |
from dtr.main import client
|
| 7 |
from dtr.utils.utils import sendNotification
|
7 |
from dtr.utils.utils import sendNotification
|
| 8 |
def main():
|
8 |
def main():
|
| 9 |
#scrapepaytm()
|
9 |
#scrapepaytm()
|
| 10 |
db = client.Dtr
|
10 |
db = client.Dtr
|
| 11 |
|
11 |
|
| 12 |
batchId = db.refund.findOne({"$query":{},"$orderby":{"batch":-1}}).get("batch")
|
12 |
batchId = db.refund.find_one({"$query":{},"$orderby":{"batch":-1}}).get("batch")
|
| - |
|
13 |
print "Batch Id recently Credited", batchId
|
| 13 |
if batchId is None:
|
14 |
if batchId is None:
|
| 14 |
return
|
15 |
return
|
| 15 |
refunds = db.refund.find({"batch":batchId})
|
16 |
refunds = db.refund.find({"batch":batchId})
|
| 16 |
#refunds = [{"timestamp" : "2015-04-14 00:00:02", "userId" : 2, "batch" : 1428949802, "userAmount" : 847 }]
|
- |
|
| 17 |
sendNotification([8], 'Batch Credit', 'Cashback Credited', 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(8))
|
17 |
sendNotification([8], 'Batch Credit', 'Cashback Credited', 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(8))
|
| 18 |
sendNotification([14], 'Batch Credit', 'Cashback Credited', 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(14))
|
18 |
sendNotification([14], 'Batch Credit', 'Cashback Credited', 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(14))
|
| 19 |
for ref in refunds:
|
19 |
for ref in refunds:
|
| 20 |
print ref.get("userId"), ref.get("userAmount")
|
20 |
print ref.get("userId"), ref.get("userAmount")
|
| 21 |
#sendNotification([ref.get("userId")], 'Batch Credit', 'Cashback Credited', 'Rs.%s has been added to your wallet'%(ref.get("userAmount")), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(ref.get("userId")))
|
21 |
sendNotification([ref.get("userId")], 'Batch Credit', 'Cashback Credited', 'Rs.%s has been added to your wallet'%(int(ref.get("userAmount"))), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(ref.get("userId")))
|
| 22 |
pass
|
22 |
pass
|
| 23 |
|
23 |
|
| 24 |
if __name__ == '__main__':
|
24 |
if __name__ == '__main__':
|
| 25 |
main()
|
25 |
main()
|
| 26 |
|
26 |
|