补充跨服id 获取接口

This commit is contained in:
liwei1dao 2022-10-17 18:34:29 +08:00
parent a28f4a5396
commit 9431b19d2e
3 changed files with 15 additions and 0 deletions

View File

@ -104,6 +104,11 @@ func (this *ModuleBase) Start() (err error) {
return return
} }
//获取跨服标签
func (this *ModuleBase) GetCrossTag() string {
return db.CrossTag()
}
func (this *ModuleBase) GetUserSession(uid string) (session comm.IUserSession, ok bool) { func (this *ModuleBase) GetUserSession(uid string) (session comm.IUserSession, ok bool) {
var udata *pb.CacheUser var udata *pb.CacheUser
if udata = this.ModuleUser.GetUserSession(uid); udata == nil { if udata = this.ModuleUser.GetUserSession(uid); udata == nil {

View File

@ -8,6 +8,8 @@ type (
ISys interface { ISys interface {
//本服数据连接 //本服数据连接
Local() (conn *DBConn, err error) Local() (conn *DBConn, err error)
//跨服区服id
CrossTag() string
//本服数据连接 //本服数据连接
Cross() (conn *DBConn, err error) Cross() (conn *DBConn, err error)
//跨服列表数据层连接 //跨服列表数据层连接
@ -51,6 +53,10 @@ func Local() (conn *DBConn, err error) {
return defsys.Local() return defsys.Local()
} }
func CrossTag() string {
return defsys.CrossTag()
}
func Cross() (conn *DBConn, err error) { func Cross() (conn *DBConn, err error) {
return defsys.Cross() return defsys.Cross()
} }

View File

@ -107,6 +107,10 @@ func (this *DB) Local() (conn *DBConn, err error) {
return return
} }
func (this *DB) CrossTag() string {
return this.options.CrossTag
}
func (this *DB) Cross() (conn *DBConn, err error) { func (this *DB) Cross() (conn *DBConn, err error) {
conn = this.cross conn = this.cross
if conn == nil { if conn == nil {