添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

jpush-api-golang-client

JPush's Golang client library for accessing JPush APIs. 极光推送的 Golang 版本服务器端 SDK。 该项目参考 ylywyn 结合极光推送官方文档而来。(原项目年久失修,有很多新特性都没有提供,本项目旨在将其完善,方便大家使用,后续会持续更新,不足之处欢迎大家指正,谢谢~)

参考REST API文档

参考短信 REST API 文档

短信这边暂时只实现了发送单条模板短信

现已支持以下内容

  • Push API v3
  • Report API v3
  • Device API v3
  • Schedule API v3
  • File API v3
  • Image API v3
  • Admin API v3
  • SMS API v1
  • go get github.com/Scorpio69t/jpush-api-golang-client

    1.构建要推送的平台:jpush.Platform
    // Platform: all
    var pf jpush.Platform
    pf.Add(jpush.ANDROID)
    pf.Add(jpush.IOS)
    pf.Add(jpush.WINPHONE)
    // pf.All()
    
    2.构建接收目标:jpush.Audience
    // Audience: tag
    var at jpush.Audience
    s := []string{"tag1", "tag2"}
    at.SetTag(s)
    id := []string{"1", "2"}
    at.SetID(id)
    // at.All()
    
    3.构建通知:jpush.Notification 或者消息:jpush.Message
    // Notification
    var n jpush.Notification
    n.SetAlert("alert")
    n.SetAndroid(&jpush.AndroidNotification{Alert: "alert", Title: "title"})
    n.SetIos(&jpush.IosNotification{Alert: "alert", Badge: 1})
    n.SetWinPhone(&jpush.WinPhoneNotification{Alert: "alert"})
    // Message
    var m jpush.Message
    m.MsgContent = "This is a message"
    m.Title = "Hello"
    
    4.构建消息负载:jpush.PayLoad
    // PayLoad
    payload := jpush.NewPayLoad()
    payload.SetPlatform(&pf)
    payload.SetAudience(&at)
    payload.SetNotification(&n)
    payload.SetMessage(&m)
    
    5.构建JPushClient,发送推送
    // Send
    c := jpush.NewJPushClient("appKey", "masterSecret") // appKey and masterSecret can be gotten from https://www.jiguang.cn/
    data, err := payload.Bytes()
    if err != nil {
    	panic(err)
    res, err := c.Push(data)
    if err != nil {
    	fmt.Printf("%+v\n", err)
    } else {
    	fmt.Printf("ok: %v\n", res)
    
    6.详细例子见examples

    发送短信参见sms_test中的代码

    func SendGet(url, appKey, masterSecret string) (string, error) func SendPostBytes(url string, content []byte, appKey, masterSecret string) (string, error) func SendPostBytes2(url string, data []byte, appKey, masterSecret string) (string, error) func SendPostString(url string, content, appKey, masterSecret string) (string, error) func TimeoutDialer(connectTimeout time.Duration, readWriteTimeout time.Duration) func(ctx context.Context, network, addr string) (c net.Conn, err error) func UnmarshalResponse(resp string) (map[string]interface{}, error) type AndroidNotification type Audience func (a *Audience) All() func (a *Audience) Interface() interface{} func (a *Audience) SetABTest(abtests []string) func (a *Audience) SetAlias(aliases []string) func (a *Audience) SetID(ids []string) func (a *Audience) SetLiveActivityID(liveActivityID string) func (a *Audience) SetSegment(segments []string) func (a *Audience) SetTag(tags []string) func (a *Audience) SetTagAnd(tags []string) func (a *Audience) SetTagNot(tags []string) type AudienceType func (a AudienceType) String() string type CallBack func (c *CallBack) SetParams(params map[string]interface{}) func (c *CallBack) SetType(t string) func (c *CallBack) SetUrl(url string) type CidRequest func NewCidRequest(count int, pushType string) *CidRequest func (c *CidRequest) GetCidList(key, secret string) (*CidResponse, error) func (c *CidRequest) String() string type CidResponse func (c *CidResponse) String() string type HttpRequest func Delete(url string) *HttpRequest func Get(url string) *HttpRequest func Post(url string) *HttpRequest func Put(url string) *HttpRequest func (h *HttpRequest) Bytes() ([]byte, error) func (h *HttpRequest) GetCookie(key string) string func (h *HttpRequest) GetHeader() http.Header func (h *HttpRequest) GetParam(key string) string func (h *HttpRequest) Response() (*http.Response, error) func (h *HttpRequest) SetBasicAuth(username, password string) *HttpRequest func (h *HttpRequest) SetBody(body interface{}) *HttpRequest func (h *HttpRequest) SetCookie(cookie *http.Cookie) *HttpRequest func (h *HttpRequest) SetHeader(key, value string) *HttpRequest func (h *HttpRequest) SetParam(key, value string) *HttpRequest func (h *HttpRequest) SetProtocolVersion(vers string) *HttpRequest func (h *HttpRequest) SetProxy(proxy func(*http.Request) (*url.URL, error)) *HttpRequest func (h *HttpRequest) SetQueryParam(key, value string) *HttpRequest func (h *HttpRequest) SetTLSConfig(config *tls.Config) *HttpRequest func (h *HttpRequest) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *HttpRequest func (h *HttpRequest) SetTransport(transport http.RoundTripper) *HttpRequest func (h *HttpRequest) SetUserAgent(useragent string) *HttpRequest func (h *HttpRequest) Status() int func (h *HttpRequest) String() (string, error) func (h *HttpRequest) ToFile(file string) error func (h *HttpRequest) ToJson(v interface{}) error func (h *HttpRequest) ToXml(v interface{}) error type InappMessage func (i *InappMessage) SetInAppMessage(inAppMessage bool) type IosLiveActivity type IosLiveActivityAlert type IosNotification type JPushClient func NewJPushClient(appKey string, masterSecret string) *JPushClient func (j *JPushClient) CreateSchedule(data []byte) (string, error) func (j *JPushClient) DeleteSchedule(id string) (string, error) func (j *JPushClient) GetAuthorization() string func (j *JPushClient) GetCid(count int, push_type string) ([]byte, error) func (j *JPushClient) GetReport(msg_ids string) (string, error) func (j *JPushClient) GetSchedule(id string) (string, error) func (j *JPushClient) Push(data []byte) (string, error) func (j *JPushClient) SendSms(data []byte) (string, error) type LiveActivity type Message func (m *Message) AddExtras(key string, value interface{}) func (m *Message) SetContent(content string) func (m *Message) SetContentType(contentType string) func (m *Message) SetExtras(extras map[string]interface{}) func (m *Message) SetTitle(title string) type Notification func (n *Notification) SetAiOpportunity(use bool) func (n *Notification) SetAlert(alert string) func (n *Notification) SetAndroid(android *AndroidNotification) func (n *Notification) SetIos(ios *IosNotification) func (n *Notification) SetQuickApp(quickApp *QuickAppNotification) func (n *Notification) SetVoip(value map[string]interface{}) func (n *Notification) SetWinPhone(winPhone *WinPhoneNotification) type Notification3rd func (n *Notification3rd) SetBadgeAddNum(badgeAddNum string) func (n *Notification3rd) SetBadgeClass(badgeClass string) func (n *Notification3rd) SetChannelId(channelId string) func (n *Notification3rd) SetContent(content string) error func (n *Notification3rd) SetExtras(extras map[string]interface{}) func (n *Notification3rd) SetSound(sound string) func (n *Notification3rd) SetTitle(title string) func (n *Notification3rd) SetUriAction(uriAction string) func (n *Notification3rd) SetUriActivity(uriActivity string) type Options func (o *Options) AddThirdPartyChannel(channel ThirdChannelType, value ThirdPartyOptions) func (o *Options) SetApnsProduction(apnsProduction bool) func (o *Options) SetBigPushDuration(bigPushDuration int) func (o *Options) SetOverrideMsgId(overrideMsgId int) func (o *Options) SetSendNo(sendNo int) func (o *Options) SetTimeToLive(timeToLive int) type PayLoad func NewPayLoad() *PayLoad func (p *PayLoad) Bytes() ([]byte, error) func (p *PayLoad) SetAudience(audience *Audience) func (p *PayLoad) SetLiveActivity(liveActivity *LiveActivity) func (p *PayLoad) SetMessage(message *Message) func (p *PayLoad) SetNotification(notification *Notification) func (p *PayLoad) SetOptions(options *Options) func (p *PayLoad) SetPlatform(platform *Platform) type Platform func (p *Platform) Add(os PlatformType) error func (p *Platform) AddAndroid() func (p *Platform) AddIOS() func (p *Platform) AddWinphone() func (p *Platform) All() func (p *Platform) Interface() interface{} func (p *Platform) Remove(os PlatformType) error type PlatformType type QuickAppNotification type Schecule func NewSchedule(cid, name string, enabled bool, push *PayLoad) *Schecule func (s *Schecule) Bytes() ([]byte, error) func (s *Schecule) GetCid() string func (s *Schecule) GetEnabled() bool func (s *Schecule) GetName() string func (s *Schecule) PeriodicalTrigger(start, end, t time.Time, timeUnit string, frequency int, point []string) func (s *Schecule) SetCid(cid string) func (s *Schecule) SetEnabled(enabled bool) func (s *Schecule) SetName(name string) func (s *Schecule) SetPayLoad(push *PayLoad) func (s *Schecule) SingleTrigger(t time.Time) type SmsMessage func (s *SmsMessage) SetActiveFilter(activeFilter bool) func (s *SmsMessage) SetDelayTime(delayTime int) func (s *SmsMessage) SetSignid(signid int) func (s *SmsMessage) SetTempId(tempId int64) func (s *SmsMessage) SetTempPara(tempPara interface{}) type SmsPayLoad func NewSmsPayLoad() *SmsPayLoad func (p *SmsPayLoad) Bytes() ([]byte, error) func (p *SmsPayLoad) SetSignid(signid *int) func (p *SmsPayLoad) SetTempId(tempId *int64) func (p *SmsPayLoad) SetTempara(tempara *TempPara) type TempPara type ThirdChannelType func (t ThirdChannelType) String() string type ThirdPartyChannel type ThirdPartyOptions type WinPhoneNotification

    Constants

    View Source
    const (
    	CHARSET                    = "UTF-8"
    	CONTENT_TYPE_JSON          = "application/json"
    	CONTENT_TYPE_FORM          = "application/x-www-form-urlencoded"
    	DEFAULT_CONNECT_TIMEOUT    = 60 // Connect timeout in seconds
    	DEFAULT_READ_WRITE_TIMEOUT = 60 // Read and write timeout in seconds
    	SUCCESS_FLAG  = "msg_id"
    	SMS           = "https://api.sms.jpush.cn/v1/messages"
    	HOST_PUSH     = "https://api.jpush.cn/v3/push"
    	HOST_SCHEDULE = "https://api.jpush.cn/v3/schedules"
    	HOST_REPORT   = "https://report.jpush.cn/v3/received"
    	HOST_CID      = "https://api.jpush.cn/v3/push/cid"
    
    
    
    
    
        
    	HOST_IMAGES   = "https://api.jpush.cn/v3/images"
          
    func SendPostBytes(url string, content []byte, appKey, masterSecret string) (string, error)

    SendPostBytes sends a post request and returns the response body as bytes

    func SendPostBytes2(url string, data []byte, appKey, masterSecret string) (string, error)

    SendPostBytes2 sends a post request and returns the response body as bytes

    func SendPostString(url string, content, appKey, masterSecret string) (string, error)

    SendPostString sends a post request and returns the response body as string

    func TimeoutDialer(connectTimeout time.Duration, readWriteTimeout time.Duration) func(ctx context.Context, network, addr string) (c net.Conn, err error)

    TimeoutDialer returns functions of connection dialer with timeout settings for http.Transport Dial field.

    type AndroidNotification struct {
    	Alert             interface{}            `json:"alert"`                        // 通知内容
    	Title             interface{}            `json:"title,omitempty"`              // 通知标题
    	BuilderID         int                    `json:"builder_id,omitempty"`         // 通知栏样式 ID
    	ChannelId         string                 `json:"channel_id,omitempty"`         // android通知channel_id
    	Priority          int                    `json:"priority,omitempty"`           // 通知栏展示优先级, 默认为 0,范围为 -2~2。
    	Category          string                 `json:"category,omitempty"`           // 通知栏条目过滤或排序
    	Style             int                    `json:"style,omitempty"`              // 通知栏样式类型, 默认为 0,还有 1,2,3 可选
    	AlertType         int                    `json:"alert_type,omitempty"`         // 通知提醒方式, 可选范围为 -1~7
    	BigText           string                 `json:"big_text,omitempty"`           // 大文本通知栏样式, 当 style = 1 时可用,内容会被通知栏以大文本的形式展示出来
    	Inbox             interface{}            `json:"inbox,omitempty"`              // 文本条目通知栏样式, 当 style = 2 时可用, json 的每个 key 对应的 value 会被当作文本条目逐条展示
    	BigPicPath        string                 `json:"big_pic_path,omitempty"`       // 大图片通知栏样式, 当 style = 3 时可用,可以是网络图片 url,或本地图片的 path
    	Extras            map[string]interface{} `json:"extras,omitempty"`             // 扩展字段
    	LargeIcon         string                 `json:"large_icon,omitempty"`         // 通知栏大图标
    	SmallIconUri      string                 `json:"small_icon_uri,omitempty"`     // 通知栏小图标
    	Intent            interface{}            `json:"intent,omitempty"`             // 指定跳转页面
    	UriActivity       string                 `json:"uri_activity,omitempty"`       // 指定跳转页面, 该字段用于指定开发者想要打开的 activity,值为 activity 节点的 “android:name”属性值; 适配华为、小米、vivo厂商通道跳转;
    	UriAction         string                 `json:"uri_action,omitempty"`         // 指定跳转页面, 该字段用于指定开发者想要打开的 activity,值为 "activity"-"intent-filter"-"action" 节点的 "android:name" 属性值; 适配 oppo、fcm跳转;
    	BadgeAddNum       int                    `json:"badge_add_num,omitempty"`      // 角标数字,取值范围1-99
    	BadgeClass        string                 `json:"badge_class,omitempty"`        // 桌面图标对应的应用入口Activity类, 配合badge_add_num使用,二者需要共存,缺少其一不可;
    	Sound             string                 `json:"sound,omitempty"`              // 填写Android工程中/res/raw/路径下铃声文件名称,无需文件名后缀
    	ShowBeginTime     string                 `json:"show_begin_time,omitempty"`    //定时展示开始时间(yyyy-MM-dd HH:mm:ss)
    	ShowEndTime       string                 `json:"show_end_time,omitempty"`      //定时展示结束时间(yyyy-MM-dd HH:mm:ss)
    	DisplayForeground string                 `json:"display_foreground,omitempty"` //APP在前台,通知是否展示, 值为 "1" 时,APP 在前台会弹出通知栏消息;值为 "0" 时,APP 在前台不会弹出通知栏消息。
    	TAG             AudienceType = "tag"              // 标签OR
    	TAG_AND         AudienceType = "tag_and"          // 标签AND
    	TAG_NOT         AudienceType = "tag_not"          // 标签NOT
    	ALIAS           AudienceType = "alias"            // 别名
    	REGISTRATION_ID AudienceType = "registration_id"  // 注册ID
    	SEGMENT         AudienceType = "segment"          // 用户分群 ID
    	ABTEST          AudienceType = "abtest"           // A/B Test ID
    	LIVEACTIVITYID  AudienceType = "live_activity_id" // 实时活动标识
          
    type CallBack struct {
    	Url    string                 `json:"url,omitempty"`    // 数据临时回调地址,指定后以此处指定为准,仅针对这一次推送请求生效;不指定,则以极光后台配置为准
    	Params map[string]interface{} `json:"params,omitempty"` // 需要回调给用户的自定义参数
    	Type   string                 `json:"type,omitempty"`   // 回调数据类型,1:送达回执, 2:点击回执, 3:送达和点击回执, 8:推送成功回执, 9:成功和送达回执, 10:成功和点击回执, 11:成功和送达以及点击回执
          
    type CidRequest struct {
    	Count int    `json:"count,omitempty"` // 数值类型,不传则默认为 1。范围为 [1, 1000]
    	Type  string `json:"type,omitempty"`  // CID 类型。取值:push(默认),schedule
          
    func (h *HttpRequest) SetBody(body interface{}) *HttpRequest

    SetBody sets request body. It supports string, []byte, url.Values, map[string]interface{} and io.Reader.

    func (h *HttpRequest) SetProxy(proxy func(*http.Request) (*url.URL, error)) *HttpRequest

    SetProxy sets proxy for HttpClient. example:

    func(req *http.Request) (*url.URL, error) {
    	u, _ := url.ParseRequestURI("http://127.0.0.1:8118")
    	return u, nil
          
    func (h *HttpRequest) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *HttpRequest

    SetTimeout sets connect time out and read-write time out for Request.

    func (h *HttpRequest) String() (string, error)

    String returns the body string in response. it calls Response internally.

    type IosLiveActivity struct {
    	Event          string                `json:"event"`                     // 开始:“start”,更新:“update”,结束:"end"。
    	ContentState   interface{}           `json:"content-state"`             // 需与客户端 SDK 值匹配(对应 Apple 官方的 content-state 字段)。
    	AttributesType string                `json:"attributes-type"`           // 创建实时活动事件必填(更新或者结束实时活动无需传递),字段规则:由数字,字母,下划线组成,但是不能以数字开头;对应 Apple 官方的 attributes-type 字段
    	Attributes     interface{}           `json:"attributes"`                // 创建实时活动事件必填(更新或者结束实时活动无需传递);对应 Apple 官方的 attributes 字段
    	RelevanceScore int                   `json:"relevance-score,omitempty"` // 对应 Apple 官方的 relevance-score 字段
    	StaleDate      int                   `json:"stale-date,omitempty"`      // 对应 Apple 官方的 stale-date 字段
    	Alert          *IosLiveActivityAlert `json:"alert,omitempty"`           // 通知内容
    	DismissalDate  int                   `json:"dismissal-date,omitempty"`  // 实时活动结束展示时间。
          
    type IosLiveActivityAlert struct {
    	Title string `json:"title,omitempty"` // 标题
    	Body  string `json:"body,omitempty"`  // 内容
    	Sound string `json:"sound,omitempty"` // 声音
          
    type IosNotification struct {
    	Alert             interface{}            `json:"alert"`                        // 通知内容
    	Sound             interface{}            `json:"sound,omitempty"`              // 通知提示声音或警告通知
    	Badge             interface{}            `json:"badge,omitempty"`              // 应用角标, 如果不填,表示不改变角标数字,否则把角标数字改为指定的数字;为 0 表示清除。
    	ContentAvailable  bool                   `json:"content-available,omitempty"`  // 推送唤醒
    	MutableContent    bool                   `json:"mutable-content,omitempty"`    // 通知扩展
    	Category          string                 `json:"category,omitempty"`           // 通知类别, IOS 8 才支持。设置 APNs payload 中的 "category" 字段值
    	Extras            map[string]interface{} `json:"extras,omitempty"`             // 扩展字段
    	ThreadId          string                 `json:"thread-id,omitempty"`          // 通知分组, ios 的远程通知通过该属性来对通知进行分组,同一个 thread-id 的通知归为一组。
    	InterruptionLevel string                 `json:"interruption-level,omitempty"` // 通知优先级和交付时间的中断级别, ios15 的通知级别,取值只能是active,critical,passive,timeSensitive中的一个。
          
    type Message struct {
    	MsgContent  string                 `json:"msg_content"`            // 消息内容本身
    	Title       string                 `json:"title,omitempty"`        // 消息标题
    	ContentType string                 `json:"content_type,omitempty"` // 消息内容类型
    	Extras      map[string]interface{} `json:"extras,omitempty"`       // JSON 格式的可选参数
          
    type Notification struct {
    	AiOpportunity bool                   `json:"ai_opportunity,omitempty"` // 如需采用“智能时机”策略下发通知,必须指定该字段。
    	Alert         string                 `json:"alert,omitempty"`          // 通知的内容在各个平台上,都可能只有这一个最基本的属性 "alert"。
    	Android       *AndroidNotification   `json:"android,omitempty"`        // Android通知
    	Ios           *IosNotification       `json:"ios,omitempty"`            // iOS通知
    	QuickApp      *QuickAppNotification  `json:"quick_app,omitempty"`      // 快应用通知
    	WinPhone      *WinPhoneNotification  `json:"winphone,omitempty"`       // Windows Phone通知
    	Voip          map[string]interface{} `json:"voip,omitempty"`           // iOS VOIP功能。
          
    type Notification3rd struct {
    	Title       string                 `json:"title,omitempty"`         // 补发通知标题,如果为空则默认为应用名称
    	Content     string                 `json:"content"`                 // 补发通知的内容,如果存在 notification_3rd 这个key,content 字段不能为空,且值不能为空字符串。
    	ChannelId   string                 `json:"channel_id,omitempty"`    // 不超过1000字节
    	UriActivity string                 `json:"uri_activity,omitempty"`  // 该字段用于指定开发者想要打开的 activity,值为 activity 节点的 “android:name”属性值;适配华为、小米、vivo厂商通道跳转;针对 VIP 厂商通道用户使用生效。
    	UriAction   string                 `json:"uri_action,omitempty"`    // 指定跳转页面;该字段用于指定开发者想要打开的 activity,值为 "activity"-"intent-filter"-"action" 节点的 "android:name" 属性值;适配 oppo、fcm跳转;针对 VIP 厂商通道用户使用生效。
    	BadgeAddNum string                 `json:"badge_add_num,omitempty"` // 角标数字,取值范围1-99
    	BadgeClass  string                 `json:"badge_class,omitempty"`   // 桌面图标对应的应用入口Activity类, 比如“com.test.badge.MainActivity;
    	Sound       string                 `json:"sound,omitempty"`         // 填写Android工程中/res/raw/路径下铃声文件名称,无需文件名后缀;注意:针对Android 8.0以上,当传递了channel_id 时,此属性不生效。
    	Extras      map[string]interface{} `json:"extras,omitempty"`        // 扩展字段;这里自定义 JSON 格式的 Key / Value 信息,以供业务使用。
          
    type Options struct {
    	SendNo            int               `json:"sendno,omitempty"`              //推送序号
    	TimeToLive        int               `json:"time_to_live,omitempty"`        //离线消息保留时长(秒)
    	OverrideMsgId     int               `json:"override_msg_id,omitempty"`     //要覆盖的消息 ID
    	ApnsProduction    bool              `json:"apns_production"`               //APNs 是否生产环境
    	ApnsCollapseId    string            `json:"apns_collapse_id,omitempty"`    //更新 iOS 通知的标识符
    	BigPushDuration   int               `json:"big_push_duration,omitempty"`   //定速推送时长(分钟)
    	ThirdPartyChannel ThirdPartyChannel `json:"third_party_channel,omitempty"` //推送请求下发通道
          
    func (o *Options) AddThirdPartyChannel(channel ThirdChannelType, value ThirdPartyOptions)

    AddThirdPartyChannel 添加第三方渠道。

    type PayLoad struct {
    	Platform     *Platform     `json:"platform"`                // 平台
    	Audience     *Audience     `json:"audience"`                // 推送目标
    	Notification *Notification `json:"notification,omitempty"`  // 推送内容
    	Message      *Message      `json:"message,omitempty"`       // 推送内容
    	LiveActivity *LiveActivity `json:"live_activity,omitempty"` // 实时推送内容
    	Options      *Options      `json:"options,omitempty"`       // 推送选项
    	Cid          string        `json:"cid,omitempty"`           // 推送唯一标识符
    	IOS      PlatformType = "ios"
    	ANDROID  PlatformType = "android"
    	WINPHONE PlatformType = "winphone"
          
    type QuickAppNotification struct {
    	Title  string                 `json:"title"`            // 通知标题, 必填字段,快应用推送通知的标题
    	Alert  string                 `json:"alert"`            // 通知内容, 这里指定了,则会覆盖上级统一指定的 alert 信息。
    	Page   string                 `json:"page"`             // 通知跳转页面, 必填字段,快应用通知跳转地址。
    	Extras map[string]interface{} `json:"extras,omitempty"` // 扩展字段, 这里自定义 Key / value 信息,以供业务使用。
          
    type Schecule struct {
    	Cid     string                 `json:"cid"`     // 定时任务id
    	Name    string                 `json:"name"`    // 定时任务名称
    	Enabled bool                   `json:"enabled"` // 是否启用
    	Trigger map[string]interface{} `json:"trigger"` // 定时任务触发条件
    	Push    *PayLoad               `json:"push"`    // 定时任务推送内容
          
    func (s *Schecule) PeriodicalTrigger(start, end, t time.Time, timeUnit string, frequency int, point []string)

    PeriodicalTrigger 周期触发

    type SmsMessage struct {
    	DelayTime    int         `json:"delay_time"`          // 单位为秒,不能超过24小时。设置为0,表示立即发送短信。该参数仅对 android 和 iOS 平台有效,Winphone 平台则会立即发送短信。
    	Signid       int         `json:"signid,omitempty"`    // 签名ID,该字段为空则使用应用默认签名。
    	TempId       int64       `json:"temp_id,omitempty"`   // 短信补充的内容模板 ID。没有填写该字段即表示不使用短信补充功能。
    	TempPara     interface{} `json:"temp_para,omitempty"` // 短信模板中的参数。
    	ActiveFilter bool        `json:"active_filter"`       // active_filter 字段用来控制是否对补发短信的用户进行活跃过滤,默认为 true ,做活跃过滤;为 false,则不做活跃过滤;
          
    type SmsPayLoad struct {
    	Mobile   string   `json:"mobile"`              // 手机号
    	Signid   int      `json:"signid,omitempty"`    // 签名ID,该字段为空则使用应用默认签名。
    	TempId   int64    `json:"temp_id,omitempty"`   // 短信补充的内容模板 ID。没有填写该字段即表示不使用短信补充功能。
    	TempPara TempPara `json:"temp_para,omitempty"` // 短信模板中的参数。
    	XIAOMI ThirdChannelType = "xiaomi"
    	HUAWEI ThirdChannelType = "huawei"
    	MEIZU  ThirdChannelType = "meizu"
    	OPPO   ThirdChannelType = "oppo"
    	VIVO   ThirdChannelType = "vivo"
    	FCM    ThirdChannelType = "fcm"
          
    type ThirdPartyOptions struct {
    	Distribution          string      `json:"distribution,omitempty"`           //通知栏消息下发逻辑
    	DistributionFcm       string      `json:"distribution_fcm,omitempty"`       //通知栏消息fcm+国内厂商组合类型下发逻辑
    	DistributionCustomize string      `json:"distribution_customize,omitempty"` //自定义消息国内厂商类型下发逻辑
    	ChannelId             string      `json:"channel_id"`                       //通知栏消息分类
    	SkipQuota             bool        `json:"skip_quota"`                       //配额判断及扣除, 目前仅对小米和oppo有效
    	Classification        int         `json:"classification,omitempty"`         //通知栏消息分类, 为了适配 vivo 手机厂商通知栏消息分类,“0”代表运营消息,“1”代表系统消息
    	PushMode              int         `json:"push_mode,omitempty"`              //通知栏消息类型, 对应 vivo 的 pushMode 字段,值分别是:“0”表示正式推送;“1”表示测试推送,不填默认为0
    	Importance            string      `json:"importance,omitempty"`             //华为通知栏消息智能分类, 为了适配华为手机厂商的通知栏消息智能分类
    	Urgency               string      `json:"urgency,omitempty"`                //华为厂商自定义消息优先级, 为了适配华为手机厂商自定义消息的优先级
    	Category              string      `json:"category,omitempty"`               //华为厂商自定义消息场景标识
    	LargeIcon             string      `json:"large_icon,omitempty"`             //厂商消息大图标样式, 目前支持小米/华为/oppo三个厂商
    	SmallIconUri          string      `json:"small_icon_uri,omitempty"`         //厂商消息小图标样式, 目前支持小米/华为两个厂商
    	SmallIconColor        string      `json:"small_icon_color,omitempty"`       //小米厂商小图标样式颜色
    	Style                 int         `json:"style,omitempty"`                  //厂商消息大文本/inbox/大图片样式
    	BigText               string      `json:"big_text,omitempty"`               //厂商消息大文本样式
    	Inbox                 interface{} `json:"inbox,omitempty"`                  //厂商消息inbox样式, 目前支持华为厂商
    	BigPicPath            string      `json:"big_pic_path,omitempty"`           //厂商big_pic_path, 为了适配厂商的消息大图片样式,目前支持小米/oppo两个厂商
    	OnlyUseVendorStyle    bool        `json:"only_use_vendor_style,omitempty"`  //是否是否使用自身通道设置样式
    	CallbackId            string      `json:"callback_id,omitempty"`            // vivo厂商通道回调ID
          
    type WinPhoneNotification struct {
    	Alert    string                 `json:"alert"`                // 通知内容, 必填字段,会填充到 toast 类型 text2 字段上。这里指定了,将会覆盖上级统一指定的 alert 信息;内容为空则不展示到通知栏。
    	Title    string                 `json:"title,omitempty"`      // 通知标题, 会填充到 toast 类型 text1 字段上。
    	OpenPage string                 `json:"_open_page,omitempty"` // 点击打开的页面名称, 点击打开的页面。会填充到推送信息的 param 字段上,表示由哪个 App 页面打开该通知。可不填,则由默认的首页打开。
    	Extras   map[string]interface{} `json:"extras,omitempty"`     // 扩展字段, 这里自定义 Key / value 信息,以供业务使用。
            
    go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic. Learn more.