Exemplo n.º 1
0
    def post(self):
        # 接收 POST 过来的数据
        rawData = self.request.body

        # 创建 request 对象
        request = ProtobufAPI.GetStationFromIdRequest()

        #
        # 此处一定要对 request 对象进行赋值
        # 例如: request.baserequest.sdk_version = 1
        #

        model = Model('GetStationFromId')
        response = model.communication(request)

        self.render('index.html',author = 'Zeta - JCheng')
Exemplo n.º 2
0
    def get(self,station_id):
        request = ProtobufAPI.GetStationFromIdRequest()

        flag = Helper.fillBaseRequest(request.baseRequest)

        if not flag:
            self.render('index.html',author = 'Error')

        request.station_id = station_id

        model = Model('GetStationFromId')
        response = model.communication(request)

        # 判断状态
        if response.baseResponse.status != 0:
            if hasattr(response.baseResponse,'info'):
                self.render('index.html',author = response.baseResponse.info)
            else:
                self.render('index.html',author = 'Zeta - Error')

        # 解析 station 对象
        station = self.parsingStation(response.stations)

        # 创建 request 对象
        request = ProtobufAPI.GetServiceInStationRequest()

        flag = Helper.fillBaseRequest(request.baseRequest)

        if not flag:
            self.render('index.html',author = 'Error')

        model = Model('GetServiceInStation')
        response = model.communication(request)

        # 判断状态
        if response.baseResponse.status != 0:
            if hasattr(response.baseResponse,'info'):
                self.render('index.html',author = response.baseResponse.info)
            else:
                self.render('index.html',author = 'Zeta - Error')

        services = self.parsingProduct(response.services)

        self.render('index.html',author = 'Zeta -JCheng')