예제 #1
0
def com_apply_accept(user_id, com_id, admin_id):
    zsite_member_new(com_id, user_id, ZSITE_MEMBER_STATE_ACTIVE)

    ca = ComApply.get_or_create(user_id=user_id, com_id=com_id, )
    ca.admin_id = admin_id
    ca.create_time = today_seconds()
    ca.state = COM_APPLY_STATE_ACCEPT
    ca.save()
    mc_flush(com_id)
예제 #2
0
def com_apply_rm(user_id, com_id, admin_id):
    ca = ComApply.get(user_id=user_id, com_id=com_id)
    if ca:
        ca.state = COM_APPLY_STATE_RM
        ca.admin_id = admin_id
        ca.create_time = today_seconds()
        ca.save()

        mc_flush(com_id)
예제 #3
0
def com_apply_new(com_id, user_id):

    if zsite_member_can_admin(com_id, user_id):
        return

    ca = ComApply.get_or_create(com_id=com_id, user_id=user_id)
    ca.state = COM_APPLY_STATE_APPLY
    ca.create_time = today_seconds()
    ca.save()
    mc_flush(com_id)
예제 #4
0
def notice_day():
    prev_pos = kv_int.get(KV_NOTICE_POS)
    c = Notice.raw_sql('select max(id) from notice where create_time<%s',
                       today_seconds())
    pos = c.fetchone()[0]
    if pos > prev_pos:
        d = defaultdict(OrderedSet)

        for i in Notice.where(state=STATE_APPLY).where('id>%s and id<=%s',
                                                       prev_pos, pos):
            cid = i.cid
            to_id = i.to_id
            if cid in NOTICE_MAIL_DAY and mail_notice_state(
                    to_id, CID_MAIL_DAY):
                d[to_id].add((i.from_id, cid, i.rid))

        for to_id, li in d.iteritems():
            notice_mail_day(to_id, li)
            sleep(0.1)

        kv_int.set(KV_NOTICE_POS, pos)
예제 #5
0
def notice_day():
    prev_pos = kv_int.get(KV_NOTICE_POS)
    c = Notice.raw_sql(
        'select max(id) from notice where create_time<%s', today_seconds()
    )
    pos = c.fetchone()[0]
    if pos > prev_pos:
        d = defaultdict(OrderedSet)

        for i in Notice.where(state=STATE_APPLY).where(
            'id>%s and id<=%s', prev_pos, pos
        ):
            cid = i.cid
            to_id = i.to_id
            if cid in NOTICE_MAIL_DAY and mail_notice_state(to_id, CID_MAIL_DAY):
                d[to_id].add((i.from_id, cid, i.rid))

        for to_id, li in d.iteritems():
            notice_mail_day(to_id, li)
            sleep(0.1)

        kv_int.set(KV_NOTICE_POS, pos)