封号优化
This commit is contained in:
parent
c9b6c86139
commit
618fc63604
@ -40,7 +40,7 @@ func (f *BanMgr) IsBanned(userId int64) bool {
|
|||||||
if !banned {
|
if !banned {
|
||||||
return false
|
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) {
|
func (f *BanMgr) BanUser(userId int64, endTime int64, reason string) {
|
||||||
|
|||||||
@ -238,16 +238,7 @@ func ReqAdminBan(args []interface{}) error {
|
|||||||
res := make(map[string]interface{})
|
res := make(map[string]interface{})
|
||||||
res["Code"] = 0
|
res["Code"] = 0
|
||||||
res["Msg"] = "ok"
|
res["Msg"] = "ok"
|
||||||
player := G_GameLogicPtr.GetPlayer(req.Uid)
|
G_GameLogicPtr.BanMgr.BanUser(req.Uid, int64(req.Time), req.Reason)
|
||||||
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)
|
|
||||||
AdminPlayerBack(a, res)
|
AdminPlayerBack(a, res)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24969,7 +24969,7 @@ func (x *ReqAdminGm) GetCommand() string {
|
|||||||
type ReqAdminBan struct {
|
type ReqAdminBan struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Uid int64 `protobuf:"varint,1,opt,name=Uid,proto3" json:"Uid,omitempty"` // uid
|
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"` // 禁止原因
|
Reason string `protobuf:"bytes,3,opt,name=Reason,proto3" json:"Reason,omitempty"` // 禁止原因
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -25012,7 +25012,7 @@ func (x *ReqAdminBan) GetUid() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ReqAdminBan) GetTime() int32 {
|
func (x *ReqAdminBan) GetTime() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Time
|
return x.Time
|
||||||
}
|
}
|
||||||
@ -26832,7 +26832,7 @@ const file_proto_Gameapi_proto_rawDesc = "" +
|
|||||||
"\aCommand\x18\x02 \x01(\tR\aCommand\"K\n" +
|
"\aCommand\x18\x02 \x01(\tR\aCommand\"K\n" +
|
||||||
"\vReqAdminBan\x12\x10\n" +
|
"\vReqAdminBan\x12\x10\n" +
|
||||||
"\x03Uid\x18\x01 \x01(\x03R\x03Uid\x12\x12\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" +
|
"\x06Reason\x18\x03 \x01(\tR\x06Reason*\xc8\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\x0eITEM_POP_LABEL\x12\f\n" +
|
"\x0eITEM_POP_LABEL\x12\f\n" +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user