Esempio n. 1
0
def pauseMessage(mid):
    update_sql = '''
        update 
            email_package ep 
        set 
            ep.task_status_id = 5 
        where 
            ep.task_status_id = 0 and ep.object_id = %s
    '''
    carrier_conn = mdb.get_mesher_conn()
    mdb.exe_update_sql(carrier_conn, update_sql % (mid), False, True, False, False)
Esempio n. 2
0
def selectMessage(mid):
    select_sql = '''
        select 
            count(0)
        from
            email_package ep 
        where 
            ep.task_status_id = 0 and ep.object_id = %s
    '''
    carrier_conn = mdb.get_mesher_conn()
    data = mdb.exe_sql(carrier_conn, select_sql % (mid), False, True)
    return data[0]
Esempio n. 3
0
def defaultloadinfo(start_time, end_time, client_group):
    sql = '''
        select 
            day(ep.start_time) as day, ep.client_id, sum(ep.successful_count) as success, sum(ep.softbounce_count) as soft, sum(ep.unstart_count) as unstart
        from 
            email_package ep 
        where 
            ep.start_time >= '%s' and ep.start_time < '%s' and ep.client_id not in (%s) and ep.domain_name = 'qq.com'
    '''
    carrier_conn = mdb.get_mesher_conn()
    data = mdb.exe_sql(carrier_conn, sql % (start_time, end_time, client_group), True, True)
    #print data[0]
    return data[0]
Esempio n. 4
0
def sendinfo(start_time, end_time, client_list, group_by=False):
    sql = '''
        select 
            day(ep.start_time) as day, ep.client_id, sum(ep.successful_count) as success, sum(ep.softbounce_count) as soft, sum(ep.unstart_count) as unstart
        from 
            email_package ep 
        where 
            ep.start_time >= '%s' and ep.start_time < '%s' and ep.client_id in (%s) and ep.domain_name = 'qq.com'
    '''
    if(group_by):
        sql += '''group by ep.client_id'''
    carrier_conn = mdb.get_mesher_conn()
    data = mdb.exe_sql(carrier_conn, sql % (start_time, end_time, client_list), True, True)
    return data
Esempio n. 5
0
def get_task_status(task_id):
    select_msg_sql = '''
        select 
            task_id, task_status_id, domain_name, schedule_time, claimed_process, successful_count, softbounce_count, unstart_count
        from 
            email_package ep 
        where 
            ep.task_id = '%s'
    '''

    carrier_conn = mdb.get_mesher_conn()
    datas = mdb.exe_sql(carrier_conn, select_msg_sql % (task_id), False, True)
    width = [10] * 3 + [20] + [10] * 4
    mytt.display(['t_id','t_status','domain','s_time','mesher','succ','soft','unt'], datas, width)
Esempio n. 6
0
def get_unfinsh_task(message_id):
    select_msg_sql = '''
        select 
            task_id, client_id, object_id, task_status_id, weight, domain_name, schedule_time, claimed_process
        from 
            email_package ep 
        where 
            ep.task_status_id <> 3 and ep.object_id = %s
    '''

    carrier_conn = mdb.get_mesher_conn()
    datas = mdb.exe_sql(carrier_conn, select_msg_sql % (message_id), False, True)
    width = [10] * 6 + [20] + [10] 
    mytt.display(['t_id', 'cid', 'mid', 't_status','weight','domain','s_time','mesher'], datas, width)
Esempio n. 7
0
def updatemsgpri(mid):
    update_sql = '''
        update 
            email_package ep 
        set 
            ep.priority = 1
        where 
            ep.task_status_id = 0 and ep.object_id = %s
    '''
    try:
        carrier_conn = mdb.get_mesher_conn()
        row_info = mdb.exe_update_sql(carrier_conn, update_sql % (mid), False, True, False, False)
        print row_info
    except Exception,e:
        print e 
        sys.exit()
Esempio n. 8
0
def showBymessage(start_time, end_time, clients):
    show_sql = '''
        select 
            	ep.client_id,ep.object_id,sum(ep.successful_count),sum(ep.softbounce_count),sum(ep.hardbounce_count),sum(ep.unstart_count)
	from
		email_package ep	
        where 
            	ep.start_time > '%s' and ep.end_time < '%s' and ep.client_id in (%s) 
	group by 
		ep.object_id
    '''
    try:
        carrier_conn = mdb.get_mesher_conn()
        data = mdb.exe_sql(carrier_conn, show_sql % (start_time, end_time, clients), False, True)
	head = ['cid', 'mid', 'success', 'soft', 'hard', 'unstart' ]
	width = [10] * 6
	nt.display(head,data,width)
    except Exception,e:
        print e 
        sys.exit()