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
bbabc57d
Commit
bbabc57d
authored
Feb 01, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
算法优化,环信接口有限制,每个时间段最多能推送多少请求
parent
4f034e1a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
ChatService.php
application/chat/service/ChatService.php
+1
-0
RPush.php
application/chat/utils/RPush.php
+13
-1
No files found.
application/chat/service/ChatService.php
View file @
bbabc57d
...
@@ -142,6 +142,7 @@ class ChatService
...
@@ -142,6 +142,7 @@ class ChatService
{
{
//todo
//todo
$this
->
insertMsg
(
$target_type
,
$target
,
$source
,
$is_user
,
$type
,
$msg_content
,
$from
);
$this
->
insertMsg
(
$target_type
,
$target
,
$source
,
$is_user
,
$type
,
$msg_content
,
$from
);
$rPush
=
new
RPush
();
$rPush
=
new
RPush
();
...
...
application/chat/utils/RPush.php
View file @
bbabc57d
...
@@ -28,7 +28,19 @@ class RPush
...
@@ -28,7 +28,19 @@ class RPush
*/
*/
public
function
send
(
$target_type
,
$target
,
$msg_content
,
$from
,
$type
,
$access_token
,
$callback
)
public
function
send
(
$target_type
,
$target
,
$msg_content
,
$from
,
$type
,
$access_token
,
$callback
)
{
{
//todo 这里做算法优化,环信接口有限制,每个时间段最多能推送多少请求
//todo
if
(
Cache
::
get
(
'save_message_num'
)){
$save_message_num
=
Cache
::
get
(
'save_message_num'
);
if
(
$save_message_num
>
10
){
sleep
(
1
);
Cache
::
set
(
'save_message_num'
,
0
);
}
else
{
$save_message_num
=
$save_message_num
+
1
;
Cache
::
set
(
'save_message_num'
,
$save_message_num
);
}
}
else
{
Cache
::
set
(
'save_message_num'
,
0
);
}
$response
=
$this
->
sendRequestByCurl
(
$target_type
,
$target
,
$msg_content
,
$from
,
$type
,
$access_token
);
$response
=
$this
->
sendRequestByCurl
(
$target_type
,
$target
,
$msg_content
,
$from
,
$type
,
$access_token
);
...
...
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