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
e4fb872f
Commit
e4fb872f
authored
May 15, 2019
by
zmj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 初始化参数
parent
0c60a2b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
50 deletions
+52
-50
lib/app_push.rb
+51
-49
lib/app_push/version.rb
+1
-1
No files found.
lib/app_push.rb
View file @
e4fb872f
...
...
@@ -6,61 +6,63 @@ require 'app_push/log'
require
'igetui'
module
AppPush
class
Push
attr_accessor
:igetui_config
,
:xiaomi_config
def
initialize
(
opts
=
{})
opts
=
opts
.
with_indifferent_access
# {
# base: {
# app_id: '',
# app_key: '',
# master_secret: ''
# template_base: {
# logo: 'ik_logo.png',
# logo_url: 'http://www.ikcrm.com/assets/img/ik_logo.png',
# title: '',
# text: ''
# }
# },
# opts: {
# push_type: 2
# }
# }
@igetui_config
=
opts
[
'igetui'
]
# xiaomi default config
# {
# restricted_package_name: 'com.vcooline.aike',
# pass_through: 1,
# title: 'xiaomi push',
# description: 'xiaomi push',
# notify_type: 1
# }
@xiaomi_config
=
opts
[
'xiaomi'
]
if
@igetui_config
.
present?
Igetui
.
config
=
@igetui_config
[
'opts'
]
Igetui
::
Push
.
config
=
@igetui_config
[
'base'
]
class
<<
self
attr_accessor
:igetui_config
,
:xiaomi_config
def
init
(
opts
=
{})
opts
=
opts
.
with_indifferent_access
# {
# base: {
# app_id: '',
# app_key: '',
# master_secret: ''
# template_base: {
# logo: 'ik_logo.png',
# logo_url: 'http://www.ikcrm.com/assets/img/ik_logo.png',
# title: '',
# text: ''
# }
# },
# opts: {
# push_type: 2
# }
# }
@igetui_config
=
opts
[
'igetui'
]
# xiaomi default config
# {
# restricted_package_name: 'com.vcooline.aike',
# pass_through: 1,
# title: 'xiaomi push',
# description: 'xiaomi push',
# notify_type: 1
# }
@xiaomi_config
=
opts
[
'xiaomi'
]
if
@igetui_config
.
present?
Igetui
.
config
=
@igetui_config
[
'opts'
]
Igetui
::
Push
.
config
=
@igetui_config
[
'base'
]
end
Xiaomi
.
config
=
@xiaomi_config
end
Xiaomi
.
config
=
@xiaomi_config
end
# transmission_content 是真正的推送信息
# {
# transmission_content: opts,
# transmission_type: transmission_type
# }
def
push
(
user_device_ids
,
message
)
message
=
message
.
with_indifferent_access
# transmission_content 是真正的推送信息
# {
# transmission_content: opts,
# transmission_type: transmission_type
# }
def
push
(
user_device_ids
,
message
)
message
=
message
.
with_indifferent_access
# igetui
Igetui
.
push
(
user_device_ids
,
message
)
# igetui
Igetui
.
push
(
user_device_ids
,
message
)
# xiaomi
Xiaomi
.
push
(
user_device_ids
,
message
[
'transmission_content'
])
# xiaomi
Xiaomi
.
push
(
user_device_ids
,
message
[
'transmission_content'
])
# huawei
# huawei
# etc
rescue
StandardError
=>
err
Log
.
error
(
err
)
# etc
rescue
StandardError
=>
err
Log
.
error
(
err
)
end
end
end
end
lib/app_push/version.rb
View file @
e4fb872f
module
AppPush
VERSION
=
"0.1"
VERSION
=
"0.1
1
"
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