1
This commit is contained in:
commit
a8c104912a
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
"main/model/system"
|
"main/model/system"
|
||||||
|
"main/mt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"q5"
|
"q5"
|
||||||
|
|
||||||
@ -183,6 +184,8 @@ func (this *GameSwitchApi) Edit(c *gin.Context) {
|
|||||||
"code": 0,
|
"code": 0,
|
||||||
"message": "",
|
"message": "",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.refreshAct(func(f5.HttpCliResponse) {})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GameSwitchApi) Del(c *gin.Context) {
|
func (this *GameSwitchApi) Del(c *gin.Context) {
|
||||||
@ -228,3 +231,32 @@ func (this *GameSwitchApi) Del(c *gin.Context) {
|
|||||||
"message": "",
|
"message": "",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *GameSwitchApi) Refresh(c *gin.Context) {
|
||||||
|
this.refreshAct(func(rsp f5.HttpCliResponse) {
|
||||||
|
if rsp.GetErr() != nil {
|
||||||
|
f5.RspErr2(c, 500, rsp.GetErr().Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rspJson := struct {
|
||||||
|
ErrCode int32 `json:"errcode"`
|
||||||
|
ErrMsg string `json:"errmsg"`
|
||||||
|
CP int32 `json:"contributionPoint"`
|
||||||
|
}{}
|
||||||
|
if q5.DecodeJson(rsp.GetRawData(), &rspJson) != nil {
|
||||||
|
f5.RspErr2(c, 500, "server internal error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
f5.RspErr2(c, rspJson.ErrCode, rspJson.ErrMsg)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *GameSwitchApi) refreshAct(cb func(f5.HttpCliResponse)) {
|
||||||
|
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||||
|
mt.Table.Config.RandElement().GetGameapiUrl()+"/webapp/index.php",
|
||||||
|
map[string]string{
|
||||||
|
"c": "OutAppTools",
|
||||||
|
"a": "refreshServerSwitch",
|
||||||
|
},
|
||||||
|
cb)
|
||||||
|
}
|
||||||
|
@ -18,6 +18,7 @@ func (this *GameSwitchRoute) InitGameSwitchRouter(priRouter *gin.RouterGroup) {
|
|||||||
//group.POST("add", middleware.Permission("api/v1/game_switch/add", api.Add))
|
//group.POST("add", middleware.Permission("api/v1/game_switch/add", api.Add))
|
||||||
group.POST("edit", middleware.Permission("api/v1/game_switch/edit", api.Edit))
|
group.POST("edit", middleware.Permission("api/v1/game_switch/edit", api.Edit))
|
||||||
//group.POST("del", middleware.Permission("api/v1/game_switch/del", api.Del))
|
//group.POST("del", middleware.Permission("api/v1/game_switch/del", api.Del))
|
||||||
group.GET("list", middleware.Permission("api/v1/game_switch/list", api.List))
|
group.GET("list", middleware.Permission("api/v1/game_switch/list", api.List))
|
||||||
|
group.GET("refresh", middleware.Permission("api/v1/game_switch/refresh", api.Refresh))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user