示例#1
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))
示例#2
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 '')
        )
示例#3
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")
示例#4
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,
        )
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
示例#6
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)
示例#7
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')
示例#8
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'
        )
示例#9
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)
示例#10
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
示例#11
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)
示例#12
0
 def get(self):
     id_list = SHOW_LIST
     zsite_list = filter(bool, Zsite.mc_get_list(id_list))
     self.render(
         sex=0,
         password='',
         errtip=Errtip(),
         zsite_list=zsite_list,
     )
示例#13
0
def tag_list_with_user_count_po_count():
    id_count_list = tag2idlist_po_user.tag_id_count_list()
    po_count_dict = dict(tag2idlist_po.tag_id_count_list())
    id_list = map(itemgetter(0), id_count_list)
    tag_list = Zsite.mc_get_list(id_list)
    for id, tag, count in zip(id_list, tag_list, map(itemgetter(1), id_count_list)):
        tag.user_count = count
        tag.po_count = po_count_dict.get(id,0)
    return tag_list
示例#14
0
 def get(self):
     id_list = SHOW_LIST
     zsite_list = filter(bool, Zsite.mc_get_list(id_list))
     self.render(
         sex=0,
         password='',
         errtip=Errtip(),
         zsite_list=zsite_list,
     )
示例#15
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
     )
示例#16
0
def tag_list_with_user_count_po_count():
    id_count_list = tag2idlist_po_user.tag_id_count_list()
    po_count_dict = dict(tag2idlist_po.tag_id_count_list())
    id_list = map(itemgetter(0), id_count_list)
    tag_list = Zsite.mc_get_list(id_list)
    for id, tag, count in zip(id_list, tag_list,
                              map(itemgetter(1), id_count_list)):
        tag.user_count = count
        tag.po_count = po_count_dict.get(id, 0)
    return tag_list
示例#17
0
def feed_import_list_count_by_part_time_job(limit, offset):
    cid = PART_TIME_JOB_CID_FEED_IMPORT
    id_list = id_list_by_part_time_job_cid(cid, limit, offset)
    feed_list = map(FeedImport.get, map(itemgetter(0), id_list))
    user_list = Zsite.mc_get_list(map(itemgetter(1), id_list))
    for i, u, t in zip(feed_list, user_list, map(itemgetter(2), id_list)):
        i.admin = u
        i.time = t

    return feed_list, part_time_job_count_by_cid(cid)
示例#18
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)
示例#19
0
def member_list_by_id_list(member_id_list):
    if type(member_id_list) in (str, int, long):
        member_id_list = [
            member_id_list,
        ]

    member_id_list = map(int, member_id_list)

    follower_list = [
        i for i in Zsite.mc_get_list(member_id_list) if i and i.cid == CID_USER
    ]
    return follower_list
示例#20
0
def search(keywords, cid, offset, limit):

    netloc = urlparse(keywords).netloc
    if netloc and netloc.endswith(SITE_DOMAIN_SUFFIX):
        url = netloc[:-len(SITE_DOMAIN_SUFFIX)]
        if url:
            id = id_by_url(url)
            if id:
                return Zsite.mc_get_list([id]), 1

    e = ENQUIRE
    keywords = make_query(keywords)

    match, count = _search(e, keywords, cid, offset, limit)
    r = []
    for m in match:
        doc = m.document
        rss_id = doc.get_value(0)
        r.append(rss_id)

    return Zsite.mc_get_list(r), count
示例#21
0
def member_list_by_id_list(member_id_list):
    if type(member_id_list) in (str, int, long):
        member_id_list = [member_id_list, ]

    member_id_list = map(int, member_id_list)

    follower_list = [
        i for i in
        Zsite.mc_get_list(member_id_list)
        if i and i.cid == CID_USER
    ]
    return follower_list
示例#22
0
def search(keywords, cid, offset, limit):

    netloc = urlparse(keywords).netloc
    if netloc and netloc.endswith(SITE_DOMAIN_SUFFIX):
        url = netloc[:-len(SITE_DOMAIN_SUFFIX)]
        if url:
            id = id_by_url(url)
            if id:
                return  Zsite.mc_get_list([id]), 1

    e = ENQUIRE
    keywords = make_query(keywords)

    match, count = _search(e, keywords, cid, offset, limit)
    r = []
    for m in match:
        doc = m.document
        rss_id = doc.get_value(0)
        r.append(rss_id)

    return Zsite.mc_get_list(r), count
示例#23
0
def _get(self, func):
    key = self.get_argument('q', None)
    user_id = self.current_user_id
    result = []
    if user_id:
        name_dict, url_dict = func(user_id)
        id_list = zsite_by_key(key, name_dict, url_dict, 7)
        zsite_list = Zsite.mc_get_list(id_list)
        ico_url_bind_with_default(zsite_list)
        career_bind(zsite_list)

        for i in zsite_list:
            li = (i.name, ','.join(i.career), url_or_id(i.id), i.ico)
            result.append(li)
    #print result
    self.finish(jsonp(self, dumps(result)))
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)
示例#25
0
def buzz_at_list(user_id, limit, offset):
    po_id_list = []
    reply_id_list = []
    user_id_list = []
    id_list = []
    for id, from_id, po_id, reply_id in buzz_at_col_list(user_id, limit, offset):
        id_list.append(id)
        po_id_list.append(po_id)
        reply_id_list.append(reply_id)
        user_id_list.append(from_id)

    from model.zsite import Zsite
    from model.po import Po
    from model.reply import Reply
    return tuple(zip(
        id_list,
        Zsite.mc_get_list(user_id_list),
        Po.mc_get_list(po_id_list),
        Reply.mc_get_list(reply_id_list),
    ))
示例#26
0
def po_id_next_by_user(user_id, offset):
    from model.po import Po
    from model.rss import RssPoId
    id = redis.lindex(REDIS_USER_RSS_PO % user_id, offset)
    if id:
        po = Po.mc_get(id)
        if po:
            rss_po_id = RssPoId.get(po_id=id)
            if rss_po_id:
                tag_id_list = rss_po_id.tag_id_list
            else:
                tag_id_list = ""
            tag_id_list = filter(bool, 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))
            po.tag_id_list = tag_id_list
            return po
示例#27
0
def po_id_next_by_user(user_id, offset):
    from model.po import Po
    from model.rss import RssPoId
    id = redis.lindex(REDIS_USER_RSS_PO%user_id, offset)
    if id: 
        po = Po.mc_get(id)
        if po:
            rss_po_id =  RssPoId.get(po_id=id)
            if rss_po_id:
                tag_id_list = rss_po_id.tag_id_list
            else:
                tag_id_list = ""
            tag_id_list = filter(bool, 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
                )
            )
            po.tag_id_list = tag_id_list
            return po
示例#28
0
    def post(self):
        user_list = self.get_argument('user_list','')
        user_list = filter(bool, map(str.strip, user_list.splitlines()))

#        print tag_id_list

        user_list_exist = []
        user_list_not_exist = []

        for i in user_list:
            zsite_id = zsite_by_query(i)
            if zsite_id:
                user_list_exist.append(zsite_id)
            else:
                user_list_not_exist.append(i)
            
             

        user_list_not_exist = unique(user_list_not_exist)
        user_list_exist = unique(user_list_exist)



        tag_id_list = tag_id_list_by_str_list(
            filter(
                bool, map(
                    str.strip, 
                    self.get_argument('tag','').split()
                )
            )
        )

        for i in user_list_exist:
            tag2idlist_po_user.append_id_tag_id_list(i, tag_id_list) 

        self.render(
            user_list_exist=Zsite.mc_get_list(user_list_exist),
            user_list_not_exist=user_list_not_exist,
        )
示例#29
0
def user_school_search(school_id, school_year, school_degree, school_department):
    if not school_id:
        return []
    #result = user_school_dict(school_id)
    #zsite_id_list = []
    #for i in result:
    #    zsite_id_list.extend(i[1])
    #Zsite.mc_get_list(zsite_id_list)
    #result.sort(key=UserSchoolSorter(school_year,school_degree, school_department))
    #return result

    user_school = UserSchool.where(school_id=school_id)
    if school_year and int(school_year):
        user_school = user_school.where(school_year=school_year) 
    #if school_degree:
    #    user_school = user_school.where(school_degree=school_degree) 
    if school_department and int(school_department):
        user_school = user_school.where(school_department=school_department)
    id_list = user_school.col_list(col="user_id")
    rank_dict = zsite_rank.get_dict(id_list)
    items = sorted(rank_dict.iteritems(), key=lambda x:-x[1])
    return Zsite.mc_get_list(i[0] for i in items)
示例#30
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
示例#31
0
def user_school_search(school_id, school_year, school_degree,
                       school_department):
    if not school_id:
        return []
    #result = user_school_dict(school_id)
    #zsite_id_list = []
    #for i in result:
    #    zsite_id_list.extend(i[1])
    #Zsite.mc_get_list(zsite_id_list)
    #result.sort(key=UserSchoolSorter(school_year,school_degree, school_department))
    #return result

    user_school = UserSchool.where(school_id=school_id)
    if school_year and int(school_year):
        user_school = user_school.where(school_year=school_year)
    #if school_degree:
    #    user_school = user_school.where(school_degree=school_degree)
    if school_department and int(school_department):
        user_school = user_school.where(school_department=school_department)
    id_list = user_school.col_list(col="user_id")
    rank_dict = zsite_rank.get_dict(id_list)
    items = sorted(rank_dict.iteritems(), key=lambda x: -x[1])
    return Zsite.mc_get_list(i[0] for i in items)
示例#32
0
    def post(self):
        name = self.get_argument('name', None)
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        current_user = self.current_user
        current_user_id = current_user.id

        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            if not (sex and int(sex) in (1, 2)):
                errtip.sex = '请选择性别'

        password = UserPassword.get(current_user_id)
        if not password:
            password = self.get_argument('password', None)
            if not password:
                errtip.password = '******'
            else:
                user_password_new(current_user_id, password)

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

        if not errtip:
            path = '/i/guide'
            user_info_new(current_user.id, sex=sex)
            return self.redirect(path)

        id_list = SHOW_LIST
        zsite_list = filter(bool, Zsite.mc_get_list(id_list))
        return self.render(
            sex=sex,
            name=name,
            errtip=errtip,
            zsite_list=zsite_list,
        )
示例#33
0
    def post(self):
        name = self.get_argument('name', None)
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        current_user = self.current_user
        current_user_id = current_user.id

        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            if not(sex and int(sex) in (1, 2)):
                errtip.sex = '请选择性别'

        password = UserPassword.get(current_user_id)
        if not password:
            password = self.get_argument('password', None)
            if not password:
                errtip.password = '******'
            else:
                user_password_new(current_user_id, password)

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

        if not errtip:
            path = '/i/guide'
            user_info_new(current_user.id, sex=sex)
            return self.redirect(path)

        id_list = SHOW_LIST
        zsite_list = filter(bool, Zsite.mc_get_list(id_list))
        return self.render(
                   sex=sex,
                   name=name,
                   errtip=errtip,
                   zsite_list=zsite_list,
               )
示例#34
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 ''))
示例#35
0
def tag_list_by_user_id(user_id):
    tag_id_list = tag2idlist_po_user.tag_id_list_by_id(user_id)
    tag_list = Zsite.mc_get_list(tag_id_list)
    return tag_list
示例#36
0
def zsite_site_by_user_id_sample(user_id, k):
    id_list = zsite_id_list_sample(user_id, CID_SITE, k)
    return Zsite.mc_get_list(id_list)
示例#37
0
def user_list_by_tag_id(tag_id):
    user_id_list = tag2idlist_po_user.id_list_by_tag_id(tag_id)
    user_list = Zsite.mc_get_list(user_id_list)
    for i in user_list:
        i.po_count = redis.llen(REDIS_USER_RSS_PO % i.id)
    return user_list
示例#38
0
 def get(self, mail=""):
     id_list = SHOW_LIST
     zsite_list = filter(bool, Zsite.mc_get_list(id_list))
     self.render(mail=mail, sex=0, password="", errtip=Errtip(), zsite_list=zsite_list)
示例#39
0
def site_rec(user_id):
    #zsite_id = SiteRecNew.get(user_id)
    zsite_id = "10000000"
    if zsite_id:
        return Zsite.mc_get_list(map(int,zsite_id.split()))
示例#40
0
def zsite_com_list(cid, limit, offset):
    return Zsite.mc_get_list(zsite_com_id_list(cid, limit, offset))
示例#41
0
def user_list_count_by_feed_import_user():
    id_count_list = redis.zrevrange(REDIS_FEED_IMPORT_USER, 0, -1, True, int)
    zsite_list = Zsite.mc_get_list(map(itemgetter(0), id_count_list))
    for i, count in zip(zsite_list, map(itemgetter(1), id_count_list)):
        i.feed_import_count = count 
    return zsite_list
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

import _env
import csv
from model.cid import CID_SITE, CID_NOTE
from zweb.orm import ormiter
from model.zsite import Zsite
from model.site_po import po_cid_count_by_zsite_id

def can_rec_site_id_list():
    result = []
    for i in ormiter(Zsite, 'cid=%s'%CID_SITE):
        zsite_id = i.id
        count = po_cid_count_by_zsite_id(zsite_id, CID_NOTE)
        if count > 5:
            result.append(zsite_id)
    return set(result)

if __name__ == '__main__':
    result = []
    for z in Zsite.mc_get_list(can_rec_site_id_list()):
        result.append([z.id, z.name])
    writer = csv.writer(open('site_id_name.csv', 'wb'), quoting=csv.QUOTE_ALL)
    writer.writerows(result)
示例#43
0
def user_list_count_by_feed_import_user():
    id_count_list = redis.zrevrange(REDIS_FEED_IMPORT_USER, 0, -1, True, int)
    zsite_list = Zsite.mc_get_list(map(itemgetter(0), id_count_list))
    for i, count in zip(zsite_list, map(itemgetter(1), id_count_list)):
        i.feed_import_count = count
    return zsite_list
示例#44
0
def zsite_list_by_member_admin(id, limit=None, offset=None):
    return Zsite.mc_get_list(zsite_id_list_by_member_admin(id, limit, offset))
示例#45
0
def zsite_list_sample(zsite_id, cid, k):
    return Zsite.mc_get_list(zsite_id_list_sample(zsite_id, cid, k))
示例#46
0
def user_list_by_tag_id(tag_id):
    user_id_list = tag2idlist_po_user.id_list_by_tag_id(tag_id)
    user_list = Zsite.mc_get_list(user_id_list)
    for i in user_list:
        i.po_count = redis.llen(REDIS_USER_RSS_PO%i.id)
    return user_list
示例#47
0
def zsite_list(owner_id, cid, limit=None, offset=None):
    return Zsite.mc_get_list(zsite_id_list(owner_id, cid, limit, offset))
示例#48
0
def tag_list_by_user_id(user_id):
    tag_id_list = tag2idlist_po_user.tag_id_list_by_id(user_id)
    tag_list = Zsite.mc_get_list(tag_id_list)
    return tag_list
示例#49
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)
示例#50
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

import _env
import csv
from model.cid import CID_SITE, CID_NOTE
from zweb.orm import ormiter
from model.zsite import Zsite
from model.site_po import po_cid_count_by_zsite_id


def can_rec_site_id_list():
    result = []
    for i in ormiter(Zsite, 'cid=%s' % CID_SITE):
        zsite_id = i.id
        count = po_cid_count_by_zsite_id(zsite_id, CID_NOTE)
        if count > 5:
            result.append(zsite_id)
    return set(result)


if __name__ == '__main__':
    result = []
    for z in Zsite.mc_get_list(can_rec_site_id_list()):
        result.append([z.id, z.name])
    writer = csv.writer(open('site_id_name.csv', 'wb'), quoting=csv.QUOTE_ALL)
    writer.writerows(result)
示例#51
0
def zsite_member_admin_list(com_id):
    return Zsite.mc_get_list(zsite_id_list_by_zsite_id(com_id, CID_ZSITE_TUPLE_LIST_MEMBER))
示例#52
0
def site_rec(user_id):
    #zsite_id = SiteRecNew.get(user_id)
    zsite_id = "10000000"
    if zsite_id:
        return Zsite.mc_get_list(map(int, zsite_id.split()))
示例#53
0
def zsite_show_list(cid, limit=None, offset=None):
    id_list = zsite_id_list(OWNER_ID, cid, limit, offset)
    return Zsite.mc_get_list(id_list)