Beispiel #1
0
def traverse_message_sender(message, resp_suc):
    """
        遍历发送一条消息
    """
    if message:
        user_pic = to_messages_no_time(message.content, message.sender_id)
        user_pic['sender_id'] = message.sender_id
        user_pic['receiver_id'] = message.receiver_id
        time = time_to_str(message.time)
        user_pic['sender_time'] = time
        resp_suc['sender_list'].append(user_pic)
Beispiel #2
0
def traverse_message(message, resp_suc):
    """
        遍历一条消息
    """
    if message:
        times = time_diff(message.time)
        content = message.content
        user_pic = to_messages(times, content, message.sender_id)
        user_pic['sender_id'] = message.sender_id
        user_pic['receiver_id'] = message.receiver_id
        time = time_to_str(message.time)
        user_pic['time'] = time
        resp_suc['list'].append(user_pic)
Beispiel #3
0
def traverse_user_sender_one(message, resp_suc, receiver_id):
   """
   一条用户发送给好友信息
   """
   if message.sender_id == receiver_id:
       pass
   else:
       message.view = 1
   db.commit()
   times = time_diff(message.time)
   user_pic = to_messages_sender(message.content, message.sender_id, receiver_id)
   user_pic['sender_id'] = message.sender_id
   user_pic['receiver_id'] = message.receiver_id
   time = time_to_str(message.time)
   user_pic['time'] = time
   resp_suc['list'].append(user_pic)
Beispiel #4
0
def traverse_messages_receiver(messages, resp_suc):
    """
        遍历接收多条消息
    """
    #if receiver_messages:
    #    for message in receiver_messages:
    #        user_pic = to_messages_no_time(message.content, message.sender_id)
    #        user_pic['sender_id'] = message.sender_id
    #        user_pic['receiver_id'] = message.receiver_id
    #        time = time_to_str(message.time)
    #        user_pic['time'] = time
    #        resp_suc['list'].append(user_pic)
    if messages:
        for message in messages:
            message.view = 1
            db.commit()
            times = time_diff(message.time)
            user_pic = to_messages(times, message.content, message.sender_id)
            user_pic['sender_id'] = message.sender_id
            user_pic['receiver_id'] = message.receiver_id
            time = time_to_str(message.time)
            user_pic['time'] = time
            resp_suc['list'].append(user_pic)
Beispiel #5
0
def traverse_message_receiver(sender_message, resp_suc):
    """
        遍历接收一条消息
    """
    #if message:
    #    times = time_diff(message.time)
    #    content = message.content
    #    user_pic = to_messages(times, content, message.sender_id)
    #    user_pic['sender_id'] = message.sender_id
    #    user_pic['receiver_id'] = message.receiver_id
    #    time = time_to_str(message.time)
    #    user_pic['time'] = time
    #    resp_suc['list'].append(user_pic)
    if sender_message:
        sender_message.view = 1
        db.commit()
        times = time_diff(sender_message.time)
        content = sender_message.content
        user_pic = to_messages(times, content, sender_message.receiver_id)
        user_pic['sender_id'] = sender_message.sender_id
        user_pic['receiver_id'] = sender_message.receiver_id
        time = time_to_str(sender_message.time)
        user_pic['time'] = time
        resp_suc['list'].append(user_pic)