Exemplo n.º 1
0
    def post(self):
        name = self.get_argument('name', '')
        mail = self.get_argument('mail', '')
        errtip = Errtip()
        if mail:
            mail = mail.lower()
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮箱格式有误'

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


        if not errtip:
            user_id = user_id_by_mail(mail)
            if not user_id:
                user_id = user_new(mail, name=name)
                #session = user_session(user_id)
                #self.set_cookie('S', session)
                self.set_cookie('E', mail)

                phone = self.get_argument('phone', '')
                namecard_new(user_id,phone=phone)

            return self.redirect('/auth/reged/%s'%user_id)

        self.render(
            mail=mail,
            name=name,
            errtip=errtip
        )
Exemplo n.º 2
0
    def post(self):
        name = self.get_argument('name', '')
        mail = self.get_argument('mail', '')
        errtip = Errtip()
        if mail:
            mail = mail.lower()
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮箱格式有误'

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

        if not errtip:
            user_id = user_id_by_mail(mail)
            if not user_id:
                user_id = user_new(mail, name=name)
                #session = user_session(user_id)
                #self.set_cookie('S', session)
                self.set_cookie('E', mail)

                phone = self.get_argument('phone', '')
                namecard_new(user_id, phone=phone)

            return self.redirect('/auth/reged/%s' % user_id)

        self.render(mail=mail, name=name, errtip=errtip)
Exemplo n.º 3
0
 def post(self):
     hr_mail = self.get_argument('hr_mail', None)
     errtip = Errtip()
     if not EMAIL_VALID.match(hr_mail):
         errtip.hr_mail = '请输入正确的邮箱'
     if not errtip:
         job_mail_new_with_verify_mail(self.zsite, self.current_user_id, hr_mail)
         self.get()
     else:
         self.render(
             errtip=errtip,
             hr_mail=hr_mail,
         )
Exemplo n.º 4
0
 def post(self):
     hr_mail = self.get_argument('hr_mail', None)
     errtip = Errtip()
     if not EMAIL_VALID.match(hr_mail):
         errtip.hr_mail = '请输入正确的邮箱'
     if not errtip:
         job_mail_new_with_verify_mail(self.zsite, self.current_user_id,
                                       hr_mail)
         self.get()
     else:
         self.render(
             errtip=errtip,
             hr_mail=hr_mail,
         )
Exemplo n.º 5
0
    def post(self, id):
        self._prepare(id)
        errtip = Errtip()
        user_id, mail, password, errtip = self._mail_password_post()

        if not errtip:

            if user_id:
                token_key_login_set(id, user_id)
                return self._login(user_id, mail,
                                   self.get_argument('next', None))
            else:
                token_key_login_set(id, user_id)
                user_id = user_new(mail, password=password)

                sync_txt = self.get_argument('sync_txt', None)
                txt = self.get_argument('weibo', None)
                flag = 0
                if sync_txt:
                    flag |= 0b10

                sync_follow_new(user_id, flag, self.cid, txt, id)

                return self.redirect('/auth/verify/send/%s' % user_id)

        self.render(errtip=errtip)
Exemplo n.º 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)
Exemplo n.º 7
0
    def post(self):
        errtip = Errtip()
        user_id = self.current_user_id
        user = self.current_user

        password = self.get_argument('password', None)
        mail = self.get_argument('mail', None)
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮件格式不正确'

        if not password:
            errtip.password = '******'
        elif not user_password_verify(user_id, password):
            errtip.password = '******'
            password = ''

        if not errtip:
            from model.user_mail import user_mail_new, user_mail_by_state, MAIL_VERIFIED, user_mail_active_by_user
            if mail in user_mail_by_state(user_id, MAIL_VERIFIED):
                user_mail_active_by_user(user, mail)
                return self.redirect('/i/account/mail/success')

            if user_mail_new(user_id, mail):
                verify_mail_new(user_id, self.current_user.name, mail,
                                CID_VERIFY_LOGIN_MAIL)
            else:
                errtip.mail = '该邮箱已经注册'

        self.render(mail=mail, errtip=errtip, password=password)
Exemplo n.º 8
0
    def post(self):
        current_user_id = self.current_user_id
        hr_mail = self.get_argument('hr_mail', '').strip().lower()
        zsite_id = self.zsite_id
        zsite = self.zsite

        errtip = Errtip()
        if hr_mail:
            if not EMAIL_VALID.match(hr_mail):
                errtip.mail = '邮件格式错误'
        else:
            errtip.mail = '请输入邮箱'

        if errtip:
            return self.render(errtip=errtip, current_user_id=current_user_id)
        else:
            job_mail_new_with_verify_mail(zsite, current_user_id, hr_mail)
            return self.redirect('/job/mail/verify')
Exemplo n.º 9
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,
     )
Exemplo n.º 10
0
    def post(self):
        current_user_id = self.current_user_id
        hr_mail = self.get_argument('hr_mail', '').strip().lower()
        zsite_id = self.zsite_id
        zsite = self.zsite

        errtip = Errtip()
        if hr_mail:
            if not EMAIL_VALID.match(hr_mail):
                errtip.mail = '邮件格式错误'
        else:
            errtip.mail = '请输入邮箱'

        if errtip:
            return self.render(errtip=errtip, current_user_id=current_user_id)
        else:
            job_mail_new_with_verify_mail(zsite, current_user_id, hr_mail)
            return self.redirect('/job/mail/verify')
Exemplo n.º 11
0
    def get(self, id=0):
        user_id = self.current_user_id

        if id:
            event = Event.mc_get(id)
            if not event or event.zsite_id != self.current_user_id:
                return self.redirect('/po/event')
            return po_event_edit_get(self, event)

        default_event = last_event_by_zsite_id(user_id)

        return self.render(errtip=Errtip(), default_event=default_event)
Exemplo n.º 12
0
    def post(self):
        errtip = Errtip()
        user_id = self.current_user_id
        user = self.current_user

        password = self.get_argument('password', None)
        mail = self.get_argument('mail', None)
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮件格式不正确'

        if not password:
            errtip.password = '******'
        elif not user_password_verify(user_id, password):
            errtip.password = '******'
            password = ''

        if not errtip:
            from model.user_mail import user_mail_new, user_mail_by_state, MAIL_VERIFIED, user_mail_active_by_user
            if mail in user_mail_by_state(user_id, MAIL_VERIFIED):
                user_mail_active_by_user(user, mail)
                return self.redirect('/i/account/mail/success')

            if user_mail_new(user_id, mail):
                verify_mail_new(
                    user_id, self.current_user.name, mail, CID_VERIFY_LOGIN_MAIL
                )
            else:
                errtip.mail = '该邮箱已经注册'

        self.render(mail=mail, errtip=errtip, password=password)
Exemplo n.º 13
0
    def post(self, mail=None):
        mail = self.get_argument('mail', '')
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        if sex:
            sex = int(sex)
            if sex not in (1, 2):
                sex = 0

        if mail:
            mail = mail.lower()
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮箱格式有误'

        #if not password:
        #    errtip.password = '******'

        if not errtip:
            user_id = user_id_by_mail(mail)
            if user_id:
                #if user_password_verify(user_id, password):
                #    return self._login(user_id, mail)
                #else:
                errtip.mail = '邮箱已注册。忘记密码了?<a href="/auth/password/reset/%s">点此找回</a>' % escape(mail)

        if not sex:
            errtip.sex = '请选择性别'

        if not errtip:
            user_id = user_new(mail, sex=sex)
            return self.redirect('/auth/verify/send/%s'%user_id)

        self.render(
            sex=sex,
            mail=mail,
            errtip=errtip
        )
Exemplo n.º 14
0
def _mail_password_post(self):
    mail = self.get_argument('mail', None)
    password = self.get_argument('password', None)
    errtip = Errtip()

    if mail:
        mail = mail.lower()
    if not mail:
        errtip.mail = '请输入邮箱'
    elif not EMAIL_VALID.match(mail):
        errtip.mail = '邮箱格式有误'

    if not password:
        errtip.password = '******'

    user_id = 0
    if not errtip:
        user_id = user_id_by_mail(mail)
        if user_id:
            if not user_password_verify(user_id, password):
                errtip.password = '******' % escape(mail)

    return user_id , mail, password, errtip
Exemplo n.º 15
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)
        pid = self.get_arguments('pid', None)
        address = self.get_arguments('address', None)
        phone = self.get_argument('phone', None)
        pid_add = zip(pid, address)
        zsite = self.zsite

        if not name:
            errtip.name = '请输入名称'
        else:
            zsite.name = name
            zsite.save()

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

        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:
            current_user_id = self.current_user_id
            com_id = self.zsite_id
            zsite_com_new(com_id, phone=phone)
            site_ico_bind(current_user_id, pic_id, com_id)
            motto_set(com_id, motto)
            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)
            return self.redirect('/')

        return self.render(
            errtip=errtip,
            name=name,
            motto=motto,
            #txt=txt,
            phone=phone,
            pic_id=pic_id,
            pid_add=pid_add)
Exemplo n.º 16
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,
               )
Exemplo n.º 17
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,
        )
Exemplo n.º 18
0
    def get(self):
        current_user = self.current_user
        current_user_id = self.current_user_id
        url, title = self._arguments()
        price = self.get_argument('price', 4.2)

        if current_user:
            alipay_account = pay_account_get(current_user_id, CID_PAY_ALIPAY)
        else:
            alipay_account = ''

        self.render(url=url,
                    title=title,
                    amount=price,
                    errtip=Errtip(),
                    alipay_account=alipay_account)
Exemplo n.º 19
0
    def get(self):
        errtip = Errtip()
        name = self.zsite.name
        com_id = self.zsite_id
        pic_id = ico96.get(com_id)
        motto = _motto.get(com_id)
        pid_add = pid_by_com_id(com_id)
        pid_add = [[i.pid, i.address] for i in pid_add]
        zc = ZsiteCom.mc_get(com_id)
        phone = None
        if zc:
            phone = zc.phone

        self.render('/ctrl/com/index/com_new.htm',
                    errtip=errtip,
                    motto=motto,
                    pic_id=pic_id,
                    name=name,
                    phone=phone,
                    pid_add=pid_add,
                    edit=True)
Exemplo n.º 20
0
def po_event_edit_get(self, event):
    return self.render(
        errtip=Errtip(),
        event_id=event.id,
        event=event,
        address=event.address,
        pic_id=event.pic_id,
        limit_up=event.limit_up,
        limit_down=event.limit_down,
        transport=event.transport,
        price=event.price,
        phone=event.phone,
        pid=event.pid,
        event_cid=event.cid,
        begin_time=minute2ymd(event.begin_time),
        end_time=minute2ymd(event.end_time),
        begin_time_hour=(event.begin_time%ONE_DAY_MINUTE)/60,
        begin_time_minute=event.begin_time%60,
        end_time_hour=(event.end_time%ONE_DAY_MINUTE)/60,
        end_time_minute=event.end_time%60,
    )
Exemplo n.º 21
0
 def get(self, id):
     job = ComJob.mc_get(id)
     if job and job.com_id == self.zsite_id:
         needs = job.needs
         self.render(errtip=Errtip(),
                     title=job.title,
                     kinds=job_kind_by_job_id(job.id),
                     job_type=job_type_by_job_id(job.id),
                     txt=needs.txt,
                     stock_option=needs.stock_option,
                     priority=needs.priority,
                     require=needs.require,
                     welfare=needs.welfare,
                     salary_type=job.salary_type,
                     salary1=job.salary_from,
                     salary2=job.salary_to,
                     dead_line=90,
                     quota=job.quota,
                     job=job,
                     addr=job_pid_by_job_id(job.id))
     else:
         return self.redirect('/job/admin')
Exemplo n.º 22
0
def _mail_password_post(self):
    mail = self.get_argument('mail', None)
    password = self.get_argument('password', None)
    errtip = Errtip()

    if mail:
        mail = mail.lower()
    if not mail:
        errtip.mail = '请输入邮箱'
    elif not EMAIL_VALID.match(mail):
        errtip.mail = '邮箱格式有误'

    if not password:
        errtip.password = '******'

    user_id = 0
    if not errtip:
        user_id = user_id_by_mail(mail)
        if user_id:
            if not user_password_verify(user_id, password):
                errtip.password = '******' % escape(
                    mail)

    return user_id, mail, password, errtip
Exemplo n.º 23
0
    def post(self, mail=None):
        mail = self.get_argument('mail', '')
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        if sex:
            sex = int(sex)
            if sex not in (1, 2):
                sex = 0

        if mail:
            mail = mail.lower()
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮箱格式有误'

        #if not password:
        #    errtip.password = '******'

        if not errtip:
            user_id = user_id_by_mail(mail)
            if user_id:
                #if user_password_verify(user_id, password):
                #    return self._login(user_id, mail)
                #else:
                errtip.mail = '邮箱已注册。忘记密码了?<a href="/auth/password/reset/%s">点此找回</a>' % escape(
                    mail)

        if not sex:
            errtip.sex = '请选择性别'

        if not errtip:
            user_id = user_new(mail, sex=sex)
            return self.redirect('/auth/verify/send/%s' % user_id)

        self.render(sex=sex, mail=mail, errtip=errtip)
Exemplo n.º 24
0
 def get(self, id):
     self._prepare(id)
     errtip = Errtip()
     self.render(errtip=errtip)
Exemplo n.º 25
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
        )
Exemplo n.º 26
0
 def get(self):
     errtip = Errtip()
     self.render(errtip=errtip)
Exemplo n.º 27
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)
        pid = self.get_arguments('pid', None)
        address = self.get_arguments('address', None)
        phone = self.get_argument('phone', None)
        pid_add = zip(pid, address)
        zsite = self.zsite

        if not name:
            errtip.name = '请输入名称'
        else:
            zsite.name = name
            zsite.save()

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



        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:
            current_user_id = self.current_user_id
            com_id = self.zsite_id
            zsite_com_new(com_id, phone=phone)
            site_ico_bind(current_user_id, pic_id, com_id)
            motto_set(com_id, motto)
            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)
            return self.redirect('/')


        return self.render(
            errtip=errtip,
            name=name,
            motto=motto,
            #txt=txt,
            phone=phone,
            pic_id=pic_id,
            pid_add=pid_add
        )
Exemplo n.º 28
0
def po_event_edit_post(self, id, event, can_change, event_new):
    user_id = self.current_user_id
    if event:
        user_id = event.zsite_id
    errtip = Errtip()
    phone = self.get_argument('phone', '')
    address = self.get_argument('address', None)
    limit_up = self.get_argument('limit_up', '42')
    limit_down = self.get_argument('limit_down', '0')
    transport = self.get_argument('transport', '')
    price = self.get_argument('price', '0')
    pid = self.get_argument('pid', '1')
    event_cid = self.get_argument('event_cid', '')
    #print event_cid, "!!!!!!!!!!!"
    begin_time = self.get_argument('begin_time', '')
    end_time = self.get_argument('end_time', '')
    begin_time = self.get_argument('begin_time', '')

    begin_time_hour = self.get_argument('begin_time_hour', '0')
    begin_time_minute = self.get_argument('begin_time_minute', '0')
    end_time_hour = self.get_argument('end_time_hour', '0')
    end_time_minute = self.get_argument('end_time_minute', '0')

    if not can_change:
        city_pid = end = begin = None
    else:
        begin_time_hour = int(begin_time_hour)
        begin_time_minute = int(begin_time_minute)

        end_time_hour = int(end_time_hour)
        end_time_minute = int(end_time_minute)

        if begin_time_hour > 23 or begin_time_hour < 0:
            begin_time_hour = 10

        if end_time_hour > 23 or end_time_hour < 0:
            end_time_hour = 11

        if begin_time_minute > 59 or begin_time_minute < 0:
            begin_time_minute = 0

        if end_time_minute > 59 or end_time_minute < 0:
            end_time_minute = 30

        if begin_time:
            begin_time = int(begin_time)

        if end_time:
            end_time = int(end_time)


        if begin_time > end_time:
            end_time, begin_time = begin_time, end_time

        if begin_time < today_ymd_int():
            errtip.begin_time = '这个时间 , 属于过去'


        begin = ymd2minute(begin_time)+begin_time_hour*60+begin_time_minute
        end = ymd2minute(end_time)+end_time_hour*60+end_time_minute

        if not event_cid.isdigit():
            errtip.event_cid = '请选择类型'
        else:
            event_cid = int(event_cid)
            if event_cid not in EVENT_CID:
                errtip.event_cid = '请选择类型'

        if not pid.isdigit():
            errtip.pid = '请选择地址'
        else:
            pid = int(pid)
            city_pid = pid_city(pid)
            if not city_pid:
                errtip.pid = '请选择地址'

        if price:
            try:
                price = float(price)
            except:
                errtip.price = '请输入有效的金额'
            if price < 0:
                errtip.price = '金额必须大于零'
        else:
            price = 0

        if not limit_down.isdigit():
            limit_down = 0
        else:
            limit_down = int(limit_down)

        if not limit_up.isdigit():
            limit_up = 42
        else:
            limit_up = int(limit_up)

        if limit_down > limit_up:
            limit_up, limit_down = limit_down, limit_up
        if limit_down < 0:
            errtip.limit_down = '人数不能为负数'

        if not address:
            errtip.address = '请输入详细地址'

    if not phone:
        errtip.phone = '请输入联系电话'

    pic_id = None
    files = self.request.files
    if 'pic' in files:
        pic = files['pic'][0]['body']
        pic = picopen(pic)
        if not pic:
            errtip.pic = '图片格式有误'
        else:
            pic_id = po_event_pic_new(user_id, pic)

    if not pic_id:
        pic_id = self.get_argument('pic_id', None)
        if pic_id:
            o = Pic.get(pic_id)
            if not (o and o.cid == CID_EVENT):
                pic_id = None

    if not pic_id:
        errtip.pic = '请上传图片'

    if errtip:
        self.render(
            event=event,
            errtip=errtip,
            address=address,
            pic_id=pic_id,
            limit_up=limit_up,
            limit_down=limit_down,
            transport=transport,
            price=price,
            phone=phone,
            pid=pid,
            event_cid=event_cid,
            begin_time=begin_time if can_change else 0,
            end_time=end_time if can_change else 0,
            begin_time_hour=begin_time_hour,
            begin_time_minute=begin_time_minute,
            end_time_hour=end_time_hour,
            end_time_minute=end_time_minute,
        )
        return
    else:
        event = event_new(
            user_id,
            event_cid,
            city_pid,
            pid,
            address,
            transport,
            begin,
            end,
            int(100*price),
            limit_up,
            limit_down,
            phone,
            pic_id,
            id
        )
        return event
Exemplo n.º 29
0
 def get(self):
     err = Errtip()
     self.render(current_user_id=self.current_user_id, errtip=err)
Exemplo n.º 30
0
def _job_save(self, job=None, add=None):
    errtip = Errtip()
    department_id = self.get_argument('depart', None)
    title = self.get_argument('title', None)
    kinds = self.get_argument('kinds', None)
    stock_option = self.get_argument('share', None)
    priority = self.get_argument('more', None)
    job_type = self.get_arguments('type', None)
    require = self.get_argument('require', None)
    txt = self.get_argument('txt', None)
    welfare = self.get_argument('other', None)
    salary_from = self.get_argument('salary1', None)
    salary_to = self.get_argument('salary2', None)
    salary_type = self.get_argument('sal_type', None)
    dead_line = self.get_argument('deadline', None)
    pids = self.get_arguments('addr', None)
    quota = self.get_argument('quota', None)

    if not department_id:
        errtip.department_id = '请选择部门'
    if not title:
        errtip.title = '请输入职位头衔'
    if not kinds:
        errtip.kinds = '请选择行业'
    if not job_type:
        errtip.job_type = '请选择工作种类'
    if not pids:
        errtip.addr = '请选择工作地址'
    if not quota.isdigit():
        errtip.quota = '请设定人数'
    if not (salary_from and salary_to):
        errtip.salary = '必须设定薪水'
    if not (salary_from.isdigit() and salary_to.isdigit()):
        errtip.salary = '请输入正确的薪水'
    else:
        salary_from = int(salary_from)
        salary_to = int(salary_to)
        if salary_from > salary_to:
            salary_to, salary_from = salary_from, salary_to

    if not txt:
        errtip.txt = '请填写职位描述'
    if not dead_line:
        errtip.dead_line = '必须选择过期时间'
    if not salary_type:
        errtip.salary_type = '必须选择工资类型'

    if not errtip:
        cj = job_new(self.zsite_id, department_id, title, today_days(),
                     salary_from, salary_to, salary_type,
                     int(dead_line) + today_days(), quota, txt, require,
                     stock_option, welfare, priority, pids, job_type,
                     kinds.split('-'), job)
        if add:
            return self.redirect('/job/admin')
        elif not job:
            return self.redirect('/job/next')
        else:
            return self.redirect('/job/admin')
    else:
        self.render(
            errtip=errtip,
            title=title,
            stock_option=stock_option,
            kinds=kinds.split('-'),
            priority=priority,
            job_type=job_type,
            require=require,
            txt=txt,
            welfare=welfare,
            salary_type=salary_type,
            salary1=salary_from,
            salary2=salary_to,
            dead_line=dead_line,
            addr=pids,
            quota=quota,
        )
Exemplo n.º 31
0
 def get(self):
     if job_mail_by_com_id(self.zsite_id):
         return self.render(errtip=Errtip())
     else:
         return self.redirect('/job/mail')
Exemplo n.º 32
0
    def post(self):
        current_user = self.current_user
        zsite = self.zsite
        request = self.request
        errtip = Errtip()
        zsite_id = self.zsite_id

        url, title = self._arguments()
        amount = self.get_argument('amount', 0)
        alipay_account = self.get_argument('alipay_account', '')

        if not amount:
            errtip.amount = '请输入金额'
        else:
            try:
                amount = float(amount)
            except ValueError:
                errtip.amount = '%s 不是有效的金额'%amount
            else:
                if amount <= 0:
                    errtip.amount = '金额须大于零'
                elif amount >= 9999999:
                    errtip.amount = '金额超出上限'
                else:
                    amount_cent = amount * 100

        if not current_user:
            mail = self.get_argument('mail', '')
            if not mail:
                errtip.mail = '请输入联系邮箱'
            elif not EMAIL_VALID.match(mail):
                errtip.mail = '邮箱无效'
            else:
                user = user_by_mail(mail)
                self.set_cookie('E', mail.strip().lower())
                if not user:
                    user = user_new_by_mail(mail)
                elif user.state >= ZSITE_STATE_APPLY:
                    return self.redirect(
                              '/auth/login?next=%s'%request.uri
                           )
                current_user = user

        if current_user and not errtip:
            subject = '%s 向 %s 捐赠 %.2f 元' % (current_user.name, zsite.name, amount)
            current_user_id = current_user.id
            balance_cent = bank.get(current_user_id)

            def _pay_new(state):
                return pay_new(amount, current_user_id, zsite_id, CID_TRADE_PAY, state).id


            txt = self.get_argument('txt', None)
            secret = self.get_argument('secret', None)

            message = {}

            if title:
                message['title'] = title
            if url:
                message['url'] = url
            if txt:
                message['txt'] = txt
                if secret:
                    message['secret'] = secret




            if balance_cent >= amount_cent:
                o_id = _pay_new(TRADE_STATE_FINISH)
                if message:
                    trade_log.set(o_id, dumps(message))
                pay_notice(o_id)

                return self.redirect('%s/pay/result/%s'%(SITE_HTTP, o_id))
            elif balance_cent > 0:
                subject += '(余额支付 %.2f 元)' % (balance_cent/100.0)
                o_id = _pay_new(TRADE_STATE_NEW)
                amount_cent -= balance_cent
            else:
                o_id = _pay_new(TRADE_STATE_NEW)

            trade_log.set(o_id, dumps(message))

            return_url = '%s/money/alipay_sync' % SITE_HTTP
            notify_url = '%s/money/alipay_async' % RPC_HTTP

            alipay_url = alipay_payurl_with_tax(
                current_user_id,
                amount_cent/100.0,
                return_url,
                notify_url,
                subject,
                alipay_account,
                o_id
            )

            return self.redirect(alipay_url)

        self.render(
            url=url, title=title,
            amount=amount,
            errtip=errtip,
            alipay_account=alipay_account
        )
Exemplo n.º 33
0
    def post(self):
        current_user = self.current_user
        zsite = self.zsite
        request = self.request
        errtip = Errtip()
        zsite_id = self.zsite_id

        url, title = self._arguments()
        amount = self.get_argument('amount', 0)
        alipay_account = self.get_argument('alipay_account', '')

        if not amount:
            errtip.amount = '请输入金额'
        else:
            try:
                amount = float(amount)
            except ValueError:
                errtip.amount = '%s 不是有效的金额' % amount
            else:
                if amount <= 0:
                    errtip.amount = '金额须大于零'
                elif amount >= 9999999:
                    errtip.amount = '金额超出上限'
                else:
                    amount_cent = amount * 100

        if not current_user:
            mail = self.get_argument('mail', '')
            if not mail:
                errtip.mail = '请输入联系邮箱'
            elif not EMAIL_VALID.match(mail):
                errtip.mail = '邮箱无效'
            else:
                user = user_by_mail(mail)
                self.set_cookie('E', mail.strip().lower())
                if not user:
                    user = user_new_by_mail(mail)
                elif user.state >= ZSITE_STATE_APPLY:
                    return self.redirect('/auth/login?next=%s' % request.uri)
                current_user = user

        if current_user and not errtip:
            subject = '%s 向 %s 捐赠 %.2f 元' % (current_user.name, zsite.name,
                                             amount)
            current_user_id = current_user.id
            balance_cent = bank.get(current_user_id)

            def _pay_new(state):
                return pay_new(amount, current_user_id, zsite_id,
                               CID_TRADE_PAY, state).id

            txt = self.get_argument('txt', None)
            secret = self.get_argument('secret', None)

            message = {}

            if title:
                message['title'] = title
            if url:
                message['url'] = url
            if txt:
                message['txt'] = txt
                if secret:
                    message['secret'] = secret

            if balance_cent >= amount_cent:
                o_id = _pay_new(TRADE_STATE_FINISH)
                if message:
                    trade_log.set(o_id, dumps(message))
                pay_notice(o_id)

                return self.redirect('%s/pay/result/%s' % (SITE_HTTP, o_id))
            elif balance_cent > 0:
                subject += '(余额支付 %.2f 元)' % (balance_cent / 100.0)
                o_id = _pay_new(TRADE_STATE_NEW)
                amount_cent -= balance_cent
            else:
                o_id = _pay_new(TRADE_STATE_NEW)

            trade_log.set(o_id, dumps(message))

            return_url = '%s/money/alipay_sync' % SITE_HTTP
            notify_url = '%s/money/alipay_async' % RPC_HTTP

            alipay_url = alipay_payurl_with_tax(current_user_id,
                                                amount_cent / 100.0,
                                                return_url, notify_url,
                                                subject, alipay_account, o_id)

            return self.redirect(alipay_url)

        self.render(url=url,
                    title=title,
                    amount=amount,
                    errtip=errtip,
                    alipay_account=alipay_account)
Exemplo n.º 34
0
def _site_save(self):
    arguments = self.request.arguments

    current_user = self.current_user
    current_user_id = current_user.id

    link_cid = []
    link_kv = []
    errtip = Errtip()

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

    for cid, link in zip(arguments.get('cid', []), arguments.get('link', [])):
        cid = int(cid)
        link_name = SITE_LINK_ZSITE_DICT[cid]
        link_cid.append(
            (cid, link_name, linkify(link, cid))
        )



    for id, key, value in zip(
        arguments.get('id', []),
        arguments.get('key', []),
        arguments.get('value', [])
    ):
        id = int(id)
        link = linkify(value)
        link_kv.append(
            (id, key.strip() or urlparse(link).netloc, link)
        )


    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 name:
        errtip.name = '请输入名称'

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

    if url:
        errtip.url = url_valid(url)


    if errtip:
        for cid, link_name in SITE_LINK_NAME:
            if cid not in set(i[0] for i in link_cid):
                link_cid.append(
                    (
                        cid,
                        link_name,
                        ''
                    )
                )


    return errtip, link_cid, link_kv, name, motto, url, txt, pic_id
Exemplo n.º 35
0
def _job_save(self, job=None, add=None):
    errtip = Errtip()
    department_id = self.get_argument('depart', None)
    title = self.get_argument('title', None)
    kinds = self.get_argument('kinds', None)
    stock_option = self.get_argument('share', None)
    priority = self.get_argument('more', None)
    job_type = self.get_arguments('type', None)
    require = self.get_argument('require', None)
    txt = self.get_argument('txt', None)
    welfare = self.get_argument('other', None)
    salary_from = self.get_argument('salary1', None)
    salary_to = self.get_argument('salary2', None)
    salary_type = self.get_argument('sal_type', None)
    dead_line = self.get_argument('deadline', None)
    pids = self.get_arguments('addr', None)
    quota = self.get_argument('quota', None)

    if not department_id:
        errtip.department_id = '请选择部门'
    if not title:
        errtip.title = '请输入职位头衔'
    if not kinds:
        errtip.kinds = '请选择行业'
    if not job_type:
        errtip.job_type = '请选择工作种类'
    if not pids:
        errtip.addr = '请选择工作地址'
    if not quota.isdigit():
        errtip.quota = '请设定人数'
    if not (salary_from and salary_to):
        errtip.salary = '必须设定薪水'
    if not(salary_from.isdigit() and salary_to.isdigit()):
        errtip.salary = '请输入正确的薪水'
    else:
        salary_from = int(salary_from)
        salary_to = int(salary_to)
        if salary_from > salary_to:
            salary_to, salary_from = salary_from, salary_to

    if not txt:
        errtip.txt = '请填写职位描述'
    if not dead_line:
        errtip.dead_line = '必须选择过期时间'
    if not salary_type:
        errtip.salary_type = '必须选择工资类型'

    if not errtip:
        cj = job_new(
                self.zsite_id,
                department_id,
                title,
                today_days(),
                salary_from,
                salary_to,
                salary_type,
                int(dead_line)+today_days(),
                quota,
                txt,
                require, stock_option, welfare, priority,
                pids,
                job_type,
                kinds.split('-'),
                job
            )
        if add:
            return self.redirect('/job/admin')
        elif not job:
            return self.redirect('/job/next')
        else:
            return self.redirect('/job/admin')
    else:
        self.render(
                errtip=errtip,
                title=title,
                stock_option=stock_option,
                kinds=kinds.split('-'),
                priority=priority,
                job_type=job_type,
                require=require,
                txt=txt,
                welfare=welfare,
                salary_type=salary_type,
                salary1=salary_from,
                salary2=salary_to,
                dead_line=dead_line,
                addr=pids,
                quota=quota,
        )
Exemplo n.º 36
0
 def get(self):
     self.render(errtip=Errtip())
Exemplo n.º 37
0
 def get(self, mail=''):
     self.render(
         mail=mail,
         sex=0,
         errtip=Errtip(),
     )