update
This commit is contained in:
parent
d91bc39663
commit
362b19e5b7
@ -106,25 +106,16 @@ async def create_order(request: CreateOrderRequest,
|
|||||||
|
|
||||||
|
|
||||||
class NotifyRequest(BaseModel):
|
class NotifyRequest(BaseModel):
|
||||||
code: int
|
merchantOrderNo: str
|
||||||
message: str
|
|
||||||
data: dict
|
|
||||||
# order_no: str
|
|
||||||
# merchant_order_no: str
|
|
||||||
# status: str
|
|
||||||
# amount: str
|
|
||||||
# currency: str
|
|
||||||
# chain_type: str
|
|
||||||
|
|
||||||
@router.post("/notify")
|
@router.post("/notify")
|
||||||
async def notify(notify: NotifyRequest, session: Session = Depends(get_db)):
|
async def notify(notify: NotifyRequest, session: Session = Depends(get_db)):
|
||||||
try:
|
try:
|
||||||
data = notify.data
|
|
||||||
# 更新订单状态
|
# 更新订单状态
|
||||||
subscription_order_manager = SubscriptionOrderManager(session)
|
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:
|
if order is None:
|
||||||
return {
|
return {
|
||||||
@ -146,7 +137,7 @@ async def notify(notify: NotifyRequest, session: Session = Depends(get_db)):
|
|||||||
user_subscription_manager.create_subscription(user_id,
|
user_subscription_manager.create_subscription(user_id,
|
||||||
member_type,
|
member_type,
|
||||||
time_type,
|
time_type,
|
||||||
data['merchantOrderNo'],
|
notify.merchantOrderNo,
|
||||||
expire_time)
|
expire_time)
|
||||||
|
|
||||||
return "ok"
|
return "ok"
|
||||||
|
|||||||
@ -29,7 +29,7 @@ services:
|
|||||||
cryptoai-api:
|
cryptoai-api:
|
||||||
build: .
|
build: .
|
||||||
container_name: cryptoai-api
|
container_name: cryptoai-api
|
||||||
image: cryptoai-api:0.2.2
|
image: cryptoai-api:0.2.3
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user