Пример #1
0
    def get(self, to_id=0):
        current_user = self.current_user
        current_user_id = self.current_user_id

        if to_id:
            zsite = Zsite.mc_get(to_id)
        else:
            host = self.request.host
            zsite = zsite_by_domain(host)

        if zsite:
            zsite_id = zsite.id
            cid = zsite.cid
            if cid in (CID_SITE, CID_COM, CID_TAG):
                zsite_fav_new(zsite, current_user_id)
            elif cid == CID_USER:
                follow_new(current_user_id, zsite_id)
                mq_buzz_follow_new(current_user_id, zsite_id)

            txt = self.get_argument("txt", None)
            if txt:
                if cid == CID_SITE:
                    from model.reply import STATE_ACTIVE

                    zsite.reply_new(current_user, txt, STATE_ACTIVE)
                elif cid == CID_COM:
                    from model.po_review import po_review_new

                    po_review_new(zsite_id, current_user_id, name)

        self.finish("{}")
Пример #2
0
def site_rec_feeckback(user_id, zsite_id, state):
    site = Zsite.mc_get(zsite_id)
    state = int(state)

    if not (site and site.cid == CID_SITE):
        return

    if state not in SITE_REC_STATE:
        return

    if state == SITE_REC_STATE_FAV:
        zsite_fav_new(site, user_id)
    if state == SITE_REC_STATE_REJECT:
        zsite_fav_rm(site, user_id)

    rech = SiteRecHistory.where(user_id=user_id).where(zsite_id=zsite_id)

    if rech:
        rech[0].state = state
        rech[0].save()
    else:
        SiteRecHistory(user_id=user_id, zsite_id=zsite_id, state=state).save()

    id_list = SiteRecNew.get(user_id).split()
    if zsite_id in id_list:
        id_list.remove(zsite_id)

    SiteRecNew.set(user_id, ' '.join(map(str, id_list)))

    top_rec_unmark(user_id, TOP_REC_CID_SITE_REC)
Пример #3
0
def site_rec_feeckback(user_id, zsite_id, state):
    site = Zsite.mc_get(zsite_id)
    state = int(state)

    if not (site and site.cid == CID_SITE):
        return

    if state not in SITE_REC_STATE:
        return


    if state == SITE_REC_STATE_FAV:
        zsite_fav_new(site, user_id)
    if state ==SITE_REC_STATE_REJECT : 
        zsite_fav_rm(site,user_id)


    rech = SiteRecHistory.where(user_id=user_id).where(zsite_id=zsite_id)

    if rech:
        rech[0].state = state
        rech[0].save()
    else:
        SiteRecHistory(
                user_id=user_id, zsite_id=zsite_id, state=state
                ).save()


    id_list = SiteRecNew.get(user_id).split()
    if zsite_id in id_list:
        id_list.remove(zsite_id)

    SiteRecNew.set(user_id, ' '.join(map(str,id_list)))

    top_rec_unmark(user_id, TOP_REC_CID_SITE_REC)
Пример #4
0
    def get(self, to_id=0):
        current_user = self.current_user
        current_user_id = self.current_user_id

        if to_id:
            zsite = Zsite.mc_get(to_id)
        else:
            host = self.request.host
            zsite = zsite_by_domain(host)

        if zsite:
            zsite_id = zsite.id
            cid = zsite.cid
            if cid in (CID_SITE, CID_COM, CID_TAG):
                zsite_fav_new(zsite, current_user_id)
            elif cid == CID_USER:
                follow_new(current_user_id, zsite_id)
                mq_buzz_follow_new(current_user_id, zsite_id)

            txt = self.get_argument('txt', None)
            if txt:
                if cid == CID_SITE:
                    from model.reply import STATE_ACTIVE
                    zsite.reply_new(current_user, txt, STATE_ACTIVE)
                elif cid == CID_COM:
                    from model.po_review import po_review_new
                    po_review_new(zsite_id, current_user_id, name)

        self.finish('{}')
Пример #5
0
    def get(self, id):
        current_user_id = self.current_user_id

        zsite = Zsite.mc_get(id)

        if zsite:
            cid = zsite.cid
            if cid == CID_TAG:
                zsite_fav_new(zsite, current_user_id)                
            else:
                follow_new(current_user_id, id)
                mq_buzz_follow_new(current_user_id, id)
Пример #6
0
    def get(self):
        current_user = self.current_user
        current_user_id = self.current_user_id

        host = self.request.host
        zsite = zsite_by_domain(host)
        zsite_id = zsite.id
        cid = zsite.cid

        if zsite and cid in (CID_SITE, CID_COM):
            zsite_fav_new(zsite, current_user_id)

        txt = self.get_argument('txt', None)
        if txt:
            if cid == CID_SITE:
                from model.reply import STATE_ACTIVE
                zsite.reply_new(current_user, txt, STATE_ACTIVE)
            elif cid == CID_COM:
                from model.po_review import po_review_new
                po_review_new(zsite_id, current_user_id, name)

        self.finish('{}')
Пример #7
0
    def get(self):
        current_user = self.current_user
        current_user_id = self.current_user_id

        host = self.request.host
        zsite = zsite_by_domain(host)
        zsite_id = zsite.id
        cid = zsite.cid

        if zsite and cid in (CID_SITE, CID_COM):
            zsite_fav_new(zsite, current_user_id)


        txt = self.get_argument('txt', None)
        if txt:
            if cid == CID_SITE:
                from model.reply import STATE_ACTIVE
                zsite.reply_new(current_user, txt, STATE_ACTIVE)
            elif cid == CID_COM:
                from model.po_review import po_review_new
                po_review_new(zsite_id, current_user_id, name)

        self.finish('{}')