activity query

This commit is contained in:
yangduo 2024-07-24 14:28:03 +08:00
parent 1745767139
commit 8a19d47445
2 changed files with 11 additions and 5 deletions

View File

@ -18,6 +18,12 @@ import (
type EventApi struct {
}
var EVENTYPE = map[string]int32{
"mint": 1,
"lock": 2,
"unlock": 3,
}
func (ea *EventApi) TxQuery(c *gin.Context) {
netid := q5.SafeToInt32(c.Param("net_id"))
txhash := strings.ToLower(c.Param("txhash"))
@ -133,7 +139,7 @@ func (ea *EventApi) ActivityQuery(c *gin.Context) {
Page common.StreamPagination `json:"page"`
Rows []struct {
Nft interface{} `json:"nft"`
Type string `json:"type"`
Type int32 `json:"type"`
From string `json:"from"`
To string `json:"to"`
Date int32 `json:"date"`
@ -161,7 +167,7 @@ func (ea *EventApi) ActivityQuery(c *gin.Context) {
p.Payload = map[string]string{}
p.Payload.(map[string]string)["type"] = ds.GetByName("event_name")
p.Payload.(map[string]string)["to"] = ds.GetByName("to_address")
p.Payload.(map[string]string)["from"] = ds.GetByName("from_address")
p.Payload.(map[string]string)["from"] = ds.GetByName("sender_address")
p.Payload.(map[string]string)["date"] = ds.GetByName("createtime")
q5.AppendSlice(&nfts, p)
})
@ -174,7 +180,7 @@ func (ea *EventApi) ActivityQuery(c *gin.Context) {
if v, ok := jsonData.(map[string]interface{}); ok {
v := q5.MapClone(v)
tmpmap := val.Payload.(map[string]string)
p.Type = tmpmap["type"]
p.Type = EVENTYPE[strings.ToLower(tmpmap["type"])]
p.To = tmpmap["to"]
p.From = tmpmap["from"]
p.Date = q5.SafeToInt32(tmpmap["date"])

View File

@ -1,9 +1,9 @@
package constant
const (
BCNFT_DB = "bcnftdb"
BCNFT_DB = "bcnftdb"
BCEVENT_DB = "bceventdb"
GAME_DB = "gamedb"
GAME_DB = "gamedb"
)
const (