aozhiwei f583dda29b 1
2024-06-22 14:06:10 +08:00

46 lines
958 B
Go

package service
import (
"q5"
"f5"
"jccommon"
"main/constant"
)
func GetItemIdHeroQuality(netId int32, contractAddress string, tokenId string,
itemId *int32, heroQuality *int32) {
f5.GetGoStyleDb().OrmSelectOne(
constant.BCNFT_DB,
"t_nft",
[][]string {
{"net_id", q5.ToString(netId)},
{"contract_address", contractAddress},
{"token_id", tokenId},
},
func (err error, ds *f5.DataSet) {
if err != nil {
return
}
if ds.Next() {
*itemId = q5.ToInt32(ds.GetByName("item_id"))
tokenType := q5.ToInt32(ds.GetByName("token_type"))
if tokenType == jccommon.NFT_TYPE_CFHERO {
f5.GetGoStyleDb().OrmSelectOne(
constant.GAME_DB,
"t_hero",
[][]string {
{"token_id", tokenId},
},
func (err error, ds *f5.DataSet) {
if err != nil {
return
}
if ds.Next() {
*heroQuality = q5.ToInt32(ds.GetByName("quality"))
}
})
}
}
})
}