Exemplo n.º 1
0
def zsite_fav_new(zsite, owner_id):
    if zsite_fav_get(zsite, owner_id):
        return

    zsite_id = zsite.id
    cid = zsite.cid


        #tag_tag.tag_fav(zsite.cid)

    zsite_list_new(
        zsite_id,
        owner_id,
        cid,
        1,
        STATE_ACTIVE
    )

    mq_buzz_site_fav(owner_id, zsite_id)

    if cid == CID_TAG:
        rec_read_user_topic_score_fav(owner_id, zsite_id)
        autocomplete_tag.rank_update(
            zsite_id, zsite_fav_count_by_zsite(zsite)
        )
Exemplo n.º 2
0
def zsite_fav_touch(zsite, owner_id):
    zsite_list_new(
        zsite.id,
        owner_id,
        zsite.cid,
        1,
        STATE_RM
    )
Exemplo n.º 3
0
def zsite_member_new(
    zsite_id,
    member_id,
    state=ZSITE_MEMBER_STATE_INVITE
):
    id, _state = zsite_list_id_state(zsite_id, member_id, CID_ZSITE_TUPLE_LIST_MEMBER)
    if _state < state:
        zsite_list_new(zsite_id, member_id, CID_ZSITE_TUPLE_LIST_MEMBER, state=state)
        po_review_state_set(zsite_id, member_id, 1)
        return True
Exemplo n.º 4
0
def zsite_admin_new(zsite_id, admin_id, state=STATE_OWNER):
    if zsite_id and admin_id:
        cid = CID_SITE
        zsite = zsite_list_get(
            zsite_id,
            admin_id,
            cid
        )
        if not zsite:
            zsite = zsite_list_new(
                zsite_id,
                admin_id,
                cid,
                1,
                state
            )
        else:
            zsite.state = state
            zsite.save()
        mc_flush(zsite_id, admin_id)
#coding:utf-8
import _env
from misc.spider.zhihu_topic_id_rank import ID2RANK
from zweb.orm import ormiter
from model.cid import CID_TAG
from model.zsite import Zsite
from model.zsite_list import zsite_list_new

for i in ormiter(Zsite, 'cid=%s'%CID_TAG):
    id = i.id
    rank = ID2RANK.get(id, 0)
    print id, rank
    zsite_list_new(id, 0, CID_TAG, rank)

if __name__ == '__main__':
    pass