This commit is contained in:
aaron 2025-04-12 16:59:05 +08:00
parent 3030eb158d
commit b4bd051683

View File

@ -86,7 +86,7 @@ async def get_tryon_histories(
"""
获取试穿历史
"""
histories = await db.execute(select(TryonHistory).where(TryonHistory.user_id == current_user.id))
histories = await db.execute(select(TryonHistory).where(TryonHistory.user_id == current_user.id).order_by(TryonHistory.create_time.desc()))
tryon_histories = histories.scalars().all()
return StandardResponse(code=200, message="试穿历史获取成功", data=[TryonHistoryModel.model_validate(history) for history in tryon_histories])
@ -133,5 +133,10 @@ async def check_tryon_status(
tryon_history.completion_url = url
await db.commit()
await db.refresh(tryon_history)
elif completion.get("status") == "FAILED":
tryon_history.status = TryonStatus.FAILED
await db.commit()
await db.refresh(tryon_history)
return StandardResponse(code=200, message="检查试穿状态成功", data=TryonHistoryModel.model_validate(tryon_history))
return StandardResponse(code=200, message="", data=TryonHistoryModel.model_validate(tryon_history))