1
This commit is contained in:
parent
64326e169b
commit
91dfd320ba
@ -5,30 +5,32 @@ import (
|
|||||||
"main/service"
|
"main/service"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
"mt"
|
"mt"
|
||||||
|
//"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type hero struct {
|
type hero struct {
|
||||||
|
mailCfgHash *q5.ConcurrentMap[string, *mailConfig]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* hero) onMint(dbIdx int64, netId int32, contractAddress string, tokenId string,
|
func (this* hero) onMint(dbIdx int64, netId int32, contractAddress string, tokenId string,
|
||||||
from string, to string) bool {
|
from string, to string) bool {
|
||||||
ok := this.internalSendMail(to, constant.MAIL_HERO_MINT, tokenId)
|
ok := this.internalSendMail(dbIdx, to, constant.MAIL_HERO_MINT, tokenId)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* hero) onLock(dbIdx int64, netId int32, contractAddress string, tokenId string,
|
func (this* hero) onLock(dbIdx int64, netId int32, contractAddress string, tokenId string,
|
||||||
from string, to string) bool {
|
from string, to string) bool {
|
||||||
ok := this.internalSendMail(from, constant.MAIL_HERO_LOCK, tokenId)
|
ok := this.internalSendMail(dbIdx, from, constant.MAIL_HERO_LOCK, tokenId)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *hero) onUnlock(dbIdx int64, netId int32, contractAddress string, tokenId string,
|
func (this *hero) onUnlock(dbIdx int64, netId int32, contractAddress string, tokenId string,
|
||||||
from string, to string) bool {
|
from string, to string) bool {
|
||||||
ok := this.internalSendMail(to, constant.MAIL_HERO_UNLOCK, tokenId)
|
ok := this.internalSendMail(dbIdx, to, constant.MAIL_HERO_UNLOCK, tokenId)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* hero) internalSendMail(accountAddress string, mailName string, tokenId string) bool {
|
func (this* hero) internalSendMail(dbIdx int64, accountAddress string, mailName string, tokenId string) bool {
|
||||||
var itemId, heroQuality int32
|
var itemId, heroQuality int32
|
||||||
if !service.GetHeroByTokenId(tokenId, &itemId, &heroQuality) {
|
if !service.GetHeroByTokenId(tokenId, &itemId, &heroQuality) {
|
||||||
return true
|
return true
|
||||||
@ -45,10 +47,20 @@ func (this* hero) internalSendMail(accountAddress string, mailName string, token
|
|||||||
if mailMeta == nil {
|
if mailMeta == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
//uniKey := fmt.Sprintf("%d_%s_%s", dbIdx, mailName, tokenId)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *hero) getMailConfigMeta(mailName string) *mailConfig {
|
||||||
|
if v, ok := this.mailCfgHash.Load(mailName); ok {
|
||||||
|
return *v
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func newHero() *hero {
|
func newHero() *hero {
|
||||||
p := new(hero)
|
p := new(hero)
|
||||||
|
p.mailCfgHash = new(q5.ConcurrentMap[string, *mailConfig])
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
@ -8,3 +8,9 @@ type specTransfer721Handle interface {
|
|||||||
onUnlock(dbIdx int64, netId int32, contractAddress string, tokenId string,
|
onUnlock(dbIdx int64, netId int32, contractAddress string, tokenId string,
|
||||||
from string, to string) bool
|
from string, to string) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type mailConfig struct {
|
||||||
|
mailName string
|
||||||
|
tag1 int32
|
||||||
|
tag2 int32
|
||||||
|
}
|
||||||
|
@ -30,3 +30,18 @@ const (
|
|||||||
CONTRACT_NAME_GoldBrick = "GoldBrick"
|
CONTRACT_NAME_GoldBrick = "GoldBrick"
|
||||||
CONTRACT_NAME_NFTLock = "NFTLock"
|
CONTRACT_NAME_NFTLock = "NFTLock"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MAIL_TAG1_HERO = 100
|
||||||
|
MAIL_TAG1_GOLD_BULLION = 101
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MAIL_TAG2_HERO_MINT = 1
|
||||||
|
MAIL_TAG2_HERO_LOCK = 2
|
||||||
|
MAIL_TAG2_HERO_UNLOCK = 3
|
||||||
|
|
||||||
|
MAIL_TAG2_GOLD_BULLION_MINT = 1
|
||||||
|
MAIL_TAG2_GOLD_BULLION_LOCK = 2
|
||||||
|
MAIL_TAG2_GOLD_BULLION_UNLOCK = 3
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user