调整渲染和logger名称
This commit is contained in:
parent
1248f43a5e
commit
2739d7283e
|
@ -28,7 +28,7 @@ def create_app():
|
|||
configure_logging()
|
||||
|
||||
@app.before_request
|
||||
def log_request_info():
|
||||
def LogService():
|
||||
logger.info(f"Request Path: {request.path}")
|
||||
logger.info(f"Request Method: {request.method}")
|
||||
logger.info(f"Request Headers: {request.headers}")
|
||||
|
|
|
@ -31,15 +31,15 @@ class Ticket(db.Model):
|
|||
self.state = 1
|
||||
return self
|
||||
|
||||
|
||||
def generateTicket(item, passenger_id):
|
||||
# Create a new Ticket object
|
||||
ticket = Ticket(
|
||||
seat_class=item["seatClass"],
|
||||
train_no=item["trainNo"],
|
||||
from_station=item["from"],
|
||||
to_station=item["to"],
|
||||
date=item["date"],
|
||||
passenger_id=passenger_id
|
||||
)
|
||||
return ticket
|
||||
@classmethod
|
||||
def generateTicket(cls, item, passenger_id):
|
||||
# Create a new Ticket object
|
||||
ticket = Ticket(
|
||||
seat_class=item["seatClass"],
|
||||
train_no=item["trainNo"],
|
||||
from_station=item["from"],
|
||||
to_station=item["to"],
|
||||
date=item["date"],
|
||||
passenger_id=passenger_id
|
||||
)
|
||||
return ticket
|
||||
|
|
1125
logs/app.log
1125
logs/app.log
File diff suppressed because it is too large
Load Diff
|
@ -8,10 +8,10 @@ class OrderPresenter:
|
|||
def as_dict(self):
|
||||
return {
|
||||
"id": self.data.id,
|
||||
"order_no": self.data.order_no,
|
||||
"orderNo": self.data.order_no,
|
||||
"price": self.data.price,
|
||||
"state": self.data.state,
|
||||
"payment_time": self.data.payment_time,
|
||||
"paymentTime": self.data.payment_time,
|
||||
"tickets": [TicketPresenter(ticket).as_dict() for ticket in self.data.tickets]
|
||||
}
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@ class TicketPresenter:
|
|||
def as_dict(self):
|
||||
return {
|
||||
"id": self.data.id,
|
||||
"seat_no": self.data.seat_no,
|
||||
"seat_class": self.data.seat_class,
|
||||
"seatNo": self.data.seat_no,
|
||||
"seatClass": self.data.seat_class,
|
||||
"price": self.data.price,
|
||||
"state": self.data.state,
|
||||
"train_no": self.data.train_no,
|
||||
"from_station": self.data.from_station,
|
||||
"to_station": self.data.to_station,
|
||||
"trainNo": self.data.train_no,
|
||||
"fromStation": self.data.from_station,
|
||||
"toStation": self.data.to_station,
|
||||
"date": self.data.date,
|
||||
"departure_time": self.data.departure_time,
|
||||
"arrival_time": self.data.arrival_time,
|
||||
"departureTime": self.data.departure_time,
|
||||
"arrivalTime": self.data.arrival_time,
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ class TrainPresenter:
|
|||
return {
|
||||
"id": self.data.id,
|
||||
"trainNo": self.data.train_no,
|
||||
"expiration_time": self.data.expiration_time,
|
||||
"effective_time": self.data.effective_time,
|
||||
"arrival_station": self.data.arrival_station,
|
||||
"departure_station":self.data.departure_station,
|
||||
"train_stations": [TrainStationPresenter(station).as_dict() for station in self.data.train_stations]
|
||||
"expirationTime": self.data.expiration_time,
|
||||
"effectiveTime": self.data.effective_time,
|
||||
"arrivalStation": self.data.arrival_station,
|
||||
"departureStation": self.data.departure_station,
|
||||
"trainStations": [TrainStationPresenter(station).as_dict() for station in self.data.train_stations]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue