1
This commit is contained in:
parent
2d5363a39c
commit
351798662a
7
bin/adminserver/config/adminserver.cluster.json
Normal file
7
bin/adminserver/config/adminserver.cluster.json
Normal file
@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"instance_id": 1,
|
||||
"listen_port": 8890,
|
||||
"http_listen_port": 9991
|
||||
}
|
||||
]
|
3
bin/adminserver/config/config.json
Normal file
3
bin/adminserver/config/config.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"gameapi_url": "https://game2006api-test.kingsome.cn"
|
||||
}
|
7
bin/adminserver/config/frienddb.mysql.json
Normal file
7
bin/adminserver/config/frienddb.mysql.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"host": "login-test.kingsome.cn",
|
||||
"port": 3306,
|
||||
"user": "root",
|
||||
"passwd": "keji178",
|
||||
"database": "frienddb_dev_1"
|
||||
}
|
7
bin/adminserver/config/gamedb.mysql.json
Normal file
7
bin/adminserver/config/gamedb.mysql.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"host": "login-test.kingsome.cn",
|
||||
"port": 3306,
|
||||
"user": "root",
|
||||
"passwd": "keji178",
|
||||
"database": "gamedb2006_dev_1"
|
||||
}
|
@ -15,9 +15,11 @@ func (this *App) GetPkgName() string {
|
||||
func (this *App) Init() {
|
||||
f5.LoadMetaTable(mt.Table)
|
||||
this.registerDataSources()
|
||||
ginMgr.init()
|
||||
}
|
||||
|
||||
func (this *App) UnInit() {
|
||||
ginMgr.unInit()
|
||||
}
|
||||
|
||||
func (this *App) Update() {
|
||||
|
@ -1,3 +1,4 @@
|
||||
package main
|
||||
|
||||
var app = new(App)
|
||||
var ginMgr = new(GinMgr)
|
||||
|
39
server/adminserver/ginmgr.go
Normal file
39
server/adminserver/ginmgr.go
Normal file
@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
"net/http"
|
||||
"github.com/gin-gonic/gin"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
type GinMgr struct {
|
||||
group errgroup.Group
|
||||
}
|
||||
|
||||
func (this *GinMgr) init() {
|
||||
server01 := &http.Server{
|
||||
Addr: ":8080",
|
||||
Handler: this.router(),
|
||||
ReadTimeout: 5 * time.Second,
|
||||
WriteTimeout: 10 * time.Second,
|
||||
}
|
||||
this.group.Go(func() error {
|
||||
return server01.ListenAndServe()
|
||||
})
|
||||
}
|
||||
|
||||
func (this *GinMgr) unInit() {
|
||||
}
|
||||
|
||||
func (this *GinMgr) router() http.Handler {
|
||||
r := gin.New()
|
||||
r.Use(gin.Recovery())
|
||||
r.GET("/webapp/index.php", func(c *gin.Context) {
|
||||
c.JSON(200, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
})
|
||||
})
|
||||
return r
|
||||
}
|
@ -37,6 +37,7 @@ require (
|
||||
golang.org/x/arch v0.5.0 // indirect
|
||||
golang.org/x/crypto v0.12.0 // indirect
|
||||
golang.org/x/net v0.14.0 // indirect
|
||||
golang.org/x/sync v0.3.0 // indirect
|
||||
golang.org/x/sys v0.12.0 // indirect
|
||||
golang.org/x/text v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
|
@ -88,6 +88,8 @@ golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
|
||||
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
|
||||
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||
|
@ -13,7 +13,7 @@ type table struct {
|
||||
|
||||
var Table = f5.New(func (this* table) {
|
||||
this.AdminCluster = f5.New(func (this *AdminClusterTable) {
|
||||
this.FileName = "../config/imserver.cluster.json"
|
||||
this.FileName = "../config/adminserver.cluster.json"
|
||||
this.PrimKey = "instance_id"
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user