Commit 1a77e5f9 authored by hujun's avatar hujun

message_id

parent 12addacd
......@@ -180,9 +180,9 @@ class ChatService
return true;
}
/**
* 发送消息
*
* @param $user_name
* @param $target_type
* @param $target
......@@ -193,6 +193,7 @@ class ChatService
* @param $from
* @param $accessToken
* @return bool
* @throws Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
......@@ -225,7 +226,7 @@ class ChatService
foreach ($info as $item) {
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;
}
......
......@@ -29,8 +29,9 @@ class RPush
* @param $access_token
* @param $callback
* @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
if (Cache::get('save_message_num')) {
......@@ -46,7 +47,7 @@ class RPush
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 ]);
}
......@@ -64,7 +65,7 @@ class RPush
* @param $push_id
* @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 = "收到一条消息";
......@@ -85,7 +86,8 @@ class RPush
'body' => $msg_content,
'to_id' => $target,
'from_id' => $from,
'created_at' => '2018-04-02 13:19:14'
'created_at' => date('Y-m-d H:i:s'),
'message_id' => $message_id
]
));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment