add adminserver
This commit is contained in:
parent
90e0005361
commit
eae61bcace
@ -5,7 +5,7 @@ module.exports = class {
|
||||
constructor() {
|
||||
this.apis = [
|
||||
{
|
||||
'method': 'GET',
|
||||
'method': 'POST',
|
||||
'name': 'login',
|
||||
'desc': '用户登录',
|
||||
'group': 'User',
|
||||
@ -14,10 +14,8 @@ module.exports = class {
|
||||
],
|
||||
'is_json_params': true,
|
||||
'params': [
|
||||
new common.ReqHead(),
|
||||
['account', '', '账号'],
|
||||
['passwd', '', '密码'],
|
||||
['!test', [0], '密码']
|
||||
],
|
||||
'response': [
|
||||
new common.RspHead(),
|
||||
@ -26,11 +24,14 @@ module.exports = class {
|
||||
{
|
||||
'method': 'GET',
|
||||
'name': 'info',
|
||||
'desc': '用户登录',
|
||||
'desc': 'user info',
|
||||
'group': 'User',
|
||||
'url': 'api/v1/user/info/:user_id',
|
||||
'uri_params': [
|
||||
['user_id', '', 'user_id'],
|
||||
],
|
||||
'params': [
|
||||
['user_id', '', 'user_id', 'optional'],
|
||||
['user_name', '', 'user_name', 'optional'],
|
||||
],
|
||||
'response': [
|
||||
new common.RspHead(),
|
||||
|
@ -2,7 +2,7 @@ exports.DefaultHttpHeader = class DefaultHttpHeader {
|
||||
|
||||
constructor() {
|
||||
this.fields = [
|
||||
['access-key', 'Users unique access-key.'],
|
||||
['Authorization', 'Users unique access-key.'],
|
||||
];
|
||||
}
|
||||
|
||||
|
46
server/adminserver/app.go
Normal file
46
server/adminserver/app.go
Normal file
@ -0,0 +1,46 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"cs"
|
||||
"f5"
|
||||
"mt"
|
||||
"q5"
|
||||
"ss"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
}
|
||||
|
||||
func (this *App) GetPkgName() string {
|
||||
return "adminserver"
|
||||
}
|
||||
|
||||
func (this *App) Init() {
|
||||
f5.LoadMetaTable(mt.Table)
|
||||
this.registerDataSources()
|
||||
}
|
||||
|
||||
func (this *App) UnInit() {
|
||||
}
|
||||
|
||||
func (this *App) Update() {
|
||||
}
|
||||
|
||||
func (this *App) registerDataSources() {
|
||||
f5.GetJsStyleDb().RegisterDataSource(
|
||||
GAME_DB,
|
||||
mt.Table.GameDb.GetById(0).GetHost(),
|
||||
mt.Table.GameDb.GetById(0).GetPort(),
|
||||
mt.Table.GameDb.GetById(0).GetUser(),
|
||||
mt.Table.GameDb.GetById(0).GetPasswd(),
|
||||
mt.Table.GameDb.GetById(0).GetDatabase(),
|
||||
30)
|
||||
f5.GetJsStyleDb().RegisterDataSource(
|
||||
FRIEND_DB,
|
||||
mt.Table.FriendDb.GetById(0).GetHost(),
|
||||
mt.Table.FriendDb.GetById(0).GetPort(),
|
||||
mt.Table.FriendDb.GetById(0).GetUser(),
|
||||
mt.Table.FriendDb.GetById(0).GetPasswd(),
|
||||
mt.Table.FriendDb.GetById(0).GetDatabase(),
|
||||
30)
|
||||
}
|
10
server/adminserver/constant.go
Normal file
10
server/adminserver/constant.go
Normal file
@ -0,0 +1,10 @@
|
||||
package main
|
||||
|
||||
const (
|
||||
MAX_PACKET_LEN = 1024 * 64
|
||||
)
|
||||
|
||||
const (
|
||||
GAME_DB = "gamedb"
|
||||
FRIEND_DB = "firenddb"
|
||||
)
|
3
server/adminserver/export.go
Normal file
3
server/adminserver/export.go
Normal file
@ -0,0 +1,3 @@
|
||||
package main
|
||||
|
||||
var app = new(App)
|
27
server/adminserver/go.mod
Normal file
27
server/adminserver/go.mod
Normal file
@ -0,0 +1,27 @@
|
||||
module adminsever
|
||||
|
||||
go 1.20
|
||||
|
||||
require q5 v1.0.0
|
||||
|
||||
require f5 v1.0.0
|
||||
|
||||
require mt v1.0.0
|
||||
|
||||
require mtb v1.0.0 // indirect
|
||||
|
||||
require github.com/golang/protobuf v1.4.2
|
||||
|
||||
require (
|
||||
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
||||
github.com/gomodule/redigo v1.8.3 // indirect
|
||||
google.golang.org/protobuf v1.23.0 // indirect
|
||||
)
|
||||
|
||||
replace q5 => ../../third_party/q5
|
||||
|
||||
replace f5 => ../../third_party/f5
|
||||
|
||||
replace mt => ./mt
|
||||
|
||||
replace mtb => ./mtb
|
34
server/adminserver/go.sum
Normal file
34
server/adminserver/go.sum
Normal file
@ -0,0 +1,34 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/gomodule/redigo v1.8.3 h1:HR0kYDX2RJZvAup8CsiJwxB4dTCSC0AaUq6S4SiLwUc=
|
||||
github.com/gomodule/redigo v1.8.3/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
9
server/adminserver/main.go
Normal file
9
server/adminserver/main.go
Normal file
@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"f5"
|
||||
)
|
||||
|
||||
func main() {
|
||||
f5.Run(app)
|
||||
}
|
17
server/adminserver/makefile
Normal file
17
server/adminserver/makefile
Normal file
@ -0,0 +1,17 @@
|
||||
compile:
|
||||
@. /etc/profile
|
||||
|
||||
@export GOPROXY=https://goproxy.io
|
||||
@go build -gcflags=all="-N -l" -o ../../bin/adminserver/bin
|
||||
@echo "compile done"
|
||||
|
||||
debug:
|
||||
@. /etc/profile
|
||||
|
||||
@export GOPROXY=https://goproxy.io
|
||||
@go build -gcflags=all="-N -l" -ldflags "-X q5.optDebug=1" -o ../../bin/adminserver/bin
|
||||
@echo "compile done"
|
||||
|
||||
clean:
|
||||
@rm -f ../../bin/adminserver/bin
|
||||
@echo "clean done"
|
34
server/adminserver/mt/AdminCluster.go
Normal file
34
server/adminserver/mt/AdminCluster.go
Normal file
@ -0,0 +1,34 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type IMCluster struct {
|
||||
mtb.IMCluster
|
||||
}
|
||||
|
||||
type IMClusterTable struct {
|
||||
f5.IdMetaTable[IMCluster]
|
||||
selfConf *IMCluster
|
||||
}
|
||||
|
||||
func (this *IMCluster) Init1() {
|
||||
|
||||
}
|
||||
|
||||
func (this *IMClusterTable) GetListenPort() int32 {
|
||||
return this.selfConf.GetListenPort()
|
||||
}
|
||||
|
||||
func (this *IMClusterTable) GetHttpListenPort() int32 {
|
||||
return this.selfConf.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *IMClusterTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
|
||||
if this.selfConf == nil {
|
||||
panic("imserver集群无法读取本服配置")
|
||||
}
|
||||
}
|
15
server/adminserver/mt/Config.go
Normal file
15
server/adminserver/mt/Config.go
Normal file
@ -0,0 +1,15 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
mtb.Config
|
||||
}
|
||||
|
||||
type ConfigTable struct {
|
||||
f5.IdMetaTable[Config]
|
||||
selfConf *Config
|
||||
}
|
15
server/adminserver/mt/FriendDb.go
Normal file
15
server/adminserver/mt/FriendDb.go
Normal file
@ -0,0 +1,15 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type FriendDb struct {
|
||||
mtb.FriendDb
|
||||
}
|
||||
|
||||
type FriendDbTable struct {
|
||||
f5.IdMetaTable[FriendDb]
|
||||
selfConf *FriendDb
|
||||
}
|
17
server/adminserver/mt/GameDb.go
Normal file
17
server/adminserver/mt/GameDb.go
Normal file
@ -0,0 +1,17 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type GameDb struct {
|
||||
mtb.GameDb
|
||||
}
|
||||
|
||||
type GameDbTable struct {
|
||||
f5.IdMetaTable[GameDb]
|
||||
}
|
||||
|
||||
func (this *GameDb) Init1() {
|
||||
}
|
34
server/adminserver/mt/export.go
Normal file
34
server/adminserver/mt/export.go
Normal file
@ -0,0 +1,34 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
)
|
||||
|
||||
type table struct {
|
||||
AdminCluster *AdminClusterTable
|
||||
GameDb *GameDbTable
|
||||
FriendDb *FriendDbTable
|
||||
Config *ConfigTable
|
||||
}
|
||||
|
||||
var Table = f5.New(func (this* table) {
|
||||
this.IMCluster = f5.New(func (this *IMClusterTable) {
|
||||
this.FileName = "../config/imserver.cluster.json"
|
||||
this.PrimKey = "instance_id"
|
||||
});
|
||||
|
||||
this.GameDb = f5.New(func (this *GameDbTable) {
|
||||
this.FileName = "../config/gamedb.mysql.json"
|
||||
this.PrimKey = ""
|
||||
});
|
||||
|
||||
this.FriendDb = f5.New(func (this *FriendDbTable) {
|
||||
this.FileName = "../config/frienddb.mysql.json"
|
||||
this.PrimKey = ""
|
||||
});
|
||||
|
||||
this.Config = f5.New(func (this *ConfigTable) {
|
||||
this.FileName = "../config/config.json"
|
||||
this.PrimKey = ""
|
||||
});
|
||||
})
|
14
server/adminserver/mt/go.mod
Normal file
14
server/adminserver/mt/go.mod
Normal file
@ -0,0 +1,14 @@
|
||||
module mt
|
||||
|
||||
go 1.20
|
||||
|
||||
require q5 v1.0.0
|
||||
require f5 v1.0.0
|
||||
require mtb v1.0.0
|
||||
|
||||
require (
|
||||
)
|
||||
|
||||
replace q5 => ../../../third_party/q5
|
||||
replace f5 => ../../../third_party/f5
|
||||
replace mtb => ../mtb
|
15
server/adminserver/mtb/go.mod
Normal file
15
server/adminserver/mtb/go.mod
Normal file
@ -0,0 +1,15 @@
|
||||
module mtb
|
||||
|
||||
go 1.20
|
||||
|
||||
require q5 v1.0.0
|
||||
require f5 v1.0.0
|
||||
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.4.2
|
||||
google.golang.org/protobuf v1.23.0
|
||||
)
|
||||
|
||||
replace q5 => ../../../third_party/q5
|
||||
replace f5 => ../../../third_party/f5
|
19
server/adminserver/mtb/go.sum
Normal file
19
server/adminserver/mtb/go.sum
Normal file
@ -0,0 +1,19 @@
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
221
server/adminserver/mtb/mtb.auto_gen.go
Normal file
221
server/adminserver/mtb/mtb.auto_gen.go
Normal file
@ -0,0 +1,221 @@
|
||||
package mtb
|
||||
|
||||
import (
|
||||
"f5"
|
||||
)
|
||||
|
||||
type IMCluster struct {
|
||||
instance_id int32
|
||||
listen_port int32
|
||||
http_listen_port int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type MasterCluster struct {
|
||||
instance_id int32
|
||||
ip string
|
||||
listen_port int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type GameDb struct {
|
||||
host string
|
||||
port int32
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type FriendDb struct {
|
||||
host string
|
||||
port int32
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
gameapi_url string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
func (this *IMCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
|
||||
func (this *IMCluster) HasInstanceId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *IMCluster) GetListenPort() int32 {
|
||||
return this.listen_port
|
||||
}
|
||||
|
||||
func (this *IMCluster) HasListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *IMCluster) GetHttpListenPort() int32 {
|
||||
return this.http_listen_port
|
||||
}
|
||||
|
||||
func (this *IMCluster) HasHttpListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *MasterCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
|
||||
func (this *MasterCluster) HasInstanceId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *MasterCluster) GetIp() string {
|
||||
return this.ip
|
||||
}
|
||||
|
||||
func (this *MasterCluster) HasIp() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *MasterCluster) GetListenPort() int32 {
|
||||
return this.listen_port
|
||||
}
|
||||
|
||||
func (this *MasterCluster) HasListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
|
||||
func (this *GameDb) HasHost() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetPort() int32 {
|
||||
return this.port
|
||||
}
|
||||
|
||||
func (this *GameDb) HasPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetUser() string {
|
||||
return this.user
|
||||
}
|
||||
|
||||
func (this *GameDb) HasUser() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetPasswd() string {
|
||||
return this.passwd
|
||||
}
|
||||
|
||||
func (this *GameDb) HasPasswd() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetDatabase() string {
|
||||
return this.database
|
||||
}
|
||||
|
||||
func (this *GameDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasHost() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetPort() int32 {
|
||||
return this.port
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetUser() string {
|
||||
return this.user
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasUser() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetPasswd() string {
|
||||
return this.passwd
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasPasswd() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetDatabase() string {
|
||||
return this.database
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *Config) GetGameapiUrl() string {
|
||||
return this.gameapi_url
|
||||
}
|
||||
|
||||
func (this *Config) HasGameapiUrl() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
|
||||
func (this *IMCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv)
|
||||
}
|
||||
|
||||
func (this *MasterCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.ip, "ip", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 3, kv)
|
||||
}
|
||||
|
||||
func (this *GameDb) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.user, "user", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.passwd, "passwd", &this._flags1_, 4, kv)
|
||||
f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv)
|
||||
}
|
||||
|
||||
func (this *FriendDb) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.user, "user", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.passwd, "passwd", &this._flags1_, 4, kv)
|
||||
f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv)
|
||||
}
|
||||
|
||||
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
||||
}
|
33
server/adminserver/proto/mt.proto
Normal file
33
server/adminserver/proto/mt.proto
Normal file
@ -0,0 +1,33 @@
|
||||
package mt;
|
||||
|
||||
option go_package = ".;mt";
|
||||
|
||||
message AdminCluster
|
||||
{
|
||||
optional int32 instance_id = 1;
|
||||
optional int32 listen_port = 2;
|
||||
optional int32 http_listen_port = 3;
|
||||
}
|
||||
|
||||
message GameDb
|
||||
{
|
||||
optional string host = 1;
|
||||
optional int32 port = 2;
|
||||
optional string user = 3;
|
||||
optional string passwd = 4;
|
||||
optional string database = 5;
|
||||
}
|
||||
|
||||
message FriendDb
|
||||
{
|
||||
optional string host = 1;
|
||||
optional int32 port = 2;
|
||||
optional string user = 3;
|
||||
optional string passwd = 4;
|
||||
optional string database = 5;
|
||||
}
|
||||
|
||||
message Config
|
||||
{
|
||||
optional string gameapi_url = 1;
|
||||
}
|
2
server/adminserver/proto/protoc-gen.bat
Normal file
2
server/adminserver/proto/protoc-gen.bat
Normal file
@ -0,0 +1,2 @@
|
||||
protoc --go_out=..\cs .\cs_*.proto
|
||||
protoc --go_out=..\ss .\ss_*.proto
|
1
server/adminserver/types.go
Normal file
1
server/adminserver/types.go
Normal file
@ -0,0 +1 @@
|
||||
package main
|
@ -72,6 +72,9 @@ class Doc
|
||||
);
|
||||
}
|
||||
);
|
||||
if (item.hasOwnProperty('uri_params')) {
|
||||
this.asParamOut(item.uri_params, 'uri参数');
|
||||
}
|
||||
if (item.is_json_params) {
|
||||
this.data += ` * @apiParamExample {json} 请求样例:\n`;
|
||||
this.data += ` * {\n`;
|
||||
@ -100,14 +103,27 @@ class Doc
|
||||
return 'String';
|
||||
}
|
||||
|
||||
asParamOut(itemList) {
|
||||
asParamOut(itemList, group = null) {
|
||||
itemList.forEach(
|
||||
(item) => {
|
||||
if (util.isArray(item)) {
|
||||
const paramType = this.getFieldType(item[1]);
|
||||
this.data += ` * @apiParam {${paramType}} ${item[0]} ${item[2]}\n`;
|
||||
const isOptional = item.length > 3 ? item[3].indexOf('optional') >= 0: false;
|
||||
if (group) {
|
||||
if (isOptional) {
|
||||
this.data += ` * @apiParam (${group}) {${paramType}} [${item[0]}] ${item[2]}\n`;
|
||||
} else {
|
||||
this.asParamOut(item.fields);
|
||||
this.data += ` * @apiParam (${group}) {${paramType}} ${item[0]} ${item[2]}\n`;
|
||||
}
|
||||
} else {
|
||||
if (isOptional) {
|
||||
this.data += ` * @apiParam {${paramType}} [${item[0]}] ${item[2]}\n`;
|
||||
} else {
|
||||
this.data += ` * @apiParam {${paramType}} ${item[0]} ${item[2]}\n`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.asParamOut(item.fields, group);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user