1
This commit is contained in:
parent
957d7c537e
commit
3559513aea
@ -1,7 +1,10 @@
|
|||||||
package spec_transfer721
|
package spec_transfer721
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"q5"
|
||||||
"main/service"
|
"main/service"
|
||||||
|
"main/constant"
|
||||||
|
"mt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type hero struct {
|
type hero struct {
|
||||||
@ -9,28 +12,47 @@ type hero struct {
|
|||||||
|
|
||||||
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 {
|
||||||
accountId := service.GetAccountIdByAddress(to)
|
var itemId, heroQuality int32
|
||||||
if accountId == "" {
|
if !service.GetHeroByTokenId(tokenId, &itemId, &heroQuality) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return true
|
ok := this.internalSendMail(to, constant.MAIL_HERO_MINT, itemId, heroQuality)
|
||||||
|
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 {
|
||||||
accountId := service.GetAccountIdByAddress(from)
|
var itemId, heroQuality int32
|
||||||
if accountId == "" {
|
if !service.GetHeroByTokenId(tokenId, &itemId, &heroQuality) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return true
|
ok := this.internalSendMail(from, constant.MAIL_HERO_LOCK, itemId, heroQuality)
|
||||||
|
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 {
|
||||||
accountId := service.GetAccountIdByAddress(to)
|
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 {
|
||||||
|
accountId := service.GetAccountIdByAddress(accountAddress)
|
||||||
if accountId == "" {
|
if accountId == "" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
mailMeta := mt.Table.Mail.GetByName(mailName)
|
||||||
|
if mailMeta == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
itemMeta := mt.Table.Item.GetById(q5.ToInt64(itemId))
|
||||||
|
if itemMeta == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user