Пример #1
0
    def get(self, id):
        user_id = self.current_user_id
        po = self._po(user_id, id)

        if po is None:
            return
        po_zsite_id = po.zsite_id

        if po_zsite_id and po_zsite_id != self.zsite_id:
            return self.redirect(
                '%s/po/edit/%s'%(link(po_zsite_id), id)
            )
        cid = po.cid
        if cid == CID_EVENT_FEEDBACK:
            self.event = Event.mc_get(po.rid)

        if cid == CID_NOTE:
            template = 'ctrl/zsite/po/note.htm'
        else:
            template = 'ctrl/zsite/po/po.htm'
        self.render(
            template,
            po=po,
            cid=po.cid,
            pic_list=pic_list_edit(user_id, id)
        )
Пример #2
0
 def get(self, id):
     event = Event.mc_get(id)
     if event.id and event.zsite_id == self.current_user_id:
         if event.cid == EVENT_STATE_INIT:
             return self.redirect('/po/event/%s'%id)
         return self.render(event=event)
     self.redirect('/po/event')
Пример #3
0
 def post(self, id):
     current_user_id = self.current_user_id
     event = Event.mc_get(id)
     txt = self.get_argument('txt', '')
     if event and event.can_admin(current_user_id) and txt:
         event_kill(current_user_id, event, txt)
     self.finish('{}')
Пример #4
0
 def post(self, id):
     current_user_id = self.current_user_id
     event = Event.mc_get(id)
     txt = self.get_argument('txt', '')
     if event and event.can_admin(current_user_id) and txt:
         po_event_notice_new(current_user_id, id, txt)
     self.finish('{}')
Пример #5
0
 def _event(self, id):
     o = Event.mc_get(id)
     if o and o.state > EVENT_STATE_RM:
         if o.zsite_id == self.zsite_id:
             return o
         return self.redirect(link(o.zsite_id)+self.request.path)
     return self.redirect('/')
Пример #6
0
 def post(self, id):
     current_user_id = self.current_user_id
     event = Event.mc_get(id)
     txt = self.get_argument('txt', '')
     if event and event.can_admin(current_user_id) and txt:
         event_kill(current_user_id, event, txt)
     self.finish('{}')
Пример #7
0
 def _event(self, id):
     o = Event.mc_get(id)
     if o and o.state > EVENT_STATE_RM:
         if o.zsite_id == self.zsite_id:
             return o
         return self.redirect(link(o.zsite_id) + self.request.path)
     return self.redirect('/')
Пример #8
0
 def post(self, id):
     current_user_id = self.current_user_id
     event = Event.mc_get(id)
     txt = self.get_argument('txt', '')
     if event and event.can_admin(current_user_id) and txt:
         po_event_notice_new(current_user_id, id, txt)
     self.finish('{}')
Пример #9
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)
Пример #10
0
    def get(self, id):
        po = self.po(id)
        if po is None:
            return

        zsite_id = self.zsite_id
        user_id = self.current_user_id
        can_admin = po.can_admin(user_id)
        can_view = po.can_view(user_id)

        if can_view and user_id:
            self.mark()

        cid = po.cid
        if cid == CID_PRODUCT:
            return self.redirect(po.user.link)

        if cid == CID_EVENT:
            zsite_tag_id = tag_name = None
            event = Event.mc_get(id)
            if event.state <= EVENT_STATE_TO_REVIEW:
                tag_link = '/event/to_review'
            else:
                tag_link = '/event'
        elif cid == CID_EVENT_NOTICE:
            zsite_tag_id = tag_name = None
            tag_link = '/%s'%po.rid
        else:
            zsite_tag_id, tag_name = zsite_tag_id_tag_name_by_po_id(po.user_id, id)
            if zsite_tag_id:
                tag_link = '/tag/%s' % zsite_tag_id
            else:
                tag_link = '/po/cid/%s'%cid

        prev_id, next_id = po_prev_next(
            po, zsite_tag_id
        )

        buzz_reply_hide(user_id,po.id)

        return self.render(
            self.template,
            po=po,
            can_admin=can_admin,
            can_view=can_view,
            zsite_tag_id=zsite_tag_id,
            prev_id=prev_id,
            next_id=next_id,
            tag_name=tag_name,
            tag_link=tag_link
        )
Пример #11
0
    def _event(self, event_id):
        self.event_id = event_id
        self.event = event = Event.mc_get(event_id)
        current_user_id = self.current_user_id

        if not event:
            return self.redirect('/')

        if event.state < EVENT_STATE_NOW:
            return self.redirect(event.link)

        state = event_joiner_state(
            event_id, current_user_id
        )

        if state < EVENT_JOIN_STATE_YES:
            return self.redirect(event.link)

        return event
Пример #12
0
    def get(self):
        query = self.request.query
        t = alipay_url_recall(query)

        if t.for_id:
            t = Trade.get(t.for_id)

        url = SITE_URL

        if t:
            cid = t.cid
            if cid == CID_TRADE_CHARDE:
                user = Zsite.mc_get(t.to_id)
                url = '%s/money/charged/%s/%s'%(user.link, t.id, t.to_id)
            elif cid == CID_TRADE_EVENT:
                event = Event.mc_get(t.rid)
                zsite = Zsite.mc_get(event.zsite_id)
                url = '%s/event/%s/state'%(zsite.link, event.id)
            else:
                url = '/pay/result/%s'%t.id

        return self.redirect(url)
Пример #13
0
    def get(self, id):
        user_id = self.current_user_id
        po = self._po(user_id, id)

        if po is None:
            return
        po_zsite_id = po.zsite_id

        if po_zsite_id and po_zsite_id != self.zsite_id:
            return self.redirect('%s/po/edit/%s' % (link(po_zsite_id), id))
        cid = po.cid
        if cid == CID_EVENT_FEEDBACK:
            self.event = Event.mc_get(po.rid)

        if cid == CID_NOTE:
            template = 'ctrl/zsite/po/note.htm'
        else:
            template = 'ctrl/zsite/po/po.htm'
        self.render(template,
                    po=po,
                    cid=po.cid,
                    pic_list=pic_list_edit(user_id, id))
Пример #14
0
    def post(self, id=0):
        user_id = self.current_user_id

        if id:
            event = Event.mc_get(id)
            if event.zsite_id != self.current_user_id:
                return self.redirect('/%s'%id)
            can_change = event.can_change()
        else:
            event = None
            can_change = True

        event = po_event_edit_post(self, id, event, can_change, event_new_if_can_change)
        if event:
            if not id:
                id = event.id
                zsite = self.zsite
                zsite_id = zsite_id_by_zsite_user_id(zsite, user_id)
                po_new(CID_EVENT, user_id, '', STATE_SECRET, id=id, zsite_id=zsite_id)

            if event.state <= EVENT_STATE_TO_REVIEW:
                return self.redirect('/po/edit/%s'%id)
            else:
                return self.redirect('/%s'%id)
Пример #15
0
 def get(self, id):
     event = Event.mc_get(id)
     po = event.po
     self.render(po=po)
Пример #16
0
 def _event(self, id):
     event = Event.mc_get(id)
     if not event:
         return self.redirect('/')
     return event
Пример #17
0
 def get(self, id):
     event = Event.mc_get(id)
     po = event.po
     self.render(po=po)
Пример #18
0
    def get(self, id):
        po = Po.mc_get(id)
        current_user_id = self.current_user_id
        cid = po.cid
        if po.can_view(current_user_id):
            po_pos_set(current_user_id, po)
            result = po.htm
            if cid == CID_EVENT:
                result = [result]
                event = Event.mc_get(id)
                result.append('<p>联系电话 : %s</p>'%escape(event.phone))
                if event.transport:
                    result.append(
                        '<p>交通方式 : %s</p>'%escape(event.transport)
                    )

                if event.price:
                    result.append('<p>%s 元 / 人</p>'%event.price)


                notice_list = po_event_notice_list_by_event_id(id)
                for notice in notice_list:
                    result.append('<div class="pb14"><div><b>%s</b></div>%s</div>'%(
                        friendly_time(notice.create_time),
                        notice.name_htm
                    ))

                t = []

                if event.join_count:
                    t.append(
                        '<a href="/%s#join_count" target="_blank"><span class="mr3">%s</span>报名</a>'%(
                            event.id ,
                            event.join_count
                        )
                    )

                if event.state < EVENT_STATE_END:
                    t.append('<a href="/event/join/%s" target="_blank">报名参加</a>'%event.id)
                else:
                    nc = event_joiner_feedback_normal_count(id)
                    gc = event_joiner_feedback_good_count(id)
                    if gc:
                        t.append(
'<a href="/%s#feedback_good" target="_blank"><span class="mr3">%s</span>好评</a>'%(
                        id,
                        gc
)
                        )
                    if nc:
                        t.append(
'<a href="/%s#feedback_normal" target="_blank"><span class="mr3">%s</span>反馈</a>'%(
                        id,
                        nc
)
                        )

                if t:
                    result.append(
                        '<p>%s</p>'%(
                            ' , '.join(t)
                        )
                    )

                #if event.state == EVENT_STATE_END:
                #    result.append("")

                result = ''.join(result)
        else:
            result = ''
        self.finish(result)
Пример #19
0
 def _event(self, id):
     event = Event.mc_get(id)
     if not event:
         return self.redirect('/')
     return event