#coding:utf8 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):
import multiprocessing 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',