| Line 6... |
Line 6... |
| 6 |
from dtr.config import PythonPropertyReader
|
6 |
from dtr.config import PythonPropertyReader
|
| 7 |
from dtr.storage import Mongo
|
7 |
from dtr.storage import Mongo
|
| 8 |
from dtr.storage.DataService import Retailers, Users, CallHistory, RetryConfig, \
|
8 |
from dtr.storage.DataService import Retailers, Users, CallHistory, RetryConfig, \
|
| 9 |
RetailerLinks, Activation_Codes, Agents, Agent_Roles, AgentLoginTimings, \
|
9 |
RetailerLinks, Activation_Codes, Agents, Agent_Roles, AgentLoginTimings, \
|
| 10 |
FetchDataHistory, RetailerContacts, Orders, OnboardedRetailerChecklists,\
|
10 |
FetchDataHistory, RetailerContacts, Orders, OnboardedRetailerChecklists,\
|
| 11 |
RetailerAddresses, Pincodeavailability, app_offers
|
11 |
RetailerAddresses, Pincodeavailability, app_offers, appmasters
|
| 12 |
from dtr.storage.Mongo import get_mongo_connection
|
12 |
from dtr.storage.Mongo import get_mongo_connection
|
| 13 |
from dtr.storage.Mysql import fetchResult
|
13 |
from dtr.storage.Mysql import fetchResult
|
| 14 |
from dtr.utils import FetchLivePrices, DealSheet as X_DealSheet, \
|
14 |
from dtr.utils import FetchLivePrices, DealSheet as X_DealSheet, \
|
| 15 |
UserSpecificDeals
|
15 |
UserSpecificDeals
|
| 16 |
from dtr.utils.utils import getLogger
|
16 |
from dtr.utils.utils import getLogger
|
| 17 |
from elixir import *
|
17 |
from elixir import *
|
| 18 |
from operator import and_
|
18 |
from operator import and_
|
| 19 |
from sqlalchemy.sql.expression import func, func, or_
|
19 |
from sqlalchemy.sql.expression import func, func, or_, desc, asc
|
| 20 |
from urllib import urlencode
|
20 |
from urllib import urlencode
|
| 21 |
import contextlib
|
21 |
import contextlib
|
| 22 |
import falcon
|
22 |
import falcon
|
| 23 |
import json
|
23 |
import json
|
| 24 |
import re
|
24 |
import re
|
| Line 26... |
Line 26... |
| 26 |
import traceback
|
26 |
import traceback
|
| 27 |
import urllib
|
27 |
import urllib
|
| 28 |
import urllib2
|
28 |
import urllib2
|
| 29 |
import uuid
|
29 |
import uuid
|
| 30 |
import gdshortener
|
30 |
import gdshortener
|
| - |
|
31 |
from dtr.dao import AppOfferObj
|
| - |
|
32 |
|
| 31 |
alphalist = list(string.uppercase)
|
33 |
alphalist = list(string.uppercase)
|
| 32 |
alphalist.remove('O')
|
34 |
alphalist.remove('O')
|
| 33 |
numList = ['1','2','3','4','5','6','7','8','9']
|
35 |
numList = ['1','2','3','4','5','6','7','8','9']
|
| 34 |
codesys = [alphalist, alphalist, numList, numList, numList]
|
36 |
codesys = [alphalist, alphalist, numList, numList, numList]
|
| 35 |
CONTACT_PRIORITY = ['sms', 'called', 'ringing']
|
37 |
CONTACT_PRIORITY = ['sms', 'called', 'ringing']
|
| Line 1296... |
Line 1298... |
| 1296 |
resp.body = str(result)
|
1298 |
resp.body = str(result)
|
| 1297 |
|
1299 |
|
| 1298 |
class AppOffers():
|
1300 |
class AppOffers():
|
| 1299 |
def on_get(self, req, resp, retailerId):
|
1301 |
def on_get(self, req, resp, retailerId):
|
| 1300 |
retailerId = int(retailerId)
|
1302 |
retailerId = int(retailerId)
|
| 1301 |
offers = app_offers.query.filter(app_offers.affiliate_id==retailerId).filter(app_offers.show==True).all()
|
1303 |
offers = session.query(app_offers.id,app_offers.appmaster_id, app_offers.app_name, app_offers.affiliate_offer_id, app_offers.image_url, app_offers.downloads, app_offers.link, app_offers.offer_price, app_offers.offerCategory, app_offers.package_name, app_offers.promoImage, app_offers.ratings, app_offers.user_payout, func.IF("appmasters.shortDescription is not null", appmasters.shortDescription, app_offers.shortDescription).label('shortDescription'), func.IF("appmasters.longDescription is not null", appmasters.longDescription, app_offers.longDescription).label('longDescription'), appmasters.customerOneLiner, appmasters.retailerOneLiner,app_offers.priority).join((appmasters,appmasters.id==app_offers.appmaster_id)).filter(app_offers.show==True).order_by(asc(app_offers.priority),desc(app_offers.user_payout)).all()
|
| 1302 |
offersJsonArray = []
|
1304 |
offersJsonArray = []
|
| 1303 |
if offers is None:
|
1305 |
if offers is None or len(offers)==0:
|
| 1304 |
resp.body = json.dumps("{}")
|
1306 |
resp.body = json.dumps("{}")
|
| 1305 |
else:
|
1307 |
else:
|
| 1306 |
for offer in offers:
|
1308 |
for offer in offers:
|
| - |
|
1309 |
appOfferObj = AppOfferObj(offer[0], offer[1], offer[2], offer[3], offer[4], offer[5], offer[6], offer[7], offer[8], offer[9], offer[10], offer[11], offer[12], offer[13], offer[14], offer[15], offer[16], offer[17])
|
| 1307 |
offersJsonArray.append(todict(offer))
|
1310 |
offersJsonArray.append(todict(appOfferObj))
|
| 1308 |
resp.body = json.dumps({"AppOffers":offersJsonArray}, encoding='utf-8')
|
1311 |
resp.body = json.dumps({"AppOffers":offersJsonArray}, encoding='utf-8')
|
| 1309 |
|
1312 |
|
| 1310 |
def main():
|
1313 |
def main():
|
| 1311 |
#tagActivatedReatilers()
|
1314 |
#tagActivatedReatilers()
|
| 1312 |
a = RetailerDetail()
|
1315 |
a = RetailerDetail()
|