def get(self, *args, **kwargs):
     jsCode = self.get_argument('jsCode')
     nickName = self.get_argument('nickName')
     sign = self.get_argument('sign')
     time = self.get_argument('time')
     md5Util = MD5Util()
     if sign == md5Util.md5Signature(time):
         logging = LogUtil().getLogging()
         # logging.info('----> jsCode: ' + jsCode)
         # logging.info('----> nickName: ' + nickName)
         # logging.info('----> sign: ' + sign)
         # logging.info('----> time: ' + time)
         httpUrl = 'https://api.weixin.qq.com/sns/jscode2session'
         param = {
             "appid": WxToken.APP_ID,
             "secret": WxToken.APP_SECRET,
             "js_code": str(jsCode),
             "grant_type": 'authorization_code'
         }
         body = HttpUtil.http_get(httpUrl, params=param)
         jsonBody = json.loads(body, "utf8")
         if isinstance(jsonBody, dict):
             if jsonBody.has_key('openid'):
                 jsonBody['result'] = True
             else:
                 jsonBody['result'] = False
         # logging.info(type(jsonBody))
         logging.info('--->session json: ' + str(jsonBody))
     else:
         jsonBody = json.loads(u'校验失败', "utf8")
     self.write(jsonBody)
Exemplo n.º 2
0
 def get(self, *args, **kwargs):
     page = int(self.get_argument('page'))
     size = int(self.get_argument('size'))
     sign = self.get_argument('sign')
     time = self.get_argument('time')
     logging = LogUtil().getLogging()
     baseResponse = BaseResponse()
     md5Util = MD5Util()
     if sign == md5Util.md5Signature(time):
         getCategory = GetCategory()
         homeDiscoverList = getCategory.getHomeDiscoverList(page_num=page, page_size=size)
         baseResponse.code = ResponseCode.op_success
         baseResponse.desc = ResponseCode.op_success_desc
         homeDiscoverCount = getCategory.getHomeDiscoverCount().get('count')
         logging.info('---> homeDiscoverCount: ' + str(homeDiscoverCount))
         page_total = (homeDiscoverCount / size) + (1 if homeDiscoverCount % size > 0 else 0)
         baseResponse.pageNum = page
         baseResponse.pageSize = size
         baseResponse.page_total = page_total
         baseResponse.totalCount = homeDiscoverCount
         if homeDiscoverList:
             for homeDiscover in homeDiscoverList:
                 baseResponse.append(homeDiscover)
     else:
         baseResponse.code = ResponseCode.fail_check_api_md5
         baseResponse.desc = ResponseCode.fail_check_api_md5_desc
     json_str = json.dumps(baseResponse, cls=HomeDiscoverEncoder)
     self.write(json_str)
Exemplo n.º 3
0
 def __init__(self):
     self.cateDao = CategoryDao()
     self.goodsDao = GoodsDao()
     self.brandDao = BrandDao()
     self.attrDao = AttributeDao()
     self.photoDao = GoodsPhotoDao()
     self.logging = LogUtil().getLogging()
Exemplo n.º 4
0
 def get(self, *args, **kwargs):
     sign = self.get_argument('sign')
     time = self.get_argument('time')
     logging = LogUtil().getLogging()
     baseResponse = BaseResponse()
     md5Util = MD5Util()
     if sign == md5Util.md5Signature(time):
         getAdverts = GetAdverts()
         netAdvertsList = getAdverts.getLastAdverts(6)
         logging.info("---> netAdvertsList: " + str(netAdvertsList))
         baseResponse.code = ResponseCode.op_success
         baseResponse.desc = ResponseCode.op_success_desc
         baseResponse.data = netAdvertsList
     else:
         baseResponse.code = ResponseCode.fail_check_api_md5
         baseResponse.desc = ResponseCode.fail_check_api_md5_desc
     json_str = json.dumps(baseResponse, cls=AdvertsEncoder)
     self.write(json_str)
    def post(self, *args, **kwargs):
        logging = LogUtil().getLogging()
        param = self.request.body.decode('utf-8')
        param = json.loads(param)
        sign = param['sign']
        time = param['time']
        admin_tel = param['tel']
        sms_pwd = param['sms']

        permissionMgr = PermissionManager()
        baseResponse = permissionMgr.checkAdminPermissionWithLoginStatus(sign=sign, time=time,
                                                                         admin_tel=admin_tel, sms_pwd=sms_pwd)
        logging.info('baseResponse code: ', baseResponse.code)
        # 登录还在有效期内。
        if baseResponse.code == ResponseCode.success_check_admin_permission:
            # 登录成功
            baseResponse.code = ResponseCode.op_success
            baseResponse.desc = ResponseCode.op_success_desc
            baseResponse.data = u'恭喜! 系统登陆成功.'
            # 通知超管(我)
            admin_sms_msg = '用户 {tel} 已成功登陆后台系统.'.format(tel=admin_tel)
            notifyAdmin = NotifyAdmin()
            notifyAdmin.sendMsg(sms_msg=admin_sms_msg, subject=SMS_SUBJECT_LOGIN)
            notifyAdmin.sendWxMsg(msg=admin_sms_msg)
        elif baseResponse.code == ResponseCode.fail_admin_out_of_date \
                or baseResponse.code == ResponseCode.fail_admin_login:
            adminMgr = AdminManager()
            loginResult = adminMgr.login(admin_tel=admin_tel, sms_pwd=sms_pwd)
            if loginResult:
                baseResponse.data = u'您已成功登录!'
                baseResponse.code = ResponseCode.op_success
                baseResponse.desc = ResponseCode.op_success_desc
            else:
                baseResponse.data = u'新密码已发送至手机, 请按新密码重新登录。'
        json_str = json.dumps(baseResponse, cls=StrEncoder)
        self.write(json_str)
Exemplo n.º 6
0
 def __init__(self):
     self.brandDao = BrandDao()
     self.logging = LogUtil().getLogging()
     pass
Exemplo n.º 7
0
 def __init__(self):
     self.advertDao = AdvertsDao()
     self.cateDao = CategoryDao()
     self.logging = LogUtil().getLogging()
     pass
Exemplo n.º 8
0
 def __init__(self, qr_code_path=def_qr_path):
     self.logging = LogUtil().getLogging()
     self.qr_code_path = def_qr_path
     self.call_times = 0
Exemplo n.º 9
0
import os.path
import sys
import shutil
import time
import logging
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile

parent_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                          os.pardir)
sys.path.append(parent_dir)
from util.LogUtil import LogUtil

logging.getLogger("werkzeug").setLevel(logging.ERROR)
logUtil = LogUtil()


class PatentFinder:
    def __init__(self, filePath):
        self.patent_list = pd.read_excel(filePath)
        #print self.patent_list
        #self.patent_list.set_index("Wipro Ref #", inplace=True)
        self.patent_list_indexed = self.patent_list.set_index("Wipro Ref #",
                                                              drop=False)
        print self.patent_list_indexed

    def stats(self):
        print self.patent_list.head()
        print "============================="
        print self.patent_list.columns
Exemplo n.º 10
0
 def __init__(self):
     self.logging = LogUtil().getLogging()
     self.photoDao = GoodsPhotoDao()
     pass
Exemplo n.º 11
0
 def __init__(self):
     self.dateUtil = DateUtil()
     self.logging = LogUtil().getLogging()
Exemplo n.º 12
0
 def __init__(self):
     self.logging = LogUtil().getLogging()
     pass
Exemplo n.º 13
0
 def __init__(self):
     self.logging = LogUtil().getLogging()
     self.attrDao = AttributeDao()
     pass
Exemplo n.º 14
0
 def __init__(self):
     self.adminDao = AdminDao()
     self.dateUtil = DateUtil()
     self.notifyAdmin = NotifyAdmin()
     self.logging = LogUtil().getLogging()