Пример #1
0
def buzz_po_reply_rm(po_id, reply_id):
    from po_pos import PoPos, STATE_BUZZ
    from model.po import Po
    po = Po.mc_get(po_id)
    if not po:
        return
    reply_id_last = po.reply_id_last
    if po and reply_id >= reply_id_last:
        for user_id in PoPos.where(po_id=po_id, state=STATE_BUZZ).where('pos>=%s', reply_id_last).col_list(col='user_id'):
            BuzzReply.where(po_id=po_id, user_id=user_id, state=BUZZ_REPLY_STATE_SHOW).update(state=BUZZ_REPLY_STATE_HIDE)
            mc_flush(user_id)
    buzz_at_reply_rm(reply_id)
Пример #2
0
    for i in po_list:
        pos = po_pos_get_last_reply_id(user_id, i.id)
        new_reply_id_list = []
        for reply_id in i.reply_id_list():
            if reply_id > pos:
                new_reply_id_list.append(reply_id)

        user_id_list = []
        for reply in Reply.mc_get_list(reversed(new_reply_id_list)):
            user_id_list.append(reply.user_id)
        po_user_id.append(user_id_list)

    return buzz_po_bind_user(po_list, po_user_id, user_id)


if __name__ == '__main__':
    pass
    user_id = 10031395
    from zweb.orm import ormiter
    from model.po import Po
    from model.po_pos import PoPos
    from po_pos import PoPos, STATE_BUZZ
    for po in ormiter(Po):
        po_id = po.id
        print po.id
        reply_id_last = po.reply_id_last
        for user_id in PoPos.where(po_id=po_id, state=STATE_BUZZ).where('pos>=%s', reply_id_last).col_list(col='user_id'):
            BuzzReply.where(po_id=po_id, user_id=user_id, state=BUZZ_REPLY_STATE_SHOW).update(state=BUZZ_REPLY_STATE_HIDE)
            mc_flush(user_id)