Commit 6ee57396 authored by zw's avatar zw

Merge branch 'test' into 0102-v3.0.4

# Conflicts: # application/api_broker/controller/User.php # application/index/extend/Basic.php # application/index/service/UserLogService.php # application/model/Users.php # public/resource/js/RemarkFollowIndex.js # public/resource/js/user.js
parents 63de59f2 31fecada
No preview for this file type
No preview for this file type
...@@ -28,8 +28,10 @@ use app\model\Evaluate; ...@@ -28,8 +28,10 @@ use app\model\Evaluate;
use app\model\GOperatingRecords; use app\model\GOperatingRecords;
use app\model\NoteLog; use app\model\NoteLog;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use app\model\Users; use app\model\Users;
use app\task\controller\FollowUpTask;
use think\Exception; use think\Exception;
use think\Log; use think\Log;
use think\Request; use think\Request;
...@@ -345,17 +347,19 @@ class Broker extends Basic ...@@ -345,17 +347,19 @@ class Broker extends Basic
$params['user_status']='1';//0电话跟进 1普通跟进*/ $params['user_status']='1';//0电话跟进 1普通跟进*/
$checkResult = $this->validate($params, "BrokerValidate.verifyStatus"); $checkResult = $this->validate($params, "BrokerValidate.add_phone_follow_up_verify");
if (true !== $checkResult) { if (true !== $checkResult) {
return $this->response("300", $checkResult); return $this->response("300", $checkResult);
} }
$user_id = $params['user_id']; $user_id = $params['user_id'];
$user_status = $params['user_status']; $user_status = $params['user_status'];
$Users = new Users(); $Users = new Users();
$UPhoneFollowPp = new UPhoneFollowPp($this->siteId); // $s_phone_follow_up = new UPhoneFollowUp($this->siteId);
$result = $UPhoneFollowPp->savePhoneFollow($params); $s_phone_follow_up = new UPhoneFollowUpTemporary($this->siteId);
$result = $s_phone_follow_up->savePhoneFollow($params);
if ($result > 0) { if ($result > 0) {
//跟进,对客户状态进行更新 0:求租;1:已租;-1:无效 //跟进,对客户状态进行更新 0:求租;1:已租;-1:无效
......
...@@ -6,8 +6,8 @@ use app\api_broker\extend\Basic; ...@@ -6,8 +6,8 @@ use app\api_broker\extend\Basic;
use app\index\service\UserService; use app\index\service\UserService;
use app\model\AAgents; use app\model\AAgents;
use app\model\ULabels; use app\model\ULabels;
use app\model\UPhoneFollowUp;
use app\model\Users; use app\model\Users;
use app\model\UPhoneFollowPp;
use app\api_broker\service\VipService; use app\api_broker\service\VipService;
/** /**
...@@ -171,7 +171,7 @@ class Client extends Basic ...@@ -171,7 +171,7 @@ class Client extends Basic
*/ */
public function agentUserFollow(){ public function agentUserFollow(){
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$table= new UPhoneFollowPp($this->siteId); $table= new UPhoneFollowUp($this->siteId);
$data['msg'] = ''; $data['msg'] = '';
$params = $this->request->param(); $params = $this->request->param();
$time=date("Y-m-d H:i:s",time());//当前时间 $time=date("Y-m-d H:i:s",time());//当前时间
...@@ -283,9 +283,9 @@ class Client extends Basic ...@@ -283,9 +283,9 @@ class Client extends Basic
$total = $user->all_user_count($conditions); $total = $user->all_user_count($conditions);
}else{ }else{
//跟进 //跟进
$UPhoneFollowPp = new UPhoneFollowPp($this->siteId); $s_phone_follow_up = new UPhoneFollowUp($this->siteId);
$user_res = $UPhoneFollowPp->all_user_search($phone_or_name,$pagesize,$pagenum); $user_res = $s_phone_follow_up->all_user_search($phone_or_name,$pagesize,$pagenum);
$total = $UPhoneFollowPp->all_user_search_count($phone_or_name); $total = $s_phone_follow_up->all_user_search_count($phone_or_name);
} }
if($search_type!='2') if($search_type!='2')
......
...@@ -10,7 +10,9 @@ use app\extra\RedisExt; ...@@ -10,7 +10,9 @@ use app\extra\RedisExt;
use app\model\AAgents; use app\model\AAgents;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesFollowUp; use app\model\GHousesFollowUp;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use app\task\controller\FollowUpTask;
use think\Log; use think\Log;
use think\Request; use think\Request;
...@@ -26,12 +28,14 @@ class HomePageLog extends Basic ...@@ -26,12 +28,14 @@ class HomePageLog extends Basic
private $uPhoneFollowUpModel; private $uPhoneFollowUpModel;
private $gHouseFollowUpModel; private $gHouseFollowUpModel;
private $phoneFollowUpTemporary;
function __construct(Request $request = null) function __construct(Request $request = null)
{ {
parent::__construct($request); parent::__construct($request);
$this->uPhoneFollowUpModel = new UPhoneFollowPp($this->siteId); $this->uPhoneFollowUpModel = new UPhoneFollowUp( $this->siteId);
$this->gHouseFollowUpModel = new GHousesFollowUp(); $this->gHouseFollowUpModel = new GHousesFollowUp();
$this->phoneFollowUpTemporary = new UPhoneFollowUpTemporary( $this->siteId);
} }
/** /**
...@@ -44,16 +48,14 @@ class HomePageLog extends Basic ...@@ -44,16 +48,14 @@ class HomePageLog extends Basic
public function userFollowUpList() public function userFollowUpList()
{ {
$params = $this->params; $params = $this->params;
Log::write($params, 'userFollowUpList'); //记录日志 /* $params = array(
/*$params = array( "start_time" => strtotime('2018-08-14 15:47:36'), //开始时间
"start_time" => strtotime('2016-08-14 15:47:36'), //开始时间 "end_time" => strtotime('2019-01-10 15:47:36'), //结束时间
"end_time" => strtotime('2018-08-14 15:47:36'), //结束时间 //"name_or_phone" => "18112347151",//用户姓名或电话 经纪人
"name_or_phone" => "18112347151",//用户姓名或电话 经纪人
"search_content" => "",// 搜索跟进内容 "search_content" => "",// 搜索跟进内容
"pageNo" => 1, "pageNo" => 1,
"pageSize" => 15 "pageSize" => 15
);*/ );*/
$vrs = new VerifyRepetitionService(); $vrs = new VerifyRepetitionService();
$is_check = $vrs->followUpClick($this->agentId); $is_check = $vrs->followUpClick($this->agentId);
if($params["pageNo"] == 1 && !$is_check){ if($params["pageNo"] == 1 && !$is_check){
...@@ -69,19 +71,24 @@ class HomePageLog extends Basic ...@@ -69,19 +71,24 @@ class HomePageLog extends Basic
if (empty($params['start_time']) || empty($params['end_time'])) { if (empty($params['start_time']) || empty($params['end_time'])) {
return $this->response("101", '请选择时间'); return $this->response("101", '请选择时间');
} }
$start_time = date("Y-m-d H:i:s", $params["start_time"]);
$end_time = date("Y-m-d H:i:s", $params["end_time"]);
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$field = "f.id,f.user_id,f.agent_id,f.type,f.content,f.create_time,f.user_status"; $field = "id,user_id,agent_id,type,content,create_time,user_status";
$where_ = []; $where_ = [];
$where = ' 1=1 ';
if (!empty($params["search_content"])) { if (!empty($params["search_content"])) {
$where_["f.content"] = array( "like", "%" . trim($params['search_content']) . "%" ); $search_content = trim($params['search_content']);
$where_["content"] = array( "like", "%" . $search_content . "%" );
$where .= " AND content LIKE '%$search_content%'";
} }
if (!empty($params["start_time"]) && !empty($params["end_time"])) { if (!empty($params["start_time"]) && !empty($params["end_time"])) {
$start_time = date("Y-m-d H:i:s", $params["start_time"]);
$end_time = date("Y-m-d H:i:s", $params["end_time"]); $where_["create_time"] = array( 'between', array( $start_time, $end_time ) );
$where_["f.create_time"] = array( 'between', array( $start_time, $end_time ) ); $where .= ' AND create_time BETWEEN "'.$start_time.'" AND "'.$end_time .'"';
} }
if (!empty($params["name_or_phone"])) { if (!empty($params["name_or_phone"])) {
...@@ -97,17 +104,20 @@ class HomePageLog extends Basic ...@@ -97,17 +104,20 @@ class HomePageLog extends Basic
$model = new AAgents(); $model = new AAgents();
$res_a = $model->getAgentsIdsArray($agent_field, $agent_params); $res_a = $model->getAgentsIdsArray($agent_field, $agent_params);
if ($res_a) { if ($res_a) {
$where_["f.agent_id"] = [ 'in', $res_a ]; $where_["agent_id"] = [ 'in', $res_a ];
$where .= " AND agent_id in ($res_a)";
} else { } else {
return $this->response("200", "request null"); return $this->response("200", "request null");
} }
} }
//$where_["f.city"] = trim($this->city) ? trim($this->city) : '上海市'; $date = date("Y-m-d", time());
if ($start_time >= $date && $start_time <= $date . " 23:59:59" ) {
$order = "f.id desc"; big_log(json_encode($where_));
$result = $this->phoneFollowUpTemporary->getFollowList($pageNo, $pageSize, $order_ = 'id desc', $field, $where_);
$result = $this->uPhoneFollowUpModel->getSearch($pageNo, $pageSize, $order, $field, [], $where_, ""); } else {
$result = $this->uPhoneFollowUpModel->getFollowList($pageNo, $pageSize, 'id desc',$field, $where);
}
$clientService = new ClientService(); $clientService = new ClientService();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
$agent_params = []; $agent_params = [];
......
...@@ -7,12 +7,12 @@ use app\api_broker\service\CallPhoneService; ...@@ -7,12 +7,12 @@ 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\GOperatingRecords; use app\model\GOperatingRecords;
use app\model\ULabels; use app\model\ULabels;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowPp;
use app\model\UPhoneFollowUp;
use app\model\Users; use app\model\Users;
use think\Log; use think\Log;
use think\Request; use think\Request;
...@@ -663,7 +663,7 @@ class User extends Basic ...@@ -663,7 +663,7 @@ class User extends Basic
$field = 'a.id,a.user_id,b.user_nick,b.user_nick,b.agent_id,b.vip,b.create_time'; $field = 'a.id,a.user_id,b.user_nick,b.user_nick,b.agent_id,b.vip,b.create_time';
$model = new UPhoneFollowPp($this->siteId); $model = new UPhoneFollowUp($this->siteId);
$model_res = $model->getLastOrNextUserIDPhoneFollowP($where, $field, $limit = 1, $order); $model_res = $model->getLastOrNextUserIDPhoneFollowP($where, $field, $limit = 1, $order);
if (!$model_res) { if (!$model_res) {
...@@ -724,206 +724,4 @@ class User extends Basic ...@@ -724,206 +724,4 @@ 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
...@@ -15,7 +15,8 @@ use app\extra\RedisExt; ...@@ -15,7 +15,8 @@ use app\extra\RedisExt;
use app\model\AliYunPhone; use app\model\AliYunPhone;
use app\model\BindingPhone; use app\model\BindingPhone;
use app\model\SecretReport; use app\model\SecretReport;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use app\model\Users; use app\model\Users;
use think\Log; use think\Log;
...@@ -562,7 +563,7 @@ class CallPhoneService ...@@ -562,7 +563,7 @@ class CallPhoneService
if(empty($array[2])){ if(empty($array[2])){
$this->redis->hDel($user_key, $v); $this->redis->hDel($user_key, $v);
} else { } else {
$m_follow_up = new UPhoneFollowPp($array[2]); $m_follow_up = new UPhoneFollowUpTemporary($array[2]);
$num = $m_follow_up->getFollowTotal($follow_where); $num = $m_follow_up->getFollowTotal($follow_where);
if (empty($num) && !empty($array[1])) { if (empty($num) && !empty($array[1])) {
//$agent_id, $user_id, $content, $type //$agent_id, $user_id, $content, $type
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace app\api_broker\service; namespace app\api_broker\service;
use app\extra\RedisExt; use app\extra\RedisExt;
use app\model\UPhoneFollowPp;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
......
...@@ -467,7 +467,7 @@ class DailyPaperService ...@@ -467,7 +467,7 @@ class DailyPaperService
return ["code" => 101, "msg" => "经纪人信息错误"]; return ["code" => 101, "msg" => "经纪人信息错误"];
} }
//todo 判断是否提交过, //todo 判断是否提交过,
$dailyInfo = $this->getDailyInfo($agent_id,$daily_date); $dailyInfo = $this->getDailyInfo($agent_id,$daily_date,1);
if(count($dailyInfo) > 0 ){ if(count($dailyInfo) > 0 ){
return ["code" => 101, "msg" => "请勿重复提交日报"]; return ["code" => 101, "msg" => "请勿重复提交日报"];
} }
...@@ -600,17 +600,22 @@ class DailyPaperService ...@@ -600,17 +600,22 @@ class DailyPaperService
* 获取提交的日报记录 * 获取提交的日报记录
* @param $store_id * @param $store_id
* @param $daily_data * @param $daily_data
* @param $type
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
private function getDailyInfo($store_id, $daily_data) private function getDailyInfo($store_id, $daily_data,$type = 0)
{ {
$field_info_field = "id,agent_id,agent_name,daily_date,alipay,tenpay,realty_pay,family_pay,private_bank, $field_info_field = "id,agent_id,agent_name,daily_date,alipay,tenpay,realty_pay,family_pay,private_bank,
cash,pos,other_bank,status,create_time,update_time"; cash,pos,other_bank,status,create_time,update_time";
if($type == 1){
$daily_info_params["agent_id"] = $store_id;
}else{
$daily_info_params["store_id"] = $store_id; $daily_info_params["store_id"] = $store_id;
}
$daily_info_params["daily_date"] = $daily_data; $daily_info_params["daily_date"] = $daily_data;
return $this->oDailyModel->getDailyList($field_info_field, $daily_info_params, 1, 1); return $this->oDailyModel->getDailyList($field_info_field, $daily_info_params, 1, 1);
......
...@@ -18,7 +18,8 @@ use app\model\ORefundModel; ...@@ -18,7 +18,8 @@ use app\model\ORefundModel;
use app\model\OReportModel; use app\model\OReportModel;
use app\model\OTaxes; use app\model\OTaxes;
use app\model\Regions; use app\model\Regions;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use app\model\Users; use app\model\Users;
...@@ -752,12 +753,28 @@ class OrderLogService ...@@ -752,12 +753,28 @@ class OrderLogService
$oRefundModel = new ORefundModel(); $oRefundModel = new ORefundModel();
$oBargainModel = new OBargainModel(); $oBargainModel = new OBargainModel();
$uPhoneFollowModel = new UPhoneFollowPp($site_id); $uPhoneFollowModel = new UPhoneFollowUp($site_id);
$uPhoneFollowTempModel = new UPhoneFollowUpTemporary($site_id);
//电话跟进 //电话跟进
$userParams["user_id"] = $user_id; $userParams["user_id"] = $user_id;
$userParams["type"] = 0; //电话跟进 $userParams["type"] = 0; //电话跟进
$field_user_follow = "a.id,a.content,a.user_id,a.agent_id,a.type,a.create_time,a.user_status,b.name,b.phone,b.img,c.store_name"; $field_user_follow = "a.id,a.content,a.user_id,a.agent_id,a.type,a.create_time,a.user_status,b.name,b.phone,b.img,c.store_name";
$bargainData = $uPhoneFollowModel->getFollowUpListByUserId($field_user_follow, $userParams); $bargainData = $uPhoneFollowModel->getFollowUpListByUserId($field_user_follow, $userParams);
$bargainDataTemp = $uPhoneFollowTempModel->getFollowUpListByUserId($field_user_follow, $userParams);
if (count($bargainDataTemp) > 0) {
foreach ($bargainDataTemp as $k => $v) {
$type = "无效";
if ($v["user_status"] == 0) {
$type = "求租";
} elseif ($v["user_status"] == 1) {
$type = "已租";
}
$v["step_name"] = "phone_follow_up";
$v["step"] = "电话跟进:" . $v['content'] . "【" . $type . "】";
$result[$sort++] = $v;
}
}
if (count($bargainData) > 0) { if (count($bargainData) > 0) {
foreach ($bargainData as $k => $v) { foreach ($bargainData as $k => $v) {
$type = "无效"; $type = "无效";
...@@ -775,6 +792,21 @@ class OrderLogService ...@@ -775,6 +792,21 @@ class OrderLogService
//跟进 //跟进
$userParams["type"] = 1; //普通跟进 $userParams["type"] = 1; //普通跟进
$bargainData = $uPhoneFollowModel->getFollowUpListByUserId($field_user_follow, $userParams); $bargainData = $uPhoneFollowModel->getFollowUpListByUserId($field_user_follow, $userParams);
$bargainDataTemp = $uPhoneFollowTempModel->getFollowUpListByUserId($field_user_follow, $userParams);
if (count($bargainDataTemp) > 0) {
foreach ($bargainDataTemp as $k => $v) {
$type = "无效";
if ($v["user_status"] == 0) {
$type = "求租";
} elseif ($v["user_status"] == 1) {
$type = "已租";
}
$v["step_name"] = "follow_up";
$v["step"] = "跟进:" . $v['content'] . "【" . $type . "】";
$result[$sort++] = $v;
}
}
if (count($bargainData) > 0) { if (count($bargainData) > 0) {
foreach ($bargainData as $k => $v) { foreach ($bargainData as $k => $v) {
$type = "无效"; $type = "无效";
......
...@@ -12,7 +12,7 @@ use app\model\OMarchInModel; ...@@ -12,7 +12,7 @@ use app\model\OMarchInModel;
use app\model\OPayLogModel; use app\model\OPayLogModel;
use app\model\OReportModel; use app\model\OReportModel;
use app\model\TAgentTotalModel; use app\model\TAgentTotalModel;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\Users; use app\model\Users;
use think\Log; use think\Log;
...@@ -759,7 +759,7 @@ class PerformanceService ...@@ -759,7 +759,7 @@ class PerformanceService
} }
$addUserList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]); $addUserList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
$follow = new UPhoneFollowPp($site_id); $follow = new UPhoneFollowUp($site_id);
$res = $follow->getLastPhoneFollowTime($val['id']); $res = $follow->getLastPhoneFollowTime($val['id']);
$addUserList[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!'; $addUserList[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!';
...@@ -856,7 +856,7 @@ class PerformanceService ...@@ -856,7 +856,7 @@ class PerformanceService
$list = $this->agentModel->searchAgentsByKeywordPcInfo($field, $params, $page_size, $page_no); $list = $this->agentModel->searchAgentsByKeywordPcInfo($field, $params, $page_size, $page_no);
foreach ($list as $key => $val) { foreach ($list as $key => $val) {
$follow = new UPhoneFollowPp($site_id); $follow = new UPhoneFollowUp($site_id);
$res = $follow->getLastPhoneFollowTime($val['id']); $res = $follow->getLastPhoneFollowTime($val['id']);
$list[$key]["user_name"] = $val["user_name"] ? $val["user_name"] : ''; $list[$key]["user_name"] = $val["user_name"] ? $val["user_name"] : '';
$list[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!'; $list[$key]["last_phone_follow_time"] = $res[0]['create_time'] ? $res[0]['create_time'] : '暂无!';
......
...@@ -164,7 +164,7 @@ class StatementService ...@@ -164,7 +164,7 @@ class StatementService
$where_["agent_id"] = array( "in", $agentIds ); $where_["agent_id"] = array( "in", $agentIds );
} }
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) ); $where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$where_['status'] =array( "in", '10, 11, 13, 20' ); $where_['status'] =array( "in", '10, 11, 13' );
// $obargain = new OBargainModel(); // $obargain = new OBargainModel();
$performanceSum = $this->bargainModel->getAddBargainNum($where_, 1);//1表示业绩 2表示实收 $performanceSum = $this->bargainModel->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
......
...@@ -13,7 +13,8 @@ use app\api_broker\service\PushMessageService; ...@@ -13,7 +13,8 @@ use app\api_broker\service\PushMessageService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\model\AAgents; use app\model\AAgents;
use app\model\SecretReport; use app\model\SecretReport;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use app\model\Users; use app\model\Users;
use app\model\TAgentTotalCallModel; use app\model\TAgentTotalCallModel;
...@@ -92,7 +93,8 @@ class CellPhone extends Basic ...@@ -92,7 +93,8 @@ class CellPhone extends Basic
$list = $report->getCallList($pageNo, $pageSize, 'id desc', $field, $where); $list = $report->getCallList($pageNo, $pageSize, 'id desc', $field, $where);
$m_user = new Users(); $m_user = new Users();
$m_phone_follow = new UPhoneFollowPp($this->siteId); $m_phone_follow = new UPhoneFollowUp($this->siteId);
$m_phone_follow_temp = new UPhoneFollowUpTemporary($this->siteId);
$m_agent = new AAgents(); $m_agent = new AAgents();
foreach ($list as $k => $v) { foreach ($list as $k => $v) {
if (empty($v['agents_id'])) { if (empty($v['agents_id'])) {
...@@ -142,7 +144,10 @@ class CellPhone extends Basic ...@@ -142,7 +144,10 @@ class CellPhone extends Basic
$where_follow['user_id'] = $v['users_id']; $where_follow['user_id'] = $v['users_id'];
$where_follow['type'] = 0; $where_follow['type'] = 0;
$where_follow['agent_id'] = $v['agents_id']; $where_follow['agent_id'] = $v['agents_id'];
$result[$k]['content'] = $m_phone_follow_temp->getUserFollowKey('content', $where_follow, 'id DESC');
if (empty($result[$k]['content'])) {
$result[$k]['content'] = $m_phone_follow->getUserFollowKey('content', $where_follow, 'id DESC'); $result[$k]['content'] = $m_phone_follow->getUserFollowKey('content', $where_follow, 'id DESC');
}
} else { } else {
$result[$k]['user_nick'] = ""; $result[$k]['user_nick'] = "";
$result[$k]['content'] = ""; $result[$k]['content'] = "";
......
...@@ -13,7 +13,8 @@ use app\index\extend\Basic; ...@@ -13,7 +13,8 @@ use app\index\extend\Basic;
use app\model\FollowUp; use app\model\FollowUp;
use app\model\GLabels; use app\model\GLabels;
use app\model\ULabels; use app\model\ULabels;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use think\Session; use think\Session;
class Label extends Basic class Label extends Basic
...@@ -162,8 +163,12 @@ class Label extends Basic ...@@ -162,8 +163,12 @@ class Label extends Basic
if (empty($this->params['user_id'])) { if (empty($this->params['user_id'])) {
return $this->response(101, '没有用户信息'); return $this->response(101, '没有用户信息');
} }
$follow = new UPhoneFollowPp($this->siteId); $follow_temp = new UPhoneFollowUpTemporary($this->siteId);
$user_status = $follow_temp->getUserFollowKey('user_status', ['user_id'=>$this->params['user_id']], 'id DESC');
if (empty($user_status)) {
$follow = new UPhoneFollowUp($this->siteId);
$user_status = $follow->getUserFollowKey('user_status', ['user_id'=>$this->params['user_id']], 'id DESC'); $user_status = $follow->getUserFollowKey('user_status', ['user_id'=>$this->params['user_id']], 'id DESC');
}
return $this->response(200, '', $user_status); return $this->response(200, '', $user_status);
} }
......
...@@ -11,8 +11,10 @@ use app\index\service\UserService; ...@@ -11,8 +11,10 @@ use app\index\service\UserService;
use app\model\AAgents; use app\model\AAgents;
use app\model\ACollectUser; use app\model\ACollectUser;
use app\model\GOperatingRecords; use app\model\GOperatingRecords;
use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use app\model\Users; use app\model\Users;
use app\model\UPhoneFollowPp; use app\task\controller\FollowUpTask;
use think\Log; use think\Log;
use think\Request; use think\Request;
use think\session; use think\session;
...@@ -437,8 +439,10 @@ class Member extends Basic{ ...@@ -437,8 +439,10 @@ class Member extends Basic{
$params['agent_id'] = Session::get("user_info.id"); $params['agent_id'] = Session::get("user_info.id");
$params['type'] = 1; $params['type'] = 1;
$params['user_status'] = $params['user_status']; $params['user_status'] = $params['user_status'];
$model = new UPhoneFollowPp($this->siteId); // $model = new UPhoneFollowUp($this->siteId);
$result = $model->savePhoneFollow($params); $s_phone_follow_up = new UPhoneFollowUpTemporary($this->siteId);
$result = $s_phone_follow_up->savePhoneFollow($params);
$user = new Users(); $user = new Users();
$user->update_user_status(['id'=>$params['user_id'],'user_status'=>$params['user_status']]); $user->update_user_status(['id'=>$params['user_id'],'user_status'=>$params['user_status']]);
......
...@@ -13,6 +13,7 @@ use app\api_broker\service\ClientService; ...@@ -13,6 +13,7 @@ use app\api_broker\service\ClientService;
use app\extra\RedisExt; use app\extra\RedisExt;
use app\api_broker\service\VerifyRepetitionService; use app\api_broker\service\VerifyRepetitionService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\index\service\PhoneFollowUpService;
use app\index\service\UserService; use app\index\service\UserService;
use app\model\AAgents; use app\model\AAgents;
use app\model\AAgentsPhone; use app\model\AAgentsPhone;
...@@ -20,7 +21,7 @@ use app\model\ASite; ...@@ -20,7 +21,7 @@ use app\model\ASite;
use app\model\GOperatingRecords; use app\model\GOperatingRecords;
use app\model\Remarks; use app\model\Remarks;
use app\model\ULabels; use app\model\ULabels;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\Users; use app\model\Users;
class Remark extends Basic class Remark extends Basic
...@@ -49,7 +50,7 @@ class Remark extends Basic ...@@ -49,7 +50,7 @@ class Remark extends Basic
return $this->response("101", $msg); return $this->response("101", $msg);
} }
$u_phone_follow = new UPhoneFollowPp($this->siteId); $u_phone_follow = new UPhoneFollowUp($this->siteId);
$user_service = new UserService(); $user_service = new UserService();
$clientService = new ClientService(); $clientService = new ClientService();
$m_agent_phone = new AAgentsPhone(); $m_agent_phone = new AAgentsPhone();
...@@ -166,6 +167,84 @@ class Remark extends Basic ...@@ -166,6 +167,84 @@ class Remark extends Basic
return $this->response(200, '成功', $data); return $this->response(200, '成功', $data);
} }
/**
* 跟进列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function followUpListV2()
{
if (!$this->request->isAjax()) {
return view('remark_follow_index');
}
$m_user = new Users();
$m_label = new ULabels();
$m_agent = new AAgents();
$code = 200;
$msg = '';
$follow_up_service = new PhoneFollowUpService($this->siteId);
$where = $list = [];
$where['page_no'] = $this->params['pageNo'];
$where['page_size'] = $this->params['pageSize'];
if (!empty($this->params['user_id'])) {
$where['user_id'] = (int)$this->params['user_id'];
}
if (!empty($this->params['agent_id'])) {
$where['agent_id'] = (int)$this->params['agent_id'];
}
if (!empty($this->params['content'])) {
$where['content'] = $this->params['content'];
}
if (!empty($this->params['remark_store_id'])) {
$where['store_id'] = (int)$this->params['remark_store_id'];
}
if (!empty($this->params['remark_district_id'])) {
$where['district_id'] = (int)$this->params['remark_district_id'];
}
$result_data = $follow_up_service->getPhoneFollowList($this->params['start_date'], $this->params['end_date'], $where, $this->userId);
$label_data = $m_label->getColumn('id,name', ['type'=>1]); //获取标签
if ($result_data['code'] == 200) {
if (!empty($result_data['data'])) {
foreach ($result_data['data'] as $k => $v) {
if (!empty($v['user_id'])) {
$user_data = $m_user->getUserById('user_name,user_phone,vip,agent_id,create_time', $v['user_id']);
$list[$k]['user_name'] = $user_data['user_name'];
$list[$k]['user_phone'] = $user_data['user_phone'];
$list[$k]['u_create_time'] = $user_data['create_time'];
$list[$k]['vip'] = $user_data['vip'];
$list[$k]['agent_id'] = $user_data['agent_id']; //客户客方
}
$list[$k]['user_phone'] = substr_replace($list[$k]['user_phone'], '****', 3, 4);
$list[$k]['admin'] = $m_agent->getAgentsById($v['agent_id'], 'name');
$list[$k]['label_name'] = array_key_exists($v['labels_id'], $label_data) ? $label_data[$v['labels_id']] : '';
$list[$k]['is_outstrip_twenty_four_hours'] = $v['is_outstrip_twenty_four_hours'];
$list[$k]['is_outpace_call_num'] = $v['is_outpace_call_num'];
$list[$k]['create_time'] = $v['create_time'];
$list[$k]['user_id'] = $v['user_id'];
$list[$k]['content'] = $v['content'];
$list[$k]['user_status'] = $v['user_status'];
$list[$k]['id'] = $v['id'];
}
}
} else {
$msg = $result_data['data'];
$code = 101;
$list = [];
}
$data['data']['list'] = $list;
$data['data']['total'] = 40000;
return $this->response($code, $msg, $data);
}
/** /**
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
...@@ -214,22 +293,22 @@ class Remark extends Basic ...@@ -214,22 +293,22 @@ class Remark extends Basic
$pagesize = 15; $pagesize = 15;
$user_id = $params['user_id']; $user_id = $params['user_id'];
$UPhoneFollowPp = new UPhoneFollowPp($this->siteId); $s_phone_follow_up = new UPhoneFollowUp($this->siteId);
// 查询电话跟进数据 // 查询电话跟进数据
$UPhoneFollowPp_res = $UPhoneFollowPp->select_useraction_search($user_id, $searchdate); $s_phone_follow_up_res = $s_phone_follow_up->select_useraction_search($user_id, $searchdate);
foreach ($UPhoneFollowPp_res as $k => $v) { foreach ($s_phone_follow_up_res as $k => $v) {
$table = new AAgents(); $table = new AAgents();
$Agents_res = $table->Agents_res($v['agent_id']); $Agents_res = $table->Agents_res($v['agent_id']);
$UPhoneFollowPp_res[$k]['agentinfo'] = $Agents_res ? $Agents_res['store_name'] . '-' . $Agents_res['name'] : '未知'; $s_phone_follow_up_res[$k]['agentinfo'] = $Agents_res ? $Agents_res['store_name'] . '-' . $Agents_res['name'] : '未知';
$UPhoneFollowPp_res[$k]['user_pic'] = AGENTHEADERIMGURL . $Agents_res['img']; $s_phone_follow_up_res[$k]['user_pic'] = AGENTHEADERIMGURL . $Agents_res['img'];
$UPhoneFollowPp_res[$k]['label'] = ''; $s_phone_follow_up_res[$k]['label'] = '';
//电话跟进标签 //电话跟进标签
if ($v['labels_id']) { if ($v['labels_id']) {
$table = new ULabels(); $table = new ULabels();
$table_res = $table->get_labelsname($v['labels_id']); $table_res = $table->get_labelsname($v['labels_id']);
$UPhoneFollowPp_res[$k]['label'] = $table_res[0]['name']; $s_phone_follow_up_res[$k]['label'] = $table_res[0]['name'];
} }
} }
...@@ -324,7 +403,7 @@ class Remark extends Basic ...@@ -324,7 +403,7 @@ class Remark extends Basic
return $this->response("200", "success!", [ return $this->response("200", "success!", [
'user_info' => $user_res, 'user_info' => $user_res,
'user_date' => $UPhoneFollowPp_res, 'user_date' => $s_phone_follow_up_res,
'user_history' => $records_result, 'user_history' => $records_result,
'user_invite_history' => $records_invite_result, 'user_invite_history' => $records_invite_result,
'user_invite_info' => $user_invite_info, 'user_invite_info' => $user_invite_info,
...@@ -343,12 +422,12 @@ class Remark extends Basic ...@@ -343,12 +422,12 @@ class Remark extends Basic
$page_num = isset($params['pagenum']) ? $params['pagenum'] : 1; $page_num = isset($params['pagenum']) ? $params['pagenum'] : 1;
$page_size = 15; $page_size = 15;
$UPhoneFollowPp = new UPhoneFollowPp($this->siteId); $s_phone_follow_up = new UPhoneFollowUp($this->siteId);
// 查询电话跟进数据 // 查询电话跟进数据
$UPhoneFollowPp_res = $UPhoneFollowPp->phone_up_list($page_size, $page_num); $s_phone_follow_up_res = $s_phone_follow_up->phone_up_list($page_size, $page_num);
$total = $UPhoneFollowPp->phone_up_list_count(); $total = $s_phone_follow_up->phone_up_list_count();
$total = intval($total / $page_size) + (($total % $page_size == 0) ? 0 : 1); $total = intval($total / $page_size) + (($total % $page_size == 0) ? 0 : 1);
return $this->response("200", "success!", [ 'user_date' => $UPhoneFollowPp_res, 'pagenum' => $pagenum, 'total' => $total ]); return $this->response("200", "success!", [ 'user_date' => $s_phone_follow_up_res, 'pagenum' => $pagenum, 'total' => $total ]);
} }
......
...@@ -83,6 +83,34 @@ class UserLog extends Basic{ ...@@ -83,6 +83,34 @@ class UserLog extends Basic{
} }
/**
* 电话跟进
* @return \think\Response
*/
public function followUpLogNew(){
$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->service_->phoneFollowUpNew($user_id,$this->siteId,$pageNo,$pageSize);
if(count($result) > 0){
return $this->response("200", "success!", $result);
}else{
return $this->response("101", "请求数据为空");
}
}
/** /**
* 电话跟进 * 电话跟进
* @return \think\Response * @return \think\Response
......
...@@ -68,6 +68,10 @@ class Basic extends Controller ...@@ -68,6 +68,10 @@ class Basic extends Controller
'index/yindaoIos', 'index/yindaoIos',
'index/getUserMacAddress', 'index/getUserMacAddress',
'index/getConfigWeek', 'index/getConfigWeek',
'index/followUpLogNew',
'index/followUpLog',
'index/userLog',
'index/userDetail',
'index/getSystemMessageByUser', 'index/getSystemMessageByUser',
'index/userModalList', 'index/userModalList',
'index/mainIndex' 'index/mainIndex'
......
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/1/10
* Time: 13:51
*/
namespace app\index\service;
use app\api_broker\service\VerifyRepetitionService;
use app\model\AAgents;
use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use app\model\Users;
use app\task\controller\FollowUpTask;
class PhoneFollowUpService
{
private $phoneFollowUp;
private $phoneFollowUpTemporary;
private $siteId;
public function __construct($site_id)
{
$this->siteId = $site_id;
$this->phoneFollowUp = new UPhoneFollowUp($site_id);
$this->phoneFollowUpTemporary = new UPhoneFollowUpTemporary($site_id);
}
/**
* @param string $start_time
* @param string $end_time
* @param array $params
* @param string $field
* @param $agent_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getPhoneFollowList(string $start_time, string $end_time, array $params, $agent_id, $field = 'id,user_id,create_time,content,user_status,labels_id,agent_id')
{
$vrs = new VerifyRepetitionService();
$page_no = isset($params['page_no']) ? $params['page_no'] : 1;
$page_size = isset($params['page_size']) ? $params['page_size'] : 15;
$is_check = $vrs->followUpClick($agent_id);
if($page_no == 1 && !$is_check){
$is_bool = $vrs->getCurrTimeSection();
$msg = "请勿频繁请求";
if($is_bool) {
$msg = "高峰期间每10秒钟只能搜索一次(6.30-8.30)";
}
return ['code'=>'101','data'=>$msg];
}
$where = ' 1=1 ';
if (empty($start_time) || empty($end_time)) {
return ['code'=>'101','data'=>'时间不能为空'];
} else {
$where .= ' AND create_time BETWEEN "'.$start_time.' 00:00:00" AND "'.$end_time. ' 23:59:59"';
}
$data = [];
if (isset($params['user_id'])) {
$where .= " AND user_id= {$params['user_id']}";
}
if (isset($params['agent_id'])) {
$where .= " AND agent_id = {$params['agent_id']}";
}
if (!empty($params['store_id'])) {
$agent_where['store_id'] = $params['store_id'];
}
if (!empty($params['district_id'])) {
$agent_where['district_id'] = $params['district_id'];
}
if (!empty($params['content'])) {
$params['content'] = trim($params['content']);
$where .= " AND content LIKE '%{$params['content']}%'";
}
if (!empty($agent_where)) {
$m_agent = new AAgents();
$agent_id = $m_agent->getAgentsByWhereColumn($agent_where, 'id');
if (empty($agent_id)) {
return ['code'=>'101','data'=>'暂无数据'];
} else {
$agent_id_string = implode(',', $agent_id);
$where .= " AND agent_id in ({$agent_id_string})";
}
}
$date = date("Y-m-d", time());
// if ($end_time < $date && $end_time < $date . " 23:59:59" ) {
if ($end_time == $date && $start_time == $date) {
$data = $this->phoneFollowUpTemporary->getFollowList($page_no, $page_size, $order_ = 'id desc', $field, $where);
} else {
$data = $this->phoneFollowUp->getFollowList($page_no, $page_size, $order_ = 'id desc', $field, $where);
}
// else {
// $data = $this->phoneFollowUpTemporary->getFollowListV3($this->siteId,$page_no, $page_size, $where, $field);
// }
$s_user_service = new UserService();
$s_user_Log_service = new UserLogService();
$m_user = new Users();
foreach ($data as $k => $v) {
#客户是否在保护期内(0:保护器内 1:超过保护期)
$data[$k]['is_outstrip_twenty_four_hours'] = $s_user_service->isUserProtect($v['user_id']);
#判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定(0允许拨打 1不允许拨打)
$user_res = $m_user->verifyUser('user_name,user_phone', '', [ 'id' => $v['user_id'] ]);
$data[$k]['is_outpace_call_num'] = $s_user_Log_service->userDetailIsOutpaceCallNum($v['user_id'],$user_res['user_phone'], $agent_id);
}
return ['code'=>'200','data'=>$data];
}
}
\ No newline at end of file
...@@ -11,7 +11,8 @@ use app\model\ACollectUser; ...@@ -11,7 +11,8 @@ use app\model\ACollectUser;
use app\model\ASite; use app\model\ASite;
use app\model\GOperatingRecords; use app\model\GOperatingRecords;
use app\model\OReportModel; use app\model\OReportModel;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use app\model\Users; use app\model\Users;
/** /**
...@@ -56,6 +57,8 @@ class UserLogService ...@@ -56,6 +57,8 @@ class UserLogService
} }
$user_arr['user_pic'] = HEADERIMGURL . $user_arr['user_pic']; $user_arr['user_pic'] = HEADERIMGURL . $user_arr['user_pic'];
$user_arr['user_phone'] = substr_replace($user_arr['user_phone'], '****', 3, 4);
$agents_arr = $this->agentModel->verifyUser('name,phone', '', ['id' => $user_arr['agent_id']]); $agents_arr = $this->agentModel->verifyUser('name,phone', '', ['id' => $user_arr['agent_id']]);
$user_arr['agent_info'] = $agents_arr ? $agents_arr['name'] . '-' . $agents_arr['phone'] : '未知'; $user_arr['agent_info'] = $agents_arr ? $agents_arr['name'] . '-' . $agents_arr['phone'] : '未知';
...@@ -200,14 +203,27 @@ class UserLogService ...@@ -200,14 +203,27 @@ class UserLogService
* @param $page_no * @param $page_no
* @param $page_size * @param $page_size
*/ */
public function phoneFollowUpNew($user_id, $site_id, $page_no, $page_size)
{
// $userParams["type"] = 0; //电话跟进 $userParams["type"] = 1; //普通跟进
$uPhoneFollowTempModel = new UPhoneFollowUpTemporary($site_id);
//电话跟进
$userParams["user_id"] = $user_id;
$field_user_follow = "a.id,a.content,a.user_id,a.agent_id,a.type,a.create_time,a.user_status,b.name,b.phone,b.img";
$bargainData = $uPhoneFollowTempModel->getFollowUpList($field_user_follow, $userParams,$page_no,$page_size);
return $bargainData;
}
public function phoneFollowUp($user_id, $site_id, $page_no, $page_size) public function phoneFollowUp($user_id, $site_id, $page_no, $page_size)
{ {
// $userParams["type"] = 0; //电话跟进 $userParams["type"] = 1; //普通跟进 // $userParams["type"] = 0; //电话跟进 $userParams["type"] = 1; //普通跟进
$uPhoneFollowModel = new UPhoneFollowPp($site_id); $uPhoneFollowModel = new UPhoneFollowUp($site_id);
//电话跟进 //电话跟进
$userParams["user_id"] = $user_id; $userParams["user_id"] = $user_id;
$field_user_follow = "a.id,a.content,a.user_id,a.agent_id,a.type,a.create_time,a.user_status,b.name,b.phone,b.img"; $field_user_follow = "a.id,a.content,a.user_id,a.agent_id,a.type,a.create_time,a.user_status,b.name,b.phone,b.img";
$bargainData = $uPhoneFollowModel->getFollowUpList($field_user_follow, $userParams,$page_no,$page_size); $bargainData = $uPhoneFollowModel->getFollowUpList($field_user_follow, $userParams,$page_no,$page_size);
return $bargainData; return $bargainData;
...@@ -368,4 +384,28 @@ class UserLogService ...@@ -368,4 +384,28 @@ class UserLogService
} }
return $referrer_user_string; return $referrer_user_string;
} }
/**
* 判断当天被拨打是否超过5次
* 同时判断是否当前经纪人跟当前客户是否有电话绑定
* @param $user_id
* @param $user_phone
* @param $agent_id
* @return int
*/
public function userDetailIsOutpaceCallNum($user_id,$user_phone, $agent_id)
{
$is_outpace_call_num = 0;
$clientService = new ClientService();
if (!$clientService->dialTotal($user_id)) {
$is_outpace_call_num = 1;
}
$agent_res = $this->agentModel->searchAgentsByKeyword("id,name,phone", ["id" => $agent_id]);
$call = new CallPhoneService();
$bind_num_res = $call->getBindNum($user_phone, $agent_res[0]['phone']);
if ($bind_num_res != 0) {
$is_outpace_call_num = 0;
}
return $is_outpace_call_num;
}
} }
\ No newline at end of file
...@@ -393,27 +393,21 @@ class UserService ...@@ -393,27 +393,21 @@ class UserService
return false; return false;
} }
//根据客户id查询 //根据客户id查询
$user_res = $this->user->selectUser($user_id, "id,site_ids"); // $user_res = $this->user->selectUser($user_id, "id,site_ids");
//dump($user_res);exit;
if ($user_res['site_ids']) { /*if ($user_res['site_ids']) {
$site_ids_array = explode(',', rtrim($user_res['site_ids'], ',')); $site_ids_array = explode(',', rtrim($user_res['site_ids'], ','));
$site_ids_array_ = explode(',', rtrim($site_id, ',')); $site_ids_array_ = explode(',', rtrim($site_id, ','));
$site_ids_merge = array_merge($site_ids_array, $site_ids_array_);//数组合并 $site_ids_merge = array_merge($site_ids_array, $site_ids_array_);//数组合并
$site_ids_merge = array_unique($site_ids_merge);//数组去重 $site_ids_merge = array_unique($site_ids_merge);//数组去重
$site_ids = implode(",", $site_ids_merge); $site_ids = implode(",", $site_ids_merge);
} else { } else {
$site_ids = $site_id; $site_ids = $site_id;
} }*/
//dump($site_ids);exit; $site_ids = $site_id;
//保存数据 //保存数据
$params_['site_ids'] = $site_ids; $params_['site_ids'] = $site_ids;
//dump($user_id); $this->user->updateUsers($user_id, $params_);//int(1)
$res = $this->user->updateUsers($user_id, $params_);//int(1)
return true; return true;
} }
......
...@@ -594,9 +594,7 @@ ...@@ -594,9 +594,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
备注: <textarea name="" rows="" cols=""style="width: 500px;height: 160px;" class="remark-financial"> 备注: <textarea name="" rows="" cols=""style="width: 500px;height: 160px;" class="remark-financial"></textarea>
</textarea>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button btn2" class="btn btn-primary is-submit-pass"> <button type="button btn2" class="btn btn-primary is-submit-pass">
......
<script src='/resource/lib/js/require.min.js' data-main='/resource/js/main?version=20190103' charset='utf-8'></script> <script src='/resource/lib/js/require.min.js' data-main='/resource/js/main?version=201901111111' charset='utf-8'></script>
...@@ -404,11 +404,11 @@ ...@@ -404,11 +404,11 @@
<div class="clear"> <div class="clear">
</div> </div>
<select class="form-control btn4 ld-Marheight input" name="" id="district_id"> <!--<select class="form-control btn4 ld-Marheight input" name="" id="district_id">
<option value="">跟进人所在部门</option> <option value="">跟进人所在部门</option>
</select> </select>
<select class="form-control btn4 ld-Marheight input" name="" id="guest_stores" value=""> <select class="form-control btn4 ld-Marheight input" name="" id="guest_stores" value="">
</select> </select>-->
<!--<span class="fore-span ld-Marheight"> <!--<span class="fore-span ld-Marheight">
客户去重: 客户去重:
</span> </span>
...@@ -422,6 +422,8 @@ ...@@ -422,6 +422,8 @@
<div class="clear "></div> <div class="clear "></div>
<span class="btn btn-info btn3 ld-Marheight" id="search">搜索</span> <span class="btn btn-info btn3 ld-Marheight" id="search">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset">重置</span> <span class="btn btn-info btn3 ld-Marheight" id="reset">重置</span>
<!--<span class="btn btn-info btn3 ld-Marheight" id="is_today">今天跟进</span>-->
</form> </form>
</td> </td>
</tr> </tr>
......
...@@ -5,20 +5,20 @@ namespace app\model; ...@@ -5,20 +5,20 @@ namespace app\model;
use think\Db; use think\Db;
class UPhoneFollowPp extends BaseModel class UPhoneFollowUp extends BaseModel
{ {
protected $table = 'u_phone_follow_up'; protected $table = 'u_phone_follow_up';
protected $UPhoneFollowPp; protected $UPhoneFollowUp;
function __construct($site_id) function __construct($site_id)
{ {
$this->UPhoneFollowPp = Db($this->table."_".$site_id); $this->UPhoneFollowUp = Db($this->table."_".$site_id);
} }
/** /**
* 新增电话跟进-插入数据 * 新增电话跟进-插入数据
* @param $data * @param $params
* @return int|string * @return int|string
*/ */
public function savePhoneFollow($params) { public function savePhoneFollow($params) {
...@@ -51,7 +51,8 @@ class UPhoneFollowPp extends BaseModel ...@@ -51,7 +51,8 @@ class UPhoneFollowPp extends BaseModel
if (isset($params["disc"])) { if (isset($params["disc"])) {
$arr["disc"] = $params["disc"]; $arr["disc"] = $params["disc"];
} }
$result = $this->UPhoneFollowPp->insert($arr);
$result = $this->UPhoneFollowUp->insert($arr);
return $result; return $result;
} }
...@@ -70,7 +71,7 @@ class UPhoneFollowPp extends BaseModel ...@@ -70,7 +71,7 @@ class UPhoneFollowPp extends BaseModel
*/ */
public function getSearch($p = 1, $pageSize = 15, $order_ = 'id desc', $field, $join, $where, $group) public function getSearch($p = 1, $pageSize = 15, $order_ = 'id desc', $field, $join, $where, $group)
{ {
$r = $this->UPhoneFollowPp->field($field) $r = $this->UPhoneFollowUp->field($field)
->alias('f') ->alias('f')
->join($join) ->join($join)
->where($where) ->where($where)
...@@ -92,7 +93,7 @@ class UPhoneFollowPp extends BaseModel ...@@ -92,7 +93,7 @@ class UPhoneFollowPp extends BaseModel
public function getUserAgentTotal($params, $join) public function getUserAgentTotal($params, $join)
{ {
$result = $this->UPhoneFollowPp->alias('f') $result = $this->UPhoneFollowUp->alias('f')
->join($join) ->join($join)
->where($params)->count(); ->where($params)->count();
return $result; return $result;
...@@ -106,19 +107,19 @@ class UPhoneFollowPp extends BaseModel ...@@ -106,19 +107,19 @@ class UPhoneFollowPp extends BaseModel
public function select_useraction_search($user_id, $searchdate) public function select_useraction_search($user_id, $searchdate)
{ {
if ($searchdate) { if ($searchdate) {
$UPhoneFollowPp_res = $this->UPhoneFollowPp $UPhoneFollowUp_res = $this->UPhoneFollowUp
->where('user_id', $user_id) ->where('user_id', $user_id)
->where('content', $searchdate) ->where('content', $searchdate)
->order('create_time', 'desc') ->order('create_time', 'desc')
->select(); ->select();
} else { } else {
$UPhoneFollowPp_res = $this->UPhoneFollowPp $UPhoneFollowUp_res = $this->UPhoneFollowUp
->where('user_id', $user_id) ->where('user_id', $user_id)
->order('create_time', 'desc') ->order('create_time', 'desc')
->select(); ->select();
} }
return $UPhoneFollowPp_res; return $UPhoneFollowUp_res;
} }
/*zw start**/ /*zw start**/
...@@ -132,7 +133,7 @@ class UPhoneFollowPp extends BaseModel ...@@ -132,7 +133,7 @@ class UPhoneFollowPp extends BaseModel
if (isset($params["type"])) { if (isset($params["type"])) {
$where_["a.type"] = $params["type"]; $where_["a.type"] = $params["type"];
} }
$result = $this->UPhoneFollowPp $result = $this->UPhoneFollowUp
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("a_agents b", "a.agent_id = b.id", "left") ->join("a_agents b", "a.agent_id = b.id", "left")
...@@ -151,7 +152,7 @@ class UPhoneFollowPp extends BaseModel ...@@ -151,7 +152,7 @@ class UPhoneFollowPp extends BaseModel
if (isset($params["user_id"])) { if (isset($params["user_id"])) {
$where_["a.user_id"] = $params["user_id"]; $where_["a.user_id"] = $params["user_id"];
} }
$result = $this->UPhoneFollowPp $result = $this->UPhoneFollowUp
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("a_agents b", "a.agent_id = b.id", "left") ->join("a_agents b", "a.agent_id = b.id", "left")
...@@ -169,26 +170,26 @@ class UPhoneFollowPp extends BaseModel ...@@ -169,26 +170,26 @@ class UPhoneFollowPp extends BaseModel
public function phone_up_list($pagesize, $pagenum) public function phone_up_list($pagesize, $pagenum)
{ {
$UPhoneFollowPp_res = $this->UPhoneFollowPp $UPhoneFollowUp_res = $this->UPhoneFollowUp
->order('create_time', 'desc') ->order('create_time', 'desc')
->limit($pagesize) ->limit($pagesize)
->page($pagenum) ->page($pagenum)
->select(); ->select();
return $UPhoneFollowPp_res; return $UPhoneFollowUp_res;
} }
public function phone_up_list_count() public function phone_up_list_count()
{ {
$UPhoneFollowPp_res = $this->UPhoneFollowPp $UPhoneFollowUp_res = $this->UPhoneFollowUp
->count(); ->count();
return $UPhoneFollowPp_res; return $UPhoneFollowUp_res;
} }
public function all_user_search($searchdate, $pagesize, $pagenum) public function all_user_search($searchdate, $pagesize, $pagenum)
{ {
$UPhoneFollowPp_res = $this->UPhoneFollowPp $UPhoneFollowUp_res = $this->UPhoneFollowUp
->field('a.*,b.vip') ->field('a.*,b.vip')
->alias('a') ->alias('a')
->join('u_users b','a.user_id = b.id', 'left') ->join('u_users b','a.user_id = b.id', 'left')
...@@ -197,15 +198,15 @@ class UPhoneFollowPp extends BaseModel ...@@ -197,15 +198,15 @@ class UPhoneFollowPp extends BaseModel
->limit($pagesize) ->limit($pagesize)
->page($pagenum) ->page($pagenum)
->select(); ->select();
return $UPhoneFollowPp_res; return $UPhoneFollowUp_res;
} }
public function all_user_search_count($searchdate) public function all_user_search_count($searchdate)
{ {
$UPhoneFollowPp_res = $this->UPhoneFollowPp $UPhoneFollowUp_res = $this->UPhoneFollowUp
->where('content', 'like', "%$searchdate%") ->where('content', 'like', "%$searchdate%")
->count(); ->count();
return $UPhoneFollowPp_res; return $UPhoneFollowUp_res;
} }
/** /**
...@@ -222,7 +223,7 @@ class UPhoneFollowPp extends BaseModel ...@@ -222,7 +223,7 @@ class UPhoneFollowPp extends BaseModel
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getFollowList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') { public function getFollowList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->UPhoneFollowPp->field($field) return $this->UPhoneFollowUp->field($field)
->where($params) ->where($params)
->order($order_) ->order($order_)
->limit($pageSize) ->limit($pageSize)
...@@ -238,12 +239,12 @@ class UPhoneFollowPp extends BaseModel ...@@ -238,12 +239,12 @@ class UPhoneFollowPp extends BaseModel
*/ */
public function getFollowTotal($params) public function getFollowTotal($params)
{ {
return $this->UPhoneFollowPp->where($params) return $this->UPhoneFollowUp->where($params)
->count(); ->count();
} }
public function getUserFollowKey($field, $where, $order = 'id asc') { public function getUserFollowKey($field, $where, $order = 'id asc') {
return $this->UPhoneFollowPp->where($where) return $this->UPhoneFollowUp->where($where)
->order($order) ->order($order)
->value($field); ->value($field);
} }
...@@ -252,7 +253,7 @@ class UPhoneFollowPp extends BaseModel ...@@ -252,7 +253,7 @@ class UPhoneFollowPp extends BaseModel
public function getLastOrNextUserIDPhoneFollowP($where, $field, $limit, $order) public function getLastOrNextUserIDPhoneFollowP($where, $field, $limit, $order)
{ {
$return = $this->UPhoneFollowPp $return = $this->UPhoneFollowUp
->field($field) ->field($field)
->alias('a') ->alias('a')
->join('u_users b','a.user_id = b.id', 'left') ->join('u_users b','a.user_id = b.id', 'left')
...@@ -286,7 +287,7 @@ class UPhoneFollowPp extends BaseModel ...@@ -286,7 +287,7 @@ class UPhoneFollowPp extends BaseModel
$data['user_id'] = $user_id; $data['user_id'] = $user_id;
$data['content'] = $content; $data['content'] = $content;
$data['type'] = $type; $data['type'] = $type;
return $this->UPhoneFollowPp->insertGetId($data); return $this->UPhoneFollowUp->insertGetId($data);
} }
public function getLastPhoneFollowTime($user_id) public function getLastPhoneFollowTime($user_id)
...@@ -298,7 +299,7 @@ class UPhoneFollowPp extends BaseModel ...@@ -298,7 +299,7 @@ class UPhoneFollowPp extends BaseModel
$field = 'create_time'; $field = 'create_time';
$order = 'id desc'; $order = 'id desc';
$limit = 1; $limit = 1;
$return = $this->UPhoneFollowPp $return = $this->UPhoneFollowUp
->field($field) ->field($field)
->where($arr) ->where($arr)
->limit($limit) ->limit($limit)
...@@ -315,7 +316,7 @@ class UPhoneFollowPp extends BaseModel ...@@ -315,7 +316,7 @@ class UPhoneFollowPp extends BaseModel
*/ */
public function getPhoneFollowData($field,$params,$order) public function getPhoneFollowData($field,$params,$order)
{ {
$result = $this->UPhoneFollowPp $result = $this->UPhoneFollowUp
->field($field) ->field($field)
->order($order) ->order($order)
->where($params) ->where($params)
......
<?php
namespace app\model;
/**
* 客户电话跟进-临时表
*/
use app\task\controller\FollowUpTask;
use think\Db;
class UPhoneFollowUpTemporary extends BaseModel
{
protected $table = 'u_phone_follow_up';
protected $follow_up;
protected $siteId;
protected $table_name_string;
function __construct($site_id)
{
$date = date("Y-m-d", time());
$this->follow_up = Db($this->table."_".$site_id."_".$date);
$this->siteId = $site_id;
$this->table_name_string = '`'.$this->table."_".$site_id."_".$date.'`';
}
public function createTable(){
$date = date("Y-m-d", time());
$t_follow_up_task = new FollowUpTask();
if(!$t_follow_up_task->isExistTable($date, $this->siteId)){
return false;
}
return true;
}
/**
* 新增电话跟进-插入数据
* @param $params
* @return int|string
*/
public function savePhoneFollow($params) {
if(!$this->createTable()){
return null;
}
$arr = [];
if (isset($params["content"])) {
$arr["content"] = $params["content"];
}
if (isset($params["labels_id"])) {
$arr["labels_id"] = $params["labels_id"];
}
if (isset($params["user_id"])) {
$arr["user_id"] = $params["user_id"];
}
if (isset($params["agent_id"])) {
$arr["agent_id"] = $params["agent_id"];
}
if (isset($params["type"])) {
$arr["type"] = $params["type"];
}
if (isset($params["user_status"])) {
$arr["user_status"] = $params["user_status"];
}
if (isset($this->siteId)) {
switch ($this->siteId) {
case 10001 :
$province = '上海市';
$city = '上海市';
$disc = '黄埔区';
break;
case 10002 :
$province = '浙江省';
$city = '杭州市';
$disc = '西湖区';
break;
case 10003 :
$province = '广东省';
$city = '深圳市';
$disc = '罗湖区';
break;
default :
$province = '上海市';
$city = '上海市';
$disc = '黄埔区';
}
$arr["province"] = $province;
$arr["city"] = $city;
$arr["disc"] = $disc;
}else{
$arr["site_id"] = '10001';
$arr["province"] = '上海市';
$arr["city"] = '上海市';
$arr["disc"] = '黄埔区';
}
$result = $this->follow_up->insert($arr);
return $result;
}
public function getFollowList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
if(!$this->createTable()){
return null;
}
return $this->follow_up->field($field)
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
public function getFollowUpList($field, $params,$page_no,$page_size)
{
if(!$this->createTable()){
return null;
}
$where_ = [];
if (isset($params["user_id"])) {
$where_["a.user_id"] = $params["user_id"];
}
$result = $this->follow_up
->field($field)
->alias("a")
->join("a_agents b", "a.agent_id = b.id", "left")
->where($where_)
->order("a.create_time desc")
->page($page_no)
->limit($page_size)
->select();
return $result;
}
public function getFollowUpListByUserId($field, $params)
{
if(!$this->createTable()){
return null;
}
$where_ = [];
if (isset($params["user_id"])) {
$where_["a.user_id"] = $params["user_id"];
}
if (isset($params["type"])) {
$where_["a.type"] = $params["type"];
}
$result = $this->follow_up
->field($field)
->alias("a")
->join("a_agents b", "a.agent_id = b.id", "left")
->join("a_store c", "b.store_id = c.id", "left")
->where($where_)
->select();
return $result;
}
/**
* 插入默认跟进
*
* @param $agent_id
* @param $user_id
* @param $content
* @param $type
* @return int|string
*/
public function insertDefaultFollow($agent_id, $user_id, $content, $type) {
if(!$this->createTable()){
return null;
}
$data['agent_id'] = $agent_id;
$data['user_id'] = $user_id;
$data['content'] = $content;
$data['type'] = $type;
return $this->follow_up->insertGetId($data);
}
/**
* 记录总数
*
* @param $params
* @return int|string
*/
public function getFollowTotal($params)
{
if(!$this->createTable()){
return null;
}
return $this->follow_up->where($params)
->count();
}
/**
* 查询数据
* 朱伟 2018-10-24
*/
public function getPhoneFollowData($field,$params,$order)
{
if(!$this->createTable()){
return null;
}
$result = $this->follow_up
->field($field)
->order($order)
->where($params)
->limit(1)
->select();
//dump($this->getLastSql());
return $result;
}
public function getFollowListV2($site_id,$pageNo = 1, $pageSize = 15, $where, $filed = '`id`, `user_id`, `create_time`, `content`, `user_status`, `labels_id`, `agent_id`') {
if(!$this->createTable()){
return null;
}
$start_index = ($pageNo - 1) * $pageSize;
$sql = "SELECT * FROM
((SELECT
$filed
FROM
$this->table_name_string
WHERE
$where)
UNION
(SELECT
$filed
FROM
u_phone_follow_up_$site_id
WHERE
$where
) ) as aa ORDER BY `id` DESC limit $start_index,$pageSize";
return $this->follow_up->execute($sql);
}
/**
* @param $site_id
* @param int $pageNo
* @param int $pageSize
* @param $where
* @param string $field
* @return false|null|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getFollowListV3($site_id, $pageNo, $pageSize, $where, $field = '`id`, `user_id`, `create_time`, `content`, `user_status`, `labels_id`, `agent_id`') {
if(!$this->createTable()){
return null;
}
$sql = Db::table('u_phone_follow_up_'.$site_id)->field($field)->order('id desc')->where($where)->buildSql();
$sql_string = $this->table($this->table_name_string)->field($field)->where($where)->union([$sql], true)->buildSql();
$data = Db::table($sql_string. ' a')
->field($field)
->order('id desc')
->limit($pageSize)
->page($pageNo)
->order('id desc')
->select();
return $data;
}
/**
* @param $field
* @param $where
* @param string $order
* @return null
*/
public function getUserFollowKey($field, $where, $order = 'id asc') {
if(!$this->createTable()){
return null;
}
return $this->follow_up->where($where)
->order($order)
->value($field);
}
}
...@@ -162,7 +162,32 @@ class Users extends Model ...@@ -162,7 +162,32 @@ class Users extends Model
->page($pageNo) ->page($pageNo)
->select(); ->select();
} }
return $result; //echo Db::table($this->table)->getLastSql();
$s_phone_follow_up = new UPhoneFollowUp($site_id);
$s_phone_follow_temp = new UPhoneFollowUpTemporary($site_id);
foreach ($result as $k => $v) {
$data[$k] = $v->getData();
if ($data[$k]['user_pic']) {
$data[$k]['user_pic'] = CURRENT_URL . 'static/head_portrait/' . $data[$k]['user_pic'];
} else {
$data[$k]['user_pic'] = '';
}
$user_data = $this->field('id,user_nick,user_phone')->where('id', $data[$k]['referrer_id'])->find();
$data[$k]['name'] = $user_data['user_nick'];
$data[$k]['phone'] = $user_data['user_phone'];
$params_['user_id']= $data[$k]['id'];
$order= 'id desc';
$res = $s_phone_follow_temp->getPhoneFollowData('create_time',$params_,$order);
if (empty($res)) {
$res = $s_phone_follow_up->getPhoneFollowData('create_time',$params_,$order);
}
$data[$k]['follow_time'] = $res[0]['create_time'];
}
return $data;
} }
/** /**
...@@ -478,15 +503,6 @@ class Users extends Model ...@@ -478,15 +503,6 @@ 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小时内受保护的客户
...@@ -974,20 +990,5 @@ class Users extends Model ...@@ -974,20 +990,5 @@ class Users extends Model
//dump($this->getLastSql()); //dump($this->getLastSql());
return $data; return $data;
} }
public function verifyUser($field, $join, $params)
{
try {
$data = $this->field($field)
->alias('a')
->join($join)
->where($params)
->find();
} catch (\Exception $e) {
$data = [];
}
return $data;
}
} }
...@@ -199,7 +199,7 @@ Route::group('index', [ ...@@ -199,7 +199,7 @@ Route::group('index', [
'lable' => ['index/label/index', ['method' => 'get']], //标签列表 'lable' => ['index/label/index', ['method' => 'get']], //标签列表
'getDistrict' => ['index/District/getList', ['method' => 'get']], //获取部门列表 'getDistrict' => ['index/District/getList', ['method' => 'get']], //获取部门列表
//数据统计 //数据统计
'RemarkFollowList' => ['index/remark/followUpList', ['method' => 'get']],//跟进列表 'RemarkFollowList' => ['index/remark/followUpListV2', ['method' => 'get']],//跟进列表
'phone_list' => ['index/Phone/index', ['method' => 'get']],//隐私号码列表 'phone_list' => ['index/Phone/index', ['method' => 'get']],//隐私号码列表
'bindPhoneList' => ['index/Phone/bindPhoneList', ['method' => 'get']],//绑定的隐私号码列表 'bindPhoneList' => ['index/Phone/bindPhoneList', ['method' => 'get']],//绑定的隐私号码列表
'edit_aliYunPhone' => ['index/Phone/edit_aliYunPhone', ['method' => 'get|post']],//新增或编辑中间号 'edit_aliYunPhone' => ['index/Phone/edit_aliYunPhone', ['method' => 'get|post']],//新增或编辑中间号
...@@ -399,6 +399,7 @@ Route::group('index', [ ...@@ -399,6 +399,7 @@ Route::group('index', [
'userDetail' => ['index/UserLog/userDetail', ['method' => 'get|post']], 'userDetail' => ['index/UserLog/userDetail', ['method' => 'get|post']],
'userLog' => ['index/UserLog/userLog', ['method' => 'get|post']], 'userLog' => ['index/UserLog/userLog', ['method' => 'get|post']],
'followUpLog' => ['index/UserLog/followUpLog', ['method' => 'get|post']], 'followUpLog' => ['index/UserLog/followUpLog', ['method' => 'get|post']],
'followUpLogNew' => ['index/UserLog/followUpLogNew', ['method' => 'get|post']],
'dailyDetail' => ['index/DailyPaper/dailyDetail', ['method' => 'get|post']], 'dailyDetail' => ['index/DailyPaper/dailyDetail', ['method' => 'get|post']],
'addDaily' => ['index/DailyPaper/addDaily', ['method' => 'get|post']], 'addDaily' => ['index/DailyPaper/addDaily', ['method' => 'get|post']],
...@@ -559,7 +560,12 @@ Route::group('task', [ ...@@ -559,7 +560,12 @@ Route::group('task', [
'updateShopAgeLimit' => ['task/JobTask/updateShopAgeLimit', ['method' => 'get']], //默认年限 'updateShopAgeLimit' => ['task/JobTask/updateShopAgeLimit', ['method' => 'get']], //默认年限
'push' => ['task/PushMessageTask/push', ['method' => 'get']], //推送和客户推送 'push' => ['task/PushMessageTask/push', ['method' => 'get']], //推送和客户推送
'updateLandlordLimit' => ['task/JobTask/updateLandlordLimit', ['method' => 'get']] //转换房东手机号 'updateLandlordLimit' => ['task/JobTask/updateLandlordLimit', ['method' => 'get']], //转换房东手机号
'test' => ['task/FollowUpTask/test', ['method' => 'get']],
'isExistTable' => ['task/FollowUpTask/isExistTable', ['method' => 'get']],
'moveFollowUpList' => ['task/FollowUpTask/moveFollowUpList', ['method' => 'get']],
]); ]);
Route::group('broker', [ Route::group('broker', [
...@@ -684,6 +690,7 @@ Route::group('broker', [ ...@@ -684,6 +690,7 @@ Route::group('broker', [
//首页跟进记录 //首页跟进记录
'userFollowUpList' => ['api_broker/HomePageLog/userFollowUpList', ['method' => 'post']], 'userFollowUpList' => ['api_broker/HomePageLog/userFollowUpList', ['method' => 'post']],
'userFollowUpListV2' => ['api_broker/HomePageLog/userFollowUpListV2', ['method' => 'post|get']],
'houseFollowUpList' => ['api_broker/HomePageLog/houseFollowUpList', ['method' => 'post']], 'houseFollowUpList' => ['api_broker/HomePageLog/houseFollowUpList', ['method' => 'post']],
'housingResource' => ['api_broker/Performance/housingResource', ['method' => 'POST|GET']], //获取房源list 'housingResource' => ['api_broker/Performance/housingResource', ['method' => 'POST|GET']], //获取房源list
......
<?php
namespace app\task\controller;
use app\extra\RedisExt;
use app\model\ASite;
use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
/**
* Created by PhpStorm.
* User : zw
* Date : 2019/1/10
* Time : 2:20 PM
* Intro:
*/
class FollowUpTask
{
private $redis_;
private $table = 'u_phone_follow_up_';
private $siteModel;
public function __construct()
{
$this->redis_ = RedisExt::getRedis();
$this->siteModel = new ASite();
}
/**
* @param $time
* @param $siteId
* @return bool
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function isExistTable($time, $siteId)
{
$site_arr = $this->siteModel->findByOne('city', ["id" => $siteId]);
if (count($site_arr) <= 0) {
return false;
}
//todo 1.判断表是否存在,不存在则创建,
$date = date("Y-m-d", time());
//时间是今天
if ($time >= $date && $time <= $date . " 23:59:59") {
$phoneFollowUpModel = new UPhoneFollowUpTemporary($siteId);
$table_name = $this->table . $siteId . "_" . $date;
//存在表
if ($this->redis_->get($table_name) > 0) {
return true;
}
$isTable = $phoneFollowUpModel->query('SHOW TABLES LIKE "' . $table_name . '"');
if ($isTable) {
$this->redis_->set($table_name, 1, 24 * 3600);
return true;//存在表
} else {
//创建表
return $this->createTemp($phoneFollowUpModel, $table_name);
}
}
return false;
}
/**
* @param $db
* @param $tableName
* @return bool
*/
public function createTemp($db, $tableName)
{
if (!$tableName) {
return false;
}
$sql = "CREATE TABLE `" . $tableName . "` (
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '电话跟进表',
`content` varchar(255) DEFAULT '' COMMENT '跟进内容',
`labels_id` int(10) DEFAULT '0' COMMENT 'u_labels表主键',
`user_id` int(10) unsigned DEFAULT '0' COMMENT 'u_users ID用户表id',
`agent_id` int(10) unsigned DEFAULT '0' COMMENT 'agent表id',
`province` varchar(60) DEFAULT '' COMMENT '省份',
`city` varchar(60) DEFAULT '' COMMENT '城市',
`disc` varchar(60) DEFAULT '' COMMENT '区域',
`type` int(10) unsigned DEFAULT '0' COMMENT '0 电话跟进 1普通跟进 2不知道是什么,3打电话未跟进',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_status` tinyint(2) DEFAULT '0' COMMENT '客户状态(0:求租;1:已租;-1:无效)',
PRIMARY KEY (`id`),
KEY `idx_agent_id` (`agent_id`),
KEY `idx_user_id` (`user_id`),
KEY `idx_create_time` (`create_time`),
KEY `idx_city` (`city`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8";
if (false !== $db->execute($sql)) {
return true;
} else {
return false;
}
}
/**
* 每天0.30执行移动操作
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function moveFollowUpList()
{
//todo 判断参数和时间
$checkDayStr = date('Y-m-d ', time());
$timeBegin1 = strtotime($checkDayStr . "0:10" . ":00");
$timeEnd1 = strtotime($checkDayStr . "0:50" . ":00");
$curr_time = time();
if ($curr_time < $timeBegin1 || $curr_time > $timeEnd1) {
return;
}
$site_arr = $this->siteModel->getSite("id,name,city,is_del", ["is_del" => 0]);
if (count($site_arr) <= 0) {
return;
}
$date = date("Y-m-d",strtotime("-1 day"));
foreach ($site_arr as $item) {
$site_id = $item["id"];
//判断此站点是否执行过
if ($this->redis_->get("is_run_" . $date . "_" . $site_id) > 0) {
continue;
}
$table_name = $this->table . $site_id . "_" . $date;
$phoneFollowUpModel = new UPhoneFollowUpTemporary($site_id);
$isTable = $phoneFollowUpModel->query('SHOW TABLES LIKE "' . $table_name . '"');
if ($isTable) {
$sql = "INSERT into u_phone_follow_up_" . $site_id . "
(content,labels_id,user_id,agent_id,province,city,disc,type,create_time,update_time,user_status )
select content,labels_id,user_id,agent_id,province,city,disc,type,create_time,update_time,user_status
from `" . $table_name . "`";
$followUpModel = new UPhoneFollowUp($site_id);
if (false !== $followUpModel->execute($sql)) {
$this->redis_->set("is_run_" . $date . "_" . $site_id, 1, 24 * 3600);
}
}
}
}
}
...@@ -11,7 +11,8 @@ use app\model\OMarchInModel; ...@@ -11,7 +11,8 @@ use app\model\OMarchInModel;
use app\model\OPayLogModel; use app\model\OPayLogModel;
use app\model\OReportModel; use app\model\OReportModel;
use app\model\TAgentTotalModel; use app\model\TAgentTotalModel;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use app\model\Users; use app\model\Users;
use Think\Log; use Think\Log;
...@@ -294,7 +295,8 @@ class ResultsSummaryNewTask ...@@ -294,7 +295,8 @@ class ResultsSummaryNewTask
$result_arr["bargain_sum"] = $bargainSum[0]["num"]; $result_arr["bargain_sum"] = $bargainSum[0]["num"];
//电话跟进数 //电话跟进数
$uFollowModel = new UPhoneFollowPp($site_id); //$uFollowModel = new UPhoneFollowUp($site_id);
$uFollowModel = new UPhoneFollowUpTemporary($site_id);
$followUp = $uFollowModel->getFollowTotal($params); $followUp = $uFollowModel->getFollowTotal($params);
$result_arr["followUp_sum"] = $followUp; $result_arr["followUp_sum"] = $followUp;
......
No preview for this file type
...@@ -47,22 +47,23 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -47,22 +47,23 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
agent_id_phone:'', agent_id_phone:'',
pageNoUser:1,//客户详情 客户动态初始化分页 pageNoUser:1,//客户详情 客户动态初始化分页
moreUser:0,//标识点击加载更多 还有没有数据 moreUser:0,//标识点击加载更多 还有没有数据
isExitsNew:0,
isTaday:1, isTaday:1,
init: function() { init: function() {
//初始化dot //初始化dot
$("body").append(template); $("body").append(template);
//初始化城市 区域筛选 //初始化时间
user.initializationCityFunction();
user.event();
// 初始化时间
var myDate = new Date(); var myDate = new Date();
var y = myDate.getFullYear(); var y = myDate.getFullYear();
var m = myDate.getMonth() + 1; var m = myDate.getMonth() + 1;
var d = myDate.getDate(); var d = myDate.getDate();
var day_end = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d); var day_end = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
$('#start_date').val(day_end); $('#start_date').val(day_end);
$('#end_date').val(day_end); $('#end_date').val(day_end);//客户跟进 添加 默认时间一天
//初始化城市 区域筛选
user.initializationCityFunction();
user.event();
//时间控件初始化 //时间控件初始化
//bootstrap 时间控件选择 //bootstrap 时间控件选择
...@@ -141,18 +142,6 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -141,18 +142,6 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
_doc.on('input', '#user_area_choose', function() { _doc.on('input', '#user_area_choose', function() {
user.getList(1); user.getList(1);
}); });
_doc.on('click', '#is_taday', function() {
$('#start_date').val('');
$('#end_date').val('');
user.isTaday=1;
$(this).removeClass('btn-default').addClass('btn-info');
// user.getList(1);
});
_doc.on('input', '#end_date', function() {
$('#is_taday').removeClass('btn-info').addClass('btn-default');
user.isTaday=0;
});
//客户详情跟进 取消收藏 //客户详情跟进 取消收藏
_doc.on('click', '#user_is_collect', function() { _doc.on('click', '#user_is_collect', function() {
if(!confirm('是否继续?')) { if(!confirm('是否继续?')) {
...@@ -259,12 +248,6 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -259,12 +248,6 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
BrowseServer('cover_image'); BrowseServer('cover_image');
}); });
$("#search").click(function() { $("#search").click(function() {
var time_=getTimeStamp(getBeforeDate(1));
var time1_=getTimeStamp($('#day_end').val());
if(time1_ > time_){
alert('请选择大于今天的日期!!!')
return;
};
user.getList(1); user.getList(1);
}); });
...@@ -273,8 +256,6 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -273,8 +256,6 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
user.agent_id_phone='';//重置搜索 user.agent_id_phone='';//重置搜索
$('#guest_stores').html(''); $('#guest_stores').html('');
$('#guest_stores2').html(''); $('#guest_stores2').html('');
user.isTaday=0;
$('#is_taday').removeClass('btn-info').addClass('btn-default');
}); });
//新增 客户 重置信息 //新增 客户 重置信息
$("#confirm_delete").click(function() { $("#confirm_delete").click(function() {
...@@ -288,8 +269,9 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -288,8 +269,9 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
user.delete_user(params); user.delete_user(params);
}); });
$(document).delegate(".genj_ure", "click", function() { $(document).delegate(".genj_ure", "click", function() {
var _$this = $(this); user.user_id = $(this).attr("data-id");
$('#modal-record iframe').attr('src', '/index/userModalList?data=' + _$this.attr('data-item') + '&id=' + _$this.attr('data-id')); // checkLogin();
user.getGenjinLabel();
}); });
$(document).delegate(".add_alert", "click", function() { $(document).delegate(".add_alert", "click", function() {
...@@ -335,6 +317,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -335,6 +317,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
}); });
//客户列表操作 //客户列表操作
$(document).delegate(".cao-zuo-record", "click", function() { //点击操作跟进详情 $(document).delegate(".cao-zuo-record", "click", function() { //点击操作跟进详情
user.isExitsNew=0;
user.user_id = $(this).attr("data-id"); user.user_id = $(this).attr("data-id");
user.user_phone = $(this).attr("data-phone"); user.user_phone = $(this).attr("data-phone");
user.baohu = $(this).attr("data-baohu"); user.baohu = $(this).attr("data-baohu");
...@@ -381,6 +364,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -381,6 +364,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
$('.user-log-more').show(); $('.user-log-more').show();
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon()//获取客户动态 user.getGenjincon()//获取客户动态
} }
}); });
...@@ -480,6 +464,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -480,6 +464,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
user.Caozuo(); user.Caozuo();
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon(); user.getGenjincon();
} }
}); });
...@@ -699,6 +684,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -699,6 +684,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
_btnSave.css('display','block'); _btnSave.css('display','block');
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon(); user.getGenjincon();
}; };
}else { }else {
...@@ -746,6 +732,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -746,6 +732,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
_genjinModal.hide(); _genjinModal.hide();
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon(); user.getGenjincon();
}else { }else {
layerTipsX(data['msg']); layerTipsX(data['msg']);
...@@ -1355,6 +1342,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -1355,6 +1342,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
alert('修改成功'); alert('修改成功');
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon(); user.getGenjincon();
$('#genj_text').val(''); $('#genj_text').val('');
// $("#modal-record").modal('hide'); // $("#modal-record").modal('hide');
...@@ -1614,28 +1602,12 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -1614,28 +1602,12 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
} }
params.user_id = $.trim($("#customer_name_id").val());//区域 params.user_id = $.trim($("#customer_name_id").val());//区域
// params.disc = $.trim($("#user_area_choose").val());//区域 // params.disc = $.trim($("#user_area_choose").val());//区域
if(user.isTaday){ _startDateObj.val() != '' && (params.start_date = _startDateObj.val());
var myDate = new Date(); _endDateObj.val() != '' && (params.end_date = _endDateObj.val());
var y = myDate.getFullYear();
var m = myDate.getMonth() + 1;
var d = myDate.getDate();
var day_end = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
params.start_date = day_end;
params.end_date = day_end;
}else{
params.start_date = _startDateObj.val();
params.end_date = _endDateObj.val();
var time_=getTimeStamp(getBeforeDate(1));
if(getTimeStamp(params.end_date) > time_){
alert('选择的时间不能大于等于今天!!!');
return;
}
};
$.trim(_customerNameObj.val()) != '' && (params.customer = $.trim(_customerNameObj.val())); $.trim(_customerNameObj.val()) != '' && (params.customer = $.trim(_customerNameObj.val()));
$.trim(_customerPhoneObj.val()) != '' && (params.phone = $.trim(_customerPhoneObj.val())); $.trim(_customerPhoneObj.val()) != '' && (params.phone = $.trim(_customerPhoneObj.val()));
$.trim(_followContentObj.val()) != '' && (params.content = $.trim(_followContentObj.val())); $.trim(_followContentObj.val()) != '' && (params.content = $.trim(_followContentObj.val()));
if(!params.start_date || !params.end_date){ if(!$('#start_date').val() || !$('#end_date').val()){
alert('请您选择跟进时间!'); alert('请您选择跟进时间!');
return; return;
}; };
......
...@@ -35,7 +35,9 @@ define(['doT', 'text!temp/financial_daily_list_template_tpl.html', 'css!style/ho ...@@ -35,7 +35,9 @@ define(['doT', 'text!temp/financial_daily_list_template_tpl.html', 'css!style/ho
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
localStorage.setItem('financial_check_string_liu',$(this).attr("data-store")); localStorage.setItem('financial_check_string_liu',$(this).attr("data-store"));
location.href=href='/index/dailyDetailsFinance?time=' + $(this).attr("data-storeTime")+"&storeId="+$(this).attr("data-storeId"); var href_='/index/dailyDetailsFinance?time=' + $(this).attr("data-storeTime")+"&storeId="+$(this).attr("data-storeId");
window.open(href_);
}); });
//搜索按钮的事件 //搜索按钮的事件
......
...@@ -402,8 +402,8 @@ define(['doT', 'text!temp/financial_manager_daily_list_template_tpl.html', 'css! ...@@ -402,8 +402,8 @@ define(['doT', 'text!temp/financial_manager_daily_list_template_tpl.html', 'css!
$('#pay_f').html(data.data.total_info.cash); $('#pay_f').html(data.data.total_info.cash);
$('#pay_g').html(data.data.total_info.pos); $('#pay_g').html(data.data.total_info.pos);
$('#pay_h').html(data.data.total_info.other_bank); $('#pay_h').html(data.data.total_info.other_bank);
$('#pay_i').html(); $('#pay_i').html('');
$('#pay_j').html(); $('#pay_j').html('');
} }
//入账总计 //入账总计
...@@ -445,8 +445,8 @@ define(['doT', 'text!temp/financial_manager_daily_list_template_tpl.html', 'css! ...@@ -445,8 +445,8 @@ define(['doT', 'text!temp/financial_manager_daily_list_template_tpl.html', 'css!
$('#total_f').html(data.data.total_info.cash); $('#total_f').html(data.data.total_info.cash);
$('#total_g').html(data.data.total_info.pos); $('#total_g').html(data.data.total_info.pos);
$('#total_h').html(data.data.total_info.other_bank); $('#total_h').html(data.data.total_info.other_bank);
$('#total_i').html(); $('#total_i').html('');
$('#total_j').html(); $('#total_j').html('');
} }
} }
...@@ -598,7 +598,7 @@ define(['doT', 'text!temp/financial_manager_daily_list_template_tpl.html', 'css! ...@@ -598,7 +598,7 @@ define(['doT', 'text!temp/financial_manager_daily_list_template_tpl.html', 'css!
alert('提交成功'); alert('提交成功');
$("#modal_financialremark").modal('hide');//提交成功后 关闭弹窗 $("#modal_financialremark").modal('hide');//提交成功后 关闭弹窗
bargain.getList(); bargain.getList();
location.href='/index/dailyList' // location.href='/index/dailyList'
}else{ }else{
alert(data.msg); alert(data.msg);
} }
......
...@@ -53,8 +53,10 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -53,8 +53,10 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
agent_id_call_vip:"", agent_id_call_vip:"",
pageNoUser:1,//客户详情 客户动态初始化分页 pageNoUser:1,//客户详情 客户动态初始化分页
moreUser:0,//标识点击加载更多 还有没有数据 moreUser:0,//标识点击加载更多 还有没有数据
isExitsNew:0,
agent_id_phone:'', agent_id_phone:'',
init: function() { init: function() {
user.isExitsNew=0;
//初始化dot //初始化dot
$("body").append(template); $("body").append(template);
//初始化城市 区域筛选 //初始化城市 区域筛选
...@@ -212,6 +214,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -212,6 +214,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
e.stopPropagation(); e.stopPropagation();
user.moreUser=1; user.moreUser=1;
user.getGenjincon(user.pageNoUser++) user.getGenjincon(user.pageNoUser++)
}); });
//点击 无效 //点击 无效
...@@ -456,10 +459,8 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -456,10 +459,8 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
user.delete_user(params); user.delete_user(params);
}); });
$(document).delegate(".genj_ure", "click", function() { $(document).delegate(".genj_ure", "click", function() {
// user.user_id = $(this).attr("data-id"); user.user_id = $(this).attr("data-id");
// user.getGenjinLabel(); user.getGenjinLabel();
var _$this = $(this);
$('#modal-record iframe').attr('src', '/index/userModalList?data=' + _$this.attr('data-item') + '&id=' + _$this.attr('data-id')).show();
}); });
$(document).delegate(".add_alert", "click", function() { //重置搜索 $(document).delegate(".add_alert", "click", function() { //重置搜索
...@@ -506,6 +507,8 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -506,6 +507,8 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
}); });
//客户列表操作 //客户列表操作
$(document).delegate(".cao-zuo-record", "click", function() { //点击操作跟进详情 $(document).delegate(".cao-zuo-record", "click", function() { //点击操作跟进详情
//重置客户动态 全局变量
user.isExitsNew=0;
user.user_id = $(this).attr("data-id"); user.user_id = $(this).attr("data-id");
user.user_phone = $(this).attr("data-phone"); user.user_phone = $(this).attr("data-phone");
user.agent_id_infor = $(this).attr("data-agentId"); user.agent_id_infor = $(this).attr("data-agentId");
...@@ -636,6 +639,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -636,6 +639,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
user.Caozuo(); user.Caozuo();
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon(); user.getGenjincon();
} }
}); });
...@@ -654,6 +658,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -654,6 +658,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
$('.user-log-more').show(); $('.user-log-more').show();
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon()//获取客户动态 user.getGenjincon()//获取客户动态
} }
}); });
...@@ -666,19 +671,6 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -666,19 +671,6 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
user.search_phone2(); user.search_phone2();
} }
}); });
//跟进姓名 下拉式搜索
$(document).on("input", "#partical_name", function() { //手机号新增搜索客方
if($("#partical_name").val() == '') {
user.agent_id_phone='';
$(".user-ul-liu").html('');
} else {
user.search_phone_liu();
}
});
//点击li 列表消失
$(document).delegate(".addphoneliu", "click", function() { //list消失新增客户 点击li事件 获取id ul消失
user.addphoneliu(this);
});
$(document).delegate(".addphone", "click", function() { //list消失新增客户 点击li事件 获取id ul消失 $(document).delegate(".addphone", "click", function() { //list消失新增客户 点击li事件 获取id ul消失
user.addphone(this); user.addphone(this);
}); });
...@@ -876,6 +868,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -876,6 +868,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
_btnSave.css('display','block'); _btnSave.css('display','block');
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon(); user.getGenjincon();
}; };
}else { }else {
...@@ -924,6 +917,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -924,6 +917,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
_genjinModal.hide(); _genjinModal.hide();
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon(); user.getGenjincon();
}else { }else {
layerTipsX(data['msg']); layerTipsX(data['msg']);
...@@ -1608,6 +1602,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -1608,6 +1602,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
alert('修改成功'); alert('修改成功');
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon(); user.getGenjincon();
$('#genj_text').val(''); $('#genj_text').val('');
} else { } else {
...@@ -1790,13 +1785,6 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -1790,13 +1785,6 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
//拨打电话 //拨打电话
user.customerInfo = data.data.user_info; user.customerInfo = data.data.user_info;
is_outpace_call_num = data.data.is_outpace_call_num; is_outpace_call_num = data.data.is_outpace_call_num;
//关联客户显示 解除关联
var user_bind_list = "";
$.each(data['data']['user_bind_list'], function(i, item) {
user_bind_list += '<div>' + item.user_name + ',ID:' + item.user_id + ',' + item.user_phone + '<span class="text-info del-relational" data-id="'+ item.user_id +'">解除关联</span></div>';
});
$(".user-detail-relational").html(user_bind_list);
} }
} else { } else {
...@@ -1896,11 +1884,6 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -1896,11 +1884,6 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
params.is_single_homeowner = $.trim($("select[name=landlord_status]").val());//纯房东 筛选 受权限限制 params.is_single_homeowner = $.trim($("select[name=landlord_status]").val());//纯房东 筛选 受权限限制
params.is_referrer_source_user = $.trim($("select[name='customer_referrals_choose']").val());//客户列表 是否转介绍 筛选 params.is_referrer_source_user = $.trim($("select[name='customer_referrals_choose']").val());//客户列表 是否转介绍 筛选
params.site_id = $('.user_city_choose_site_list').val(); params.site_id = $('.user_city_choose_site_list').val();
//高级筛选 面积 租金
params.area_start = $('#area_start').val();
params.area_end = $('#area_end').val();
params.price_start = $('#price_start').val();
params.price_end = $('#price_end').val();
//添加个人商铺和所有商铺选择功能 //添加个人商铺和所有商铺选择功能
var start_ = params.start_date+" 00:00:00"; var start_ = params.start_date+" 00:00:00";
...@@ -1929,15 +1912,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -1929,15 +1912,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
var temp = document.getElementById('user_list_tpl').innerHTML; var temp = document.getElementById('user_list_tpl').innerHTML;
var doTtmpl = doT.template(temp); var doTtmpl = doT.template(temp);
$("#users_list").html(doTtmpl(data.data.list)); $("#users_list").html(doTtmpl(data.data.list));
//隐藏列表按钮 显示优化
var _tempObj = $('.btn-default-show-caozuo');
$.each(_tempObj, function(i, v) {
var _$this = $(v);
_$this.nextAll().hide();//默认按钮只显示两个
if(_$this.index() == 0){
_$this.click();
}
});
/*分页代码*/ /*分页代码*/
add_page(data.data.total, pageNo, user.pageSize, user.getList); add_page(data.data.total, pageNo, user.pageSize, user.getList);
$("#total_page").html(data.data.total); $("#total_page").html(data.data.total);
...@@ -2056,70 +2031,6 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -2056,70 +2031,6 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
} }
} }
}); });
},
//新增关联客户
addRelational: function() {
$.ajax({
url: '/index/addUserBind',
type: 'GET',
async: true,
data: {
'bind_id': user.agent_id_phone,
"user_id": user.user_id
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
alert(data.msg);
user.Caozuo();//更新关联客户
}else{
alert(data.msg);
}
}
});
},
//解除关联客户
delRelational: function(id) {
$.ajax({
url: '/index/removeUserBind',
type: 'GET',
async: true,
data: {
"user_id": id
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
alert(data.msg);
user.Caozuo();//更新关联客户
}else{
alert(data.msg);
}
}
});
},
//客户列表 客户关联记录
relationalRecord: function(id) {
$.ajax({
url: '/index/getUserBindHistory',
type: 'GET',
async: true,
data: {
"user_id": id
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
var temp = document.getElementById('relational_record_list').innerHTML;
var doTtmpl = doT.template(temp);
$("#agent_phone_binding").html(doTtmpl(data.data.data));
}else{
// $("#users_list").html('暂无数据');
}
}
});
}, },
add_user: function() { add_user: function() {
var params = {}; var params = {};
...@@ -2356,6 +2267,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -2356,6 +2267,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
user.getUserLogNew(); user.getUserLogNew();
user.pageNoUser=1; user.pageNoUser=1;
$('#caozuo_table2').html(''); $('#caozuo_table2').html('');
user.isExitsNew=0;
user.getGenjincon(); user.getGenjincon();
if(data.data.user_id==data.data.max_user_id){ if(data.data.user_id==data.data.max_user_id){
user.user_id=data.data.max_user_id-1; user.user_id=data.data.max_user_id-1;
...@@ -2395,10 +2307,14 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -2395,10 +2307,14 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
}); });
}, },
getGenjincon: function() {//获取客户动态(客户详情) getGenjincon: function() {//获取客户动态(客户详情)
if(user.isExitsNew == 1){
user.getGenjincontwo();
}else{
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存 var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
// checkLogin(); // checkLogin();
$.ajax({ $.ajax({
url:'/index/followUpLog', url:'/index/followUpLogNew',
type: 'GET', type: 'GET',
async: true, async: true,
data: { data: {
...@@ -2412,12 +2328,12 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -2412,12 +2328,12 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
if(data.code == 200 && data.data != null) { if(data.code == 200 && data.data != null) {
if(data.data.length == 30){ // if(data.data.length == 30){
$('.is-show-more-followlog').show(); // $('.is-show-more-followlog').show();
}else{ // }else{
$('.is-show-more-followlog').hide(); // $('.is-show-more-followlog').hide();
//
}; // };
//客户动态 即跟进 //客户动态 即跟进
var caozuo_table = ""; var caozuo_table = "";
...@@ -2445,14 +2361,77 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -2445,14 +2361,77 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
// $('.follow-up-modal-list-area').scrollTop(0); // $('.follow-up-modal-list-area').scrollTop(0);
}else{ }else{
if(user.pageNoUser==1){ user.isExitsNew = 1;
//数据为空 num 置1
user.pageNoUser=1;
user.getGenjincontwo();
}
}
});
}
},
getGenjincontwo: function() {//获取客户动态(客户详情)
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
$.ajax({
url:'/index/followUpLog',
type: 'GET',
async: true,
data: {
"AuthToken": user_info_obj.AuthToken,
"user_id": user.user_id,
"page_no": user.pageNoUser,
"page_size": 30,
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
// if(data.data.length == 30){
// $('.is-show-more-followlog').show();
// }else{
// $('.is-show-more-followlog').hide();
//
// };
//客户动态 即跟进
var caozuo_table = "";
$.each(data['data'], function(i, item) {
if(item.user_status*1){
var user_status = '【已租】'
}else{
var user_status = '【求租】'
};
if(item.type*1){
var follow_status = '跟进:'
}else{
var follow_status = '电话跟进:'
};
caozuo_table += '<tr><td class="text-left follow-up-home" width="70%">' + follow_status + dealPunctuation(item.content) + user_status +'</td><td>' + item.name + '</td><td>' + item.create_time +'</td></tr>';
});
if(caozuo_table){
$("#caozuo_table2").append(caozuo_table);
}else{
$("#caozuo_table2").html('暂无跟进信息'); $("#caozuo_table2").html('暂无跟进信息');
$('.is-show-more-followlog').hide();
} }
if(user.moreUser){ //滚动条 回到顶部
// $('.follow-up-modal-list-area').scrollTop(0);
}else{
alert('暂无跟进信息!!!'); alert('暂无跟进信息!!!');
user.moreUser=0;
}; // if(user.pageNoUser==1){
// $("#caozuo_table2").html('暂无跟进信息');
// $('.is-show-more-followlog').hide();
// };
// if(user.moreUser){
// alert('暂无跟进信息!!!');
// user.moreUser=0;
// };
} }
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<!--<td>[%= it[item]['bargain_id'] %]</td>--> <!--<td>[%= it[item]['bargain_id'] %]</td>-->
<td>[%= it[item]['house_address'] %]</td> <td>[%= it[item]['house_address'] %]</td>
<td>[%= it[item]['price']%]</td> <td>[%= it[item]['price']%]</td>
<td>[%= (it[item]['price']*0.8).toFixed(2) %]</td> <td>[%= (it[item]['price']*0.7).toFixed(2) %]</td>
<td>[%= it[item]['money']%]</td> <td>[%= it[item]['money']%]</td>
<td>[%= (it[item]['money']*1 - (it[item]['price']*0.7)).toFixed(2) %]</td> <td>[%= (it[item]['money']*1 - (it[item]['price']*0.7)).toFixed(2) %]</td>
<td>[%= sw(it[item]['pay_type'])%]</td> <td>[%= sw(it[item]['pay_type'])%]</td>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<td width="46%" class="text-left follow-up-home"> <td width="46%" class="text-left follow-up-home">
[% if(it[item]['label_name']) { %] [% if(it[item]['label_name']) { %]
[%= it[item]['label_name'] %] [%= it[item]['label_name'] %]
[% }else{ %] [% } %]
[% if(it[item]['user_status'] == 0) { %] [% if(it[item]['user_status'] == 0) { %]
【求租】 【求租】
[% } else if(it[item]['user_status'] == 1) { %] [% } else if(it[item]['user_status'] == 1) { %]
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
[% }else{ %] [% }else{ %]
【无效】 【无效】
[% } %] [% } %]
[% } %]
[%= dealPunctuation(it[item]['content']) %] [%= dealPunctuation(it[item]['content']) %]
</td> </td>
<td>[%= it[item]['admin'] %]</td> <td>[%= it[item]['admin'] %]</td>
......
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