Commit 1a77e5f9 authored by hujun's avatar hujun

message_id

parent 12addacd
...@@ -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;
} }
......
...@@ -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
] ]
)); ));
......
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