Esempio n. 1
0
    def get(self, id):
        po = Po.mc_get(id)
        current_user_id = self.current_user_id
        if po.can_view(self.current_user_id):
            tag_list = tag_name_id_list_by_po_id(id)

            result = {
                'txt':po.htm,
                'reply_count':po.reply_count,
                'create_time':po.create_time,
                'tag_list':tag_list,
            }
            user = po.user
            if user:
                result['link'] = user.link
                result['user_name'] = " ".join((
                    user.name,
                    career_current_str(user.id)
                ))
            po_pos_mark(current_user_id, po)
        else:
            result = {}

        self.finish(result)
Esempio n. 2
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_mark(current_user_id, po)
            result = po.htm
            if cid == CID_EVENT:
                result = [result]
                event = Event.mc_get(id)
                if event.phone:
                    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)