Verified Commit d1454d90 authored by Cui's avatar Cui

update

parent f474a9f1
......@@ -4,5 +4,5 @@ require (
github.com/heycayc/chkcki v0.0.0-20180425093509-ad62647adf04
github.com/sirupsen/logrus v1.3.0
github.com/valyala/fasthttp v1.0.0
gitlab.qingclass.cn/library/jpush v0.0.1
gitlab.qingclass.cn/library/jpush v0.0.2
)
......@@ -10,8 +10,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.0.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s=
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
gitlab.qingclass.cn/library/jpush v0.0.1 h1:zXqwo7C6+fvTccAqLyAWTyYRUXXqEPq1W7ll9oYidmY=
gitlab.qingclass.cn/library/jpush v0.0.1/go.mod h1:h4wvcwtBQSlZKJhpE2FwcXFLIZREfB7fBNYJSCWdGhE=
gitlab.qingclass.cn/library/jpush v0.0.2 h1:GzRWzf/L38wvIxSyWniWwGTse7CrVh6lofa/ZBlGNks=
gitlab.qingclass.cn/library/jpush v0.0.2/go.mod h1:h4wvcwtBQSlZKJhpE2FwcXFLIZREfB7fBNYJSCWdGhE=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
......@@ -14,7 +14,7 @@ import (
// const appKey = "2eccc8d57e1bfd374e690f9d"
// const masterSecret = "30ce7445d75af8a6dd0f251b"
func AppMessageSender(am AppMessage, appKey, masterSecret string) (statusCode int, errorStr string) {
func AppMessageSender(am AppMessage, appKey, masterSecret string, iosProduction bool) (statusCode int, errorStr string) {
log := Logger.WithFields(logrus.Fields{
"position": "jpush.go",
"func": "AppMessageSender",
......@@ -42,11 +42,11 @@ func AppMessageSender(am AppMessage, appKey, masterSecret string) (statusCode in
// option 对象,表示推送可选项
options := push.NewOptions()
// iOS 平台,是否推送生产环境,false 表示开发环境;如果不指定,就是生产环境
options.ApnsProduction = false
options.ApnsProduction = iosProduction
// Options 的 Validate 方法会对 time_to_live 属性做范围限制,以满足 JPush 的规范
options.TimeToLive = 10000000
// options.TimeToLive = 10000000
// Options 的 Validate 方法会对 big_push_duration 属性做范围限制,以满足 JPush 的规范
options.BigPushDuration = 1500
// options.BigPushDuration = 1500
if am.Extra.MessageId != "" {
androidNotification.AddExtra("messageId", am.Extra.MessageId)
......
......@@ -53,8 +53,9 @@ type MessageStruct struct {
SmsAppId int `json:"smsAppId" bson:"smsAppId"`
SmsAppKey string `json:"smsAppKey" bson:"smsAppKey"`
JAppKey string `json:"jappKey"`
JAppSecret string `json:"jappSecret"`
JAppKey string `json:"jappKey"`
JAppSecret string `json:"jappSecret"`
IosProduction bool `json:"iosProduction"`
Retry int `json:"retry"`
PushCount int `json:"pushCount"`
......
......@@ -213,7 +213,7 @@ func Sender(accessToken string, message MessageStruct) (code int, msg string) {
break
}
code, msg = AppMessageSender(am, message.JAppKey, message.JAppSecret)
code, msg = AppMessageSender(am, message.JAppKey, message.JAppSecret, message.IosProduction)
break
default:
msg = "MessageType is not match"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment