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
a670d37b
Commit
a670d37b
authored
Oct 18, 2019
by
liangyuzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.deal with huawei error 2.create pusher by device_platform
parent
f51a40f7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
app/services/push/igetui/push.rb
+11
-10
No files found.
app/services/push/igetui/push.rb
View file @
a670d37b
...
@@ -5,7 +5,7 @@ module Push
...
@@ -5,7 +5,7 @@ module Push
PUSHERTYPES
=
%w[push_message_to_single push_message_to_list push_message_to_app]
.
freeze
PUSHERTYPES
=
%w[push_message_to_single push_message_to_list push_message_to_app]
.
freeze
TEMPLATETYPES
=
%w[LinkTemplate NotificationTemplate TransmissionTemplate NotyPopLoadTemplate]
.
freeze
TEMPLATETYPES
=
%w[LinkTemplate NotificationTemplate TransmissionTemplate NotyPopLoadTemplate]
.
freeze
DEVICEPLATFORMS
=
%w[android ios]
DEVICEPLATFORMS
=
%w[android ios]
.
freeze
def
initialize
(
template_data
,
opts
=
{})
def
initialize
(
template_data
,
opts
=
{})
...
@@ -16,6 +16,7 @@ module Push
...
@@ -16,6 +16,7 @@ module Push
@template_type
=
TEMPLATETYPES
.
include?
((
opts
[
:template_type
]).
to_s
)
?
opts
[:
template_type
]
:
'NotificationTemplate'
@template_type
=
TEMPLATETYPES
.
include?
((
opts
[
:template_type
]).
to_s
)
?
opts
[:
template_type
]
:
'NotificationTemplate'
@device_platform
=
opts
[
:device_platform
].
to_s
@device_platform
=
opts
[
:device_platform
].
to_s
::
Push
::
Log
.
info
(
"@template_data is
#{
@template_data
.
to_json
}
"
)
set_message
set_message
set_template_data
set_template_data
@message
.
data
=
@template
@message
.
data
=
@template
...
@@ -45,24 +46,24 @@ module Push
...
@@ -45,24 +46,24 @@ module Push
def
pusher
def
pusher
@pusher
||=
@pusher
||=
if
DEVICEPLATFORMS
.
include?
((
@
device_platform
))
if
DEVICEPLATFORMS
.
include?
((
@
template_data
[
'device_platform'
].
to_s
))
case
@
device_platform
case
@
template_data
[
'device_platform'
].
to_s
when
'android'
when
'android'
IGeTui
.
pusher
(
IGeTui
.
pusher
(
Settings
.
platform_settings
.
android
.
igetui
[
'app_id'
],
Settings
.
platform_settings
.
igetui
.
android
[
'app_id'
],
Settings
.
platform_settings
.
android
.
igetui
[
'app_key'
],
Settings
.
platform_settings
.
igetui
.
android
[
'app_key'
],
Settings
.
platform_settings
.
android
.
igetui
[
'master_secret'
]
Settings
.
platform_settings
.
igetui
.
android
[
'master_secret'
]
)
)
when
'ios'
when
'ios'
IGeTui
.
pusher
(
IGeTui
.
pusher
(
Settings
.
platform_settings
.
i
os
.
igetui
[
'app_id'
],
Settings
.
platform_settings
.
i
getui
.
ios
[
'app_id'
],
Settings
.
platform_settings
.
i
os
.
igetui
[
'app_key'
],
Settings
.
platform_settings
.
i
getui
.
ios
[
'app_key'
],
Settings
.
platform_settings
.
i
os
.
igetui
[
'master_secret'
]
Settings
.
platform_settings
.
i
getui
.
ios
[
'master_secret'
]
)
)
end
end
else
else
::
Push
::
Log
.
error
(
"设备类型不正确
#{
@device_platform
}
"
)
::
Push
::
Log
.
info
(
"设备类型不正确
#{
@device_platform
}
"
)
raise
"Failed to create pusher"
raise
"Failed to create pusher"
end
end
end
end
...
...
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