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
4a636242
Commit
4a636242
authored
Jul 16, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
区分个推两个应用
parent
bcba2e0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
18 deletions
+36
-18
GeTuiUtils.php
application/chat/utils/GeTuiUtils.php
+35
-17
RPush.php
application/chat/utils/RPush.php
+1
-1
No files found.
application/chat/utils/GeTuiUtils.php
View file @
4a636242
...
@@ -12,11 +12,12 @@ namespace app\chat\utils;
...
@@ -12,11 +12,12 @@ namespace app\chat\utils;
class
GeTuiUtils
class
GeTuiUtils
{
{
const
IGT_APP_ID
=
'A8raBWQxuX9bcVmk3rkWa5'
;
const
IGT_HOST
=
'http://sdk.open.api.igexin.com/apiex.htm'
;
const
IGT_APP_SECRET
=
'TLNDlz8YsW6J4gexzb4AX3'
;
const
IGT_APP_KEY
=
'dEC3iu81ZC9XbsVLwoiHA6'
;
private
$igt_app_id
=
''
;
const
IGT_MASTER_SECRET
=
'3NNdfsgjCJ6Rmfr9l0EeI1'
;
private
$igt_app_secret
=
''
;
const
IGT_HOST
=
'http://sdk.open.api.igexin.com/apiex.htm'
;
private
$igt_app_key
=
''
;
private
$igt_app_master_secret
=
''
;
/**
/**
* 引入类文件
* 引入类文件
...
@@ -29,23 +30,40 @@ class GeTuiUtils
...
@@ -29,23 +30,40 @@ class GeTuiUtils
}
}
/**
/**
* 推送消息
* 1 经纪人端
* 0 客户端
*
*
* @param $push_id
* @param $is
* @param string $type
* @param $title
* @param $data
* @return array
*/
*/
public
function
setting
(
$is
)
{
if
(
$is
)
{
$this
->
igt_app_id
=
'A8raBWQxuX9bcVmk3rkWa5'
;
$this
->
igt_app_secret
=
'TLNDlz8YsW6J4gexzb4AX3'
;
$this
->
igt_app_key
=
'dEC3iu81ZC9XbsVLwoiHA6'
;
$this
->
igt_app_master_secret
=
'3NNdfsgjCJ6Rmfr9l0EeI1'
;
}
else
{
$this
->
igt_app_id
=
'1GnogURb3Y8cjQjmRtxXcA'
;
$this
->
igt_app_secret
=
'qgCUSOcEQi52vRKQe6MYp8'
;
$this
->
igt_app_key
=
'oQuYepflY8A7r0yGK9f9D4'
;
$this
->
igt_app_master_secret
=
'numYAK4xpq8TEZHvaqeAT6'
;
}
}
/**
/**
* 推送消息
*
* @param $push_id
* @param $push_id
* @param $title
* @param $title
* @param $payload
* @param $payload
* @param $is_user
* @return array
* @return array
*/
*/
public
function
pushMessageToIgt
(
$push_id
,
$title
,
$payload
)
public
function
pushMessageToIgt
(
$push_id
,
$title
,
$payload
,
$is_user
)
{
{
$igt
=
new
\IGeTui
(
self
::
IGT_HOST
,
self
::
IGT_APP_KEY
,
self
::
IGT_MASTER_SECRET
);
$this
->
setting
(
$is_user
);
$igt
=
new
\IGeTui
(
self
::
IGT_HOST
,
$this
->
igt_app_key
,
$this
->
igt_app_master_secret
);
try
{
try
{
//模板
//模板
...
@@ -65,14 +83,14 @@ class GeTuiUtils
...
@@ -65,14 +83,14 @@ class GeTuiUtils
//接收方
//接收方
$target
=
new
\IGtTarget
();
$target
=
new
\IGtTarget
();
$target
->
set_appId
(
self
::
IGT_APP_ID
);
$target
->
set_appId
(
$this
->
igt_app_id
);
$result
=
[];
$result
=
[];
foreach
(
$push_id
as
$k
=>
$v
)
{
foreach
(
$push_id
as
$k
=>
$v
)
{
//echo $v;
//echo $v;
$target
->
set_clientId
(
$v
);
$target
->
set_clientId
(
$v
);
// dump($target);
// dump($target);
$res
=
$igt
->
pushMessageToSingle
(
$message
,
$target
);
$res
=
$igt
->
pushMessageToSingle
(
$message
,
$target
);
if
(
$res
[
'result'
]
==
'ok'
)
{
if
(
$res
[
'result'
]
==
'ok'
)
{
...
@@ -101,8 +119,8 @@ class GeTuiUtils
...
@@ -101,8 +119,8 @@ class GeTuiUtils
{
{
$template
=
new
\IGtTransmissionTemplate
();
$template
=
new
\IGtTransmissionTemplate
();
$template
->
set_appId
(
self
::
IGT_APP_ID
);
//应用appid
$template
->
set_appId
(
$this
->
igt_app_id
);
//应用appid
$template
->
set_appkey
(
self
::
IGT_APP_KEY
);
//应用appkey
$template
->
set_appkey
(
$this
->
igt_app_key
);
//应用appkey
$template
->
set_transmissionType
(
2
);
//透传消息类型
$template
->
set_transmissionType
(
2
);
//透传消息类型
$template
->
set_transmissionContent
(
$payload
);
//透传内容
$template
->
set_transmissionContent
(
$payload
);
//透传内容
...
...
application/chat/utils/RPush.php
View file @
4a636242
...
@@ -93,7 +93,7 @@ class RPush
...
@@ -93,7 +93,7 @@ class RPush
$push_arr
=
$target
;
$push_arr
=
$target
;
return
$pushMessageToIgt
->
pushMessageToIgt
(
$push_arr
,
$title
,
$payload
);
return
$pushMessageToIgt
->
pushMessageToIgt
(
$push_arr
,
$title
,
$payload
,
$is_user
);
/* $curl = new \app\chat\utils\CurlUtil();
/* $curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
$curl->headers = [
"Accept" => "application/json",
"Accept" => "application/json",
...
...
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