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
99181dda
Commit
99181dda
authored
Jul 22, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user name
parent
ed0d6d26
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
ChatService.php
application/chat/service/ChatService.php
+15
-2
RPush.php
application/chat/utils/RPush.php
+8
-6
No files found.
application/chat/service/ChatService.php
View file @
99181dda
...
...
@@ -222,24 +222,37 @@ class ChatService
$user_id
=
0
;
$where
[
'type'
]
=
1
;
$user_type
=
1
;
foreach
(
$user_arr
as
$item
)
{
if
(
$item
[
"only_id"
]
==
$from
)
{
$user_id
=
empty
(
$
user_arr
[
'user_id'
])
?
0
:
$user_arr
[
'user_id'
];
$user_id
=
empty
(
$
item
[
'user_id'
])
?
0
:
$item
[
'user_id'
];
}
else
{
$where
[
'type'
]
=
$item
[
"type"
];
$user_type
=
$item
[
"type"
];
}
}
$info
=
$userExt
->
getChatUserExtByUserId
(
$where
,
'a.id,a.ext_id,a.device_id,a.push_id,b.user_id'
);
if
(
count
(
$info
)
<=
0
)
{
return
false
;
}
if
(
$user_type
==
1
)
{
$user_data
=
$this
->
userModel
->
getUserById
(
'user_phone'
,
$user_id
);
$user_info
[
'id'
]
=
$user_id
;
$user_info
[
'phone'
]
=
$user_data
[
'user_phone'
];
}
else
{
$agent_data
=
$this
->
agentsV2Model
->
getAgentInfo
(
'phone'
,
$user_id
);
$user_info
[
'id'
]
=
$user_id
;
$user_info
[
'phone'
]
=
$agent_data
[
'phone'
];
}
$push_id
=
[];
foreach
(
$info
as
$item
)
{
array_push
(
$push_id
,
$item
[
"push_id"
]);
}
$rPush
->
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$user_type
,
$type
,
[
$this
,
'saveSendStatus'
],
$push_id
,
$msg_id
,
$user_i
d
);
$rPush
->
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$user_type
,
$type
,
[
$this
,
'saveSendStatus'
],
$push_id
,
$msg_id
,
$user_i
nfo
);
return
true
;
}
...
...
application/chat/utils/RPush.php
View file @
99181dda
...
...
@@ -29,9 +29,9 @@ class RPush
* @param $callback
* @param $push_id
* @param $msg_id
* @param $user_i
d
* @param $user_i
nfo
*/
public
function
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$user_type
,
$type
,
$callback
,
$push_id
,
$msg_id
,
$user_i
d
)
public
function
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$user_type
,
$type
,
$callback
,
$push_id
,
$msg_id
,
$user_i
nfo
)
{
//todo
if
(
Cache
::
get
(
'save_message_num'
))
{
...
...
@@ -47,7 +47,7 @@ class RPush
Cache
::
set
(
'save_message_num'
,
0
);
}
$response
=
$this
->
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$user_type
,
$type
,
$push_id
,
$msg_id
,
$user_i
d
);
$response
=
$this
->
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$user_type
,
$type
,
$push_id
,
$msg_id
,
$user_i
nfo
);
call_user_func_array
([
$callback
[
0
],
$callback
[
1
]
],
[
$response
,
$target
,
$from
,
$msg_content
]);
}
...
...
@@ -63,10 +63,10 @@ class RPush
* @param $type
* @param $push_id
* @param $message_id
* @param $user_i
d
* @param $user_i
nfo
* @return array
*/
public
function
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$user_type
,
$type
,
$push_id
,
$message_id
,
$user_i
d
)
public
function
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$user_type
,
$type
,
$push_id
,
$message_id
,
$user_i
nfo
)
{
$title
=
"收到一条消息"
;
...
...
@@ -88,9 +88,11 @@ class RPush
'from_id'
=>
$from
,
'created_at'
=>
date
(
'Y-m-d H:i:s'
),
'message_id'
=>
$message_id
,
'user_id'
=>
$user_id
'user_id'
=>
$user_info
[
'id'
],
'phone'
=>
$user_info
[
'phone'
]
]
);
$payload
=
json_encode
(
$msg_bin
);
$pushMessageToIgt
=
new
GeTuiUtils
();
...
...
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