集群架构优化
This commit is contained in:
parent
8c5b63a49a
commit
4dc6dcbee7
@ -238,6 +238,12 @@ func GobUnmarshal(data []byte, obj interface{}) error {
|
||||
}
|
||||
|
||||
func GetServerIdByUid(uid int) int {
|
||||
if uid <= 100000 {
|
||||
return uid
|
||||
}
|
||||
if uid <= 100000000 {
|
||||
return uid / 100000
|
||||
}
|
||||
return int((uid % 100000000) / 100000)
|
||||
}
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ func init() {
|
||||
RegisterClusterHandler(msg.CLUSTER_FRIEND_SYNC, ClusterFriendSync)
|
||||
RegisterClusterHandler(msg.HANDLE_TYPE_CHAMPSHIP_INRANK, champshipInrankHandler)
|
||||
RegisterClusterHandler(msg.HANDLE_TYPE_CHAMPSHIP_RANK_INFO, champshipRankInfoHandler)
|
||||
RegisterClusterHandler(msg.HANDLE_TYPE_CHAMPSHIP_MY_RANK, champshipMyRankHandler)
|
||||
}
|
||||
|
||||
func champshipInrankHandler(m *msg.Msg) error {
|
||||
@ -54,3 +55,12 @@ func champshipRankInfoHandler(m *msg.Msg) error {
|
||||
FriendMgrSend(m)
|
||||
return nil
|
||||
}
|
||||
|
||||
func champshipMyRankHandler(m *msg.Msg) error {
|
||||
MyRank := G_GameLogicPtr.ChampshipMgr.getMyRank(m.From)
|
||||
m.To = m.From
|
||||
m.From = 0
|
||||
m.Extra = MyRank
|
||||
FriendMgrSend(m)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -126,15 +126,16 @@ const (
|
||||
|
||||
func (m *Msg) Clone() *Msg {
|
||||
return &Msg{
|
||||
Type: m.Type,
|
||||
To: m.To,
|
||||
From: m.From,
|
||||
Item: m.Item,
|
||||
SendT: m.SendT,
|
||||
End: m.End,
|
||||
Extra: m.Extra,
|
||||
Id: m.Id,
|
||||
H: m.H,
|
||||
Type: m.Type,
|
||||
To: m.To,
|
||||
From: m.From,
|
||||
Item: m.Item,
|
||||
SendT: m.SendT,
|
||||
End: m.End,
|
||||
Extra: m.Extra,
|
||||
Id: m.Id,
|
||||
H: m.H,
|
||||
UniKey: m.UniKey,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user