txhash query
This commit is contained in:
parent
7e60a1cf39
commit
6823662718
@ -1,15 +1,16 @@
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
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/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 {
|
type ApiGroup struct {
|
||||||
@ -22,6 +23,7 @@ type ApiGroup struct {
|
|||||||
InGameApiGroup ingame.ApiGroup
|
InGameApiGroup ingame.ApiGroup
|
||||||
UserApiGroup user.ApiGroup
|
UserApiGroup user.ApiGroup
|
||||||
ActivityApiGroup activity.ApiGroup
|
ActivityApiGroup activity.ApiGroup
|
||||||
|
EventApiGroup event.ApiGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
var ApiGroupApp = new(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,15 +3,16 @@ package router
|
|||||||
import (
|
import (
|
||||||
"f5"
|
"f5"
|
||||||
"main/middleware"
|
"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/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 {
|
type routerMgr struct {
|
||||||
@ -24,6 +25,7 @@ type routerMgr struct {
|
|||||||
ingame ingame.RouterGroup
|
ingame ingame.RouterGroup
|
||||||
user user.RouterGroup
|
user user.RouterGroup
|
||||||
activity activity.RouterGroup
|
activity activity.RouterGroup
|
||||||
|
event event.RouterGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *routerMgr) Init() {
|
func (this *routerMgr) Init() {
|
||||||
@ -37,6 +39,7 @@ func (this *routerMgr) Init() {
|
|||||||
this.ingame.IngameRouter.InitRouter()
|
this.ingame.IngameRouter.InitRouter()
|
||||||
this.user.UserRouter.InitRouter()
|
this.user.UserRouter.InitRouter()
|
||||||
this.activity.StackingRouter.InitRouter()
|
this.activity.StackingRouter.InitRouter()
|
||||||
|
this.event.EventRouter.InitRouter()
|
||||||
|
|
||||||
f5.GetSysLog().Info("routerMgr.init")
|
f5.GetSysLog().Info("routerMgr.init")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user