Commit 8e6c8fde authored by clone's avatar clone

Merge branch '0416-v3.2.5' of https://gitee.com/zwyjjc/tl_estate into 0416-v3.2.5

parents b87e86ef fcceb6f4
......@@ -130,17 +130,31 @@ class HomePageLog extends Basic
}
$clientService = new ClientService();
$m_label = new ULabels();
$label_data = $m_label->getColumn('id,name', ['type' => 1]); //获取标签
// $m_label = new ULabels();
$redis_service = new RedisCacheService();
// $label_data = $m_label->getColumn('id,name', ['type' => 1]); //获取标签
$label_data = $redis_service->userCallLabelCache();
foreach ($result as $key => $value) {
$agent_params = [];
$agent_params["a.id"] = $value['agent_id'];
$agent_field = "a.name,a.img,b.store_name";
$model = new AAgents();
$res_a = $model->getAgentsInfo($agent_field, $agent_params);
$result[$key]['name'] = $res_a[0]['name'];
$result[$key]['img'] = $res_a[0]['img'];
$result[$key]['store_name'] = $res_a[0]['store_name'];
// $agent_params = [];
// $agent_params["a.id"] = $value['agent_id'];
// $agent_field = "a.name,a.img,b.store_name";
// $model = new AAgents();
// $res_a = $model->getAgentsInfo($agent_field, $agent_params);
// $result[$key]['name'] = $res_a[0]['name'];
// $result[$key]['img'] = $res_a[0]['img'];
// $result[$key]['store_name'] = $res_a[0]['store_name'];
if ($value['agent_id']) {
$res_a = $redis_service->getRedisCache(2, $value['agent_id']);
$result[$key]['name'] = $res_a['name'];
$result[$key]['img'] = $res_a['img'];
$result[$key]['store_name'] = $res_a['store_name'];
} else {
$result[$key]['name'] = '';
$result[$key]['img'] = '';
$result[$key]['store_name'] = '';
}
if ($if_search)
$result[$key]['create_time'] = date("Y-m-d H:i:s",$value["create_time"] / 1000);
......
......@@ -88,6 +88,8 @@ class User extends Basic
public function searchUser()
{
$params = $this->params;
// big_log($this->authToken);
// big_log(json_encode($params));
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//app_request_source_type 1:代表全部客户
......@@ -193,15 +195,17 @@ class User extends Basic
}
}
}
big_log(json_encode($conditions));
$field = "id as user_id,sex,user_name,city,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip,user_label,source_intro,site_ids";
$return_user_list = $this->userModel->selectUserList($field, $conditions, $pageNo, $pageSize, "id desc");
if (empty($return_user_list)) {
return $this->response("200", "此条件没有找到数据");
}
//搜索将本城市的客户排前面
if ($app_request_source_type == 1) {
//todo 搜索将本城市的客户排前面
//todo 将经纪人所在城市的客户拍前面
if ($app_request_source_type == 0) {
$return_user_list = $this->userSequenceByCity($return_user_list,$params['site_id']);
}
......@@ -242,6 +246,30 @@ class User extends Basic
}
/**
* 将经纪人所在城市的客户拍前面
* @param $user_list
* @return mixed
*/
public function userSequenceByCity($user_list, $site_id)
{
if (!$user_list or !$site_id) {
return false;
}
$user_list_temp = [];
foreach ($user_list as $k => $v) {
$site_ids_arr = explode(',', $v['site_ids']);
if (in_array($site_id, $site_ids_arr)) {
$user_list_temp[] = $v;
unset($user_list[$k]);
}
}
return $user_list_temp + $user_list;
}
/**
* 客户详情上一页下一页接口
* @return \think\Response
......
......@@ -50,6 +50,9 @@ class BargainService
case 4:
$condition["status"] = 21;
break;
case 5://调账->搜成交报告 不包括 待撤销和已撤销
$condition["status"] = array('neq','20,21');
break;
default:
}
......
......@@ -9,6 +9,7 @@
namespace app\api_broker\service;
use app\api\service\PushClientService;
use app\api\untils\GeTuiUtils;
use app\model\AAgents;
use app\model\ABindingDevice;
......@@ -77,11 +78,12 @@ class PushMessageService
* @param $report_id
* @param $type
* @param $operation_id
* @param $type_source
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function pushMarchInMessage($report_id, $type, $operation_id)
public function pushMarchInMessage($report_id, $type, $operation_id, $type_source = 0)
{
$report = new OReportModel();
......@@ -130,6 +132,12 @@ class PushMessageService
$this->record($push_type, 0, $agent_id, $operation_id, $data);
// $this->pushAgentAllDeviceId($report_data['report_agent_id'], $title, $content);
// $this->pushAgentAllDeviceId($agent_store['id'], $title, $content);
//意向金推送
if ($type_source == 10) {
$push = new PushClientService();
$push->record($report_id, $report_data['order_id'], 0, '追加评论经纪人', $operation_id, $report_data['user_id']);
}
return;
}
......
......@@ -37,7 +37,7 @@ class RedisCacheService
public function __construct()
{
$this->redis_ext = RedisExt::getRedis();
$this->time = 1800; //30分钟
$this->time = 86400; //24小时
$this->max_time = 2592000; //30天
}
......
......@@ -179,6 +179,12 @@ class SquareService
return [ 'data' => $res, 'total' => $res_total ];
}
/**
* 开盘广场文章详情
* @param $params
* @param $agent_id
* @return array|false|\PDOStatement|string|\think\Model
*/
public function getSquareInfo($params,$agent_id){
$field = 'Square.id,';
......@@ -200,9 +206,8 @@ class SquareService
$agent = $this->redis->getRedisCache(2, $res['agent_id']) ;
$res['name'] = $agent['name'];
//权限
$vip = new VipService();//0:有权限 1:无权限
$res['is_can_edit'] = $vip->vip($agent_id, 'editSquare');
//用户置顶权限
$res['user_competence'] = $this->userCompetence($agent_id);
return $res;
}
......@@ -297,6 +302,12 @@ class SquareService
}
}
/**
* 评论详情
* @param $params
* @param $agent_id
* @return array|false|\PDOStatement|string|\think\Model
*/
public function getCommenInfo($params,$agent_id){
$field = 'Comment.id,Comment.comment,Comment.create_time,Comment.agent_id';//
$get_params['Comment.id'] = $params['id'];
......@@ -305,12 +316,23 @@ class SquareService
$agent = $this->redis->getRedisCache(2, $res['agent_id']) ;
$res['name'] = $agent['name'];
$res['image_path'] = AGENTHEADERIMGURL . $agent['img'];//'http://n.sinaimg.cn/ent/transform/20170921/FVGl-fymesmp0851702.jpg';
//权限
$vip = new VipService();//0:有权限 1:无权限
$res['is_can_edit'] = $vip->vip($agent_id, 'editSquare');
//用户置顶权限
$res['user_competence'] = $this->userCompetence($agent_id);
return $res;
}
/**
* 用户置顶权限
* @param $agent_id
* @return mixed
*/
public function userCompetence($agent_id){
$vip = new VipService();//0:有权限 1:无权限
$user_competence['set_top'] = $vip->vip($agent_id, 'SquareSetTop');
return $user_competence;
}
/**
* 评论置顶
* @param $params
......
......@@ -71,7 +71,11 @@ class Evaluation extends Basic
}
//7.评价类型:1带看 2成交记录表
if (!empty($params['source'])) {
$where['a.source'] = $params['source'];
if ($params['source'] == 1) {
$where['a.source'] = 10;
} else {
$where['a.source'] = 20;
}
}
//搜索条件 end
......
......@@ -10,13 +10,12 @@ namespace app\index\controller;
use app\api_broker\service\CallPhoneService;
use app\api_broker\service\ClientService;
use app\extra\RedisExt;
use app\api_broker\service\VerifyRepetitionService;
use app\api_broker\service\RedisCacheService;
use app\index\extend\Basic;
use app\index\service\PhoneFollowUpService;
use app\index\service\UserLogService;
use app\index\service\UserService;
use app\model\AAgents;
use app\model\AAgentsPhone;
use app\model\ASite;
use app\model\GOperatingRecords;
use app\model\Remarks;
......@@ -56,9 +55,6 @@ class Remark extends Basic
}
}
$m_user = new Users();
$m_agent = new AAgents();
$code = 200;
$msg = '';
......@@ -78,12 +74,6 @@ class Remark extends Basic
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'];
// }
//有权限的人可以查看其它城市的跟进
if (!empty($this->params['site_id'])) {
......@@ -94,7 +84,7 @@ class Remark extends Basic
if (date('Y-m-d') == $this->params['start_date'] && date('Y-m-d') == $this->params['end_date']) {
$is_today = false;
}
$result = [];
if ($site_id == "10001" && ($this->params['agent_id'] > 0 || !empty($this->params["content"])) && $is_today && empty($this->params['user_id'])) {
$searchService = new SearchService();
$this->params['search_content'] = $this->params['content'];
......@@ -106,32 +96,38 @@ class Remark extends Basic
$if_search = true;
} else {
$follow_up_service = new PhoneFollowUpService($site_id);
$result_data = $follow_up_service->getPhoneFollowList($this->params['start_date'], $this->params['end_date'], $where, $this->userId);
if ($result_data['code'] == 200) {
$result = $result_data['data'];
$result_list = $follow_up_service->getPhoneFollowList($this->params['start_date'], $this->params['end_date'], $where, $this->userId);
if ($result_list['code'] == 200) {
$result = $result_list['data'];
} else {
$result = [];
$code = 101;
$msg = $result_data['data'];
$msg = $result_list['msg'];
}
}
if ($result) {
$redis_service = new RedisCacheService();
$s_user_service = new UserService();
$s_user_Log_service = new UserLogService();
$call = new CallPhoneService();
$label_data = $redis_service->userCallLabelCache();
foreach ($result as $k => $v) {
$user_data = $agent_data = [];
if (!empty($v['user_id'])) {
$user_data = $m_user->getUserById('user_name,user_phone,vip,agent_id,create_time', $v['user_id']);
$user_data = $redis_service->getRedisCache(1, $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']; //客户客方
} else {
$list[$k]['user_name'] = '';
}
if (!empty($v['agent_id'])) {
$agent_data = $redis_service->getRedisCache(2, $v['agent_id']);
$list[$k]['admin'] = $agent_data['name'];
} else {
$list[$k]['admin'] = '';
}
$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'] = $v['label_name'];
$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]['user_id'] = $v['user_id'];
$list[$k]['content'] = $v['content'];
$list[$k]['user_status'] = $v['user_status'];
......@@ -142,6 +138,20 @@ class Remark extends Basic
} else {
$list[$k]['create_time'] = $v['create_time'];
}
#客户是否在保护期内(0:保护器内 1:超过保护期)
$list[$k]['is_outstrip_twenty_four_hours'] = $s_user_service->isUserProtect($v['user_id']);
#判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定(0允许拨打 1不允许拨打)
$list[$k]['is_outpace_call_num'] = $s_user_Log_service->userDetailIsOutpaceCallNum($v['user_id'],$user_data['user_phone'], $this->userId);
if ($list[$k]['is_outpace_call_num']) {
$result = $call->checkBindRedis($this->userId, $agent_data['phone_list'], $v['user_phone']);
if($result != ''){
$list[$k]['is_outpace_call_num'] = 0;
}
}
$list[$k]['label_name'] = array_key_exists($v['labels_id'], $label_data) ? $label_data[$v['labels_id']] : '';
}
}
$data['data']['list'] = $list;
......
......@@ -54,11 +54,11 @@ class PhoneFollowUpService
if($is_bool) {
$msg = "高峰期间每10秒钟只能搜索一次(6.30-8.30)";
}
return ['code'=>'101','data'=>$msg];
return ['code'=>'101','msg'=>$msg];
}
$where = ' 1=1 ';
if (empty($start_time) || empty($end_time)) {
return ['code'=>'101','data'=>'时间不能为空'];
return ['code'=>'101','msg'=>'时间不能为空'];
} else {
$where .= ' AND create_time BETWEEN "'.$start_time.' 00:00:00" AND "'.$end_time. ' 23:59:59"';
}
......@@ -89,7 +89,7 @@ class PhoneFollowUpService
$agent_id = $m_agent->getAgentsByWhereColumn($agent_where, 'id');
if (empty($agent_id)) {
return ['code'=>'101','data'=>'暂无数据'];
return ['code'=>'101','msg'=>'暂无数据'];
} else {
$agent_id_string = implode(',', $agent_id);
$where .= " AND agent_id in ({$agent_id_string})";
......@@ -103,20 +103,6 @@ class PhoneFollowUpService
$data = $this->phoneFollowUp->getFollowList($page_no, $page_size, $order_ = '', $field, $where);
}
$s_user_service = new UserService();
$s_user_Log_service = new UserLogService();
$m_user = new Users();
$m_label = new ULabels();
$label_data = $m_label->getColumn('id,name', ['type'=>1]); //获取标签
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->getUserDetailStreamline($v['user_id'], 'user_name,user_phone');
$data[$k]['is_outpace_call_num'] = $s_user_Log_service->userDetailIsOutpaceCallNum($v['user_id'],$user_res['user_phone'], $agent_id);
$data[$k]['label_name'] = array_key_exists($v['labels_id'], $label_data) ? $label_data[$v['labels_id']] : '';
}
return ['code'=>'200','data'=>$data];
}
......
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