feat:rock增加软删除和恢复删除
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user