1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-23 13:42:25 +08:00

improve code for message

This commit is contained in:
houseme
2023-10-16 15:17:03 +08:00
parent 3d9cb16709
commit 1090563e0b
2 changed files with 18 additions and 28 deletions

View File

@@ -498,14 +498,10 @@ func (s *PushDataSubscribePopup) GetSubscribeMsgPopupEvents() []SubscribeMsgPopu
return s.subscribeMsgPopupEventList return s.subscribeMsgPopupEventList
} }
if s.SubscribeMsgPopupEvent.List == nil { if s.SubscribeMsgPopupEvent.List == nil || len(s.SubscribeMsgPopupEvent.List) < 1 {
return nil return nil
} }
list := make([]SubscribeMsgPopupEventList, len(s.SubscribeMsgPopupEvent.List)) return s.SubscribeMsgPopupEvent.List
for i, item := range s.SubscribeMsgPopupEvent.List {
list[i] = item
}
return list
} }
// PushDataSubscribeMsgChange 用户管理订阅通知事件推送 // PushDataSubscribeMsgChange 用户管理订阅通知事件推送
@@ -537,14 +533,11 @@ func (s *PushDataSubscribeMsgChange) GetSubscribeMsgChangeEvents() []SubscribeMs
return s.subscribeMsgChangeList return s.subscribeMsgChangeList
} }
if s.SubscribeMsgChangeEvent.List == nil { if s.SubscribeMsgChangeEvent.List == nil || len(s.SubscribeMsgChangeEvent.List) < 1 {
return nil return nil
} }
list := make([]SubscribeMsgChangeList, len(s.SubscribeMsgChangeEvent.List))
for i, item := range s.SubscribeMsgChangeEvent.List { return s.SubscribeMsgChangeEvent.List
list[i] = item
}
return list
} }
// PushDataSubscribeMsgSent 用户发送订阅通知事件推送 // PushDataSubscribeMsgSent 用户发送订阅通知事件推送
@@ -578,12 +571,9 @@ func (s *PushDataSubscribeMsgSent) GetSubscribeMsgSentEvents() []SubscribeMsgSen
return s.subscribeMsgSentEventList return s.subscribeMsgSentEventList
} }
if s.SubscribeMsgSentEvent.List == nil { if s.SubscribeMsgSentEvent.List == nil || len(s.SubscribeMsgSentEvent.List) < 1 {
return nil return nil
} }
list := make([]SubscribeMsgSentList, len(s.SubscribeMsgSentEvent.List))
for i, item := range s.SubscribeMsgSentEvent.List { return s.SubscribeMsgSentEvent.List
list[i] = item
}
return list
} }