Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
56885084
Commit
56885084
authored
Jul 05, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方法名修改
parent
454177c6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
35 deletions
+43
-35
GeTuiUtils.php
application/chat/utils/GeTuiUtils.php
+43
-35
No files found.
application/chat/utils/GeTuiUtils.php
View file @
56885084
...
...
@@ -27,19 +27,57 @@ class GeTuiUtils
include_once
(
EXTEND_PATH
.
'GETUI_PHP_SDK/IGt.Push.php'
);
}
/**
* 对某个人推送消息
*
* @param $id
* @param $device_id
* @param $title
* @param $content
* @param string $type
* @param $user_id
* @return array
* @throws \Exception
*/
public
function
pushToPerson
(
$id
,
$device_id
,
$title
,
$content
,
$type
=
'other'
,
$user_id
=
null
)
{
$home_url
=
$this
->
httpHost
();
$data
[
'agent_id'
]
=
$id
;
$data
[
'black_title'
]
=
$title
;
$data
[
'content'
]
=
$content
;
$data
[
'device_id'
]
=
$device_id
;
$data
[
'touchuan'
]
=
json_encode
([
'title'
=>
$title
,
'content'
=>
$content
,
'type'
=>
$type
,
'url'
=>
''
,
'name'
=>
$title
,
'id'
=>
$user_id
,
'imageUrl'
=>
$home_url
.
'notice_android_logo.png'
]);
try
{
$result
=
$this
->
pushMessageToIgt
(
$data
);
}
catch
(
\Exception
$e
)
{
$result
[
'result'
]
=
'error'
;
$result
[
'status'
]
=
$e
->
getMessage
();
}
return
$result
;
}
/**
* @param $data
* @return array
* @throws \Exception
*/
function
push_message_for_one
(
$data
)
public
function
pushMessageToIgt
(
$data
)
{
$cid
=
$data
[
'device_id'
];
$igt
=
new
\IGeTui
(
IGT_HOST
,
IGT_APP_KEY
,
IGT_MASTER_SECRET
);
//模板
$template
=
$this
->
online
_all_t
emplate
(
$data
[
'touchuan'
],
$data
[
'black_title'
],
$data
[
'content'
]);
$template
=
$this
->
online
AllT
emplate
(
$data
[
'touchuan'
],
$data
[
'black_title'
],
$data
[
'content'
]);
//个推信息体
$message
=
new
\IGtSingleMessage
();
...
...
@@ -71,7 +109,7 @@ class GeTuiUtils
* @return \IGtTransmissionTemplate
* @throws \Exception
*/
function
online
_all_t
emplate
(
$payload
,
$black_title
,
$content
)
function
online
AllT
emplate
(
$payload
,
$black_title
,
$content
)
{
$template
=
new
\IGtTransmissionTemplate
();
...
...
@@ -97,42 +135,12 @@ class GeTuiUtils
return
$template
;
}
/**
* 对某个人推送消息
*
* @param $id
* @param $device_id
* @param $title
* @param $content
* @param string $type
* @param $user_id
* @return array
* @throws \Exception
*/
function
public_push_message_for_one
(
$id
,
$device_id
,
$title
,
$content
,
$type
=
'other'
,
$user_id
)
{
$home_url
=
$this
->
http_host
();
$data
[
'agent_id'
]
=
$id
;
$data
[
'black_title'
]
=
$title
;
$data
[
'content'
]
=
$content
;
$data
[
'device_id'
]
=
$device_id
;
$data
[
'touchuan'
]
=
json_encode
([
'title'
=>
$title
,
'content'
=>
$content
,
'type'
=>
$type
,
'url'
=>
''
,
'name'
=>
$title
,
'id'
=>
$user_id
,
'imageUrl'
=>
$home_url
.
'notice_android_logo.png'
]);
return
$this
->
push_message_for_one
(
$data
);
}
/**
* 当前域名
*
* @return string
*/
public
function
http
_h
ost
()
public
function
http
H
ost
()
{
$http_type
=
((
isset
(
$_SERVER
[
'HTTPS'
])
&&
$_SERVER
[
'HTTPS'
]
==
'on'
)
||
(
isset
(
$_SERVER
[
'HTTP_X_FORWARDED_PROTO'
])
&&
...
...
@@ -148,7 +156,7 @@ class GeTuiUtils
* @param null $data
* @return mixed|string
*/
function
http
_r
equest
(
$url
,
$data
=
null
)
function
http
R
equest
(
$url
,
$data
=
null
)
{
$curl
=
curl_init
();
...
...
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