Commit 49d699cf authored by clone's avatar clone

系统消息

parent bc01c200
......@@ -22,6 +22,7 @@ use app\model\GHousesImgs;
use app\model\HouseImgs;
use app\model\HouseinfoExts;
use app\model\HouseInfos;
use app\model\MPushMessage;
use app\model\Users;
use think\Cache;
use think\Exception;
......@@ -361,7 +362,6 @@ class AppChat extends Basic
}
/**
* 获取聊天关系
* @return \think\Response
......@@ -409,9 +409,9 @@ class AppChat extends Basic
public function getUserInfoByFrom()
{
$params = $this->params;
/*$params = array(
'id' => 1,
);*/
/*$params = array(
'id' => 1,
);*/
if (!isset($params['id'])) {
return $this->response("300", "参数不全");
}
......@@ -422,16 +422,16 @@ class AppChat extends Basic
//3.ID
//4.手机号隐藏中间4位
$user = new Users();
$field = 'a.id,a.user_name,a.user_nick,a.user_phone,a.user_pic,a.other_pic';
$user = new Users();
$field = 'a.id,a.user_name,a.user_nick,a.user_phone,a.user_pic,a.other_pic';
$params_["a.id"] = $params['id'];
$result = $user->getAgentByUserId($field, $params_);
$result = $user->getAgentByUserId($field, $params_);
if (count($result) > 0) {
$result_["id"] = $result[0]["id"];
$result_["agent_id"] = 'agent_'.$result[0]["id"];
$result_["user_name"] = $result[0]["user_name"];
$result_["user_nick"] = $result[0]["user_nick"];
$result_["user_pic"] = !empty($result[0]["user_pic"]) ? HEADERIMGURL . $result[0]["user_pic"] : $result[0]["other_pic"];
$result_["id"] = $result[0]["id"];
$result_["agent_id"] = 'agent_' . $result[0]["id"];
$result_["user_name"] = $result[0]["user_name"];
$result_["user_nick"] = $result[0]["user_nick"];
$result_["user_pic"] = !empty($result[0]["user_pic"]) ? HEADERIMGURL . $result[0]["user_pic"] : $result[0]["other_pic"];
$result_["user_phone"] = $result[0]["user_phone"];
return $this->response("200", "success!", $result_);
......@@ -441,5 +441,69 @@ class AppChat extends Basic
}
/**系统消息商铺修改消息
* @return \think\Response
*/
public function getSystemMessageByShop()
{
$params = $this->params;
/* $params = array(
"agent_id" => 5740,
'page_no' => '1', //第几页
'page_size' => '15' //每页多少条
);*/
if (!isset($params['agent_id'])) {
return $this->response("101", "请求参数错误");
}
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$field = "id,addressee_id,type,message,house_id,create_time";
//获取此经纪人的所有盘方楼盘id
$params["addressee_id"] = $params["agent_id"];
$params["type"] = array( "in", array( "1,3" ) );
$msgModel = new MPushMessage();
$history_result = $msgModel->getListByWhere($field, $params, $page_no, $page_size);
return $this->response("200", "request success", array_reverse($history_result));
}
/**
* 系统消息客户修改消息
* @return \think\Response
*/
public function getSystemMessageByUser()
{
$params = $this->params;
/* $params = array(
"agent_id" => 5740,
'page_no' => '1', //第几页
'page_size' => '15' //每页多少条
);*/
if (!isset($params['agent_id'])) {
return $this->response("101", "请求参数错误");
}
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$field = "id,addressee_id,type,message,user_id,create_time";
//获取此经纪人的所有盘方楼盘id
$params["addressee_id"] = $params["agent_id"];
$params["type"] = 2;
$msgModel = new MPushMessage();
$history_result = $msgModel->getListByWhere($field, $params, $page_no, $page_size);
return $this->response("200", "request success", array_reverse($history_result));
}
}
<?php
namespace app\index\controller;
use app\index\extend\Basic;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/9/11
* Time : 16:37
* Intro:
*/
class InviteTotal extends Basic{
}
\ No newline at end of file
......@@ -211,4 +211,14 @@ class MPushMessage
}
return $result;
}
public function getListByWhere(string $field, array $params,int $page_no = 1,int $page_size = 15) : array
{
$this->db_
->field($field)
->where($params)
->page($page_no)
->limit($page_size)
->select();
}
}
\ No newline at end of file
This diff is collapsed.
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