This commit is contained in:
aozhiwei 2024-06-24 11:32:02 +08:00
parent 91dfd320ba
commit ea1e08032e
3 changed files with 25 additions and 9 deletions

View File

@ -5,11 +5,12 @@ import (
"main/service"
"main/constant"
"mt"
"jccommon"
//"fmt"
)
type hero struct {
mailCfgHash *q5.ConcurrentMap[string, *mailConfig]
mailCfgHash *q5.ConcurrentMap[string, *jccommon.MailConfig]
}
func (this* hero) onMint(dbIdx int64, netId int32, contractAddress string, tokenId string,
@ -47,11 +48,15 @@ func (this* hero) internalSendMail(dbIdx int64, accountAddress string, mailName
if mailMeta == nil {
return true
}
mailCfg := this.getMailConfigMeta(mailName)
if mailCfg == nil {
return true
}
//uniKey := fmt.Sprintf("%d_%s_%s", dbIdx, mailName, tokenId)
return true
}
func (this *hero) getMailConfigMeta(mailName string) *mailConfig {
func (this *hero) getMailConfigMeta(mailName string) *jccommon.MailConfig {
if v, ok := this.mailCfgHash.Load(mailName); ok {
return *v
} else {
@ -59,8 +64,19 @@ func (this *hero) getMailConfigMeta(mailName string) *mailConfig {
}
}
func (this *hero) registerMailConfig(mailName string, tag1 int32, tag2 int32) {
p := new(jccommon.MailConfig)
p.MailName = mailName
p.Tag1 = tag1
p.Tag2 = tag2
this.mailCfgHash.Store(mailName, p)
}
func newHero() *hero {
p := new(hero)
p.mailCfgHash = new(q5.ConcurrentMap[string, *mailConfig])
p.mailCfgHash = new(q5.ConcurrentMap[string, *jccommon.MailConfig])
p.registerMailConfig(constant.MAIL_HERO_MINT, jccommon.MAIL_TAG1_HERO, jccommon.MAIL_TAG2_HERO_MINT)
p.registerMailConfig(constant.MAIL_HERO_LOCK, jccommon.MAIL_TAG1_HERO, jccommon.MAIL_TAG2_HERO_LOCK)
p.registerMailConfig(constant.MAIL_HERO_UNLOCK, jccommon.MAIL_TAG1_HERO, jccommon.MAIL_TAG2_HERO_UNLOCK)
return p
}

View File

@ -8,9 +8,3 @@ type specTransfer721Handle interface {
onUnlock(dbIdx int64, netId int32, contractAddress string, tokenId string,
from string, to string) bool
}
type mailConfig struct {
mailName string
tag1 int32
tag2 int32
}

View File

@ -41,3 +41,9 @@ type OrderUpdatedEvent struct {
UpdatedAt interface{} `json:"updated_at"`
} `json:"data"`
}
type MailConfig struct {
MailName string
Tag1 int32
Tag2 int32
}