Commit 217213b8 authored by clone's avatar clone

聊天构建

parent f86fc643
...@@ -23,7 +23,7 @@ class ChatService ...@@ -23,7 +23,7 @@ class ChatService
public function __construct() public function __construct()
{ {
$this->userModel = new Users(); $this->userModel = new Users();
$this->agentsModel = new Agents(); $this->agentsModel = new Agents();
} }
...@@ -37,17 +37,18 @@ class ChatService ...@@ -37,17 +37,18 @@ class ChatService
public function createOnlyId($userId, $mobile, $source) public function createOnlyId($userId, $mobile, $source)
{ {
//todo 1.验证用户是否存在 经纪人和用户 2.根据规则生成唯一id 3.判断唯一id是否登录中,登陆中则调用退出接口 4.返回唯一id //todo 1.验证用户是否存在 经纪人和用户 2.根据规则生成唯一id 3.判断唯一id是否登录中,登陆中则调用退出接口 4.返回唯一id
$onlyId = "";
switch ($source) { switch ($source) {
case 1: case 1:
$agentsResult = $this->agentsModel->getAgentsById($userId); $agentsResult = $this->agentsModel->getAgentsById($userId);
if (count($agentsResult) > 1) if (count($agentsResult) > 1)
$onlyId = self::SOURCE_TYPE_AGENT . $userId; $onlyId = self::SOURCE_TYPE_AGENT . $userId;
break;
case 2: case 2:
$userResult = $this->userModel->selectUser($userId); $userResult = $this->userModel->selectUser($userId);
if (count($userResult) > 1) if (count($userResult) > 1)
$onlyId = self::SOURCE_TYPE_APP . $userId; $onlyId = self::SOURCE_TYPE_APP . $userId;
break;
default: default:
return array( "code" => 101, "msg" => "没找到用户信息" ); return array( "code" => 101, "msg" => "没找到用户信息" );
} }
...@@ -55,4 +56,61 @@ class ChatService ...@@ -55,4 +56,61 @@ class ChatService
return $onlyId; return $onlyId;
} }
/**
* 发送消息
* @param $sender_id
* @param $receiver_ids
* @param $group_id
* @param $msg_content
* @param $msg_type
* @param $msg_filename
* @param $msg_file_url
*/
public function sendMsg($sender_id, $receiver_ids, $group_id, $msg_content, $msg_type, $msg_filename, $msg_file_url)
{
//todo
$this->insertMsg();
}
/**
* 保存推送到环信的消息状态 往msg_status中插入数据
* @param $response
* @param $tmp
* @param $sender
* @param $msg_content
*/
public function saveSendStatus($response, $tmp, $sender, $msg_content)
{
//todo
}
/**
* 保存用户发送的消息
* @param $sender
* @param $receiver
* @param $group_id
* @param $msg_content
* @param $type
* @param $msg_filename
* @param $msg_file_url
*/
private function insertMsg($sender, $receiver, $group_id, $msg_content, $type, $msg_filename, $msg_file_url)
{
//todo
}
/** 获取聊天记录
* @param $sender
* @param $start
* @param $limit
* @param $site_id
* @return array
*/
public function getHistoryChatList($sender, $start, $limit, $site_id)
{
//todo
}
} }
\ No newline at end of file
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