Commit d1a6752d authored by clone's avatar clone

bug

parent c597f1dd
...@@ -217,7 +217,7 @@ class ChatService ...@@ -217,7 +217,7 @@ class ChatService
foreach ($info as $item) { foreach ($info as $item) {
array_push($target, $item["push_id"]); array_push($target, $item["push_id"]);
} }
$rPush->send($user_name, $target_type, $target, $msg_content, $from, $type, $accessToken, [ $this, 'saveSendStatus' ]); $rPush->send($user_name, $target_type, $target, $msg_content, $from,$is_user, $type, $accessToken, [ $this, 'saveSendStatus' ]);
return true; return true;
} }
...@@ -377,11 +377,11 @@ class ChatService ...@@ -377,11 +377,11 @@ class ChatService
} }
} }
/**
* 获取聊天列表 /**获取聊天列表
* @param $target * @param $target
* @return false|\PDOStatement|string|\think\Collection * @return array
* @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
*/ */
...@@ -394,15 +394,26 @@ class ChatService ...@@ -394,15 +394,26 @@ class ChatService
c.name as agent_name,c.img,d.user_name,d.user_phone,d.user_nick,d.user_pic,d.other_pic"; c.name as agent_name,c.img,d.user_name,d.user_phone,d.user_nick,d.user_pic,d.other_pic";
$relationList = $chatRelationModel->getChatRelationInfo($params, $field); $relationList = $chatRelationModel->getChatRelationInfo($params, $field);
$result = [];
//dump($relationList); //dump($relationList);
$fields = "a.id,a.from_id,a.to_id,b.body,a.created_at"; $fields = "a.id,a.from_id,a.to_id,b.body,a.created_at";
$msgModel = new ChatMsg(); $msgModel = new ChatMsg();
foreach ($relationList as $key=> $item) { foreach ($relationList as $key => $item) {
if ($item["from_id"] == $target) {
$result[$key]["relation_id"] = $item["to_id"];
}else{
$result[$key]["relation_id"] = $item["from_id"];
}
$result[$key]["id"] = $item["id"];
$result[$key]["type"] = $item["type"];
$result[$key]["id"] = $item["id"];
$result[$key]["id"] = $item["id"];
$select_["from"] = $item["from_id"]; $select_["from"] = $item["from_id"];
$select_["target"] = $item["to_id"]; $select_["target"] = $item["to_id"];
$relationList[$key]["chat_info"] = $msgModel->getChatHistory($select_, $fields, 1, 1); $result[$key]["chat_info"] = $msgModel->getChatHistory($select_, $fields, 1, 1);
} }
return $relationList; return $result;
} }
/** /**
......
...@@ -24,11 +24,12 @@ class RPush ...@@ -24,11 +24,12 @@ class RPush
* @param $target * @param $target
* @param $msg_content * @param $msg_content
* @param $from * @param $from
* @param $is_user
* @param $type * @param $type
* @param $access_token * @param $access_token
* @param $callback * @param $callback
*/ */
public function send($user_name, $target_type, $target, $msg_content, $from, $type, $access_token, $callback) public function send($user_name, $target_type, $target, $msg_content, $from, $is_user, $type, $access_token, $callback)
{ {
//todo //todo
if (Cache::get('save_message_num')) { if (Cache::get('save_message_num')) {
...@@ -44,7 +45,7 @@ class RPush ...@@ -44,7 +45,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, $type, $access_token); $response = $this->sendRequestByCurl($user_name, $target_type, $target, $msg_content, $from, $is_user, $type, $access_token);
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 ]);
} }
...@@ -61,7 +62,7 @@ class RPush ...@@ -61,7 +62,7 @@ class RPush
* @param $access_token * @param $access_token
* @return array * @return array
*/ */
public function sendRequestByCurl($user_name, $target_type, $target, $msg_content, $from, $type, $access_token) public function sendRequestByCurl($user_name, $target_type, $target, $msg_content, $from, $is_user, $type, $access_token)
{ {
$title = "收到一条消息"; $title = "收到一条消息";
...@@ -80,18 +81,18 @@ class RPush ...@@ -80,18 +81,18 @@ class RPush
'url' => '', 'url' => '',
'name' => $title, 'name' => $title,
'imageUrl' => '', 'imageUrl' => '',
'id'=>0, 'id' => 0,
'target' => $target, 'target' => $target,
'from' => $from, 'from' => $from,
'is_user' => $is_user,
'msg_type' => 1, // 1文本 2图片3楼盘 'msg_type' => 1, // 1文本 2图片3楼盘
'ext' => ["user_name" => $user_name ] 'ext' => [ "user_name" => $user_name ]
)); ));
$pushMessageToIgt = new GeTuiUtils(); $pushMessageToIgt = new GeTuiUtils();
$push_arr = $target; $push_arr = $target;
return $pushMessageToIgt->pushMessageToIgt($push_arr, $title, $payload); return $pushMessageToIgt->pushMessageToIgt($push_arr, $title, $payload);
/* $curl = new \app\chat\utils\CurlUtil(); /* $curl = new \app\chat\utils\CurlUtil();
$curl->headers = [ $curl->headers = [
......
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