封号优化

This commit is contained in:
hahwu 2025-07-30 15:02:37 +08:00
parent c9b6c86139
commit 618fc63604
3 changed files with 5 additions and 14 deletions

View File

@ -40,7 +40,7 @@ func (f *BanMgr) IsBanned(userId int64) bool {
if !banned {
return false
}
return Info.EndTime > GoUtil.Now() || Info.EndTime == 0 // 如果EndTime为0表示永久封禁
return Info.EndTime > GoUtil.Now() || Info.EndTime == -1 // 如果EndTime为0表示永久封禁
}
func (f *BanMgr) BanUser(userId int64, endTime int64, reason string) {

View File

@ -238,16 +238,7 @@ func ReqAdminBan(args []interface{}) error {
res := make(map[string]interface{})
res["Code"] = 0
res["Msg"] = "ok"
player := G_GameLogicPtr.GetPlayer(req.Uid)
if player == nil {
res["Code"] = 1
res["Msg"] = "player not found"
AdminPlayerBack(a, res)
return nil
}
player.lock.Lock()
defer player.lock.Unlock()
G_GameLogicPtr.BanMgr.BanUser(player.M_DwUin, int64(req.Time), req.Reason)
G_GameLogicPtr.BanMgr.BanUser(req.Uid, int64(req.Time), req.Reason)
AdminPlayerBack(a, res)
return nil
}

View File

@ -24969,7 +24969,7 @@ func (x *ReqAdminGm) GetCommand() string {
type ReqAdminBan struct {
state protoimpl.MessageState `protogen:"open.v1"`
Uid int64 `protobuf:"varint,1,opt,name=Uid,proto3" json:"Uid,omitempty"` // uid
Time int32 `protobuf:"varint,2,opt,name=Time,proto3" json:"Time,omitempty"` // 禁止时间
Time int64 `protobuf:"varint,2,opt,name=Time,proto3" json:"Time,omitempty"` // 禁止时间
Reason string `protobuf:"bytes,3,opt,name=Reason,proto3" json:"Reason,omitempty"` // 禁止原因
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@ -25012,7 +25012,7 @@ func (x *ReqAdminBan) GetUid() int64 {
return 0
}
func (x *ReqAdminBan) GetTime() int32 {
func (x *ReqAdminBan) GetTime() int64 {
if x != nil {
return x.Time
}
@ -26832,7 +26832,7 @@ const file_proto_Gameapi_proto_rawDesc = "" +
"\aCommand\x18\x02 \x01(\tR\aCommand\"K\n" +
"\vReqAdminBan\x12\x10\n" +
"\x03Uid\x18\x01 \x01(\x03R\x03Uid\x12\x12\n" +
"\x04Time\x18\x02 \x01(\x05R\x04Time\x12\x16\n" +
"\x04Time\x18\x02 \x01(\x03R\x04Time\x12\x16\n" +
"\x06Reason\x18\x03 \x01(\tR\x06Reason*\xc8\n" +
"\n" +
"\x0eITEM_POP_LABEL\x12\f\n" +