pc terminal can login at same time

This commit is contained in:
Gordon 2022-08-21 16:05:58 +08:00
parent 9a82dd356c
commit ed5b215bbb
2 changed files with 12 additions and 0 deletions

View File

@ -147,6 +147,11 @@ func (ws *WServer) MultiTerminalLoginCheckerWithLock(uid string, platformID int,
defer rwLock.Unlock()
log.NewInfo(operationID, utils.GetSelfFuncName(), " rpc args: ", uid, platformID, token)
switch config.Config.MultiLoginPolicy {
case constant.PCAndOther:
if constant.PlatformNameToClass(constant.PlatformIDToName(platformID)) == constant.TerminalPC {
return
}
fallthrough
case constant.AllLoginButSameTermKick:
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
if oldConn, ok := oldConnMap[platformID]; ok {
@ -197,6 +202,11 @@ func (ws *WServer) MultiTerminalLoginCheckerWithLock(uid string, platformID int,
func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn *UserConn, token string, operationID string) {
switch config.Config.MultiLoginPolicy {
case constant.PCAndOther:
if constant.PlatformNameToClass(constant.PlatformIDToName(platformID)) == constant.TerminalPC {
return
}
fallthrough
case constant.AllLoginButSameTermKick:
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
if oldConn, ok := oldConnMap[platformID]; ok {

View File

@ -140,6 +140,8 @@ const (
WebAndOther = 3
//The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at the same time
PcMobileAndWeb = 4
//The PC terminal can be online at the same time,but other terminal only one of the endpoints can login
PCAndOther = 5
OnlineStatus = "online"
OfflineStatus = "offline"