封号功能

This commit is contained in:
hahwu 2025-07-30 15:33:55 +08:00
parent 9faaaf86e2
commit 0b3961adc4
2 changed files with 12 additions and 1 deletions

View File

@ -43,6 +43,17 @@ func (f *BanMgr) IsBanned(userId int64) bool {
return Info.EndTime > GoUtil.Now() || Info.EndTime == -1 // 如果EndTime为0表示永久封禁
}
func (f *BanMgr) GetBanInfo(userId int64) *BanInfo {
if f.data.(*BanData).NewBanList == nil {
return nil
}
Info, banned := f.data.(*BanData).NewBanList[userId]
if !banned {
return nil
}
return Info
}
func (f *BanMgr) BanUser(userId int64, endTime int64, reason string) {
f.data.(*BanData).NewBanList[userId] = &BanInfo{
UserId: userId,

View File

@ -133,7 +133,7 @@ func AdminPlayerInfo(args []interface{}) error {
res["Cumulative"] = player.PlayMod.getBaseMod().Cumulative
res["RegisterTime"] = player.GetPlayerBaseMod().GetRegisterTime()
res["TodayCumulative"] = player.PlayMod.getBaseMod().TodayCumulative
res["Ban"] = G_GameLogicPtr.BanMgr.IsBanned(player.M_DwUin)
res["Ban"] = G_GameLogicPtr.BanMgr.GetBanInfo(player.M_DwUin).EndTime
if online {
res["Cumulative"] = int64(player.PlayMod.getBaseMod().Cumulative) + GoUtil.Now() - int64(player.PlayMod.getBaseMod().LoginTime)
res["TodayCumulative"] = int64(player.PlayMod.getBaseMod().TodayCumulative) + GoUtil.Now() - int64(player.PlayMod.getBaseMod().LoginTime)