diff --git a/internal/job/dao/translated.go b/internal/job/dao/translated.go new file mode 100644 index 0000000..5ba9d5a --- /dev/null +++ b/internal/job/dao/translated.go @@ -0,0 +1,10 @@ +package dao + +import "backend-go/internal/app/model" + +func (d *Dao) DeleteQuestTranslated(tokenId string) (err error) { + err = d.db.Model(&model.QuestTranslated{}). + Where("token_id = ?", tokenId). + Delete(&model.QuestTranslated{}).Error + return +} diff --git a/internal/job/service/badge.go b/internal/job/service/badge.go index 4479b6a..fbb1db3 100644 --- a/internal/job/service/badge.go +++ b/internal/job/service/badge.go @@ -63,6 +63,12 @@ func (s *Service) handleURI(hash string, vLog *types.Log) (err error) { log.Errorv("UpdateQuest error", zap.Any("quest", quest), zap.Error(err)) return err } + // 清除翻译 + err = s.dao.DeleteQuestTranslated(tokenId) + if err != nil { + log.Errorv("DeleteQuestTranslated error", zap.String("tokenId", tokenId), zap.Error(err)) + return + } s.handleTraverseStatus(hash, 1, "") return } diff --git a/internal/job/service/quest.go b/internal/job/service/quest.go index 2d32901..e0e125c 100644 --- a/internal/job/service/quest.go +++ b/internal/job/service/quest.go @@ -142,7 +142,12 @@ func (s *Service) handleModifyQuest(hash string, resJson []byte) (err error) { log.Errorv("DeleteUserChallengeLogByTokenId error", zap.Error(err), zap.Any("quest", quest)) return } + // 清除翻译 + err = s.dao.DeleteQuestTranslated(quest.TokenId) + if err != nil { + log.Errorv("DeleteQuestTranslated error", zap.String("tokenId", quest.TokenId), zap.Error(err)) + return + } s.handleTraverseStatus(hash, 1, "") - return }