fix(clothes): 保护失败原因并可靠回退额度

仅属主可查看失败原因,分享只读场景置空;额度回退改用独立
ctx,避免客户端断开导致回退失败;新增 ImageProcessStatus 与
FailReason 响应字段,并抽取 detachedCtx 复用后台任务上下文。
This commit is contained in:
2026-09-16 02:01:19 +08:00
parent b2e5eef3c8
commit e9b9754b57
5 changed files with 299 additions and 22 deletions
+21 -17
View File
@@ -29,23 +29,23 @@ type ClothesDeleteByUUIDResponse struct{}
// ClothesUpdateByUUIDRequest 修改衣物
type ClothesUpdateByUUIDRequest struct {
ClothesUUID string `json:"clothes_uuid" binding:"required"`
CategoryMain string `json:"category_main" binding:"max=64"` // 衣物大类 上装/下装/连衣裙/外套/鞋/配饰
CategorySub string `json:"category_sub" binding:"max=64"` // 衣物小类 T恤/牛仔裤/运动鞋/发带/戒指等
Style string `json:"style" binding:"max=64"` // 风格
ColorMain string `json:"color" binding:"max=64"` // 主颜色
ColorSub string `json:"color_sub" binding:"max=64"` // 副颜色
Thickness string `json:"thickness" binding:"max=64"` // 厚度
Version string `json:"version" binding:"max=64"` // 版型 宽松/修身/阔腿/紧身/常规合身
Material string `json:"material" binding:"max=64"` // 材质 牛仔布/针织/皮质/纯棉/羊毛等
Pattern string `json:"pattern" binding:"max=64"` // 花纹
SleeveType string `json:"sleeve_type" binding:"max=64"` // 袖型
ClothesType string `json:"clothes_type" binding:"max=64"` // 衣长类型 短款/常规/中长/长款
NecklineType string `json:"neckline_type" binding:"max=64"` // 领型
Formality string `json:"formality" binding:"max=16"` // 正式程度 1-5
Occasions string `json:"occasions" binding:"max=255"` // 适用场合
VisualImpact string `json:"visual_impact" binding:"max=16"` // 视觉冲击力 1-5
Name string `json:"name" binding:"max=64"` // 名称
Remark string `json:"remark" binding:"max=500"` // 备注
CategoryMain string `json:"category_main" binding:"max=64"` // 衣物大类 上装/下装/连衣裙/外套/鞋/配饰
CategorySub string `json:"category_sub" binding:"max=64"` // 衣物小类 T恤/牛仔裤/运动鞋/发带/戒指等
Style string `json:"style" binding:"max=64"` // 风格
ColorMain string `json:"color" binding:"max=64"` // 主颜色
ColorSub string `json:"color_sub" binding:"max=64"` // 副颜色
Thickness string `json:"thickness" binding:"max=64"` // 厚度
Version string `json:"version" binding:"max=64"` // 版型 宽松/修身/阔腿/紧身/常规合身
Material string `json:"material" binding:"max=64"` // 材质 牛仔布/针织/皮质/纯棉/羊毛等
Pattern string `json:"pattern" binding:"max=64"` // 花纹
SleeveType string `json:"sleeve_type" binding:"max=64"` // 袖型
ClothesType string `json:"clothes_type" binding:"max=64"` // 衣长类型 短款/常规/中长/长款
NecklineType string `json:"neckline_type" binding:"max=64"` // 领型
Formality string `json:"formality" binding:"max=16"` // 正式程度 1-5
Occasions string `json:"occasions" binding:"max=255"` // 适用场合
VisualImpact string `json:"visual_impact" binding:"max=16"` // 视觉冲击力 1-5
Name string `json:"name" binding:"max=64"` // 名称
Remark string `json:"remark" binding:"max=500"` // 备注
}
type ClothesUpdateByUUIDResponse struct{}
@@ -76,6 +76,10 @@ type ClothesGetByUUIDResponse struct {
Name string `json:"name"`
Remark string `json:"remark"`
ProcessedImage string `json:"processed_image"`
// ImageProcessStatus 处理状态:1=抠图中 2=分类中 3=排队中 4=成功 5=失败
ImageProcessStatus int8 `json:"image_process_status"`
// FailReason 处理失败原因:仅属主可见,非属主(分享只读)场景为空
FailReason string `json:"fail_reason"`
}
// ClothesListRequest 衣物列表