From f8c94c32b7455c127bbbae23618c8d13e504e45a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 23 Jun 2024 14:47:17 +0800 Subject: [PATCH] 1 --- server/backtask/task/spec_transfer721/hero.go | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/server/backtask/task/spec_transfer721/hero.go b/server/backtask/task/spec_transfer721/hero.go index 49a29520..d2e9c992 100644 --- a/server/backtask/task/spec_transfer721/hero.go +++ b/server/backtask/task/spec_transfer721/hero.go @@ -12,35 +12,31 @@ type hero struct { func (this* hero) onMint(dbIdx int64, netId int32, contractAddress string, tokenId string, from string, to string) bool { - var itemId, heroQuality int32 - if !service.GetHeroByTokenId(tokenId, &itemId, &heroQuality) { - return true - } - ok := this.internalSendMail(to, constant.MAIL_HERO_MINT, itemId, heroQuality) + ok := this.internalSendMail(to, constant.MAIL_HERO_MINT, tokenId) return ok } func (this* hero) onLock(dbIdx int64, netId int32, contractAddress string, tokenId string, from string, to string) bool { - var itemId, heroQuality int32 - if !service.GetHeroByTokenId(tokenId, &itemId, &heroQuality) { - return true - } - ok := this.internalSendMail(from, constant.MAIL_HERO_LOCK, itemId, heroQuality) + ok := this.internalSendMail(from, constant.MAIL_HERO_LOCK, tokenId) return ok } func (this *hero) onUnlock(dbIdx int64, netId int32, contractAddress string, tokenId string, from string, to string) bool { + ok := this.internalSendMail(to, constant.MAIL_HERO_UNLOCK, tokenId) + return ok +} + +func (this* hero) internalSendMail(accountAddress string, mailName string, tokenId string) bool { var itemId, heroQuality int32 if !service.GetHeroByTokenId(tokenId, &itemId, &heroQuality) { return true } - ok := this.internalSendMail(to, constant.MAIL_HERO_UNLOCK, itemId, heroQuality) - return ok -} - -func (this* hero) internalSendMail(accountAddress string, mailName string, itemId int32, heroQuality int32) bool { + itemMeta := mt.Table.Item.GetById(q5.ToInt64(itemId)) + if itemMeta == nil { + return true + } accountId := service.GetAccountIdByAddress(accountAddress) if accountId == "" { return true @@ -49,10 +45,6 @@ func (this* hero) internalSendMail(accountAddress string, mailName string, itemI if mailMeta == nil { return true } - itemMeta := mt.Table.Item.GetById(q5.ToInt64(itemId)) - if itemMeta == nil { - return true - } return true }