diff --git a/cryptoai/routes/payment.py b/cryptoai/routes/payment.py index 04312be..600dca6 100644 --- a/cryptoai/routes/payment.py +++ b/cryptoai/routes/payment.py @@ -106,25 +106,16 @@ async def create_order(request: CreateOrderRequest, class NotifyRequest(BaseModel): - code: int - message: str - data: dict - # order_no: str - # merchant_order_no: str - # status: str - # amount: str - # currency: str - # chain_type: str + merchantOrderNo: str @router.post("/notify") async def notify(notify: NotifyRequest, session: Session = Depends(get_db)): try: - data = notify.data # 更新订单状态 subscription_order_manager = SubscriptionOrderManager(session) - subscription_order_manager.update_order_status(data['merchantOrderNo'], 2) + subscription_order_manager.update_order_status(notify.merchantOrderNo, 2) - order = subscription_order_manager.get_order_by_id(data['merchantOrderNo']) + order = subscription_order_manager.get_order_by_id(notify.merchantOrderNo) if order is None: return { @@ -146,7 +137,7 @@ async def notify(notify: NotifyRequest, session: Session = Depends(get_db)): user_subscription_manager.create_subscription(user_id, member_type, time_type, - data['merchantOrderNo'], + notify.merchantOrderNo, expire_time) return "ok" diff --git a/docker-compose.yml b/docker-compose.yml index 7d65433..683c8a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: cryptoai-api: build: . container_name: cryptoai-api - image: cryptoai-api:0.2.2 + image: cryptoai-api:0.2.3 restart: always ports: - "8000:8000"