登录优化

This commit is contained in:
hahwu 2025-12-25 14:46:03 +08:00
parent 857923f268
commit e3661d11b5
4 changed files with 16 additions and 15 deletions

View File

@ -42,7 +42,7 @@ type ResPlayerBaseInfo struct {
NickName string `db:"nick_name"`
LoginTime int32 `db:"login_time"`
LogoutTime int32 `db:"logout_time"`
Todayolinetime int32 `db:"todayolinetime"`
Node int32 `db:"node"`
Rolecreatetime int32 `db:"rolecreatetime"`
EmitOrderCnt int32 `db:"EmitOrderCnt"`
DailyRenewTime int32 `db:"DailyRenewTime"`

View File

@ -195,7 +195,7 @@ func (ad *GameLogic) NewAccountInsertDataToDB() bool {
playerInfo.UserName = ad.Db_AccountInfo.UserName
playerInfo.LoginTime = (int32)(time.Now().Unix())
playerInfo.LogoutTime = 0
playerInfo.Todayolinetime = 0
playerInfo.Node = int32(conf.Server.ServerID)
playerInfo.Rolecreatetime = (int32)(time.Now().Unix())
playerInfo.FaceBookId = ""
db.FormatAllMemInsertDb(playerInfo, "t_player_baseinfo")
@ -533,12 +533,12 @@ func (ad *GameLogic) ClearData(args []interface{}) {
if player != nil && player.M_DwUin != 0 {
player.agent = nil
log.Debug("player %d 断开连接", player.M_DwUin)
player.CallEvent(300*time.Second, func() {
player.CallEvent(120*time.Second, func() {
player.lock.Lock()
defer player.lock.Unlock()
if player.agent == nil {
player.ClearData()
log.Debug("player %d 延迟300s关闭", player.M_DwUin)
log.Debug("player %d 延迟120s关闭", player.M_DwUin)
}
}, "LateClose")
}

View File

@ -5,6 +5,7 @@ import (
"database/sql"
"errors"
"server/MergeConst"
"server/conf"
baseCfg "server/conf/base"
userCfg "server/conf/user"
"server/db"
@ -47,7 +48,7 @@ func (p *PlayerBaseData) BackUp() msg.ResPlayerBaseInfo {
LoginTime: p.Data.LoginTime,
UserName: p.Data.UserName,
LogoutTime: p.Data.LogoutTime,
Todayolinetime: p.Data.Todayolinetime,
Node: p.Data.Node,
Rolecreatetime: p.Data.Rolecreatetime,
LastChampGroupID: p.Data.LastChampGroupID,
ChampshipsGroupID: p.Data.ChampshipsGroupID,
@ -74,7 +75,7 @@ func (p *PlayerBaseData) Recover(old *PlayerBaseData) *PlayerBaseData {
LoginTime: p.Data.LoginTime,
UserName: p.Data.UserName,
LogoutTime: p.Data.LogoutTime,
Todayolinetime: p.Data.Todayolinetime,
Node: p.Data.Node,
Rolecreatetime: p.Data.Rolecreatetime,
LastChampGroupID: p.Data.LastChampGroupID,
ChampshipsGroupID: p.Data.ChampshipsGroupID,
@ -107,7 +108,7 @@ func (p *PlayerBaseData) LoadDataFromDB(UserName interface{}) bool {
p.Data.Ban = sqlStruck.Ban
p.Data.UserName = sqlStruck.UserName
p.Data.LogoutTime = sqlStruck.LogoutTime
p.Data.Todayolinetime = sqlStruck.Todayolinetime
p.Data.Node = int32(conf.Server.ServerID)
p.Data.Rolecreatetime = sqlStruck.Rolecreatetime
p.Data.LastChampGroupID = sqlStruck.LastChampGroupID
p.Data.ChampshipsGroupID = sqlStruck.ChampshipsGroupID
@ -136,7 +137,7 @@ func (p *PlayerBaseData) SaveDataFromDB(Key interface{}) bool {
sqlStruck.LoginTime = int32(BaseMod.LoginTime)
sqlStruck.UserName = p.Data.UserName
sqlStruck.LogoutTime = int32(BaseMod.LogoutTime)
sqlStruck.Todayolinetime = p.Data.Todayolinetime
sqlStruck.Node = p.Data.Node
sqlStruck.Rolecreatetime = p.Data.Rolecreatetime
sqlStruck.NoAd = p.Data.NoAd
sqlStruck.ChampshipsGroupID = p.Data.ChampshipsGroupID
@ -642,7 +643,7 @@ func (p *PlayerBaseData) GetDataByUid(Uid interface{}) bool {
p.Data.LoginTime = sqlStruck.LoginTime
p.Data.UserName = sqlStruck.UserName
p.Data.LogoutTime = sqlStruck.LogoutTime
p.Data.Todayolinetime = sqlStruck.Todayolinetime
p.Data.Node = sqlStruck.Node
p.Data.Rolecreatetime = sqlStruck.Rolecreatetime
p.Data.LastChampGroupID = sqlStruck.LastChampGroupID
p.Data.ChampshipsGroupID = sqlStruck.ChampshipsGroupID

View File

@ -2632,7 +2632,7 @@ type ResPlayerBaseInfo struct {
UserName string `protobuf:"bytes,14,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty"`
LoginTime int32 `protobuf:"varint,15,opt,name=login_time,json=loginTime,proto3" json:"login_time,omitempty"`
LogoutTime int32 `protobuf:"varint,16,opt,name=logout_time,json=logoutTime,proto3" json:"logout_time,omitempty"`
Todayolinetime int32 `protobuf:"varint,17,opt,name=todayolinetime,proto3" json:"todayolinetime,omitempty"`
Node int32 `protobuf:"varint,17,opt,name=node,proto3" json:"node,omitempty"`
Rolecreatetime int32 `protobuf:"varint,18,opt,name=rolecreatetime,proto3" json:"rolecreatetime,omitempty"`
EmitOrderCnt int32 `protobuf:"varint,19,opt,name=EmitOrderCnt,proto3" json:"EmitOrderCnt,omitempty"`
NoAd int32 `protobuf:"varint,20,opt,name=NoAd,proto3" json:"NoAd,omitempty"`
@ -2786,9 +2786,9 @@ func (x *ResPlayerBaseInfo) GetLogoutTime() int32 {
return 0
}
func (x *ResPlayerBaseInfo) GetTodayolinetime() int32 {
func (x *ResPlayerBaseInfo) GetNode() int32 {
if x != nil {
return x.Todayolinetime
return x.Node
}
return 0
}
@ -27717,7 +27717,7 @@ const file_proto_Gameapi_proto_rawDesc = "" +
"ResultCode\x18\x01 \x01(\x05R\n" +
"ResultCode\")\n" +
"\x11ReqPlayerBaseInfo\x12\x14\n" +
"\x05dwUin\x18\x01 \x01(\x03R\x05dwUin\"\xfd\x05\n" +
"\x05dwUin\x18\x01 \x01(\x03R\x05dwUin\"\xe9\x05\n" +
"\x11ResPlayerBaseInfo\x12\x14\n" +
"\x05dwUin\x18\x01 \x01(\x03R\x05dwUin\x12\x16\n" +
"\x06energy\x18\x02 \x01(\x05R\x06energy\x12\x12\n" +
@ -27738,8 +27738,8 @@ const file_proto_Gameapi_proto_rawDesc = "" +
"\n" +
"login_time\x18\x0f \x01(\x05R\tloginTime\x12\x1f\n" +
"\vlogout_time\x18\x10 \x01(\x05R\n" +
"logoutTime\x12&\n" +
"\x0etodayolinetime\x18\x11 \x01(\x05R\x0etodayolinetime\x12&\n" +
"logoutTime\x12\x12\n" +
"\x04node\x18\x11 \x01(\x05R\x04node\x12&\n" +
"\x0erolecreatetime\x18\x12 \x01(\x05R\x0erolecreatetime\x12\"\n" +
"\fEmitOrderCnt\x18\x13 \x01(\x05R\fEmitOrderCnt\x12\x12\n" +
"\x04NoAd\x18\x14 \x01(\x05R\x04NoAd\x12,\n" +