feat:rock增加软删除和恢复删除

This commit is contained in:
2026-10-31 16:48:47 +08:00
parent 2d1ff1b520
commit 909867b9fb
23 changed files with 2116 additions and 82 deletions
+6 -1
View File
@@ -39,7 +39,7 @@ func (s *RockService) importPackageDetail(ctx context.Context, detail *RockPacka
redeemedAt := parseRockPackageTime(pt.RedeemedAt)
var existing model.RockToken
findErr := tx.Where("upstream_token_id = ?", upstreamID).First(&existing).Error
findErr := tx.Unscoped().Where("upstream_token_id = ?", upstreamID).First(&existing).Error
if errors.Is(findErr, gorm.ErrRecordNotFound) {
insertStatus := status
if _, ok := forceAvailableIDs[upstreamID]; ok {
@@ -85,6 +85,11 @@ func (s *RockService) importPackageDetail(ctx context.Context, detail *RockPacka
if findErr != nil {
return findErr
}
// 已软删除的 Token 视为“用户主动清理过”,再次导入时不复活、不覆盖。
if existing.DeletedAt.Valid {
skipped++
continue
}
updates := map[string]interface{}{
"package_id": packageID,