txhash query
This commit is contained in:
parent
7e60a1cf39
commit
6823662718
@ -1,27 +1,29 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"main/api/v1/market"
|
||||
"main/api/v1/asset"
|
||||
"main/api/v1/hero"
|
||||
"main/api/v1/gold_bullion"
|
||||
"main/api/v1/shopcart"
|
||||
"main/api/v1/nft"
|
||||
"main/api/v1/ingame"
|
||||
"main/api/v1/user"
|
||||
"main/api/v1/activity"
|
||||
"main/api/v1/asset"
|
||||
"main/api/v1/event"
|
||||
"main/api/v1/gold_bullion"
|
||||
"main/api/v1/hero"
|
||||
"main/api/v1/ingame"
|
||||
"main/api/v1/market"
|
||||
"main/api/v1/nft"
|
||||
"main/api/v1/shopcart"
|
||||
"main/api/v1/user"
|
||||
)
|
||||
|
||||
type ApiGroup struct {
|
||||
MarketApiGroup market.ApiGroup
|
||||
AssetApiGroup asset.ApiGroup
|
||||
HeroApiGroup hero.ApiGroup
|
||||
MarketApiGroup market.ApiGroup
|
||||
AssetApiGroup asset.ApiGroup
|
||||
HeroApiGroup hero.ApiGroup
|
||||
GoldBullionApiGroup gold_bullion.ApiGroup
|
||||
ShopCartApiGroup shopcart.ApiGroup
|
||||
NftApiGroup nft.ApiGroup
|
||||
InGameApiGroup ingame.ApiGroup
|
||||
UserApiGroup user.ApiGroup
|
||||
ActivityApiGroup activity.ApiGroup
|
||||
ShopCartApiGroup shopcart.ApiGroup
|
||||
NftApiGroup nft.ApiGroup
|
||||
InGameApiGroup ingame.ApiGroup
|
||||
UserApiGroup user.ApiGroup
|
||||
ActivityApiGroup activity.ApiGroup
|
||||
EventApiGroup event.ApiGroup
|
||||
}
|
||||
|
||||
var ApiGroupApp = new(ApiGroup)
|
||||
|
5
server/marketserver/api/v1/event/enter.go
Normal file
5
server/marketserver/api/v1/event/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package event
|
||||
|
||||
type ApiGroup struct {
|
||||
EventApi
|
||||
}
|
48
server/marketserver/api/v1/event/event.go
Normal file
48
server/marketserver/api/v1/event/event.go
Normal file
@ -0,0 +1,48 @@
|
||||
package event
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"fmt"
|
||||
"marketserver/constant"
|
||||
"q5"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type EventApi struct {
|
||||
}
|
||||
|
||||
func (ea *EventApi) TxQuery(c *gin.Context) {
|
||||
netid := q5.SafeToInt32(c.Param("net_id"))
|
||||
txhash := strings.ToLower(c.Param("txhash"))
|
||||
|
||||
rspObj := struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Confirmed int32 `json:"confirmed"`
|
||||
}{}
|
||||
|
||||
{
|
||||
sql := fmt.Sprintf(`SELECT idx FROM t_blockchain_event WHERE idx > 0 AND txhash = ? AND net_id = %d`, netid)
|
||||
params := []string{
|
||||
txhash,
|
||||
}
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.BCEVENT_DB,
|
||||
sql,
|
||||
params,
|
||||
func(err error, ds *f5.DataSet) {
|
||||
if err != nil {
|
||||
c.JSON(200, rspObj)
|
||||
return
|
||||
}
|
||||
|
||||
if ds != nil {
|
||||
rspObj.Confirmed = 1
|
||||
}
|
||||
|
||||
c.JSON(200, rspObj)
|
||||
})
|
||||
}
|
||||
}
|
5
server/marketserver/router/event/enter.go
Normal file
5
server/marketserver/router/event/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package event
|
||||
|
||||
type RouterGroup struct {
|
||||
EventRouter
|
||||
}
|
13
server/marketserver/router/event/event.go
Normal file
13
server/marketserver/router/event/event.go
Normal file
@ -0,0 +1,13 @@
|
||||
package event
|
||||
|
||||
import (
|
||||
"f5"
|
||||
v1 "main/api/v1"
|
||||
)
|
||||
|
||||
type EventRouter struct{}
|
||||
|
||||
func (er *EventRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.EventApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/api/chain/txhash/:net_id/:txhash", api.EventApi.TxQuery)
|
||||
}
|
@ -3,27 +3,29 @@ package router
|
||||
import (
|
||||
"f5"
|
||||
"main/middleware"
|
||||
"main/router/market"
|
||||
"main/router/asset"
|
||||
"main/router/hero"
|
||||
"main/router/gold_bullion"
|
||||
"main/router/shopcart"
|
||||
"main/router/nft"
|
||||
"main/router/ingame"
|
||||
"main/router/user"
|
||||
"main/router/activity"
|
||||
"main/router/asset"
|
||||
"main/router/gold_bullion"
|
||||
"main/router/hero"
|
||||
"main/router/ingame"
|
||||
"main/router/market"
|
||||
"main/router/nft"
|
||||
"main/router/shopcart"
|
||||
"main/router/user"
|
||||
"marketserver/router/event"
|
||||
)
|
||||
|
||||
type routerMgr struct {
|
||||
market market.RouterGroup
|
||||
asset asset.RouterGroup
|
||||
hero hero.RouterGroup
|
||||
market market.RouterGroup
|
||||
asset asset.RouterGroup
|
||||
hero hero.RouterGroup
|
||||
goldBullion gold_bullion.RouterGroup
|
||||
shopCart shopcart.RouterGroup
|
||||
nft nft.RouterGroup
|
||||
ingame ingame.RouterGroup
|
||||
user user.RouterGroup
|
||||
activity activity.RouterGroup
|
||||
shopCart shopcart.RouterGroup
|
||||
nft nft.RouterGroup
|
||||
ingame ingame.RouterGroup
|
||||
user user.RouterGroup
|
||||
activity activity.RouterGroup
|
||||
event event.RouterGroup
|
||||
}
|
||||
|
||||
func (this *routerMgr) Init() {
|
||||
@ -37,6 +39,7 @@ func (this *routerMgr) Init() {
|
||||
this.ingame.IngameRouter.InitRouter()
|
||||
this.user.UserRouter.InitRouter()
|
||||
this.activity.StackingRouter.InitRouter()
|
||||
this.event.EventRouter.InitRouter()
|
||||
|
||||
f5.GetSysLog().Info("routerMgr.init")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user