邀请好友,增加已成功判断
This commit is contained in:
parent
658fd9e2b8
commit
ee9b19b98c
@ -150,7 +150,10 @@ func (p *Player) handle(m *msg.Msg) error {
|
||||
p.PlayMod.save()
|
||||
case msg.HANDLE_TYPE_INVITE_FRIEND: // 邀请好友
|
||||
InviteMod := p.PlayMod.getInviteMod()
|
||||
InviteMod.AddInvite(m.From)
|
||||
err := InviteMod.AddInvite(m.From)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
p.AddLog(m.From, friend.LOG_TYPE_FRIEND_INVITE, "", m.SendT)
|
||||
p.PlayMod.save()
|
||||
p.PushClientRes(InviteMod.NotifySuccess())
|
||||
|
||||
@ -19,8 +19,12 @@ func (i *InviteMod) InitData() {
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InviteMod) AddInvite(id int) {
|
||||
func (i *InviteMod) AddInvite(id int) error {
|
||||
if _, exists := i.InviteList[id]; exists {
|
||||
return fmt.Errorf("invite already exists")
|
||||
}
|
||||
i.InviteList[id] = struct{}{}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *InviteMod) GetReward(Index int) ([]*item.Item, error) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user