Пример #1
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
Пример #2
0
def get_logger(logger):
    if logger is None:
        loggerDate = getDate.getToday()
        log_dir = createPath.mkdir(config.log_dir)
        got_logger = printLog.printLog(loggerDate, '', log_dir)
        return got_logger
    else:
        return logger
Пример #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
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']



Пример #6
0
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'):
Пример #7
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, dbOper, createPath
from conf import config
import platform
yesterday = getDate.getYesterday()

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

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

dataBase = config.ecora


def getPhoneFile():
    conn_data = dataBase

    try:
        print '开始连接数据库'
        cur, conn = dbOper.conn_db(conn_data)  # 获取数据库连接cur
        print '连接数据库成功'
        logger.info('连接数据库成功')
        print platform.python_version()