gameswitch list
This commit is contained in:
parent
b4780301b9
commit
cb0847c3f5
@ -4,6 +4,7 @@ import (
|
|||||||
"main/api/v1/activity"
|
"main/api/v1/activity"
|
||||||
"main/api/v1/asset"
|
"main/api/v1/asset"
|
||||||
"main/api/v1/event"
|
"main/api/v1/event"
|
||||||
|
"main/api/v1/game_switch"
|
||||||
"main/api/v1/gold_bullion"
|
"main/api/v1/gold_bullion"
|
||||||
"main/api/v1/hero"
|
"main/api/v1/hero"
|
||||||
"main/api/v1/ingame"
|
"main/api/v1/ingame"
|
||||||
@ -26,6 +27,7 @@ type ApiGroup struct {
|
|||||||
ActivityApiGroup activity.ApiGroup
|
ActivityApiGroup activity.ApiGroup
|
||||||
EventApiGroup event.ApiGroup
|
EventApiGroup event.ApiGroup
|
||||||
RechargeApiGroup recharge.ApiGroup
|
RechargeApiGroup recharge.ApiGroup
|
||||||
|
SwitchApiGroup game_switch.ApiGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
var ApiGroupApp = new(ApiGroup)
|
var ApiGroupApp = new(ApiGroup)
|
||||||
|
5
server/marketserver/api/v1/game_switch/enter.go
Normal file
5
server/marketserver/api/v1/game_switch/enter.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package game_switch
|
||||||
|
|
||||||
|
type ApiGroup struct {
|
||||||
|
GameSwitchApi
|
||||||
|
}
|
41
server/marketserver/api/v1/game_switch/gswitch.go
Normal file
41
server/marketserver/api/v1/game_switch/gswitch.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package game_switch
|
||||||
|
|
||||||
|
import (
|
||||||
|
"f5"
|
||||||
|
"main/constant"
|
||||||
|
"net/http"
|
||||||
|
"q5"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GameSwitchApi struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *GameSwitchApi) List(c *gin.Context) {
|
||||||
|
f5.GetGoStyleDb().RawQuery(
|
||||||
|
constant.CONF_DB,
|
||||||
|
"SELECT * FROM t_game_switch WHERE 1=1",
|
||||||
|
[]string{},
|
||||||
|
func(err error, ds *f5.DataSet) {
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": 1,
|
||||||
|
"message": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data := map[string]int32{}
|
||||||
|
for ds.Next() {
|
||||||
|
data[ds.GetByName("switch_name")] = q5.SafeToInt32(ds.GetByName("is_open"))
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": 0,
|
||||||
|
"message": "获取成功",
|
||||||
|
"contributionPoint": "",
|
||||||
|
"data": data,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
@ -97,6 +97,17 @@ func (this *app) registerDataSources() {
|
|||||||
1,
|
1,
|
||||||
mt.Table.AccountDb.GetById(0).GetMaxOpenConns(),
|
mt.Table.AccountDb.GetById(0).GetMaxOpenConns(),
|
||||||
mt.Table.AccountDb.GetById(0).GetMaxIdleConns())
|
mt.Table.AccountDb.GetById(0).GetMaxIdleConns())
|
||||||
|
|
||||||
|
f5.GetGoStyleDb().RegisterDataSource(
|
||||||
|
constant.CONF_DB,
|
||||||
|
mt.Table.ConfDb.GetById(0).GetHost(),
|
||||||
|
mt.Table.ConfDb.GetById(0).GetPort(),
|
||||||
|
mt.Table.ConfDb.GetById(0).GetUser(),
|
||||||
|
mt.Table.ConfDb.GetById(0).GetPasswd(),
|
||||||
|
mt.Table.ConfDb.GetById(0).GetDatabase(),
|
||||||
|
1,
|
||||||
|
mt.Table.ConfDb.GetById(0).GetMaxOpenConns(),
|
||||||
|
mt.Table.ConfDb.GetById(0).GetMaxIdleConns())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) HasTask() bool {
|
func (this *app) HasTask() bool {
|
||||||
|
@ -5,6 +5,7 @@ const (
|
|||||||
BCNFT_DB = "bcnftdb"
|
BCNFT_DB = "bcnftdb"
|
||||||
BCEVENT_DB = "bceventdb"
|
BCEVENT_DB = "bceventdb"
|
||||||
GAME_DB = "gamedb"
|
GAME_DB = "gamedb"
|
||||||
|
CONF_DB = "confdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
5
server/marketserver/router/game_switch/enter.go
Normal file
5
server/marketserver/router/game_switch/enter.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package game_switch
|
||||||
|
|
||||||
|
type RouterGroup struct {
|
||||||
|
GameSwitchRouter
|
||||||
|
}
|
13
server/marketserver/router/game_switch/game_switch.go
Normal file
13
server/marketserver/router/game_switch/game_switch.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package game_switch
|
||||||
|
|
||||||
|
import (
|
||||||
|
"f5"
|
||||||
|
v1 "main/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GameSwitchRouter struct{}
|
||||||
|
|
||||||
|
func (this *GameSwitchRouter) InitRouter() {
|
||||||
|
api := v1.ApiGroupApp.SwitchApiGroup
|
||||||
|
f5.GetApp().GetGinEngine().GET("/api/server_switch", api.GameSwitchApi.List)
|
||||||
|
}
|
@ -6,6 +6,7 @@ import (
|
|||||||
"main/router/activity"
|
"main/router/activity"
|
||||||
"main/router/asset"
|
"main/router/asset"
|
||||||
"main/router/event"
|
"main/router/event"
|
||||||
|
"main/router/game_switch"
|
||||||
"main/router/gold_bullion"
|
"main/router/gold_bullion"
|
||||||
"main/router/hero"
|
"main/router/hero"
|
||||||
"main/router/ingame"
|
"main/router/ingame"
|
||||||
@ -28,6 +29,7 @@ type routerMgr struct {
|
|||||||
activity activity.RouterGroup
|
activity activity.RouterGroup
|
||||||
event event.RouterGroup
|
event event.RouterGroup
|
||||||
recharge recharge.RouterGroup
|
recharge recharge.RouterGroup
|
||||||
|
gameswitch game_switch.RouterGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *routerMgr) Init() {
|
func (this *routerMgr) Init() {
|
||||||
@ -45,6 +47,7 @@ func (this *routerMgr) Init() {
|
|||||||
this.activity.ContributionRouter.InitRouter()
|
this.activity.ContributionRouter.InitRouter()
|
||||||
this.event.EventRouter.InitRouter()
|
this.event.EventRouter.InitRouter()
|
||||||
this.recharge.RechargeRouter.InitRouter()
|
this.recharge.RechargeRouter.InitRouter()
|
||||||
|
this.gameswitch.GameSwitchRouter.InitRouter()
|
||||||
|
|
||||||
f5.GetSysLog().Info("routerMgr.init")
|
f5.GetSysLog().Info("routerMgr.init")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user