46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package comm
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/liwei1dao/lego/base"
|
|
)
|
|
|
|
func NewUserSession(service base.IRPCXService, ip, sessionId, gatewayServiceId string, uid uint32) IUserSession {
|
|
return &UserSession{
|
|
IP: ip,
|
|
SessionId: sessionId,
|
|
GatewayServiceId: gatewayServiceId,
|
|
UserId: uid,
|
|
service: service,
|
|
}
|
|
}
|
|
|
|
type UserSession struct {
|
|
IP string
|
|
SessionId string
|
|
GatewayServiceId string //用户所在网关服务
|
|
UserId uint32
|
|
service base.IRPCXService
|
|
}
|
|
|
|
func (this *UserSession) GetSessionId() string {
|
|
return this.SessionId
|
|
}
|
|
func (this *UserSession) GetIP() string {
|
|
return this.IP
|
|
}
|
|
func (this *UserSession) GetGatewayServiceId() string {
|
|
return this.GatewayServiceId
|
|
}
|
|
func (this *UserSession) SendMsg(ServiceMethod string, msg interface{}) (err error) {
|
|
|
|
return
|
|
}
|
|
func (this *UserSession) Close() (err error) {
|
|
return
|
|
}
|
|
func (this *UserSession) ToString() string {
|
|
return fmt.Sprintf("SessionId:%s UserId:%d GatewayServiceId:%s", this.SessionId, this.UserId, this.GatewayServiceId)
|
|
}
|