Commit 349e97e3 authored by zhuwei's avatar zhuwei

如果是店长,将员工的消息也搜出来

parent 96b5c7f5
...@@ -15,6 +15,7 @@ use app\chat\extend\Basic; ...@@ -15,6 +15,7 @@ use app\chat\extend\Basic;
use app\chat\service\ChatService; use app\chat\service\ChatService;
use app\chat\utils\RPush; use app\chat\utils\RPush;
use app\extra\RedisPackage; use app\extra\RedisPackage;
use app\model\AAgents;
use app\model\ChatMsg; use app\model\ChatMsg;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesImgs; use app\model\GHousesImgs;
...@@ -483,8 +484,10 @@ class AppChat extends Basic ...@@ -483,8 +484,10 @@ class AppChat extends Basic
$field = "id,addressee_id,type,message,house_id,create_time,is_read"; $field = "id,addressee_id,type,message,house_id,create_time,is_read";
//获取此经纪人的所有盘方楼盘id //获取此经纪人的所有盘方楼盘id
$params_agent_id = $this->getAgentIds($params['agent_id']);//如果是店长,将员工的消息也搜出来
$param["addressee_id"] = $params["agent_id"]; $param["addressee_id"] = array("in", $params_agent_id);
// $param["addressee_id"] = $params["agent_id"];
$param["type"] = array("in", "1,3"); $param["type"] = array("in", "1,3");
$msgModel = new MPushMessage(); $msgModel = new MPushMessage();
...@@ -633,4 +636,36 @@ class AppChat extends Basic ...@@ -633,4 +636,36 @@ class AppChat extends Basic
} }
/**
* 查询店长下面的业务员id
* @param $agent_id
* @return string
*/
public function getAgentIds($agent_id){
$m_agent = new AAgents();
$a_res_level= $m_agent->getAgentFieldById($agent_id, 'level');
dump($a_res_level);
if($a_res_level == 20){
//查询总监下面门店的所有经纪人
$a_res_store_id= $m_agent->getAgentFieldById($agent_id, 'store_id');
$params = [];
$params["store_id"] = $a_res_store_id;
$params["status"] = 0; //只查询正常状态的经纪人
$agentsArr = $m_agent->getAgentsByStoreId($params);
if (count($agentsArr) > 0) {
$agent_ids = "";
foreach ($agentsArr as $k => $v) {
$agent_ids .= $v["id"] . ",";
}
$agent_ids = rtrim($agent_ids, ",");//经纪人ID集合
}//查询总监下面门店的所有经纪人 end
return $agent_ids;
}else{
return $agent_id;
}
}
} }
...@@ -6,6 +6,7 @@ use app\api_broker\service\VipService; ...@@ -6,6 +6,7 @@ use app\api_broker\service\VipService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\index\service\ImageDepotService; use app\index\service\ImageDepotService;
use app\index\service\UserService; use app\index\service\UserService;
use app\model\AAgents;
use app\model\GBusinessDistrict; use app\model\GBusinessDistrict;
use app\model\GImageDepot; use app\model\GImageDepot;
use think\Cache; use think\Cache;
...@@ -177,8 +178,38 @@ class ImageDepot extends Basic ...@@ -177,8 +178,38 @@ class ImageDepot extends Basic
public function ceshi() public function ceshi()
{ {
$we_chat_last_notice_lime = time(); // $we_chat_last_notice_lime = time();
return $this->response("200", "成功",$we_chat_last_notice_lime); // return $this->response("200", "成功",$we_chat_last_notice_lime);
$getAgentIds = $this->getAgentIds(50);
dump($getAgentIds);
}
public function getAgentIds($agent_id){
$m_agent = new AAgents();
$a_res_level= $m_agent->getAgentFieldById($agent_id, 'level');
dump($a_res_level);
if($a_res_level == 20){
//查询总监下面门店的所有经纪人
$a_res_store_id= $m_agent->getAgentFieldById($agent_id, 'store_id');
$params = [];
$params["store_id"] = $a_res_store_id;
$params["status"] = 0; //只查询正常状态的经纪人
$agentsArr = $m_agent->getAgentsByStoreId($params);
if (count($agentsArr) > 0) {
$agent_ids = "";
foreach ($agentsArr as $k => $v) {
$agent_ids .= $v["id"] . ",";
}
$agent_ids = rtrim($agent_ids, ",");//经纪人ID集合
}//查询总监下面门店的所有经纪人 end
return $agent_ids;
}else{
return $agent_id;
}
} }
......
...@@ -1584,4 +1584,10 @@ class AAgents extends BaseModel ...@@ -1584,4 +1584,10 @@ class AAgents extends BaseModel
return $result; return $result;
} }
public function getAgentFieldById($id, $fields)
{
$return = $this->where('id', $id)->value($fields);
return $return;
}
} }
\ 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