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
+6 -1
View File
@@ -172,7 +172,12 @@ func (s *ClosetShareService) Detail(ctx context.Context, userID int64, shareUUID
}
clothesResp := make([]dto.ClothesGetByUUIDResponse, 0, len(clothesList))
for i := range clothesList {
clothesResp = append(clothesResp, buildClothesResponse(&clothesList[i]))
item := buildClothesResponse(&clothesList[i])
// 非属主只读查看:不暴露内部失败原因
if !isOwner {
item.FailReason = ""
}
clothesResp = append(clothesResp, item)
}
// 记录接收关系:登录且非属主用户成功访问即视为收到,幂等,失败不阻断详情返回。