This commit is contained in:
aaron 2025-06-12 10:21:08 +08:00
parent d91bc39663
commit 362b19e5b7
2 changed files with 5 additions and 14 deletions

View File

@ -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"

View File

@ -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"