Skip to content

Commit

Permalink
Merge pull request #135 from decert-me/fix/translated
Browse files Browse the repository at this point in the history
Fix 修改挑战清除翻译
  • Loading branch information
0xdwong authored May 9, 2024
2 parents 774a0cc + 760f7fa commit 4662bed
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
10 changes: 10 additions & 0 deletions internal/job/dao/translated.go
Original file line number Diff line number Diff line change
@@ -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
}
6 changes: 6 additions & 0 deletions internal/job/service/badge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 6 additions & 1 deletion internal/job/service/quest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 4662bed

Please sign in to comment.