Esempio n. 1
0
def sync_po(po):
    id = po.user_id
    sync_cid = SYNC_GET_CID.get(po.cid)
    if not sync_cid:
        return
    for oauth_id in state_oauth_id_by_zsite_id_cid(id, sync_cid):
        sync_by_oauth_id(oauth_id, SYNC_CID_TXT.get(po.cid, '') + po.name_, 'http:%s'%po.link)
Esempio n. 2
0
def sync_po(po):
    id = po.user_id
    sync_cid = SYNC_GET_CID.get(po.cid)
    if not sync_cid:
        return
    for oauth_id in state_oauth_id_by_zsite_id_cid(id, sync_cid):
        sync_by_oauth_id(oauth_id,
                         SYNC_CID_TXT.get(po.cid, '') + po.name_,
                         'http:%s' % po.link)
Esempio n. 3
0
def sync_follow(follow):
    oauth_id = follow.oauth_id
    sync_txt = follow.state & 0b10

    if sync_txt:
        sync_by_oauth_id(oauth_id, follow.txt, 'http://%s' % SITE_DOMAIN)
    oauth_follow_by_oauth_id(oauth_id)

    follow.delete()
Esempio n. 4
0
def sync_follow(follow):
    oauth_id = follow.oauth_id
    sync_txt = follow.state&0b10

    if sync_txt:
        sync_by_oauth_id(
            oauth_id, follow.txt, 'http://%s'%SITE_DOMAIN
        )
    oauth_follow_by_oauth_id(oauth_id)

    follow.delete()
Esempio n. 5
0
def sync_recommend(id, po_id):
    from po import Po
    p = Po.mc_get(po_id)
    s = state_oauth_id_by_zsite_id_cid(id, SYNC_CID_SHARE)
    for oauth_id in s:
        rec_po = Po.mc_get(p.rid)
        if rec_po:
            txt = cnencut(p.name_, 20)
            if txt:
                txt = '%s -> '%txt
            else:
                txt = txt+"分享: "
            sync_by_oauth_id(oauth_id, txt + cnencut(rec_po.name_,50)  , 'http:%s'%rec_po.link)
Esempio n. 6
0
def sync_recommend(id, po_id):
    from po import Po
    p = Po.mc_get(po_id)
    s = state_oauth_id_by_zsite_id_cid(id, SYNC_CID_SHARE)
    for oauth_id in s:
        rec_po = Po.mc_get(p.rid)
        if rec_po:
            txt = cnencut(p.name_, 20)
            if txt:
                txt = '%s -> ' % txt
            else:
                txt = txt + "分享: "
            sync_by_oauth_id(oauth_id, txt + cnencut(rec_po.name_, 50),
                             'http:%s' % rec_po.link)
Esempio n. 7
0
def sync_site_po(po, zsite):
    id = zsite.id

    user = Zsite.mc_get(po.user_id)
    if user:
        name = user.name
    else:
        name = None

    sync_cid = SYNC_GET_CID.get(po.cid)
    if not sync_cid:
        return
    txt = ''
    if po.cid in(CID_PHOTO, CID_VIDEO, CID_NOTE, CID_EVENT, CID_AUDIO):
        txt = po.txt
        if txt:
            txt = ' | %s'%po.txt

    for oauth_id in state_oauth_id_by_zsite_id_cid(id, sync_cid):
        sync_by_oauth_id(oauth_id, po.name_+txt, 'http:%s'%po.link, name)
Esempio n. 8
0
def sync_site_po(po, zsite):
    id = zsite.id

    user = Zsite.mc_get(po.user_id)
    if user:
        name = user.name
    else:
        name = None

    sync_cid = SYNC_GET_CID.get(po.cid)
    if not sync_cid:
        return
    txt = ''
    if po.cid in (CID_PHOTO, CID_VIDEO, CID_NOTE, CID_EVENT, CID_AUDIO):
        txt = po.txt
        if txt:
            txt = ' | %s' % po.txt

    for oauth_id in state_oauth_id_by_zsite_id_cid(id, sync_cid):
        sync_by_oauth_id(oauth_id, po.name_ + txt, 'http:%s' % po.link, name)
Esempio n. 9
0
def sync_join_event(id, event_id):
    po = Po.mc_get(event_id)
    s = state_oauth_id_by_zsite_id_cid(id, SYNC_CID_EVENT)
    for oauth_id in s:
        sync_by_oauth_id(oauth_id, '报名活动 : '+ po.name_, 'http:%s'%po.link)
Esempio n. 10
0
def sync_join_event(id, event_id):
    po = Po.mc_get(event_id)
    s = state_oauth_id_by_zsite_id_cid(id, SYNC_CID_EVENT)
    for oauth_id in s:
        sync_by_oauth_id(oauth_id, '报名活动 : ' + po.name_, 'http:%s' % po.link)