Commit 243e3ee0 authored by zhuwei's avatar zhuwei

1

parent 398909bf
...@@ -19,7 +19,7 @@ use think\Log; ...@@ -19,7 +19,7 @@ use think\Log;
use think\Request; use think\Request;
/** /**
* Created by PhpStorm. * Created by PhpStorm.1
* User : zw * User : zw
* Date : 2018/5/30 * Date : 2018/5/30
* Time : 16:49 * Time : 16:49
...@@ -725,4 +725,205 @@ class User extends Basic ...@@ -725,4 +725,205 @@ 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" => 187,
"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){
return $this->response("200", "success!", $result);
}else{
return $this->response("101", $result["msg"]);
}
}
/**客户动态
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function userLog(){
$params = $this->params;
/* $params = array(
"user_id" => 828,
"type" => 1,
);*/
if (!isset($params['user_id']) || !isset($params['type'])) {
return $this->response("101", "参数不全");
}
$user_id = $params['user_id'];
$type = $params['type'];
$result = $this->userLogService->userLog($user_id,$this->siteId,$type);
if(count($result) > 0){
return $this->response("200", "success!", $result);
}else{
return $this->response("200", "请求数据为空");
}
}
/**
* 电话跟进
* @return \think\Response
*/
public function followUpLog(){
$params = $this->params;
/* $params = array(
"user_id" => 828,
"page_no" => 1,
"page_size" => 15
);*/
if (!isset($params['user_id'])) {
return $this->response("101", "参数不全");
}
$user_id = $params['user_id'];
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->userLogService->phoneFollowUp($user_id,$this->siteId,$pageNo,$pageSize);
if(count($result) > 0){
return $this->response("200", "success!", $result);
}else{
return $this->response("200", "请求数据为空");
}
}
/**
* 客户详情-详细信息-
* @return \think\Response
*/
public function userDetailFull()
{
$params = $this->params;
/*$params = array(
"user_id" => 187,
"agent_id" => 1,
);*/
if (!isset($params['user_id']) || !isset($params['agent_id'])) {
return $this->response("101", "参数不全");
}
//简易客户详情
$result['user_detail'] = $this->userLogService->userDetailFull($params['user_id'],$params['agent_id']);
$m_records = new GOperatingRecords();
//客方修改日志
$param_['user_id'] = $params['user_id'];
$param_['type'] = 3;
$result['user_history'] = $m_records->user_history($param_);
//邀请人修改日志
$param_['type'] = 5;
$result['user_invite_history'] = $m_records->user_history($param_);
if($result){
return $this->response("200", "success!", $result);
}else{
return $this->response("101", $result["msg"]);
}
}
/**
* 新增关联客户
* @return \think\Response
*/
public function addUserBind()
{
if (empty($this->params['user_id']) OR empty($this->params['bind_id'])) {
return $this->response(101, '参数错误');
}
$s_index_user = new UserService();
//新增
$add_res = $s_index_user->addUserBind($this->params['user_id'],$this->params['bind_id']);
switch ($add_res) {
case 1 :
return $this->response("300", "参数不全");
break;
case 2 :
return $this->response("300", "当前客户已经存在绑定关系");
break;
case 3 :
return $this->response("300", "当前客户已经存在绑定关系");
break;
case 4 :
return $this->response("300", "绑定客户关系数超限");
break;
case 5 :
return $this->response("300", "绑定失败");
break;
case 6 :
return $this->response("300", "不得绑定自己");
break;
case 0 :
return $this->response("200", "绑定成功");
break;
default :
return $this->response("300", "绑定失败");
}
}
/**
* 客户关联解绑
* @return \think\Response
*/
public function removeUserBind()
{
if (empty($this->params['user_id'])) {
return $this->response(101, '参数错误');
}
//解除
$s_index_user = new UserService();
$rm_res = $s_index_user->removeUserBind($this->params['user_id'],$this->agentId);
switch ($rm_res) {
case 1 :
return $this->response("300", "操作人不是客方");
break;
case 2 :
return $this->response("300", "无解除关联权限权限");
break;
case 3 :
return $this->response("300", "主账号不允许此操作!");
break;
case 0 :
return $this->response("200", "解绑成功");
break;
default :
return $this->response("300", "解绑失败");
}
}
} }
\ 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