pushplus

package module
v0.0.0-...-d277237 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

README

pushplus

go语言版 pushplus推送加

官方文档地址

实现的功能列表 TODO

  • 开放接口
    • 获取 AccessKey
  • 消息接口
    • 消息发送接口
    • 消息列表
    • 查询消息发送结果
  • 用户接口
    • 获取 token
    • 个人资料详情
    • 获取解封剩余时间
    • 查询当日消息接口请求次数
  • 群组接口
    • 群组列表
    • 获取我加入的群组详情
    • 新增群组
    • 获取群组二维码
    • 退出群组
  • 群组用户接口
    • 获取群组内用户
    • 删除群组内用户
  • 渠道配置接口
    • 获取 webHook 列表
    • 获取 webhook 详情
    • 新增 webhook
    • 修改 webhook
    • 获取微信公众号渠道列表
    • 获取企业微信应用渠道列表
    • 获取邮箱渠道列表
    • 邮箱渠道详情
  • 功能设置接口
    • 获取默认发送渠道
    • 修改默认发送渠道
    • 修改接收消息限制
    • 开启/关闭发送消息功能
    • 修改打开消息方式
  • 好友功能接口
    • 获取个人二维码
    • 获取好友列表
    • 删除好友
    • 修改好友备注

使用说明

  1. 如果只要发送消息功能, 填写token即可,
  2. 需要通过accessKey调用消息、用户、群组、渠道配置和功能设置接口时,需填写 secretKey
  3. DebugLog true 表示开启调试日志。
  4. 具体使用方法参考测试用例 *_test.go
// 发送消息
token := "xxx"
HttpClient := NewClient(token, DebugLog(true))
msg, err := HttpClient.SendMsg("标题", "内容")
if err != nil {
    return
}
fmt.Println(msg)

// 开放接口举例
secretKey := "xxx"
Client := NewClient(token, SecretKey(secretKey), DebugLog(true))

result,err := Client.GetUserInfo()
if err != nil {
    return
}
fmt.Println(result)

Stargazers over time

Stargazers over time

License

MIT © yann0917


Documentation

Index

Constants

View Source
const (
	SendMsgURL      = "/send"
	GetAccessKeyURL = "/api/common/openApi/getAccessKey"

	MsgListURL   = "/api/open/message/list"
	MsgResultURL = "/api/open/message/sendMessageResult?shortCode="

	UserTokenURL     = "/api/open/user/token"
	UserInfoURL      = "/api/open/user/myInfo"
	UserLimitTimeURL = "/api/open/user/userLimitTime"
	UserSendCount    = "/api/open/user/sendCount"

	TopicAddURL        = "/api/open/topic/add"
	TopicListURL       = "/api/open/topic/list"
	ExitTopicURL       = "/api/open/topic/exitTopic?topicId="
	TopicDetailURL     = "/api/open/topic/detail?topicId="
	JoinTopicDetailURL = "/api/open/topic/joinTopicDetail?topicId="
	TopicQRCode        = "/api/open/topic/qrCode?topicId=" // 二维码类型;0-临时二维码,1-永久二维码

	SubscriberListURL  = "/api/open/topicUser/subscriberList"
	DeleteTopicUserURL = "/api/open/topicUser/deleteTopicUser?topicRelationId="

	WebhookListURL    = "/api/open/webhook/list"
	WebhookDetailURL  = "/api/open/webhook/detail?webhookId="
	WebhookAddURL     = "/api/open/webhook/add"
	WebhookEditURL    = "/api/open/webhook/edit"
	WebhookMpList     = "/api/open/mp/list"
	WebhookCpList     = "/api/open/cp/list"
	WebhookMailList   = "/api/open/mail/list"
	WebhookMailDetail = "/api/open/mail/detail?mailId="

	GetUserSettingsURL      = "/api/open/setting/getUserSettings"
	ChangeDefaultChannelURL = "/api/open/setting/changeDefaultChannel"
	ChangeReceiveLimitURL   = "/api/open/setting/changeRecevieLimit?recevieLimit="
	ChangeIsSend            = "/api/open/setting/changeIsSend?isSend="

	FriendGetQrCode  = "/api/open/friend/getQrCode"
	FriendList       = "/api/open/friend/list"
	DeleteFriend     = "/api/open/friend/deleteFriend?friendId="
	FriendEditRemark = "/api/open/friend/editRemark"
)
View Source
const DateFormat = "2006-01-02"
View Source
const TimeFormat = "2006-01-02 15:04:05"

Variables

View Source
var (
	UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36"
	BaseURL   = "https://www.pushplus.plus"
)

Functions

func Bool2Int

func Bool2Int(b bool) int

func Byte2String

func Byte2String(b []byte) string

Byte2String 字节数组转 string

func D

func D(data interface{})

func FirstDateOfYear

func FirstDateOfYear() time.Time

FirstDateOfYear 今年第一天 eg:2021-01-01 00:00:00

func Float642String

func Float642String(v float64, p int) string

Float642String float64 转 string

func Int2String

func Int2String(val int) string

Int2String int 转 string

func Int642String

func Int642String(val int64) string

Int642String int64 转 string

func Paginator

func Paginator(page int, count int, list interface{}) map[string]interface{}

Paginator 分页统一结构

func R

func R(data interface{}, name string)

func RandNum

func RandNum(l int) string

RandNum 生成1-9随机数字

func RandStr

func RandStr(l int) string

RandStr 生成随机字符串

func RandomNum

func RandomNum(min, max int) int

func String2Float64

func String2Float64(str string) (float64, error)

String2Float64 string 转 float64

func String2Int

func String2Int(str string) (int, error)

String2Int 字符串 转 int

func String2Int64

func String2Int64(str string) (int64, error)

String2Int64 字符串 转 int64

func String2Time

func String2Time(paramTime string) (returnTime time.Time)

String2Time 字符串格式[转换为]time,Time(时间对象) eg:(2019-09-09T09:09:09+08:00)

func String2Uint

func String2Uint(str string) uint

String2Uint string 转 uint

func String2Unix

func String2Unix(paramTime string) int64

String2Unix 字符串格式[转换为]时间戳 eg:(1557398617)

func Time2String

func Time2String(t time.Time) string

Time2String 时间对象[转换为]字符串 eg:(2019-09-09 09:09:09)

func Time2Unix

func Time2Unix(paramTime time.Time) int64

Time2Unix 时间对象[转换为]Unix时间戳 eg:(1557398617)

func TodayDate

func TodayDate() (tm time.Time)

TodayDate 今天凌晨时间

func Uint642String

func Uint642String(val uint64) string

func Unix2String

func Unix2String(stamp int64) string

Unix2String 时间戳[转换为]字符串 eg:(2019-09-09 09:09:09)

func Unix2Time

func Unix2Time(stamp int64) time.Time

Unix2Time unix时间戳[转换为]时间对象 eg:(2019-09-09T09:09:09+08:00)

Types

type AuthReq

type AuthReq struct {
	Token     string `json:"token,omitempty"`     // 用户令牌,同发送消息接口令牌
	SecretKey string `json:"secretKey,omitempty"` // 用户密钥
}

type AuthResp

type AuthResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		AccessKey string `json:"accessKey"` // 要获取的 accessKey
		ExpiresIn int64  `json:"expiresIn"` // accessKey 的有效期(秒为单位,7200秒之内的值);
	} `json:"data"`
}

type Authorizer

type Authorizer interface {
	Authorize(*Client) error
}

type Client

type Client struct {
	Req       *req.Client
	AccessKey string

	Authorizer Authorizer
	Token      string
	SecretKey  string
	Topic      string
	Template   string
	Channel    string
	Webhook    string
	Callback   string
	To         string
	DebugLog   bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token string, options ...Option) *Client

func (*Client) Auth

func (client *Client) Auth() error

func (*Client) ChangeDefaultChannel

func (client *Client) ChangeDefaultChannel(channel, webhook string) (detail Resp, err error)

ChangeDefaultChannel 修改默认发送渠道 channel 默认渠道;wechat-微信公众号,mail-邮件,cp-企业微信应用,webhook-第三方webhook webhook 渠道参数;webhook和cp渠道需要填写具体的webhook编号或自定义编码

func (*Client) ChangeIsSend

func (client *Client) ChangeIsSend(isSend int) (detail IntResp, err error)

ChangeIsSend 开启/关闭发送消息功能 isSend 发送消息功能;0-禁用,1-启用

func (*Client) ChangeOpenMessageType

func (client *Client) ChangeOpenMessageType(msgType int) (detail IntResp, err error)

ChangeOpenMessageType 修改打开消息方式 msgType 消息打开类型;0:H5,1:小程序

func (*Client) ChangeReceiveLimit

func (client *Client) ChangeReceiveLimit(limit int) (detail Resp, err error)

ChangeReceiveLimit 修改接收消息限制 limit 接收消息限制;0-接收全部,1-不接收消息

func (*Client) CpList

func (client *Client) CpList(page, pageSize int) (list CpListResp, err error)

CpList 获取企业微信渠道列表 page 当前所在分页数, pageSize 每页大小最大值为50

func (*Client) DeleteTopicUser

func (client *Client) DeleteTopicUser(id int) (result Resp, err error)

DeleteTopicUser 删除群组内用户 id 用户编号

func (*Client) ExistTopic

func (client *Client) ExistTopic(topicID int) (detail Resp, err error)

ExistTopic 退出群组 topicID 群组 ID

func (*Client) FriendDel

func (client *Client) FriendDel(id int) (detail IntResp, err error)

FriendDel 删除好友 id 好友id

func (*Client) FriendEditRemark

func (client *Client) FriendEditRemark(id int, remark string) (detail IntResp, err error)

FriendEditRemark 修改好友备注 id 好友编号, remark 好友备注

func (*Client) FriendGetQRCode

func (client *Client) FriendGetQRCode() (detail FriendQRCode, err error)

FriendGetQRCode 获取个人二维码

func (*Client) FriendList

func (client *Client) FriendList(page, pageSize int) (list FriendListResp, err error)

FriendList 获取好友列表 page 当前所在分页数, pageSize 每页大小最大值为50

func (*Client) GetTopicQrCode

func (client *Client) GetTopicQrCode(topicID, forever int) (detail QrCodeResp, err error)

GetTopicQrCode 获取群组二维码 topicID 群组 ID forever 二维码类型;0-临时二维码,1-永久二维码

func (*Client) GetUserInfo

func (client *Client) GetUserInfo() (result UserInfo, err error)

func (*Client) GetUserLimitTime

func (client *Client) GetUserLimitTime() (result UserLimitTimeResp, err error)

func (*Client) GetUserSettings

func (client *Client) GetUserSettings() (detail UserSetting, err error)

func (*Client) GetUserToken

func (client *Client) GetUserToken() (result Resp, err error)

func (*Client) MailDetail

func (client *Client) MailDetail(mailID int) (detail MailDetailResp, err error)

MailDetail 获取邮箱渠道详情 mailID 邮箱编号

func (*Client) MailList

func (client *Client) MailList(page, pageSize int) (list MailListResp, err error)

MailList 获取邮箱渠道列表 page 当前所在分页数, pageSize 每页大小最大值为50

func (*Client) MessageList

func (client *Client) MessageList(page, pageSize int) (list MsgListResp, err error)

MessageList 消息列表 page 当前所在分页数, pageSize 每页大小最大值为50

func (*Client) MpList

func (client *Client) MpList(page, pageSize int) (list MpListResp, err error)

MpList 获取微信公众号渠道列表 page 当前所在分页数, pageSize 每页大小最大值为50

func (*Client) SendMessageResult

func (client *Client) SendMessageResult(shortCode string) (result SendMsgResultResp, err error)

SendMessageResult 查询消息发送结果 shortCode 消息短链码

func (*Client) SendMsg

func (client *Client) SendMsg(title, content string) (result Resp, err error)

SendMsg 发送消息

func (*Client) TopicAdd

func (client *Client) TopicAdd(req TopicAddReq) (result TopicAddResp, err error)

TopicAdd 新增群组

func (*Client) TopicDetail

func (client *Client) TopicDetail(topicID int) (detail TopicDetailResp, err error)

TopicDetail 获取我创建的群组详情 topicID 群组 ID

func (*Client) TopicJoinDetail

func (client *Client) TopicJoinDetail(topicID int) (detail TopicJoinDetailResp, err error)

TopicJoinDetail 获取我加入的群详情 topicID 群组 ID

func (*Client) TopicList

func (client *Client) TopicList(page, pageSize, topicType int) (list TopicListResp, err error)

TopicList 群组列表 page 当前所在分页数, pageSize 每页大小最大值为50, topicType 群组类型: 0-我创建的,1-我加入的

func (*Client) TopicUserList

func (client *Client) TopicUserList(page, pageSize, topicID int) (list TopicUserListResp, err error)

TopicUserList 群组内用户列表 page 当前所在分页数, pageSize 每页大小最大值为50, topicType 群组类型: 0-我创建的,1-我加入的

func (*Client) UserSendCount

func (client *Client) UserSendCount() (result UserLimitTimeResp, err error)

func (*Client) WebhookAdd

func (client *Client) WebhookAdd(req WebhookReq) (result TopicAddResp, err error)

WebhookAdd 新增Webhook

func (*Client) WebhookDetail

func (client *Client) WebhookDetail(id int) (detail WebhookResp, err error)

WebhookDetail 获取我加入的群详情 topicID 群组 ID

func (*Client) WebhookEdit

func (client *Client) WebhookEdit(req WebhookData) (result Resp, err error)

WebhookEdit 编辑Webhook

func (*Client) WebhookList

func (client *Client) WebhookList(page, pageSize int) (list WebhookListResp, err error)

WebhookList Webhook列表 page 当前所在分页数, pageSize 每页大小最大值为50

type CpData

type CpData struct {
	Id     int    `json:"id"`     // 企业微信应用编号
	CpName string `json:"cpName"` // 企业微信应用名称
	CpCode string `json:"cpCode"` // 企业微信应用编码
}

type CpListResp

type CpListResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Pager
		List []CpData `json:"list"`
	} `json:"data"`
}

type DefaultAuthorizer

type DefaultAuthorizer struct{}

func (DefaultAuthorizer) Authorize

func (da DefaultAuthorizer) Authorize(client *Client) (err error)

type EditFriendReq

type EditFriendReq struct {
	Id     int    `json:"id"`     // 好友编号
	Remark string `json:"remark"` // 备注
}

type FriendData

type FriendData struct {
	Id          int    `json:"id"`          // 好友编号
	FriendId    int    `json:"friendId"`    // 好友id
	Token       string `json:"token"`       // 好友令牌;发送好友消息使用
	HeadImgUrl  string `json:"headImgUrl"`  // 好友头像
	NickName    string `json:"nickName"`    // 好友昵称
	EmailStatus int    `json:"emailStatus"` // 邮箱验证状态;0-未验证,1-待验证,2-已验证
	HavePhone   int    `json:"havePhone"`   // 是否绑定手机;0-未绑定,1-已绑定
	IsFollow    int    `json:"isFollow"`    // 是否关注微信公众号;0-未关注,1-已关注
	Remark      string `json:"remark"`      // 备注
	CreateTime  string `json:"createTime"`  // 创建日期
}

type FriendListResp

type FriendListResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Pager
		List []FriendData `json:"list"`
	} `json:"data"`
}

type FriendQRCode

type FriendQRCode struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		QrCodeImgUrl string `json:"qrCodeImgUrl"`
	} `json:"data"`
}

type IntResp

type IntResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data int    `json:"data"`
}

type MailData

type MailData struct {
	Id         int    `json:"id"`       // 邮箱编号
	MailName   string `json:"mailName"` // 邮箱名称
	MailCode   string `json:"mailCode"` // 邮箱编码
	Account    string `json:"account,omitempty"`
	Password   string `json:"password,omitempty"`
	SmtpServer string `json:"smtpServer,omitempty"`
	SmtpSsl    int    `json:"smtpSsl,omitempty"`
	SmtpPort   int    `json:"smtpPort,omitempty"`
	CreateTime string `json:"createTime,omitempty"`
}

type MailDetailResp

type MailDetailResp struct {
	Code int      `json:"code"`
	Msg  string   `json:"msg"`
	Data MailData `json:"data"`
}

type MailListResp

type MailListResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Pager
		List []struct {
			Id       int    `json:"id"`
			MailName string `json:"mailName"`
			MailCode string `json:"mailCode"`
		} `json:"list"`
	} `json:"data"`
}

type MpData

type MpData struct {
	Id                 int    `json:"id"`                 // 微信公众号编号
	NickName           string `json:"nickName"`           // 微信公众号名称
	HeadImg            string `json:"headImg"`            // 微信公众号头像
	PrincipalName      string `json:"principalName"`      // 公众号的主体名称
	AuthorizationAppid string `json:"authorizationAppid"` // 授权方appid
	FuncInfo           string `json:"funcInfo"`           // 权限集列表
	ServiceType        int    `json:"serviceType"`        // 授权方公众号类型,0 代表订阅号,1 代表由历史老账号升级后的订阅号,2 代表服务号
	VerifyType         int    `json:"verifyType"`         // 授权方认证类型,-1 代表未认证,0 代表微信认证
	Alias              string `json:"alias"`              // 公众号所设置的微信号
	UpdateTime         string `json:"updateTime"`
}

type MpListResp

type MpListResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Pager
		List []MpData `json:"list"`
	} `json:"data"`
}

type MsgListResp

type MsgListResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Pager
		List []struct {
			TopicName   string `json:"topicName"`   // 群组名称,一对多消息才有值
			MessageType int    `json:"messageType"` // 消息类型;1-一对一消息,2-一对多消息
			Title       string `json:"title"`       // 消息标题
			ShortCode   string `json:"shortCode"`   // 消息短链码;可用于查询消息发送结果
			Channel     string `json:"channel"`     // 消息发送渠道; wechat-微信公众号,mail-邮件,cp-企业微信应用,webhook-第三方webhook
			UpdateTime  string `json:"updateTime"`  // 更新日期
		} `json:"list"`
	} `json:"data"`
}

type Option

type Option func(*Client)

func Callback

func Callback(url string) Option

func Channel

func Channel(ch string) Option

func DebugLog

func DebugLog(isDebug bool) Option

func SecretKey

func SecretKey(secretKey string) Option

func Template

func Template(tpl string) Option

func To

func To(to string) Option

func Topic

func Topic(topic string) Option

func Webhook

func Webhook(hook string) Option

type PageReq

type PageReq struct {
	Current  int `json:"current"`
	PageSize int `json:"pageSize"`
}

type Pager

type Pager struct {
	PageNum  int `json:"pageNum"`  // 当前页码
	PageSize int `json:"pageSize"` // 分页大小
	Total    int `json:"total"`    // 总行数
	Pages    int `json:"pages"`    // 总页数
}

type QrCodeResp

type QrCodeResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		QrCodeImgUrl string `json:"qrCodeImgUrl"` // 群组二维码图片路径
		Forever      int    `json:"forever"`      // 二维码类型;0-临时二维码,1-永久二维码
	} `json:"data"`
}

type Resp

type Resp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data string `json:"data"`
}

type SendMsgCallbackResp

type SendMsgCallbackResp struct {
	ShortCode  string `json:"shortCode"`  // 消息流水号
	SendStatus int    `json:"sendStatus"` // 发送状态;0未发送,1发送中,2发送成功,3发送失败
	Message    string `json:"message"`    // 推送错误内容(如有)
}

type SendMsgReq

type SendMsgReq struct {
	Token       string `json:"token"`
	Title       string `json:"title,omitempty"`
	Content     string `json:"content"`
	Template    string `json:"template,omitempty"` // 消息模板 html,json,cloudMonitor 默认 html
	Topic       string `json:"topic,omitempty"`    // 群组编码,不填仅发送给自己;channel为webhook时无效
	Channel     string `json:"channel,omitempty"`  // 发送渠道, wechat,webhook,cp 默认 wechat
	Webhook     string `json:"webhook,omitempty"`
	CallbackUrl string `json:"callback_url,omitempty"` // 发送结果回调地址
	Timestamp   string `json:"timestamp,omitempty"`    // 毫秒时间戳。格式如:1632993318000。服务器时间戳大于此时间戳,则消息不会发送
	To          string `json:"to,omitempty"`           // 好友令牌,微信公众号渠道填写好友令牌,企业微信渠道填写企业微信用户id
}

type SendMsgResultResp

type SendMsgResultResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Status       int    `json:"status"`       // 消息投递状态;0-未投递,1-发送中,2-已发送,3-发送失败
		ErrorMessage string `json:"errorMessage"` // 发送失败原因
		UpdateTime   string `json:"updateTime"`
	} `json:"data"`
}

type TopicAddReq

type TopicAddReq struct {
	TopicCode      string `json:"topicCode"`      // 群组编码
	TopicName      string `json:"topicName"`      // 群组名称
	Contact        string `json:"contact"`        // 联系方式
	Introduction   string `json:"introduction"`   // 群组简介
	ReceiptMessage string `json:"receiptMessage"` // 加入后回复内容
}

type TopicAddResp

type TopicAddResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data int    `json:"data"` // 新建群组的群组编号
}

type TopicDetailResp

type TopicDetailResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		TopicId        int    `json:"topicId"`
		TopicName      string `json:"topicName"`
		TopicCode      string `json:"topicCode"`
		QrCodeImgUrl   string `json:"qrCodeImgUrl"`
		Contact        string `json:"contact"`
		Introduction   string `json:"introduction"`
		ReceiptMessage string `json:"receiptMessage"`
		CreateTime     string `json:"createTime"`
		TopicUserCount int    `json:"topicUserCount"`
	} `json:"data"`
}

type TopicJoinDetailResp

type TopicJoinDetailResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		TopicName    string `json:"topicName"`
		TopicCode    string `json:"topicCode"`
		TopicId      int    `json:"topicId"`
		Contact      string `json:"contact"`
		Introduction string `json:"introduction"`
		CreateTime   string `json:"createTime"`
	} `json:"data"`
}

type TopicListReq

type TopicListReq struct {
	PageReq
	Params struct {
		TopicType int `json:"topicType"` // 群组类型;0-我创建的,1-我加入的
	} `json:"params"`
}

type TopicListResp

type TopicListResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Pager
		List []struct {
			TopicId    int    `json:"topicId"`    // 群组编号
			TopicCode  string `json:"topicCode"`  // 群组编码
			TopicName  string `json:"topicName"`  // 群组名称
			CreateTime string `json:"createTime"` // 创建时间
		} `json:"list"`
	} `json:"data"`
}

type TopicUserListReq

type TopicUserListReq struct {
	PageReq
	Params struct {
		TopicId int `json:"topicId"`
	} `json:"params"`
}

type TopicUserListResp

type TopicUserListResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Pager
		List []struct {
			Id          int    `json:"id"`          // 用户编号;可用于删除用户
			NickName    string `json:"nickName"`    // 昵称
			OpenId      string `json:"openId"`      // 用户微信openId
			HeadImgUrl  string `json:"headImgUrl"`  // 头像url地址
			UserSex     int    `json:"userSex"`     // 性别;0-未设置,1-男,2-女
			HavePhone   int    `json:"havePhone"`   // 是否绑定手机;0-未绑定,1-已绑定
			IsFollow    int    `json:"isFollow"`    // 是否关注微信公众号;0-未关注,1-已关注
			EmailStatus int    `json:"emailStatus"` // 邮箱验证状态;0-未验证,1-待验证,2-已验证
		} `json:"list"`
	} `json:"data"`
}

type UserInfo

type UserInfo struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		OpenId      string  `json:"openId"`      // 用户微信的openId
		UnionId     string  `json:"unionId"`     // 用户微信的unionId
		NickName    string  `json:"nickName"`    // 昵称
		HeadImgUrl  string  `json:"headImgUrl"`  // 头像
		UserSex     int     `json:"userSex"`     // 性别: 0-未设置,1-男,2-女
		Token       string  `json:"token"`       // 用户令牌
		PhoneNumber string  `json:"phoneNumber"` // 手机号
		Email       string  `json:"email"`       // 邮箱
		EmailStatus int     `json:"emailStatus"` // 邮箱验证状态;0-未验证,1-待验证,2-已验证
		Birthday    string  `json:"birthday"`    // 生日
		Points      float64 `json:"points"`      // 用户积分
	} `json:"data"`
}

type UserLimitTimeResp

type UserLimitTimeResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		SendLimit     int    `json:"sendLimit"`     // 发送限制状态;1-无限制,2-短期限制,3-永久限制
		UserLimitTime string `json:"userLimitTime"` // 解封时间
	} `json:"data"`
}

type UserSendCountResp

type UserSendCountResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		WechatSendCount  int `json:"wechatSendCount"`  // 微信公众号渠道请求次数
		CpSendCount      int `json:"cpSendCount"`      // 企业微信应用渠道请求次数
		WebhookSendCount int `json:"webhookSendCount"` // webhook渠道请求次数
		MailSendCount    int `json:"mailSendCount"`    // 邮件渠道请求次数
	} `json:"data"`
}

type UserSetting

type UserSetting struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		DefaultChannel    string `json:"defaultChannel"`    // 默认渠道编码
		DefaultChannelTxt string `json:"defaultChannelTxt"` // 默认渠道名称
		DefaultWebhook    string `json:"defaultWebhook"`    // webhook 参数
		SendLimit         int    `json:"sendLimit"`         // 发送限制;0-无限制,1-禁止所有渠道发送,2-限制微信渠道,3-限制邮件渠道
		RecevieLimit      int    `json:"recevieLimit"`      // 接收限制;0-接收全部,1-不接收消息

	} `json:"data"`
}

type WebhookData

type WebhookData struct {
	Id          int    `json:"id"`
	WebhookCode string `json:"webhookCode"` // 编码
	WebhookName string `json:"webhookName"` // 名称
	WebhookType int    `json:"webhookType"` // 类型;1-企业微信,2-钉钉,3-飞书,4-server酱
	WebhookUrl  string `json:"webhookUrl"`  // 调用的url地址
	CreateTime  string `json:"createTime"`
}

type WebhookListResp

type WebhookListResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Pager
		List []WebhookData `json:"list"`
	} `json:"data"`
}

type WebhookReq

type WebhookReq struct {
	WebhookCode string `json:"webhookCode"` // 编码
	WebhookName string `json:"webhookName"` // 名称
	WebhookType int    `json:"webhookType"` // 类型;1-企业微信,2-钉钉,3-飞书,4-server酱
	WebhookUrl  string `json:"webhookUrl"`  // 调用的url地址
}

type WebhookResp

type WebhookResp struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data WebhookData `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL