Commit 00cd4cd0 authored by clone's avatar clone

用户信息

parent 96bf2dd5
...@@ -104,6 +104,20 @@ class AppChat extends Basic ...@@ -104,6 +104,20 @@ class AppChat extends Basic
return $this->response("200", "success", ""); return $this->response("200", "success", "");
} }
public function getUserOrAgentInfo()
{
$params = $this->params;
if (!isset($params['id']) || !isset($params['type'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
}
$params = array(
"id" => 1,
"type" => 1,//1用户 or 2经纪人
);
$this->_chat->getUserInfo();
}
/** /**
* 发送消息接口 * 发送消息接口
...@@ -155,13 +169,13 @@ class AppChat extends Basic ...@@ -155,13 +169,13 @@ class AppChat extends Basic
if (!isset($params['target_type']) || !isset($params['from']) || !isset($params['target'])) { if (!isset($params['target_type']) || !isset($params['from']) || !isset($params['target'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误"); return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
} }
/* $params = array( /* $params = array(
'target_type' => 'users', // 消息类型 users 用户消息。chatgroups: 群消息,chatrooms: 聊天室消息 'target_type' => 'users', // 消息类型 users 用户消息。chatgroups: 群消息,chatrooms: 聊天室消息
'from' => 'app_64', //发送人 'from' => 'app_64', //发送人
'target' => '18112347151', //接受人 'target' => '18112347151', //接受人
'page_no' => '1', //第几页 'page_no' => '1', //第几页
'page_size' => '15' //每页多少条 'page_size' => '15' //每页多少条
);*/ );*/
$page_no = empty($params['page_no']) ? 1 : $params['page_no']; $page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size']; $page_size = empty($params['page_size']) ? 15 : $params['page_size'];
...@@ -175,7 +189,4 @@ class AppChat extends Basic ...@@ -175,7 +189,4 @@ class AppChat extends Basic
} }
} }
...@@ -91,7 +91,7 @@ class ChatService ...@@ -91,7 +91,7 @@ class ChatService
$onlyId = ""; $onlyId = "";
switch ($source) { switch ($source) {
case 1: case 1:
$agentsResult = $this->agentsModel->getAgentsById($userId); $agentsResult = $this->agentsModel->getAgentsById("id", $userId);
if (count($agentsResult) > 1) if (count($agentsResult) > 1)
$onlyId = self::SOURCE_TYPE_AGENT . $userId; $onlyId = self::SOURCE_TYPE_AGENT . $userId;
break; break;
...@@ -167,6 +167,23 @@ class ChatService ...@@ -167,6 +167,23 @@ class ChatService
//$this->insertPushLog($sender, $target, $msg_content, $status, $response['statusMsg']); //$this->insertPushLog($sender, $target, $msg_content, $status, $response['statusMsg']);
} }
public function getUserInfo($id, $type)
{
switch ($type) {
case 1:
$field = "id,";
$agentsResult = $this->agentsModel->getAgentsById($field, $id);
break;
case 2:
$userResult = $this->userModel->selectUser($id);
break;
}
}
/** /**
* 保存用户发送的消息 * 保存用户发送的消息
* @param $target_type * @param $target_type
......
...@@ -101,13 +101,14 @@ class Agents extends Model ...@@ -101,13 +101,14 @@ class Agents extends Model
/** /**
* 获取经纪人 by zw * 获取经纪人 by zw
* @param $field
* @param $id * @param $id
* @return array|false|\PDOStatement|string|Model * @return array|false|\PDOStatement|string|Model
*/ */
public function getAgentsById($id) public function getAgentsById($field , $id)
{ {
return $this return $this
->field('id') ->field($field)
->where('inuse = 1 and id = ' . $id) ->where('inuse = 1 and id = ' . $id)
->find(); ->find();
} }
......
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