Esempio n. 1
0
    def post(self, vendor_id):
        logging.info("got vendor_id %r in uri", vendor_id)

        ops = self.get_ops_info()

        _name = self.get_argument("club_name", "")
        _desc = self.get_argument("club_desc", "")
        logo_img_url = self.get_argument("logo_img_url", "")
        bk_img_url = self.get_argument("bk_img_url", "")

        club = club_dao.club_dao().query_not_safe(vendor_id)
        _timestamp = time.time()
        json = {
            "_id": vendor_id,
            "last_update_time": _timestamp,
            "club_name": _name,
            "club_desc": _desc,
            "logo_img_url": logo_img_url,
            "bk_img_url": bk_img_url
        }
        if not club:
            club_dao.club_dao().create(json)
        else:
            club_dao.club_dao().update(json)

        self.redirect('/vendors/' + vendor_id + '/setup/club')
    def get(self, vendor_id):
        logging.info("got vendor_id %r in uri", vendor_id)

        ops = self.get_ops_info()

        # categorys = category_dao.category_dao().query_by_vendor(vendor_id)
        triprouters = trip_router_dao.trip_router_dao().query_by_open(vendor_id)
        triprouters_share = triprouter_share_dao.triprouter_share_dao().query_by_vendor(vendor_id)

        # 在所有开放的线路中剔除掉自己开放的
        for triprouter in triprouters:
            if(triprouter['vendor_id'] == vendor_id):
                triprouters.remove(triprouter)
                break

        # 加share属性,区别一个自己是否已经分享了别人开放的这个线路
        for triprouter in triprouters:
            club = club_dao.club_dao().query(triprouter['vendor_id'])
            triprouter['club']= club['club_name']
            triprouter['share'] = False

            for triprouter_share in triprouters_share:
                if(triprouter['_id']==triprouter_share['triprouter']):
                    triprouter['share'] = True
                    break

        counter = self.get_counter(vendor_id)
        self.render('vendor/trip-router-share.html',
                vendor_id=vendor_id,
                ops=ops,
                counter=counter,
                triprouters=triprouters)
Esempio n. 3
0
    def get(self, vendor_id):
        logging.info("got vendor_id %r in uri", vendor_id)

        ops = self.get_ops_info()

        club = club_dao.club_dao().query(vendor_id)
        counter = self.get_counter(vendor_id)
        self.render('vendor/setup-club.html',
                    vendor_id=vendor_id,
                    ops=ops,
                    counter=counter,
                    club=club)
    def get(self, vendor_id, trip_router_id):
        logging.info("got vendor_id %r in uri", vendor_id)
        logging.info("got trip-router_id %r in uri", trip_router_id)

        ops = self.get_ops_info()

        # 设置别人开放的线路为自己所用
        triprouter = trip_router_dao.trip_router_dao().query(trip_router_id)
        club = club_dao.club_dao().query(triprouter['vendor_id'])

        _id = str(uuid.uuid1()).replace('-', '')
        json = {"_id":_id, "triprouter":trip_router_id,
                "share":True,"vendor_id":vendor_id, "bk_img_url":triprouter['bk_img_url'],
                "title":triprouter['title'],"club":club['club_name'],"score":triprouter['score']}

        triprouter_share_dao.triprouter_share_dao().create(json)

        self.redirect('/vendors/' + vendor_id + '/trip_router/share')
Esempio n. 5
0
    def get(self, vendor_id):

        # _array = trip_router_dao.trip_router_dao().query_by_open(vendor_id)
        triprouters_me = trip_router_dao.trip_router_dao().query_by_vendor(
            vendor_id)
        triprouters_share = triprouter_share_dao.triprouter_share_dao(
        ).query_by_vendor(vendor_id)

        # 处理一下自己线路
        for triprouter in triprouters_me:
            club = club_dao.club_dao().query(triprouter['vendor_id'])
            triprouter['club'] = club['club_name']
            triprouter['share'] = False

        _array = triprouters_me + triprouters_share

        self.render('wx/triprouter-index.html',
                    vendor_id=vendor_id,
                    triprouters=_array)
    def get(self, vendor_id):
        logging.info("got vendor_id %r in uri", vendor_id)

        ops = self.get_ops_info()

        triprouters_me = trip_router_dao.trip_router_dao().query_by_vendor(vendor_id)
        triprouters_share = triprouter_share_dao.triprouter_share_dao().query_by_vendor(vendor_id)

        # 处理一下自己线路
        for triprouter in triprouters_me:
            club = club_dao.club_dao().query(triprouter['vendor_id'])
            triprouter['club'] = club['club_name']
            triprouter['share'] = False

        triprouters = triprouters_me + triprouters_share

        counter = self.get_counter(vendor_id)
        self.render('vendor/trip-router-use.html',
                vendor_id=vendor_id,
                ops=ops,
                counter=counter,
                triprouters=triprouters)