def zsite2keyword(z):
    r = []
    t = defaultdict(int)
    id = z.id

    name = z.name
    if name:
        for word in seg_title_search(name):
            t[word] += 2

    url = url_by_id(id)
    if url:
        t[url] += 2

    if z.cid == CID_SITE:
        for word in seg_title_search(motto_get(id)):
            t[word] += 1

    elif z.cid == CID_USER:

        mail = mail_by_user_id(id)
        if mail:
            t[mail] += 2
            t[mail.split('@', 1)[0]] += 2


        txt = txt_get(id)

        if txt:
            man_txt_len = len(txt)

            for word in seg_txt_search(txt):
                t[word] += 1

        for seq, career in enumerate(career_list_all(id)):
            if seq:
                add = 1
            else:
                add = 2

            unit = career.unit
            title = career.title
            txt = career.txt

            if unit:
                for word in seg_title_search(unit):
                    t[word] += add

            if title:
                for word in seg_title_search(title):
                    t[word] += add
            if txt:
                for word in seg_txt_search(txt):
                    t[word] += add

    return t
Exemple #2
0
def zsite2keyword(z):
    r = []
    t = defaultdict(int)
    id = z.id

    name = z.name
    if name:
        for word in seg_title_search(name):
            t[word] += 2

    url = url_by_id(id)
    if url:
        t[url] += 2

    if z.cid == CID_SITE:
        for word in seg_title_search(motto_get(id)):
            t[word] += 1

    elif z.cid == CID_USER:

        mail = mail_by_user_id(id)
        if mail:
            t[mail] += 2
            t[mail.split('@', 1)[0]] += 2

        txt = txt_get(id)

        if txt:
            man_txt_len = len(txt)

            for word in seg_txt_search(txt):
                t[word] += 1

        for seq, career in enumerate(career_list_all(id)):
            if seq:
                add = 1
            else:
                add = 2

            unit = career.unit
            title = career.title
            txt = career.txt

            if unit:
                for word in seg_title_search(unit):
                    t[word] += add

            if title:
                for word in seg_title_search(title):
                    t[word] += add
            if txt:
                for word in seg_txt_search(txt):
                    t[word] += add

    return t
Exemple #3
0
 def get(self):
     zsite = self.zsite
     zsite_id = self.zsite_id
     link_list, link_cid = link_list_cid_by_zsite_id(
         zsite_id, SITE_LINK_ZSITE_DICT)
     self.render(errtip=JsDict(),
                 link_cid=link_cid,
                 link_list=link_list,
                 name=zsite.name,
                 motto=motto_get(zsite_id),
                 txt=txt_get(zsite_id),
                 pic_id=ico96.get(zsite_id))
Exemple #4
0
 def get(self, id):
     zsite = Zsite.mc_get(id)
     if zsite:
         info = UserInfo.get(id)
         if info:
             sex = info.sex
         else:
             sex = ''
         txt = txt_get(id)
         self.render(txt=txt, zsite=zsite, sex=sex)
     else:
         self.redirect('/')
Exemple #5
0
 def get(self, oauth_client_id):
     client = OauthClient.get(oauth_client_id)
     if client and client.can_admin(self.current_user_id):
         self.render(
             cid=client.cid,
             name=client.name,
             site=client.site,
             uri=oauth_client_uri.get(oauth_client_id),
             txt=txt_get(oauth_client_id),
             oauth_client_id=oauth_client_id,
         )
     else:
         return self.redirect('/')
Exemple #6
0
 def get(self):
     zsite = self.zsite
     zsite_id = self.zsite_id
     link_list , link_cid = link_list_cid_by_zsite_id(zsite_id, SITE_LINK_ZSITE_DICT)
     self.render(
         errtip=JsDict(),
         link_cid=link_cid,
         link_list=link_list,
         name=zsite.name,
         motto=motto_get(zsite_id),
         txt=txt_get(zsite_id),
         pic_id=ico96.get(zsite_id)
     )
 def get(self, oauth_client_id):
     client = OauthClient.get(oauth_client_id)
     if client and client.can_admin(self.current_user_id):
         self.render(
             cid=client.cid,
             name=client.name,
             site=client.site,
             uri=oauth_client_uri.get(oauth_client_id),
             txt=txt_get(oauth_client_id),
             oauth_client_id=oauth_client_id,
         )
     else:
         return self.redirect('/')
Exemple #8
0
 def get(self):
     current_user_id = self.current_user_id
     current_user = self.current_user
     motto = _motto.get(current_user_id)
     txt = txt_get(current_user_id)
     o = UserInfo.mc_get(current_user_id) or JsDict()
     c = namecard_get(current_user_id) or JsDict()
     self.render(
         name=current_user.name,
         motto=motto,
         txt=txt,
         birthday='%08d' % (o.birthday or 0),
         marry=o.marry,
         pid_home=o.pid_home or 0,
         pid_now=c.pid_now or 0,
         sex=o.sex
     )
def man_show_api(man_id):
    man = Zsite.mc_get(man_id)
    if man:
        comp, title = career_current(man_id)
        txt = txt_get(man_id)
        link = man.link
        li = [
            ('id', man_id),
            ('name', man.name),
            ('uid', url_by_id(man_id)),
            ('company', comp),
            ('title', title),
            ('signature', motto_get(man_id)),
            ('about_me', txt),
            ('ico', pic_url(man_id, 219)),
            ('link', name_link_by_zsite_id(man_id, 'http:')),
            ('appearance_fee', 42),
        ]
        return dict(filter(lambda x:bool(x[1]), li))
    return {}
Exemple #10
0
def man_show_api(man_id):
    man = Zsite.mc_get(man_id)
    if man:
        comp, title = career_current(man_id)
        txt = txt_get(man_id)
        link = man.link
        li = [
            ('id', man_id),
            ('name', man.name),
            ('uid', url_by_id(man_id)),
            ('company', comp),
            ('title', title),
            ('signature', motto_get(man_id)),
            ('about_me', txt),
            ('ico', pic_url(man_id, 219)),
            ('link', name_link_by_zsite_id(man_id, 'http:')),
            ('appearance_fee', 42),
        ]
        return dict(filter(lambda x: bool(x[1]), li))
    return {}