Commit 95220c99 authored by zhuwei's avatar zhuwei

客户详情

parent e250b998
...@@ -7,6 +7,7 @@ use app\api_broker\service\CallPhoneService; ...@@ -7,6 +7,7 @@ use app\api_broker\service\CallPhoneService;
use app\api_broker\service\ClientService; use app\api_broker\service\ClientService;
use app\api_broker\service\UserExpiredTimeService; use app\api_broker\service\UserExpiredTimeService;
use app\api_broker\service\VipService; use app\api_broker\service\VipService;
use app\index\service\UserLogService;
use app\index\service\UserService; use app\index\service\UserService;
use app\model\AAgents; use app\model\AAgents;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowPp;
...@@ -24,11 +25,14 @@ use think\Request; ...@@ -24,11 +25,14 @@ use think\Request;
class User extends Basic class User extends Basic
{ {
private $userModel; private $userModel;
private $userLogService;
public function __construct($request = null) public function __construct($request = null)
{ {
parent::__construct($request); parent::__construct($request);
$this->userModel = new Users(); $this->userModel = new Users();
$this->userLogService = new UserLogService();
} }
/** /**
...@@ -706,4 +710,41 @@ class User extends Basic ...@@ -706,4 +710,41 @@ class User extends Basic
); );
} }
/**
* 获取用户主要信息
* @return \think\Response
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function userDetail()
{
$params = $this->params;
$params = array(
"user_id" => 828,
"agent_id" => 1,
);
if (!isset($params['user_id']) || !isset($params['agent_id'])) {
return $this->response("101", "参数不全");
}
//简易客户详情
$result['user_detail'] = $this->userLogService->userDetailStreamline($params['user_id'],$params['agent_id']);
//绑定关系(关联客户)
$s_index_user = new UserService();
$result['user_bind_list'] = $s_index_user->userBindInfo($params['user_id']);
if($result["code"] == 200){
return $this->response("200", "success!", $result["data"]);
}else{
return $this->response("101", $result["msg"]);
}
}
} }
\ No newline at end of file
...@@ -208,4 +208,82 @@ class UserLogService ...@@ -208,4 +208,82 @@ class UserLogService
return $bargainData; return $bargainData;
} }
/**
* 客户详情简略信息
* @param $user_id
* @param $agent_id
* @return mixed
*/
public function userDetailStreamline($user_id, $agent_id)
{
//查询客户详情
$field = 'id,user_pic,name,phone,site_ids,agent_id';
$user_res = $this->userModel->getUserDetailStreamline($user_id,$field);
if (count($user_res) <= 0) {
return ["code" => 101, "msg" => "没找到此条用户信息"];
}
$user_res['user_pic'] = HEADERIMGURL . $user_res['user_pic'];
$result['agent_path'] = AGENTHEADERIMGURL;
/*查询站点名*/
$site_model = new ASite();
foreach (explode(',', $user_res['site_ids']) as $site_k => $site_v) {
$site_field = 'city';
$site_params['id'] = $site_v;
$site_model = $site_model->findByOne($site_field, $site_params);
$user_res['site_name'][] = $site_model["city"];
}
/*查询站点名*/
/*是否被收藏 start*/
$result["is_collect"] = 2;
//先判断是否已经存在数据
$field = 'id,status';
$get_params['agents_id'] = $agent_id;
$get_params['user_id'] = $user_id;
$collect_house = new ACollectUser();
$res = $collect_house->getCollectUser($field, $get_params);
if ($res && ($res[0]['status'] == 1)) {//如果存在
$result["is_collect"] = 1;
}
/*是否被收藏 end*/
/*判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期 start*/
//查询客户是否在保护期内
$user_service = new UserService();
$is_outstrip_twenty_four_hours = $user_service->isUserProtect($user_id);
$result['is_outstrip_twenty_four_hours'] = $is_outstrip_twenty_four_hours;
/*判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期 end*/
// 判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定
//0允许拨打 1不允许拨打
$result['is_outpace_call_num'] = 0;
$clientService = new ClientService();
if (!$clientService->dialTotal($user_id)) {
$result['is_outpace_call_num'] = 1;
}
$model = new AAgents();
$agent_res = $model->searchAgentsByKeyword("id,name,phone", ["id" => $agent_id]);
$call = new CallPhoneService();
$bind_num_res = $call->getBindNum($user_res['user_phone'], $agent_res[0]['phone']);
if ($bind_num_res != 0) {
$result['is_outpace_call_num'] = 0;
}
//查询当前经纪人是否是某个客方的总监 0:可查看 1:不可查看
$result['is_can_look'] = $user_service->isUserAgentDirector($user_res["agent_id"], $agent_id);
$vip_services = new VipService();
//是否可以查看vip客户 0:可查看 1:不可查看
$result['examine_vip'] = $vip_services->vip($agent_id);
return $result;
}
} }
\ No newline at end of file
...@@ -479,6 +479,15 @@ class Users extends Model ...@@ -479,6 +479,15 @@ class Users extends Model
return $data; return $data;
} }
public function getUserDetailStreamline($user_id,$field)
{
$data = db('u_users')
->where('id', $user_id)
->field($field)
->find();
return $data;
}
/*public function user_search($phone_or_name,$Two_days_ago,$user_id,$pagesize,$pagenum) { /*public function user_search($phone_or_name,$Two_days_ago,$user_id,$pagesize,$pagenum) {
$data =$this ->where('user_nick|user_phone','like',"%$phone_or_name%") $data =$this ->where('user_nick|user_phone','like',"%$phone_or_name%")
->where('create_time','< time',$Two_days_ago)//小于两天前,即排除48小时内受保护的客户 ->where('create_time','< time',$Two_days_ago)//小于两天前,即排除48小时内受保护的客户
......
...@@ -749,6 +749,9 @@ Route::group('broker', [ ...@@ -749,6 +749,9 @@ Route::group('broker', [
'getBeForNum' => ['api_broker/PayLog/getBeForNum', ['method' => 'get|post']], 'getBeForNum' => ['api_broker/PayLog/getBeForNum', ['method' => 'get|post']],
'adjustment' => ['api_broker/PayLog/adjustment', ['method' => 'get|post']], 'adjustment' => ['api_broker/PayLog/adjustment', ['method' => 'get|post']],
//原生客户详情
'userDetail' => ['api_broker/User/userDetail', ['method' => 'get|post']],//
]); ]);
......
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