添加好友机制调整

This commit is contained in:
hahwu 2026-03-02 17:10:10 +08:00
parent b0e2c5672c
commit fd4ab739bf
3 changed files with 16 additions and 6 deletions

View File

@ -409,13 +409,13 @@ func ReqGmCommand_(player *Player, Command string) error {
case "resetFriend":
FriendMod := player.PlayMod.getFriendMod()
FriendMod.FriendList = make(map[int]struct{})
FriendMod.ApplyList = make(map[int]int64)
FriendMod.NewApplyList = make(map[int]*friend.ApplyInfo)
FriendMod.Card = make(map[string]*card.CardInfo)
FriendMod.SendApply = make(map[int]int64)
FriendMod.NewFriendList = make(map[int]*friend.FriendInfo)
FriendMod.Npc = []int{}
FriendMod.Npc = nil
FriendMod.Id = 0
FriendMod.Log = make([]*friend.LogInfo, 0)
FriendMod.Log = nil
FriendMod.InitData()
player.FriendListBackData()
player.FriendLogBackData()

View File

@ -346,13 +346,13 @@ func (p *Player) FriendListBackData() {
func (p *Player) FriendApplyBackData() {
FriendMod := p.PlayMod.getFriendMod()
al := make([]*proto.ResFriendApplyInfo, 0, len(FriendMod.ApplyList))
for k, v := range FriendMod.ApplyList {
al := make([]*proto.ResFriendApplyInfo, 0, len(FriendMod.NewApplyList))
for k, v := range FriendMod.NewApplyList {
ps := G_GameLogicPtr.GetResSimplePlayerByUid(k)
if ps != nil {
al = append(al, &proto.ResFriendApplyInfo{
Player: ps,
Time: int32(v),
Time: int32(v.Time),
})
}
}

View File

@ -13,3 +13,13 @@ func TestFriendInit(t *testing.T) {
t.Error("FriendMod init failed")
}
}
func TestFriendApply(t *testing.T) {
p1 := new(game.Player)
p1.InitPlayer("3625212")
FriendMod := p1.GetFriendMod()
FriendMod.AddFriendApply(100002, 0)
if !FriendMod.CheckApply(100002) {
t.Error("FriendMod AddFriendApply failed")
}
}