Ejemplo n.º 1
0
 def get(self):
     user_id = self.current_user_id
     com_id = self.zsite_id
     if zsite_member_is_invite(com_id, user_id):
         zsite_member_new(com_id, user_id, ZSITE_MEMBER_STATE_ACTIVE)
     else:
         com_apply_new(com_id, user_id)
     self.redirect('/')
Ejemplo n.º 2
0
def com_apply_accept(user_id, com_id, admin_id):
    zsite_member_new(com_id, user_id, ZSITE_MEMBER_STATE_ACTIVE)

    ca = ComApply.get_or_create(user_id=user_id, com_id=com_id, )
    ca.admin_id = admin_id
    ca.create_time = today_seconds()
    ca.state = COM_APPLY_STATE_ACCEPT
    ca.save()
    mc_flush(com_id)
Ejemplo n.º 3
0
def _zsite_member_invite(zsite, member, current_user):
    zsite_id = zsite.id
    member_id = member.id

    http = http_by_member(member)

    if zsite_member_new(zsite_id, member_id):
        #TODO !
        mail = mail_by_user_id(member_id)
        #mail = "[email protected]"

        mq_rendermail(
            '/mail/com/invite_member.htm',
            mail,
            member.name,
            sender_name=current_user.name,
            format='html',
            subject='%s 邀请您给 %s 未来的同事写几句话' % (
                current_user.name,
                zsite.name
            ),
            from_user_name=current_user.name,
            from_user_link=current_user.link,
            com_link=zsite.link,
            com_name=zsite.name,
            http=http
        )
Ejemplo n.º 4
0
    def post(self):
        zsite_id = self.zsite_id
        current_user_id = self.current_user_id
        current_user = self.current_user

        name = self.get_argument('txt', '')
        po_review_new(zsite_id, current_user_id, name)

        if self.get_argument('join', None):
            if zsite_member_is_invite(zsite_id, current_user_id):
                zsite_member_new(zsite_id, current_user_id, ZSITE_MEMBER_STATE_ACTIVE)

        path = newbie_redirect(current_user)
        if path:
            return self.redirect(path)

        return self.get()
Ejemplo n.º 5
0
    def post(self):
        errtip = Errtip()
        current_user = self.current_user
        current_user_id = current_user.id
        name = self.get_argument('name', None)
        motto = self.get_argument('motto', None)
        url = self.get_argument('url', None)
        pid = self.get_arguments('pid', None)
        address = self.get_arguments('address', None)
        phone = self.get_argument('phone', None)
        pid_add = zip(pid, address)

        if not name:
            errtip.name = '请输入名称'

        if not motto:
            errtip.motto = '请编写签名'


        if url:
            errtip.url = url_valid(url)

        files = self.request.files
        pic_id = None

        if 'pic' in files:
            pic = files['pic'][0]['body']
            pic = picopen(pic)
            if pic:
                pic_id = site_ico_new(current_user_id, pic)
            else:
                errtip.pic = '图片格式有误'
        else:
            pic_id = self.get_argument('pic_id', None)
            if not pic_id:
                errtip.pic = '请上传图片'

        if not errtip:
            com = com_new(name, current_user_id )
            com_id = com.id
            zsite_com_new(com_id, phone=phone)
            site_ico_bind(current_user_id, pic_id, com_id)
            motto_set(com_id, motto)
            zsite_member_new(com_id, current_user_id, state=ZSITE_MEMBER_STATE_ACTIVE)
            if pid_add:
                for pa in pid_add:
                    zsite_com_place_new(com_id, int(pa[0]), pa[1])
            else:
                pid_add = self.get_argument('pid_add', None)
            if url:
                url_new(com_id, url)
            return self.redirect('%s/product/new'%com.link)


        return self.render(
            errtip=errtip,
            name=name,
            motto=motto,
            url=url,
            #txt=txt,
            phone=phone,
            pic_id=pic_id,
            pid_add=pid_add
        )