Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
app_push
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_server
app_push
Commits
2f365c2c
Commit
2f365c2c
authored
May 23, 2019
by
zmj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改推送的数量和token 过期时间
parent
e8db51e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
app/services/push/huawei.rb
+3
-1
app/services/push/xiaomi.rb
+2
-2
app/services/token.rb
+1
-1
No files found.
app/services/push/huawei.rb
View file @
2f365c2c
...
...
@@ -4,11 +4,13 @@ module Push
TOKEN_URL
=
'https://login.cloud.huawei.com/oauth2/v2/token'
.
freeze
PUSH_URL
=
'https://api.push.hicloud.com/pushsend.do'
.
freeze
ACCESS_TOEKN_EXPIRE_TIME
=
3500
BATCH_PUSH_MAX
=
80
class
<<
self
# 4a7d376b47c847634571a86b37e93272 测试使用的device_token
def
push
(
device_tokens
,
message
)
handle_token_res
if
access_token
.
blank?
device_tokens
.
each_slice
(
100
)
do
|
device_token_array
|
device_tokens
.
each_slice
(
BATCH_PUSH_MAX
)
do
|
device_token_array
|
res_push
(
message
,
device_token_array
)
end
rescue
StandardError
=>
err
...
...
app/services/push/xiaomi.rb
View file @
2f365c2c
module
Push
module
Xiaomi
PUSH_URL
=
'https://api.xmpush.xiaomi.com/v3/message/regid'
.
freeze
PUSH_DEVICE_MAX
=
100
0
BATCH_PUSH_MAX
=
8
0
class
<<
self
def
push
(
registration_ids
,
payload
)
registration_ids
.
each_slice
(
PUSH_DEVICE
_MAX
)
do
|
registration_ids_array
|
registration_ids
.
each_slice
(
BATCH_PUSH
_MAX
)
do
|
registration_ids_array
|
registration_id
=
registration_ids_array
.
join
(
','
)
post
(
message
(
payload
,
registration_id
))
end
...
...
app/services/token.rb
View file @
2f365c2c
module
Token
ACCESS_TOEKN_EXPIRE_TIME
=
36
00
ACCESS_TOEKN_EXPIRE_TIME
=
72
00
class
<<
self
def
key
(
app_name
)
"push:api:
#{
app_name
}
:access_token"
...
...
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