Commit a76ae022 authored by clone's avatar clone

1

parent 81fc52c2
......@@ -3,6 +3,7 @@
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\AgentLookUserLogService;
use app\api_broker\service\LookShopService;
use app\model\AAgents;
use app\model\SystemConfig;
......@@ -66,7 +67,7 @@ class LookShop extends Basic
/*$params = array(
"store_id" => 1,
);*/
if (!isset($params["store_id"]) && $params["store_id"] <= 0) {
if (!isset($params["store_id"]) && $params["store_id"] <= 0) {
return $this->response("101", "请求参数错误");
}
$field = "id,store_id,level,name,phone,img";
......@@ -80,7 +81,7 @@ class LookShop extends Basic
}
$systemConfigModel = new SystemConfig();
$lookNum = 0;
$data = $systemConfigModel->getSetting([ "config_type" => 40 ], "rule");
$data = $systemConfigModel->getSetting(["config_type" => 40], "rule");
if ($data && $data["agent_shop_num"] > 0) {
$lookNum = $data["agent_shop_num"];
}
......@@ -117,42 +118,42 @@ class LookShop extends Basic
//$params_["id"] = $params['agent_id'];
$params_["id"] = $this->agentId;
$result = $model->searchAgentsByKeyword("id,store_id,district_id,level", $params_);
$result = $model->searchAgentsByKeyword("id,store_id,district_id,level", $params_);
$field = "a.id,a.store_id,a.level,a.name,a.phone,a.img,b.store_name";
//店长
if($result[0]["level"] == 20){
if ($result[0]["level"] == 20) {
$where_["store_id"] = $result[0]["store_id"];
}else{//总监
} else {//总监
$where_["district_id"] = $result[0]["district_id"];
}
$where_["status"] = 0;
$where_["status"] = 0;
//经纪人姓名搜索
if (!empty($params["name"])) {
$where_["name"] = array( "like", "%" . trim($params['name']) . "%" );
$where_["name"] = array("like", "%" . trim($params['name']) . "%");
}
$agentList = $this->agentsModel->getAgentByIdV2($field, $where_, $page_no, $page_size);
$agentList = $this->agentsModel->getAgentByIdV2($field, $where_, $page_no, $page_size);
if (count($agentList) <= 0) {
return $this->response("200", "request null");
}
$systemConfigModel = new SystemConfig();
$lookNum = 0;
$data = $systemConfigModel->getSetting([ "config_type" => 40 ], "rule");
$data = $systemConfigModel->getSetting(["config_type" => 40], "rule");
if ($data && $data["agent_shop_num"] > 0) {
$lookNum = $data["agent_shop_num"];
}
//1.返回剩余铺数等于多少 if 0 判断是否升级过 ,升级过 显示已升级,没升级过 升级可以点击效果 else 不等于0 灰色的升级
foreach ($agentList as $key => $item) {
$agentList[$key]['img'] = AGENTHEADERIMGURL . $item['img'];
$can_look_num = $this->lookShopService_->isLookShop($item["id"]);
$is_upgrade = $this->lookShopService_->getAgentUpNum($item["id"]);
$agentList[$key]['img'] = AGENTHEADERIMGURL . $item['img'];
$can_look_num = $this->lookShopService_->isLookShop($item["id"]);
$is_upgrade = $this->lookShopService_->getAgentUpNum($item["id"]);
$agentList[$key]["can_look_num"] = $can_look_num;
$agentList[$key]["is_upgrade"] = $is_upgrade == 1 ? false : true ;//前端判断 等于1是未升级 2已升级
$agentList[$key]["is_upgrade"] = $is_upgrade == 1 ? false : true;//前端判断 等于1是未升级 2已升级
}
$result["look_num"] = $lookNum;
$result["list"] = $agentList;
......@@ -161,7 +162,6 @@ class LookShop extends Basic
}
/**
* 客户浏览记录 商铺详情点进去查看哪些客户看了的
* PC后台调
......@@ -169,15 +169,15 @@ class LookShop extends Basic
*/
public function getShopUserVisitLog()
{
$params = $this->params;
$params = $this->params;
$checkResult = $this->validate($params, "UserLookShopValidate.getLookShopList");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$s_look_Shop = new LookShopService();
$result = $s_look_Shop->getShopUserVisitLog($params,$pageNo, $pageSize);
$result = $s_look_Shop->getShopUserVisitLog($params, $pageNo, $pageSize);
return $this->response("200", "success", $result);
}
......@@ -188,15 +188,15 @@ class LookShop extends Basic
*/
public function getLookShopList()
{
$params = $this->params;
$params = $this->params;
$checkResult = $this->validate($params, "UserLookShopValidate.getLookShopList");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 10 : $params['pageSize'];
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 10 : $params['pageSize'];
$s_look_Shop = new LookShopService();
$result = $s_look_Shop->getShopUserVisitLog($params,$pageNo, $pageSize);
$result = $s_look_Shop->getShopUserVisitLog($params, $pageNo, $pageSize);
return $this->response("200", "success", $result);
}
......@@ -206,18 +206,36 @@ class LookShop extends Basic
*/
public function getShopLookList()
{
$params = $this->params;
$params = $this->params;
$checkResult = $this->validate($params, "UserLookShopValidate.getShopLookList");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$s_look_Shop = new LookShopService();
$result = $s_look_Shop->getShopLookList($params['user_id'],$pageNo,$pageSize);
$result = $s_look_Shop->getShopLookList($params['user_id'], $pageNo, $pageSize);
return $this->response("200", "success", $result);
}
public function saveLookUserList()
{
$params = $this->params;
/* $params = array(
"agent_id" => 111,
"user_id" => 111,
"source" => 1,
);*/
$agent_id = $params["agent_id"];
$user_id = $params["user_id"];
$source = empty($params["source"]) ? 0 : 1;
if (!$agent_id || !$user_id) {
return $this->response("101", "参数错误");
}
$agentLookUserService = new AgentLookUserLogService();
$agentLookUserService->saveCacheAgentLookUser($agent_id, $user_id, $source); //记录经纪人看客户
return $this->response("200", "success");
}
}
\ No newline at end of file
......@@ -65,6 +65,7 @@ class Basic extends Controller
"broker/getUserLabels",
"broker/moveHouseAgent",
"broker/moveHouseSiteId",
"broker/saveLookUserList",
"office/filtrateConditionRoom",
"office/getBuildingRoomH5",
);
......
......@@ -126,8 +126,9 @@ class UserLogService
$s_user_agent = new UserAgentService();
$user_agent_res = $s_user_agent->selectUserAgent($user_id);
$data['customer_relegation_list'] = $user_agent_res ? $user_agent_res : [];
$agentLookUserService = new AgentLookUserLogService();
$agentLookUserService->saveCacheAgentLookUser($agent_id, $user_id, 1); //记录经纪人看客户
//$agentLookUserService = new AgentLookUserLogService();
//$agentLookUserService->saveCacheAgentLookUser($agent_id, $user_id, 1); //记录经纪人看客户
$this->sendRequestByCurl($agent_id, $user_id, 1);
return ["code" => 200, "data" => $data];
}
......@@ -282,8 +283,9 @@ class UserLogService
#编辑客户详情权限 0:有权限 1:无权限
$result['is_can_edit_user_info'] = $user_service->isCanEditUserInfo($result["agent_id"], $agent_id, $user_id);
$agentLookUserService = new AgentLookUserLogService();
$agentLookUserService->saveCacheAgentLookUser($agent_id, $user_id, 0); //记录经纪人看客户
// $agentLookUserService = new AgentLookUserLogService();
// $agentLookUserService->saveCacheAgentLookUser($agent_id, $user_id, 0); //记录经纪人看客户
$this->sendRequestByCurl($agent_id, $user_id, 0);
return $result;
......@@ -569,4 +571,41 @@ class UserLogService
return $return;
}
private function sendRequestByCurl($agent_id, $user_id, $source)
{
$arr = array(
'agent_id' => $agent_id,
'user_id' => $user_id,
'source' => $source,
);
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer ",
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl();
$response = $curl->post($url, $data);
return $response;
}
/**
* 请求api
* @return string
*/
private function buildSendUrl()
{
if (CURRENT_URL == "https://api.tonglianjituan.com/") {
return "https://images.tonglianjituan.com/borker/saveLookUserList";
} else {
return "https://pre2.tonglianjituan.com/borker/saveLookUserList";
}
}
}
\ 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