Commit bcba2e0c authored by clone's avatar clone

bug

parent d1a6752d
...@@ -322,13 +322,14 @@ class AppChat extends Basic ...@@ -322,13 +322,14 @@ class AppChat extends Basic
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"target" => "agent_5775" "target" => "agent_5775",
"is_user"=> 0,//0用户1经纪人
);*/ );*/
if (!isset($params['target'])) { if (!isset($params['target']) || !isset($params["is_user"])) {
return $this->response("300", "参数不全"); return $this->response("300", "参数不全");
} }
$target = $params["target"]; $target = $params["target"];
$relationList = $this->_chat->getRelationList($target); $relationList = $this->_chat->getRelationList($target,$params["is_user"]);
return $this->response("200", "success", $relationList); return $this->response("200", "success", $relationList);
......
...@@ -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,$is_user, $type, $accessToken, [ $this, 'saveSendStatus' ]); $rPush->send($user_name, $target_type, $target, $msg_content, $from, $is_user, $type, $accessToken, [ $this, 'saveSendStatus' ]);
return true; return true;
} }
...@@ -380,12 +380,13 @@ class ChatService ...@@ -380,12 +380,13 @@ class ChatService
/**获取聊天列表 /**获取聊天列表
* @param $target * @param $target
* @param $is_user
* @return array * @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
*/ */
public function getRelationList($target) public function getRelationList($target, $is_user)
{ {
$chatRelationModel = new ChatRelation(); $chatRelationModel = new ChatRelation();
$params["target"] = $target; $params["target"] = $target;
...@@ -402,15 +403,19 @@ class ChatService ...@@ -402,15 +403,19 @@ class ChatService
foreach ($relationList as $key => $item) { foreach ($relationList as $key => $item) {
if ($item["from_id"] == $target) { if ($item["from_id"] == $target) {
$result[$key]["relation_id"] = $item["to_id"]; $result[$key]["relation_id"] = $item["to_id"];
}else{ } else {
$result[$key]["relation_id"] = $item["from_id"]; $result[$key]["relation_id"] = $item["from_id"];
} }
$result[$key]["id"] = $item["id"]; if ($is_user == 0) {
$result[$key]["type"] = $item["type"]; $result[$key]["name"] = empty($item["user_nick"]) ? $item["user_name"] : $item["user_nick"];
$result[$key]["id"] = $item["id"]; $result[$key]["img"] = empty($item["user_pic"]) ? $item["other_pic"] : $item["user_pic"];
$result[$key]["id"] = $item["id"]; } else {
$select_["from"] = $item["from_id"]; $result[$key]["name"] = $item["agent_name"];
$select_["target"] = $item["to_id"]; $result[$key]["img"] = $item["img"];
}
$result[$key]["only_id"] = $item["only_id"];
$select_["from"] = $item["from_id"];
$select_["target"] = $item["to_id"];
$result[$key]["chat_info"] = $msgModel->getChatHistory($select_, $fields, 1, 1); $result[$key]["chat_info"] = $msgModel->getChatHistory($select_, $fields, 1, 1);
} }
return $result; return $result;
......
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