Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
U
utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
library
utils
Commits
d1454d90
Verified
Commit
d1454d90
authored
May 06, 2019
by
Cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
f474a9f1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
10 deletions
+11
-10
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-2
jpush.go
sender/jpush.go
+4
-4
structs.go
sender/structs.go
+3
-2
wrapper.go
sender/wrapper.go
+1
-1
No files found.
go.mod
View file @
d1454d90
...
...
@@ -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
)
go.sum
View file @
d1454d90
...
...
@@ -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=
sender/jpush.go
View file @
d1454d90
...
...
@@ -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
)
...
...
sender/structs.go
View file @
d1454d90
...
...
@@ -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"`
...
...
sender/wrapper.go
View file @
d1454d90
...
...
@@ -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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment