Files
zt-closet-backend/internal/dto/clothes.go
T
zhengchiliu e9b9754b57 fix(clothes): 保护失败原因并可靠回退额度
仅属主可查看失败原因,分享只读场景置空;额度回退改用独立
ctx,避免客户端断开导致回退失败;新增 ImageProcessStatus 与
FailReason 响应字段,并抽取 detachedCtx 复用后台任务上下文。
2026-09-16 02:01:19 +08:00

97 lines
4.2 KiB
Go

package dto
// ClothesUploadRequest 上传衣物图片
type ClothesUploadRequest struct{}
// ClothesUploadResponse 上传衣物图片响应
type ClothesUploadResponse struct {
ClothesUUID string `json:"clothes_uuid"` // 衣物UUID
ImageProcessStatus int8 `json:"image_process_status"` // 1=抠图中 2=分类中 3=排队中 4=成功 5=失败
}
type ClothesProcessStatusGetByUUIDRequest struct {
ClothesUUID string `json:"clothes_uuid" binding:"required"`
}
type ClothesProcessStatusGetByUUIDResponse struct {
ImageProcessStatus int8 `json:"image_process_status"` // 1=抠图中 2=分类中 3=排队中 4=成功 5=失败
FailReason string `json:"fail_reason"`
}
// ClothesDeleteByUUIDRequest 删除衣物
type ClothesDeleteByUUIDRequest struct {
ClothesUUID string `json:"clothes_uuid" binding:"required"`
}
// ClothesDeleteResponse 删除衣物响应
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"` // 备注
}
type ClothesUpdateByUUIDResponse struct{}
type ClothesGetByUUIDRequest struct {
ClothesUUID string `json:"clothes_uuid" binding:"required"` // 衣物UUID
ShareUUID string `json:"share_uuid"` // 可选:通过穿搭分享只读查看时携带(非属主)
}
// ClothesGetByUUIDResponse 衣物信息
type ClothesGetByUUIDResponse struct {
ClothesUUID string `json:"clothes_uuid"`
CategoryMain string `json:"category_main"`
CategorySub string `json:"category_sub"`
Style string `json:"style"`
ColorMain string `json:"color_main"`
ColorSub string `json:"color_sub"`
Thickness string `json:"thickness"`
Version string `json:"version"`
Material string `json:"material"`
Pattern string `json:"pattern"`
SleeveType string `json:"sleeve_type"`
ClothesType string `json:"clothes_type"`
NecklineType string `json:"neckline_type"`
Formality string `json:"formality"`
Occasions string `json:"occasions"`
VisualImpact string `json:"visual_impact"`
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 衣物列表
type ClothesListRequest struct {
PageRequest
CategoryMain string `form:"category_main"` // 按大类筛选
CategorySub string `form:"category_sub"`
}
// ClothesListResponse 衣物列表
type ClothesListResponse struct {
PageResponse
List []ClothesGetByUUIDResponse `json:"list"`
}