예제 #1
0
 def __init__(self,phoneFile,coupon_info,threadNum=1,startTime='08:30:00',endTime='20:30:00'):
     self.reqSes = requests.session()
     self.startSendTime = startTime
     self.endSendTime = endTime
     self.threadNum = threadNum
     self.reqSes.keep_alive=False
     self.reqSes.adapters.DEFAULT_RETRIES = 5
     self.phone_file=phoneFile
     self.actName = coupon_info['actName']
     self.prov_code = coupon_info['prov_code']
     self.channelId = coupon_info['channelId']
     self.batchIDs = coupon_info['batchID']
     self.phone_que =Queue.Queue()
     self.logger =printLog.getLogger(getDate.getTime(),"send",config.log_dir)
     self.failedLogger =printLog.getLogger(getDate.getTime(),"unsend",config.log_dir)
예제 #2
0
 def __init__(self,
              coupon_info,
              threadNum=1,
              startTime='08:30:00',
              endTime='20:30:00'):
     self.actName = coupon_info['actName']
     self.startSendTime = startTime
     self.threadNum = threadNum
     self.endSendTime = endTime
     self.coupon_info = coupon_info
     self.resData = createPath.mkdir(config.data_dir + '/' + self.actName)
     self.logger = printLog.getLogger(loggerDate, self.actName,
                                      createPath.mkdir(config.log_dir))
     self.phoneFileName = self.actName
예제 #3
0
#coding:utf8

import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
sys.dont_write_bytecode = True
from Utils import getDate, printLog, createPath
from conf import config
import sendmessage
import time
loggerTime = getDate.getTime()
today = getDate.getToday()
log_dir = createPath.mkdir(config.log_dir)
phone_dir = createPath.mkdir(config.data_dir + '/duanxin')
logger = printLog.getLogger(loggerTime, 'duanxin', log_dir)

messageFile = config.conf_dir + '/message.conf'
resultFile = '%s/sent_%s.txt' % (phone_dir, loggerTime)
failedFile = '%s/unsend_%s.txt' % (phone_dir, loggerTime)


def getData():
    '''
    读取号码文件
    :param batch_phone_file:
    :return:
    '''
    files = os.popen('ls %s/*%s.dat' % (phone_dir, today))
    filelist = files.readlines()
예제 #4
0
 def __init__(self, pcard_name=None, logger=None):
     self.pcardName = pcard_name
     self.resData = createPath.mkdir(config.data_dir + '/' + pcard_name)
     self.logger = printLog.getLogger(loggerDate, pcard_name,
                                      createPath.mkdir(config.log_dir))
     self.phoneFileName = pcard_name + today
예제 #5
0
import os
import time
import sys
#########
#python2 需要对编码进行处理
reload(sys)
sys.setdefaultencoding('utf8')
###########
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
sys.dont_write_bytecode = True
from Utils import dbOper, printLog, getDate
from conf import config
loggerDate = getDate.getMMtime()
logger = printLog.getLogger(loggerDate, "jcy", "%s/jcy/log/" % BASE_DIR)


def getConnect():
    try:
        cur, conn = dbOper.conn_db_new(config.jcy)
        logger.info("连接数据库成功")
    except Exception as e:
        logger.error("连接数据库失败")
        cur, conn = None, None
    return cur, conn


class jcy(object):
    def __init__(self):
        #self.count =0
예제 #6
0
import os
import time
import sys, threading
#########
#python2 需要对编码进行处理
reload(sys)
sys.setdefaultencoding('utf8')
###########
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
sys.dont_write_bytecode = True
from Utils import dbOper, printLog, getDate
from conf import config
loggerDate = getDate.getTime()
logger = printLog.getLogger(loggerDate, "kaquan", "%s/kaquan/log/" % BASE_DIR)


def getConnect():
    try:
        return config.kqzx2_0_1, config.kqzx2_0_2

    except Exception as e:
        return None, None


class kaQ(object):
    def __init__(self):
        self.count = 0
        self.connect_info = getConnect()
        self.logger = logger
예제 #7
0
import os
import time
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
sys.dont_write_bytecode = True
from Utils import getDate, printLog,createPath
from conf import config
import overloadSendcard



dataBase = config.ecora
# 当前时间20180126-183918
loggerDate = getDate.getToday()

logger = printLog.getLogger(loggerDate, "overload", createPath.mkdir(config.log_dir))

class runMe(object):
    def __init__(self,info,threadNum=1,startTime='08:30:00',endTime='20:30:00'):

        self.startSendTime = startTime
        self.threadNum =threadNum
        self.endSendTime = endTime
        self.coupon_info =info['coupon_info']
        self.phone_dir = info['phone_dir']
        self.result_dir = info['result_dir']
        self.phoneFileName =info['phone_file_name']



예제 #8
0
#!/tongweb/bin/python/python2.7/bin/python2.7
#coding:utf8

import os
import sys
import datetime

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
sys.dont_write_bytecode = True
from Utils import getDate, printLog, dbOper, createPath
from conf import config
import feeCheck

loggerDate = getDate.getMMtime()
logger = printLog.getLogger(loggerDate, "fee", "%s/ecora/log/" % BASE_DIR)

try:
    startDate = sys.argv[1]
    endDate = sys.argv[2]
    #month = startDate[:6]
except Exception as e:
    logger.error("没有指定日期,默认查询T-2账期数据")
    startDate = None
    endDate = None


def initDate():

    if startDate and endDate:
        month = startDate[:6]
예제 #9
0
import os
import time
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
sys.dont_write_bytecode = True
from Utils import getDate, printLog, createPath, dbOper
from conf import config
import favSendCard
import datetime

dataBase = config.ecora2
# 当前时间20180126-183918
loggerDate = getDate.getToday()
yesterday = getDate.getYesterday()
loggerTime = getDate.getMMtime()
logger = printLog.getLogger(loggerDate, "favCharge",
                            createPath.mkdir(config.log_dir))
#5分钟前
now_time = datetime.datetime.now()
start_time = (now_time -
              datetime.timedelta(minutes=5)).strftime("%Y/%m/%d %H:%M:00")
end_time = now_time.strftime("%Y/%m/%d %H:%M:00")
table_tail = now_time.strftime("%Y%m%d")


class runMe(object):
    def __init__(self,
                 info,
                 threadNum=1,
                 startTime='08:30:00',
                 endTime='20:30:00'):
예제 #10
0
#!/tongweb/bin/python/python2.7/bin/python2.7
#coding:utf8

import os
import sys
reload(sys)
sys.setdefaultencoding('utf8')
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
sys.dont_write_bytecode = True
from Utils import getDate, printLog, dbOper
from conf import config

loggerDate = getDate.getMMtime()
logger = printLog.getLogger(loggerDate, "test",
                            "%s/ecora2card/log/" % BASE_DIR)

import sql_conf


def getConnect(connect_info):
    try:
        cur, conn = dbOper.conn_db(connect_info)
        logger.info("连接数据库成功")
    except Exception as e:
        logger.info(e)
        logger.error("连接数据库失败")
        cur, conn = None, None
    return cur, conn