| Line 7... |
Line 7... |
| 7 |
user_actions, Brands, app_offers, approved_app_transactions, user_app_cashbacks, \
|
7 |
user_actions, Brands, app_offers, approved_app_transactions, user_app_cashbacks, \
|
| 8 |
user_app_installs, appmasters, notification_campaigns
|
8 |
user_app_installs, appmasters, notification_campaigns
|
| 9 |
from dtr.storage.MemCache import MemCache
|
9 |
from dtr.storage.MemCache import MemCache
|
| 10 |
from dtr.utils.MailSender import Email
|
10 |
from dtr.utils.MailSender import Email
|
| 11 |
from dtr.utils.utils import to_java_date, CB_PENDING, CB_APPROVED, CB_INIT, \
|
11 |
from dtr.utils.utils import to_java_date, CB_PENDING, CB_APPROVED, CB_INIT, \
|
| 12 |
to_py_date, CB_REJECTED, SUB_CATEGORY_MAP,CREDIT_TYPE_REFUND,CREDIT_TYPE_OFFER,CREDIT_TYPE_ADJUSTMENT,REFUND_ADJUSTMENT_MAP, todict,REVERSE_SOURCE_MAP
|
12 |
to_py_date, CB_REJECTED, SUB_CATEGORY_MAP,CREDIT_TYPE_REFUND,CREDIT_TYPE_OFFER,CREDIT_TYPE_ADJUSTMENT,REFUND_ADJUSTMENT_MAP, todict,REVERSE_SOURCE_MAP,\
|
| - |
|
13 |
get_mongo_connection_dtr_data
|
| 13 |
from sqlalchemy.sql.expression import func, func, or_, desc, asc, case
|
14 |
from sqlalchemy.sql.expression import func, func, or_, desc, asc, case
|
| 14 |
from elixir import *
|
15 |
from elixir import *
|
| 15 |
from operator import itemgetter
|
16 |
from operator import itemgetter
|
| 16 |
from pymongo.command_cursor import CommandCursor
|
17 |
from pymongo.command_cursor import CommandCursor
|
| 17 |
import pymongo
|
18 |
import pymongo
|
| Line 2246... |
Line 2247... |
| 2246 |
mc.set("cached_app_offers_"+str(retailerId), finalAppOffersMap, 120)
|
2247 |
mc.set("cached_app_offers_"+str(retailerId), finalAppOffersMap, 120)
|
| 2247 |
else:
|
2248 |
else:
|
| 2248 |
print 'No Offers'
|
2249 |
print 'No Offers'
|
| 2249 |
mc.set("cached_app_offers_"+str(retailerId), {}, 10)
|
2250 |
mc.set("cached_app_offers_"+str(retailerId), {}, 10)
|
| 2250 |
|
2251 |
|
| 2251 |
def sendNotification(userIds, campaignName, title, message,notificationtype, url, expiresat='2999-01-01', sendsms=False, smstext=None, mongoHost='localhost'):
|
2252 |
def sendNotification(userIds, campaignName, title, message,notificationtype, url, expiresat='2999-01-01', sendsms=False, smstext=None):
|
| 2252 |
max_id = list(get_mongo_connection(host=mongoHost).User.notificationcampaigns.find().sort([('_id',pymongo.DESCENDING)]).limit(1))
|
2253 |
max_id = list(get_mongo_connection_dtr_data().User.notificationcampaigns.find().sort([('_id',pymongo.DESCENDING)]).limit(1))
|
| 2253 |
if len(max_id) ==0:
|
2254 |
if len(max_id) ==0:
|
| 2254 |
max_id = 0
|
2255 |
max_id = 0
|
| 2255 |
else:
|
2256 |
else:
|
| 2256 |
max_id = max_id[0]['_id']
|
2257 |
max_id = max_id[0]['_id']
|
| 2257 |
max_id = max_id +1
|
2258 |
max_id = max_id +1
|
| 2258 |
campaign = NotificationCampaign(max_id, campaignName, title, message, "SELECT User.id from users User where User.id="+str(userIds[0]), url, to_java_date(datetime.now()), to_java_date(datetime.now()+timedelta(days=730)), notificationtype, 'active', sendsms, smstext, 0, 0, 'BATCH_CREDIT')
|
2259 |
campaign = NotificationCampaign(max_id, campaignName, title, message, "SELECT User.id from users User where User.id="+str(userIds[0]), url, to_java_date(datetime.now()), to_java_date(datetime.now()+timedelta(days=730)), notificationtype, 'active', sendsms, smstext, 0, 0, 'BATCH_CREDIT')
|
| 2259 |
get_mongo_connection(host=mongoHost).User.notificationcampaigns.insert(campaign.__dict__)
|
2260 |
get_mongo_connection_dtr_data().User.notificationcampaigns.insert(campaign.__dict__)
|
| 2260 |
|
2261 |
|
| 2261 |
def getDummyDeals(categoryId, offset, limit):
|
2262 |
def getDummyDeals(categoryId, offset, limit):
|
| 2262 |
outer_query = []
|
2263 |
outer_query = []
|
| 2263 |
outer_query.append({"showDeal":1})
|
2264 |
outer_query.append({"showDeal":1})
|
| 2264 |
outer_query.append({"category_id":categoryId})
|
2265 |
outer_query.append({"category_id":categoryId})
|