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
1a77e5f9
Commit
1a77e5f9
authored
Jul 18, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
message_id
parent
12addacd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
ChatService.php
application/chat/service/ChatService.php
+3
-2
RPush.php
application/chat/utils/RPush.php
+6
-4
No files found.
application/chat/service/ChatService.php
View file @
1a77e5f9
...
@@ -180,9 +180,9 @@ class ChatService
...
@@ -180,9 +180,9 @@ class ChatService
return
true
;
return
true
;
}
}
/**
/**
* 发送消息
* 发送消息
*
* @param $user_name
* @param $user_name
* @param $target_type
* @param $target_type
* @param $target
* @param $target
...
@@ -193,6 +193,7 @@ class ChatService
...
@@ -193,6 +193,7 @@ class ChatService
* @param $from
* @param $from
* @param $accessToken
* @param $accessToken
* @return bool
* @return bool
* @throws Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
...
@@ -225,7 +226,7 @@ class ChatService
...
@@ -225,7 +226,7 @@ class ChatService
foreach
(
$info
as
$item
)
{
foreach
(
$info
as
$item
)
{
array_push
(
$push_id
,
$item
[
"push_id"
]);
array_push
(
$push_id
,
$item
[
"push_id"
]);
}
}
$rPush
->
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$accessToken
,
[
$this
,
'saveSendStatus'
],
$push_id
);
$rPush
->
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$accessToken
,
[
$this
,
'saveSendStatus'
],
$push_id
,
$msg_id
);
return
true
;
return
true
;
}
}
...
...
application/chat/utils/RPush.php
View file @
1a77e5f9
...
@@ -29,8 +29,9 @@ class RPush
...
@@ -29,8 +29,9 @@ class RPush
* @param $access_token
* @param $access_token
* @param $callback
* @param $callback
* @param $push_id
* @param $push_id
* @param $msg_id
*/
*/
public
function
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$access_token
,
$callback
,
$push_id
)
public
function
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$access_token
,
$callback
,
$push_id
,
$msg_id
)
{
{
//todo
//todo
if
(
Cache
::
get
(
'save_message_num'
))
{
if
(
Cache
::
get
(
'save_message_num'
))
{
...
@@ -46,7 +47,7 @@ class RPush
...
@@ -46,7 +47,7 @@ class RPush
Cache
::
set
(
'save_message_num'
,
0
);
Cache
::
set
(
'save_message_num'
,
0
);
}
}
$response
=
$this
->
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$access_token
,
$push_id
);
$response
=
$this
->
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$access_token
,
$push_id
,
$msg_id
);
call_user_func_array
([
$callback
[
0
],
$callback
[
1
]
],
[
$response
,
$target
,
$from
,
$msg_content
]);
call_user_func_array
([
$callback
[
0
],
$callback
[
1
]
],
[
$response
,
$target
,
$from
,
$msg_content
]);
}
}
...
@@ -64,7 +65,7 @@ class RPush
...
@@ -64,7 +65,7 @@ class RPush
* @param $push_id
* @param $push_id
* @return array
* @return array
*/
*/
public
function
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$access_token
,
$push_id
)
public
function
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$access_token
,
$push_id
,
$message_id
)
{
{
$title
=
"收到一条消息"
;
$title
=
"收到一条消息"
;
...
@@ -85,7 +86,8 @@ class RPush
...
@@ -85,7 +86,8 @@ class RPush
'body'
=>
$msg_content
,
'body'
=>
$msg_content
,
'to_id'
=>
$target
,
'to_id'
=>
$target
,
'from_id'
=>
$from
,
'from_id'
=>
$from
,
'created_at'
=>
'2018-04-02 13:19:14'
'created_at'
=>
date
(
'Y-m-d H:i:s'
),
'message_id'
=>
$message_id
]
]
));
));
...
...
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