Commit bcba2e0c authored by clone's avatar clone

bug

parent d1a6752d
......@@ -322,13 +322,14 @@ class AppChat extends Basic
{
$params = $this->params;
/* $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", "参数不全");
}
$target = $params["target"];
$relationList = $this->_chat->getRelationList($target);
$relationList = $this->_chat->getRelationList($target,$params["is_user"]);
return $this->response("200", "success", $relationList);
......
......@@ -217,7 +217,7 @@ class ChatService
foreach ($info as $item) {
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;
}
......@@ -380,12 +380,13 @@ class ChatService
/**获取聊天列表
* @param $target
* @param $is_user
* @return array
* * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getRelationList($target)
public function getRelationList($target, $is_user)
{
$chatRelationModel = new ChatRelation();
$params["target"] = $target;
......@@ -402,15 +403,19 @@ class ChatService
foreach ($relationList as $key => $item) {
if ($item["from_id"] == $target) {
$result[$key]["relation_id"] = $item["to_id"];
}else{
} 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_["target"] = $item["to_id"];
if ($is_user == 0) {
$result[$key]["name"] = empty($item["user_nick"]) ? $item["user_name"] : $item["user_nick"];
$result[$key]["img"] = empty($item["user_pic"]) ? $item["other_pic"] : $item["user_pic"];
} else {
$result[$key]["name"] = $item["agent_name"];
$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);
}
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