Esempio n. 1
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
Esempio n. 2
0
def zsite_rank_by_zsite(zsite):
    from model.zsite_show import zsite_show_get
    rank = 0
    id = zsite.id
    if zsite.state > ZSITE_STATE_CAN_REPLY:
        rank += 3
        if zsite_show_get(id):
            rank += 1
    else:
        if career_current(id):
            rank += 1
        if ico.get(id):
            rank += 1
    return rank
Esempio n. 3
0
def zsite_rank_by_zsite(zsite):
    from model.zsite_show import zsite_show_get
    rank = 0
    id = zsite.id
    if zsite.state > ZSITE_STATE_CAN_REPLY:
        rank += 3
        if zsite_show_get(id):
            rank += 1
    else:
        if career_current(id):
            rank += 1
        if ico.get(id):
            rank += 1
    return rank
Esempio n. 4
0
    def post(self):
        id = self.get_argument('id')
        name = self.get_argument('name', None)
        pic = self.get_argument('pic', None)
        career_id_list = map(int, self.get_arguments('career', ()))

        admin_id = self.current_user.id
        user = Zsite.mc_get(id)

        if career_id_list:
            for career_id in career_id_list:
                career_rm(career_id, int(id))
            from model.zsite_verify import zsite_verify_ajust
            zsite_verify_ajust(user)
        if name:
            zsite_name_rm(id)
        if pic:
            from model.ico import ico
            pic_no(ico.get(id), admin_id)
        return self.redirect("/zsite/verify/next/%s" % id)
Esempio n. 5
0
def zsite_verify_ajust(zsite):
    if zsite.cid != CID_USER:
        return

    need = 0
    id = zsite.id
    name = zsite.name
    if name.isdigit() or not name:
        need |= ZSITE_VERIFY_NEED_NAME

    if not ico.get(id):
        need |= ZSITE_VERIFY_NEED_ICO

    if not any(career_current(id)):
        need |= ZSITE_VERIFY_NEED_CAREER

    if need:
        zsite_verify_rm(zsite)
        return need
    else:
        zsite_verify_new(zsite)
Esempio n. 6
0
def zsite_verify_ajust(zsite):
    if zsite.cid != CID_USER:
        return

    need = 0
    id = zsite.id
    name = zsite.name
    if name.isdigit() or not name:
        need |= ZSITE_VERIFY_NEED_NAME 

    if not ico.get(id):
        need |= ZSITE_VERIFY_NEED_ICO 
    
    if not any(career_current(id)):
        need |= ZSITE_VERIFY_NEED_CAREER
 
    if need:
        zsite_verify_rm(zsite)
        return need
    else: 
        zsite_verify_new(zsite)