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:
@@ -2,12 +2,12 @@ package openapi
|
||||
|
||||
import "github.com/silenceper/wechat/v2/util"
|
||||
|
||||
// GetAPIQuotaParams 查询API调用额度参数
|
||||
// GetAPIQuotaParams 查询 API 调用额度参数
|
||||
type GetAPIQuotaParams struct {
|
||||
CgiPath string `json:"cgi_path"` // api的请求地址,例如"/cgi-bin/message/custom/send";不要前缀“https://api.weixin.qq.com” ,也不要漏了"/",否则都会76003的报错
|
||||
CgiPath string `json:"cgi_path"` // api 的请求地址,例如"/cgi-bin/message/custom/send";不要前缀“https://api.weixin.qq.com” ,也不要漏了"/",否则都会 76003 的报错
|
||||
}
|
||||
|
||||
// APIQuota API调用额度
|
||||
// APIQuota API 调用额度
|
||||
type APIQuota struct {
|
||||
util.CommonError
|
||||
Quota struct {
|
||||
@@ -17,20 +17,20 @@ type APIQuota struct {
|
||||
} `json:"quota"` // 详情
|
||||
}
|
||||
|
||||
// GetRidInfoParams 查询rid信息参数
|
||||
// GetRidInfoParams 查询 rid 信息参数
|
||||
type GetRidInfoParams struct {
|
||||
Rid string `json:"rid"` // 调用接口报错返回的rid
|
||||
Rid string `json:"rid"` // 调用接口报错返回的 rid
|
||||
}
|
||||
|
||||
// RidInfo rid信息
|
||||
// RidInfo rid 信息
|
||||
type RidInfo struct {
|
||||
util.CommonError
|
||||
Request struct {
|
||||
InvokeTime int64 `json:"invoke_time"` // 发起请求的时间戳
|
||||
CostInMs int64 `json:"cost_in_ms"` // 请求毫秒级耗时
|
||||
RequestURL string `json:"request_url"` // 请求的URL参数
|
||||
RequestBody string `json:"request_body"` // post请求的请求参数
|
||||
RequestURL string `json:"request_url"` // 请求的 URL 参数
|
||||
RequestBody string `json:"request_body"` // post 请求的请求参数
|
||||
ResponseBody string `json:"response_body"` // 接口请求返回参数
|
||||
ClientIP string `json:"client_ip"` // 接口请求的客户端ip
|
||||
} `json:"request"` // 该rid对应的请求详情
|
||||
ClientIP string `json:"client_ip"` // 接口请求的客户端 ip
|
||||
} `json:"request"` // 该 rid 对应的请求详情
|
||||
}
|
||||
|
||||
@@ -498,14 +498,10 @@ func (s *PushDataSubscribePopup) GetSubscribeMsgPopupEvents() []SubscribeMsgPopu
|
||||
return s.subscribeMsgPopupEventList
|
||||
}
|
||||
|
||||
if s.SubscribeMsgPopupEvent.List == nil {
|
||||
if s.SubscribeMsgPopupEvent.List == nil || len(s.SubscribeMsgPopupEvent.List) < 1 {
|
||||
return nil
|
||||
}
|
||||
list := make([]SubscribeMsgPopupEventList, len(s.SubscribeMsgPopupEvent.List))
|
||||
for i, item := range s.SubscribeMsgPopupEvent.List {
|
||||
list[i] = item
|
||||
}
|
||||
return list
|
||||
return s.SubscribeMsgPopupEvent.List
|
||||
}
|
||||
|
||||
// PushDataSubscribeMsgChange 用户管理订阅通知事件推送
|
||||
@@ -537,14 +533,11 @@ func (s *PushDataSubscribeMsgChange) GetSubscribeMsgChangeEvents() []SubscribeMs
|
||||
return s.subscribeMsgChangeList
|
||||
}
|
||||
|
||||
if s.SubscribeMsgChangeEvent.List == nil {
|
||||
if s.SubscribeMsgChangeEvent.List == nil || len(s.SubscribeMsgChangeEvent.List) < 1 {
|
||||
return nil
|
||||
}
|
||||
list := make([]SubscribeMsgChangeList, len(s.SubscribeMsgChangeEvent.List))
|
||||
for i, item := range s.SubscribeMsgChangeEvent.List {
|
||||
list[i] = item
|
||||
}
|
||||
return list
|
||||
|
||||
return s.SubscribeMsgChangeEvent.List
|
||||
}
|
||||
|
||||
// PushDataSubscribeMsgSent 用户发送订阅通知事件推送
|
||||
@@ -578,12 +571,9 @@ func (s *PushDataSubscribeMsgSent) GetSubscribeMsgSentEvents() []SubscribeMsgSen
|
||||
return s.subscribeMsgSentEventList
|
||||
}
|
||||
|
||||
if s.SubscribeMsgSentEvent.List == nil {
|
||||
if s.SubscribeMsgSentEvent.List == nil || len(s.SubscribeMsgSentEvent.List) < 1 {
|
||||
return nil
|
||||
}
|
||||
list := make([]SubscribeMsgSentList, len(s.SubscribeMsgSentEvent.List))
|
||||
for i, item := range s.SubscribeMsgSentEvent.List {
|
||||
list[i] = item
|
||||
}
|
||||
return list
|
||||
|
||||
return s.SubscribeMsgSentEvent.List
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user