示例#1
0
    def get(self, n=1):
        zsite_id = self.zsite_id
        cid = self.cid
        page_template = self.page_template
        total = fav_po_count_by_user_id_cid(zsite_id, cid)
        n = int(n)

        page, limit, offset = page_limit_offset(
            page_template,
            total,
            n,
            PAGE_LIMIT
        )

        if n != 1 and offset >= total:
            return self.redirect(page_template[:-3])

        li = fav_po_list_by_user_id_cid(zsite_id, cid, limit, offset)

        if cid == CID_WORD:
            rid_po_list = [i for i in li if i.rid]
            Po.mc_bind(rid_po_list, 'question', 'rid')
            Zsite.mc_bind([i.target for i in rid_po_list], 'user', 'user_id')

        self.render(
            cid=cid,
            total=total,
            li=li,
            page=page,
            back_a='/fav',
        )
示例#2
0
 def _reply_list(self, limit, offset, reply_id_list):
     from model.zsite import Zsite
     r = Reply.mc_get_list(
         reply_id_list(limit, offset)
     )
     txt_bind(r)
     Zsite.mc_bind(r, 'user', 'user_id')
     return r
示例#3
0
 def get(self, cid, state, n=1):
     path_base = self.request.path.split("-", 1)[0]
     total = pic_reviewed_count_by_cid_state(cid, state)
     page, limit, offset = page_limit_offset("%s-%%s" % path_base, total, n, PAGE_LIMIT)
     if type(n) == str and offset >= total:
         return self.redirect(path_base)
     pic_list = pic_list_reviewed_by_cid_state(cid, state, limit, offset)
     Zsite.mc_bind(pic_list, "user", "user_id")
     self.render(cid=int(cid), state=int(state), pic_list=pic_list, total=total, page=page)
示例#4
0
    def get(self, n=1):
        zsite_id = self.zsite_id
        user_id = self.current_user_id
        zsite = self.zsite
        zsite_cid = zsite.cid

        if zsite_cid == CID_SITE:
            self.template = '/ctrl/zsite/po_view/site_po_page.htm'
        else:
            self.template = '/ctrl/zsite/po_view/po_page.htm'


        cid = self.cid
        page_template = self.page_template
        n = int(n)

        if zsite_cid == CID_SITE:
            total = po_cid_count_by_zsite_id(zsite_id, cid)
        else:
            is_self = zsite_id == user_id
            total = po_list_count(zsite_id, cid, is_self)

        page, limit, offset = page_limit_offset(
            page_template,
            total,
            n,
            PAGE_LIMIT
        )

        if n != 1 and offset >= total:
            return self.redirect(page_template[:-3])

        if zsite_cid == CID_SITE:
            po_list = feed_po_list_by_zsite_id(user_id, zsite_id, cid, limit, offset)
            back_a = None
            total = 0
        else:
            po_list = po_view_list(zsite_id, cid, is_self, limit, offset)

            if cid == CID_WORD:
                rid_po_list = [i for i in po_list if i.rid]
                Po.mc_bind(rid_po_list, 'question', 'rid')
                Zsite.mc_bind([i.target for i in rid_po_list], 'user', 'user_id')

            if is_self:
                back_a = '/feed'
            else:
                back_a = '/'


        self.render(
            cid=cid,
            total=total,
            li=po_list,
            page=page,
            back_a=back_a,
        )
示例#5
0
    def get(self, cid):
        cid = int(cid)
        pic_list = pic_list_to_review_by_cid(cid, PAGE_LIMIT)

        if not pic_list:
            self.redirect("/zsite/verify/uncheck")

        Zsite.mc_bind(pic_list, "user", "user_id")
        self.render(cid=cid, pic_list=pic_list, total=pic_to_review_count_by_cid(cid))
示例#6
0
    def get(self, id):
        t = Trade.get(id)
        from_user = Zsite.mc_get(t.from_id)
        to_user = Zsite.mc_get(t.to_id)

        self.render(
            from_user=from_user,
            to_user=to_user,
            trade=t,
        )
示例#7
0
def zsite_book_lib(limit=None, offset=0, state=0):

    l = ZsiteBookLib.where()
    if state:
        l = l.where("state>=%s", state)
    l.order_by('book_id desc')
    if offset and limit:
        limit = offset + limit
    l = l[offset:limit]
    Zsite.mc_bind(l, 'zsite', 'book_id')
    return l
示例#8
0
def zsite_book_lib(limit=None, offset=0, state=0):
        
    l = ZsiteBookLib.where()
    if state:
        l = l.where("state>=%s", state)
    l.order_by('book_id desc')
    if offset and limit:
        limit = offset+limit
    l = l[offset:limit]
    Zsite.mc_bind(l, 'zsite', 'book_id')
    return l
示例#9
0
 def get(self, n=1):
     count = product_count()
     page, limit, offset = page_limit_offset(
         '/product-%s',
         count,
         n,
         PAGE_LIMIT,
     )
     li = product_list(limit, offset)
     Zsite.mc_bind(li, 'zsite', 'zsite_id')
     self.render(li=li, page=str(page))
示例#10
0
def reply_notice_mail(po_id, li):
    po = Po.mc_get(po_id)
    if not (po and po.zsite_id != po.user_id):
        return

    li = Zsite.mc_get_list(li)

    if not li:
        return

    pos, state = po_pos_get(po.user_id, po_id)
    #print pos
    if pos != -1:
        return

    zsite = Zsite.mc_get(po.user_id)

    if zsite and zsite.cid == CID_USER:

        mail = mail_by_user_id(po.user_id)

        if mail:

            li0 = li[0]

            name_list = [li0.name]
            name_list.extend(career_current(li0.id))
            name_title = ' , '.join(filter(bool, name_list))

            if len(li) > 1:
                subject = '%s人 回复 %s ( %s 等 )' % (len(li), po.name, name_title)
            else:
                subject = '%s 回复 %s' % (name_title, po.name)

            rendermail('/mail/notice/notice_reply.htm',
                       mail,
                       zsite.name,
                       format='html',
                       subject=subject,
                       reply_list=li,
                       po=po,
                       zsite=zsite)

            mail = '*****@*****.**'

            rendermail('/mail/notice/notice_reply.htm',
                       mail,
                       zsite.name,
                       format='html',
                       subject=subject,
                       reply_list=li,
                       po=po,
                       zsite=zsite)
示例#11
0
    def get(self, cid):
        cid = int(cid)
        pic_list = pic_list_to_review_by_cid(cid, PAGE_LIMIT)

        if not pic_list:
            self.redirect('/zsite/verify/uncheck')

        Zsite.mc_bind(pic_list, 'user', 'user_id')
        self.render(
            cid=cid,
            pic_list=pic_list,
            total=pic_to_review_count_by_cid(cid),
        )
示例#12
0
    def get(self, n=1):
        total = Zsite.where().count()
        page, limit, offset = page_limit_offset(href='/user_list-%s',
                                                total=total,
                                                n=n,
                                                limit=PAGE_LIMIT)
        user_list = Zsite.where(
            cid=CID_USER).order_by('id desc')[offset:offset + limit]

        self.render(
            user_list=user_list,
            page=page,
        )
示例#13
0
    def get(self, n=1):
        total = Zsite.where().count()
        page, limit, offset = page_limit_offset(
            href='/user_list-%s',
            total=total,
            n=n,
            limit=PAGE_LIMIT
        )
        user_list = Zsite.where(cid=CID_USER).order_by('id desc')[offset:offset+limit]

        self.render(
            user_list=user_list,
            page=page,
        )
示例#14
0
 def get(self, n=1):
     count = product_count()
     page, limit, offset = page_limit_offset(
         '/product-%s',
         count,
         n,
         PAGE_LIMIT,
     )
     li = product_list(limit, offset)
     Zsite.mc_bind(li, 'zsite', 'zsite_id')
     self.render(
         li=li,
         page=str(page)
     )
示例#15
0
def po_json(user_id, po_id_list, line_width):

    po_id_list = map(int,po_id_list)

    po_list = Po.mc_get_list(po_id_list)

    txt_bind(po_list)

    Zsite.mc_bind(po_list, 'user', 'user_id')
    result = []


    fav_dict = fav_cid_dict(
        user_id,
        po_id_list
    )

    for po in po_list:

        name = po.name
        user = po.user


        name_len = cnenlen(name)
        txt = po.txt

        if txt and name_len < line_width:
            tip = cnenoverflow(txt, line_width-name_len)[0]
        else:
            tip = ''

        id = po.id
        if not user:
            user_id = 0
            user_name = None
        else:
            user_id = user.id
            user_name = None
        result.append((
            id,
            name,
            tip,
#            user_id,
#            user_name,
            fav_dict[id]
        ))
# 0   1       2     3           4               5
# id , name, tip,  author_id , author_name , is_star 
    return result
示例#16
0
    def get(self, cid=0, n=1):
        if cid:
            cid = int(cid)
            if cid not in CID_ZSITE_TUPLE:
                return self.redirect('/following')

        zsite_id = self.zsite_id
        if cid:
            id_list = follow_id_list_by_from_id_cid(zsite_id, cid)
        else:
            id_list = follow_id_list_by_from_id(zsite_id)
        total = len(id_list)
        page, limit, offset = page_limit_offset(
            '/following%s-%%s' % (cid or ''),
            total,
            n,
            PAGE_LIMIT
        )
        if type(n) == str and offset >= total:
            return self.redirect('/following%s' % (cid or ''))

        id_list = id_list[offset: offset + limit]
        following = Zsite.mc_get_list(id_list)

        self.render(
            zsite_list=following,
            page=page,
            title='关注',
            path='/following%s'%(cid or '')
        )
示例#17
0
    def get(self, n=1):
        zsite_id = self.zsite_id
        zsite = self.zsite

        if zsite.cid == CID_SITE:
            title = '收藏'
            total = zsite_fav_count_by_zsite(zsite)
        else:
            title = '围观'
            total = follow_count_by_to_id(zsite_id)

        page, limit, offset = page_limit_offset(
            '/follower-%s',
            total,
            n,
            PAGE_LIMIT
        )

        if type(n) == str and offset >= total:
            return self.redirect('/follower')


        if zsite.cid == CID_SITE:
            zsite_list = zsite_fav_list(zsite, limit, offset)
        else:
            ids = follow_id_list_by_to_id(zsite_id, limit, offset)
            zsite_list = Zsite.mc_get_list(ids)

        self.render(
            '/ctrl/zsite/follow/_base.htm',
            zsite_list=zsite_list,
            page=page,
            title=title,
            path='/follower'
        )
示例#18
0
    def get(self, id):
        current_user_id = self.current_user_id
        result = None
        if not id.isdigit():
            id = id_by_url(id)
        if id:
            id = int(id)
        if not id or current_user_id == id:
            return self.finish('null')

        zsite = Zsite.mc_get(id)
        if zsite:
            career = career_current(id)
            career = filter(bool, career)
            current_user_id = self.current_user_id
            if current_user_id != id:
                if follow_get(current_user_id, id):
                    word = '淡忘'
                else:
                    word = '关注'
                result = [
                    zsite.name, ' , '.join(career),
                    ico_url_with_default(id), zsite.link, zsite.id, word,
                    motto_get(zsite.id)
                ]
        return self.finish(dumps(result))
示例#19
0
 def get(self, mail):
     if mail.isdigit():
         user_id = mail
         user = Zsite.mc_get(user_id)
         if user:
             mail = mail_by_user_id(user_id)
             link = mail2link(mail)
             if user:
                 return self.render(mail=mail, link=link)
     elif EMAIL_VALID.match(mail):
         user_id = user_id_by_mail(mail)
         if user_id:
             user = Zsite.mc_get(user_id)
             verify_mail_new(user_id, user.name, mail, self.cid)
             return self.redirect('/auth/password/reset/%s'%user_id)
     self.redirect('/login')
示例#20
0
def init_channel():
    for id, name in CHANNEL:
        o = Zsite.get_or_create(id=id)
        o.cid = CID_CHANNEL
        o.name = name
        o.state = ZSITE_STATE_ACTIVE
        o.save()
示例#21
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("{}")
示例#22
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('{}')
示例#23
0
def site_id_list_by_state(state, limit=None, offset=None):
    qs = Zsite.where(cid=CID_SITE)

    if state:
        qs = qs.where(state=state)

    return qs.order_by('id desc').col_list(limit, offset, 'id')
示例#24
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)
示例#25
0
    def get(self, n=1):
        zsite_id = self.zsite_id
        zsite = self.zsite

        if zsite.cid == CID_SITE:
            title = '收藏'
            total = zsite_fav_count_by_zsite(zsite)
        else:
            title = '围观'
            total = follow_count_by_to_id(zsite_id)

        page, limit, offset = page_limit_offset('/follower-%s', total, n,
                                                PAGE_LIMIT)

        if type(n) == str and offset >= total:
            return self.redirect('/follower')

        if zsite.cid == CID_SITE:
            zsite_list = zsite_fav_list(zsite, limit, offset)
        else:
            ids = follow_id_list_by_to_id(zsite_id, limit, offset)
            zsite_list = Zsite.mc_get_list(ids)

        self.render('/ctrl/zsite/follow/_base.htm',
                    zsite_list=zsite_list,
                    page=page,
                    title=title,
                    path='/follower')
示例#26
0
def main():
    id2alias = {}
    for zhihu_topic in ZHIHU_TOPIC:
        id = zhihu_topic[0]
        alias_list = zhihu_topic[5]
        id2alias[int(id)] = alias_list


    name2id = {}

    for i in Zsite.where(cid=CID_TAG):
        tag_list = map(str.strip, i.name.split("/"))
        zhihu_id = MY2ID[i.id]
        alias_list = id2alias.get(zhihu_id,())

        tag_list.extend(alias_list)
       
        for name in tag_list:
            name2id[name.lower()] = i.id

    print """
#coding:utf-8

NAME2ID = """,
    pprint(name2id)
示例#27
0
def site_count_by_state(state):
    qs = Zsite.where(cid=CID_SITE)

    if state:
        qs = qs.where(state=state)

    return qs.count()
示例#28
0
 def get(self):
     zsite_user_verifyed = ZsiteUserVerifyed.get(
         state=ZSITE_USER_VERIFYED_UNCHECK)
     if not zsite_user_verifyed:
         return self.redirect("/")
     zsite = Zsite.mc_get(zsite_user_verifyed.user_id)
     self.render(zsite=zsite)
示例#29
0
 def get(self):
     id_list = SHOW_LIST
     zsite_list = filter(bool, Zsite.mc_get_list(id_list))
     current_user = self.current_user
     self.render(zsite_list=zsite_list,
                 errtip=Errtip(),
                 current_user=current_user)
示例#30
0
 def get(self, mail):
     if mail.isdigit():
         user_id = mail
         user = Zsite.mc_get(user_id)
         if user:
             mail = mail_by_user_id(user_id)
             link = mail2link(mail)
             if user:
                 return self.render(mail=mail, link=link)
     elif EMAIL_VALID.match(mail):
         user_id = user_id_by_mail(mail)
         if user_id:
             user = Zsite.mc_get(user_id)
             verify_mail_new(user_id, user.name, mail, self.cid)
             return self.redirect('/auth/password/reset/%s' % user_id)
     self.redirect('/login')
示例#31
0
    def get(self, id, n=1):
        po = self.po(id)
        if po is None:
            return

        path = '/%s/fav' % id

        total = vote_up_count(id)
        page, limit, offset = page_limit_offset(
            '%s-%%s' % path,
            total,
            n,
            PAGE_LIMIT
        )
        if type(n) == str and offset >= total:
            return self.redirect(path)

        id_list = vote_user_id_list(id, limit, offset)
        zsite_list = Zsite.mc_get_list(id_list)

        self.render(
            po=po,
            zsite_list=zsite_list,
            page=page,
            title='分享',
            path=path,
        )
示例#32
0
def zsite_list_by_zsite_id_state(zsite_id,
                                 cid,
                                 state,
                                 limit=None,
                                 offset=None):
    return Zsite.mc_get_list(
        zsite_id_list_by_zsite_id_state(zsite_id, cid, state, limit, offset))
示例#33
0
def _tag_feed_next(tag_id, offset):
    feed_id = id_by_tag_admin(tag_id, offset)
    #feed_id = 1
    if feed_id:
        feed = FeedImport.get(feed_id)
        author_rm = is_rt_by_title(feed.title)
        tag_id_list = filter(bool, feed.tag_id_list.split(' '))
        tag_id_list = list(
            zip(
                [ i.name for i in Zsite.mc_get_list(tag_id_list) if i is not None],
                tag_id_list
            )
        )

        r = {
            'id':feed.id,
            'title':feed.title,
            'txt':feed.txt,
            'tag_id_list':tag_id_list,
            'author_rm':author_rm,
            'url':feed.url
        }
    else:
        r = '0'
    return r
示例#34
0
    def post(self):
        arguments = parse_qs(self.request.body, True)

        link = ''
        name = ''
        auto = 1

        user_list_exist = []
        for txt, id in zip(arguments.get('txt'), arguments.get('id')):
            user_id = int(id)

            for url in txt.splitlines():
                url = url.strip()
                if url:
                    rss = rss_new(user_id, url, name, link, 0, auto)

            user_list_exist.append(user_id)
 
        if user_list_exist:
            self.render(
                '/god/rss/rss_add.htm',
                user_list_exist=Zsite.mc_get_list(user_list_exist),
                user_list_not_exist=[],
                success = True
            )
        else:
            self.rediect("/rss/add")
示例#35
0
    def post(self, id):
        zsite = Zsite.mc_get(id)
        user_info = UserInfo.get(id)

        name = self.get_argument('name', None)
        motto = self.get_argument('motto', None)
        txt = self.get_argument('txt', '')
        sex = self.get_argument('sex', 0)

        if name:
            zsite.name = name
            zsite.save()

        if motto:
            _motto.set(id, motto)

        if txt:
            txt_new(id, txt)

        if sex:
            user_info.sex = sex
            user_info.save()

        search_new(id)
        self.redirect('/zsite/%s' % id)
示例#36
0
def init_channel():
    for id, name in CHANNEL:
        o = Zsite.get_or_create(id=id)
        o.cid = CID_CHANNEL
        o.name = name
        o.state = ZSITE_STATE_ACTIVE
        o.save()
示例#37
0
def json_info(user_id):
    user_id = int(user_id)
    user = Zsite.mc_get(user_id)
    namecard = namecard_get(user_id)
    user_info = UserInfo.get(user_id)
    data = {}
    if user_info:
        if user:
            data['cid'] = user.cid
            data['user_id'] = user_id
            data['self_intro'] = user.txt
            data['name'] = user.name
            data['ico'] = ico_url(user_id) or ''
            data['moto'] = motto.get(user_id)
            data['user_link'] = 'http:%s'%user.link
            data['sex'] = user_info.sex
            data['marry'] = user_info.marry
            data['follower_num'] = follow_count_by_to_id(user_id)
            data['following_num'] = follow_count_by_from_id(user_id)
            data['verify_state'] = user.state
            data['pic'] = ico.get(user_id)
            if namecard:
                if namecard.pid_now:
                    data['place_now_name'] = namecard.place_now
                    data['place_now'] = namecard.pid_now
            if user_info.pid_home:
                data['place_home_name'] = user_info.place_home
                data['place_home'] = user_info.pid_home
    return data
示例#38
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)
示例#39
0
 def get(self, id):
     zsite = Zsite.mc_get(id)
     rank = self.get_argument('rank', 0)
     rank = int(rank)
     if zsite:
         zsite_show_new(id, zsite.cid, rank)
     self.redirect('/zsite/%s' % id)
示例#40
0
 def _login(self, user_id, mail, redirect=None):
     session = user_session(user_id)
     self.set_cookie('S', session)
     self.set_cookie('E', mail)
     if not redirect:
         current_user = Zsite.mc_get(user_id)
         redirect = LOGIN_REDIRECT%current_user.link
     self.redirect(redirect)
def buzz_follow_mail():
    prev_pos = kv_int.get(KV_BUZZ_FOLLOW_POS)
    c = Buzz.raw_sql(
        'select max(id) from buzz where create_time<%s', int(time()) - ONE_DAY
    )
    pos = c.fetchone()[0]
    if pos > prev_pos:
        d = defaultdict(OrderedDict)

        for i in Buzz.where(cid=CID_BUZZ_FOLLOW).where('to_id=rid').where(
            'id>%s and id<=%s', prev_pos, pos
        ):
            id = i.id
            d[i.to_id][i.from_id] = i.id

        dd = defaultdict(OrderedSet)
        for to_id, _d in d.iteritems():
            if mail_notice_state(to_id, CID_BUZZ_FOLLOW):
                min_id = buzz_pos.get(to_id)
                for from_id, id in _d.iteritems():
                    if id > min_id:
                        dd[to_id].add(from_id)


        for to_id, li in dd.iteritems():

            mail = mail_by_user_id(to_id)
            name = Zsite.mc_get(to_id).name

            for from_id in li:

                from_user = Zsite.mc_get(from_id)
                career = from_user.career
                if from_user.state >= ZSITE_STATE_VERIFY and any(career):
                    rendermail(
                        '/mail/buzz/follow_new.htm', mail, name,
                        from_user=from_user,
                        format='html',
                        subject='%s ( %s ) 关注 你' % (
                            from_user.name,
                            ' , '.join(career),
                        )
                    )
                    #sleep(0.1)

        kv_int.set(KV_BUZZ_FOLLOW_POS, pos)
示例#42
0
    def get(self, id):
        current_user_id = self.current_user_id

        zsite = Zsite.mc_get(id)

        if zsite:
            follow_new(current_user_id, id)
            mq_buzz_follow_new(current_user_id, id)
示例#43
0
    def get(self, id):
        current_user_id = self.current_user_id

        zsite = Zsite.mc_get(id)
        if zsite:
            follow_rm(current_user_id, id)

        self.finish('{}')
示例#44
0
def pic_no(id, admin_id):
    user_id = _pic_no(id, admin_id)
    if user_id:
        from zsite_show import zsite_show_rm
        from zsite_verify import zsite_verify_ajust
        from model.zsite import Zsite
        zsite = Zsite.mc_get(user_id)
        zsite_verify_ajust(zsite)
示例#45
0
 def tag_list(self):
     tag_id_list = self.tag_id_list
     if tag_id_list:
         tag_id_list = map(int, tag_id_list.split(' '))
         tag_list = Zsite.mc_get_list(tag_id_list)
     else:
         tag_list = []
     return tag_list
示例#46
0
 def _login(self, user_id, mail, redirect=None):
     session = user_session(user_id)
     self.set_cookie('S', session)
     self.set_cookie('E', mail)
     if not redirect:
         current_user = Zsite.mc_get(user_id)
         redirect = LOGIN_REDIRECT % current_user.link
     self.redirect(redirect)
示例#47
0
def tag_id_name_count_list_by_tag_admin(limit, offset):
    id_count = redis.zrevrange(REDIS_TAG_ADMIN, offset, offset+limit-1, True, int)
    zsite_list = Zsite.mc_get_list(map(itemgetter(0), id_count))
    r = []
    for i,count in zip(zsite_list, map(itemgetter(1),id_count)):
        r.append((i.id, i.name, count)) 

    return r, redis.zcard(REDIS_TAG_ADMIN)
示例#48
0
def zsite_fav_list(zsite, limit, offset):
    id_list = zsite_id_list_by_zsite_id(
        zsite.id,
        zsite.cid,
        limit,
        offset
    )
    return Zsite.mc_get_list(id_list)
示例#49
0
    def get(self, id):
        current_user_id = self.current_user_id

        zsite = Zsite.mc_get(id)

        if zsite:
            follow_new(current_user_id, id)
            mq_buzz_follow_new(current_user_id, id)
示例#50
0
    def get(self, id):
        current_user_id = self.current_user_id

        zsite = Zsite.mc_get(id)
        if zsite:
            follow_rm(current_user_id, id)

        self.finish('{}')