Commit 6dabe42b authored by clone's avatar clone

1

parent 718bc6ef
...@@ -33,8 +33,10 @@ use app\model\NoteLog; ...@@ -33,8 +33,10 @@ use app\model\NoteLog;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\OfficeFollowUpLogModel; use app\model\OfficeFollowUpLogModel;
use app\model\OfficeUPhoneFollowUp; use app\model\OfficeUPhoneFollowUp;
use app\model\OfficeUPhoneFollowUpImg;
use app\model\SecretReport; use app\model\SecretReport;
use app\model\UPhoneFollowUp; use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpImg;
use app\model\UPhoneFollowUpTemporary; use app\model\UPhoneFollowUpTemporary;
use app\model\Users; use app\model\Users;
use app\task\controller\FollowUpTask; use app\task\controller\FollowUpTask;
...@@ -76,7 +78,7 @@ class Broker extends Basic ...@@ -76,7 +78,7 @@ class Broker extends Basic
$field = 'id,device_id,store_id,auth_group_id,district_id,level,name,phone,password,sex,img,inviter_id,status'; $field = 'id,device_id,store_id,auth_group_id,district_id,level,name,phone,password,sex,img,inviter_id,status';
$where['phone'] = $this->params['phone']; $where['phone'] = $this->params['phone'];
$where['id'] = [ '<>', 1 ]; $where['id'] = ['<>', 1];
$agents_data = $this->a_agents->getAgentInfo($field, '', $where); $agents_data = $this->a_agents->getAgentInfo($field, '', $where);
if (empty($agents_data)) { if (empty($agents_data)) {
...@@ -139,25 +141,25 @@ class Broker extends Basic ...@@ -139,25 +141,25 @@ class Broker extends Basic
"device_id" => "qweqweqweqweqw123123", "device_id" => "qweqweqweqweqw123123",
"model" => "iphone7",//手机型号 "model" => "iphone7",//手机型号
);*/ );*/
$status = 1; $status = 1;
$agents_data = []; $agents_data = [];
$checkResult = $this->validate($params, "PerformanceValidate.login"); $checkResult = $this->validate($params, "PerformanceValidate.login");
if (true !== $checkResult) { if (true !== $checkResult) {
return $this->response("101", $checkResult); return $this->response("101", $checkResult);
} }
$field = 'id,store_id,auth_group_id,district_id,level,name,phone,password,sex,img,inviter_id,status,site_id'; $field = 'id,store_id,auth_group_id,district_id,level,name,phone,password,sex,img,inviter_id,status,site_id';
$where['phone'] = $params['phone']; $where['phone'] = $params['phone'];
$where['id'] = [ '<>', 1 ]; $where['id'] = ['<>', 1];
$where['status'] = ['<>', 3]; $where['status'] = ['<>', 3];
$agents_data_list = $this->a_agents->getAgentById($field, $where); $agents_data_list = $this->a_agents->getAgentById($field, $where);
if (count($agents_data_list) <= 0) { if (count($agents_data_list) <= 0) {
return $this->response(101, '没有该用户'); return $this->response(101, '没有该用户');
} }
foreach ($agents_data_list as $v) { foreach ($agents_data_list as $v) {
if ($v['status'] == 0) { if ($v['status'] == 0) {
$status = 0; $status = 0;
$agents_data = $v; $agents_data = $v;
break; //查找正常状态 break; //查找正常状态
} else { } else {
...@@ -168,15 +170,20 @@ class Broker extends Basic ...@@ -168,15 +170,20 @@ class Broker extends Basic
if ($status) { if ($status) {
switch ($agents_data['status']) { switch ($agents_data['status']) {
case 1 : case 1 :
$msg = '您目前是长假状态,请联系人事进行更改';break; $msg = '您目前是长假状态,请联系人事进行更改';
break;
case 2 : case 2 :
$msg = '您目前是已离职状态,请联系人事进行更改。';break; $msg = '您目前是已离职状态,请联系人事进行更改。';
break;
case 3 : case 3 :
$msg = '您已转勤';break; $msg = '您已转勤';
break;
case 4 : case 4 :
$msg = '该账号已被列入黑名单!';break; $msg = '该账号已被列入黑名单!';
break;
case 5 : case 5 :
$msg = '该账号已被冻结!';break; $msg = '该账号已被冻结!';
break;
default : default :
$msg = '帐号异常'; $msg = '帐号异常';
} }
...@@ -204,14 +211,14 @@ class Broker extends Basic ...@@ -204,14 +211,14 @@ class Broker extends Basic
if (!empty($agents_data['img'])) { if (!empty($agents_data['img'])) {
$agents_data['img'] = AGENTHEADERIMGURL . $agents_data->img; $agents_data['img'] = AGENTHEADERIMGURL . $agents_data->img;
} }
$m_site = new ASite(); $m_site = new ASite();
$site_city = $m_site->getSite('city', ['id'=>$agents_data['site_id'], 'is_del'=>0]); $site_city = $m_site->getSite('city', ['id' => $agents_data['site_id'], 'is_del' => 0]);
$agents_data['city'] = $site_city[0]['city']; $agents_data['city'] = $site_city[0]['city'];
$jwt_data['id'] = $agents_data['id']; $jwt_data['id'] = $agents_data['id'];
$jwt_data['name'] = $agents_data['name']; $jwt_data['name'] = $agents_data['name'];
$jwt_data['phone'] = $agents_data['phone']; $jwt_data['phone'] = $agents_data['phone'];
$jwt_data['level'] = $agents_data['level']; $jwt_data['level'] = $agents_data['level'];
$jwt = new JwtUntils(); $jwt = new JwtUntils();
$data['data'] = $agents_data->getData(); $data['data'] = $agents_data->getData();
...@@ -238,12 +245,12 @@ class Broker extends Basic ...@@ -238,12 +245,12 @@ class Broker extends Basic
// } // }
// /*处理多个手机登录聊天*/ // /*处理多个手机登录聊天*/
$m_auth_group = new AuthGroup(); $m_auth_group = new AuthGroup();
$auth_group = $m_auth_group->getAuthGroup($data['data']['auth_group_id'], 'title,rules'); $auth_group = $m_auth_group->getAuthGroup($data['data']['auth_group_id'], 'title,rules');
$m_rule = new AuthRule(); $m_rule = new AuthRule();
$id = $m_rule->getAuthRuleByName('index/dailyDetailsFinance', 'id'); $id = $m_rule->getAuthRuleByName('index/dailyDetailsFinance', 'id');
$rules_arr = explode(',', $auth_group['rules']); $rules_arr = explode(',', $auth_group['rules']);
$data['data']['show_daily'] = 0; $data['data']['show_daily'] = 0;
if (in_array($id, $rules_arr)) { if (in_array($id, $rules_arr)) {
$data['data']['show_daily'] = 1; //财务日报显示 $data['data']['show_daily'] = 1; //财务日报显示
...@@ -298,7 +305,7 @@ class Broker extends Basic ...@@ -298,7 +305,7 @@ class Broker extends Basic
try { try {
$id = $this->aBD->updateDevice($params); $id = $this->aBD->updateDevice($params);
if ($id > 0) { if ($id > 0) {
return $this->response("200", "update success", [ "id" => $id ]); return $this->response("200", "update success", ["id" => $id]);
} else { } else {
return $this->response("101", "请求异常"); return $this->response("101", "请求异常");
} }
...@@ -336,14 +343,14 @@ class Broker extends Basic ...@@ -336,14 +343,14 @@ class Broker extends Basic
} }
if ($this->params['site_id']) { if ($this->params['site_id']) {
$where .= ' AND site_id ='.$this->params['site_id']; $where .= ' AND site_id =' . $this->params['site_id'];
} }
if ($where) { if ($where) {
$field = 'id,name,phone,img,status'; $field = 'id,name,phone,img,status';
$data['data'] = $this->a_agents->getList($pageNo, $pageSize, 'id DESC', $field, '', $where); $data['data'] = $this->a_agents->getList($pageNo, $pageSize, 'id DESC', $field, '', $where);
if($data['data']){ if ($data['data']) {
foreach ($data['data'] as $k=>$v) { foreach ($data['data'] as $k => $v) {
if (isset($v['img'])) { if (isset($v['img'])) {
$data['data'][$k]['head_portrait'] = AGENTHEADERIMGURL . $v['img']; $data['data'][$k]['head_portrait'] = AGENTHEADERIMGURL . $v['img'];
} }
...@@ -391,14 +398,14 @@ class Broker extends Basic ...@@ -391,14 +398,14 @@ class Broker extends Basic
$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();
// $s_phone_follow_up = new UPhoneFollowUp($this->siteId); // $s_phone_follow_up = new UPhoneFollowUp($this->siteId);
$s_phone_follow_up = new UPhoneFollowUpTemporary($this->siteId); $s_phone_follow_up = new UPhoneFollowUpTemporary($this->siteId);
$result = $s_phone_follow_up->savePhoneFollow($params); $result = $s_phone_follow_up->savePhoneFollow($params);
if ($result > 0) { if ($result > 0) {
//跟进,对客户状态进行更新 0:求租;1:已租;-1:无效 //跟进,对客户状态进行更新 0:求租;1:已租;-1:无效
$Users->update_user_status([ 'id' => $user_id, 'user_status' => $user_status ]); $Users->update_user_status(['id' => $user_id, 'user_status' => $user_status]);
// $redis = RedisExt::getRedis(); // $redis = RedisExt::getRedis();
// $user_key = 'call_phone_user_' . date('Y-m-d'); // $user_key = 'call_phone_user_' . date('Y-m-d');
...@@ -442,13 +449,13 @@ class Broker extends Basic ...@@ -442,13 +449,13 @@ class Broker extends Basic
$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();
$s_phone_follow_up = new UPhoneFollowUpTemporary($this->siteId); $s_phone_follow_up = new UPhoneFollowUpTemporary($this->siteId);
$result = $s_phone_follow_up->savePhoneFollow($params); $result = $s_phone_follow_up->savePhoneFollow($params);
if ($result > 0) { if ($result > 0) {
//跟进,对客户状态进行更新 0:求租;1:已租;-1:无效 //跟进,对客户状态进行更新 0:求租;1:已租;-1:无效
$Users->update_user_status([ 'id' => $user_id, 'user_status' => $user_status ]); $Users->update_user_status(['id' => $user_id, 'user_status' => $user_status]);
// $redis = RedisExt::getRedis(); // $redis = RedisExt::getRedis();
// $user_key = 'call_phone_user_' . date('Y-m-d'); // $user_key = 'call_phone_user_' . date('Y-m-d');
...@@ -471,13 +478,14 @@ class Broker extends Basic ...@@ -471,13 +478,14 @@ class Broker extends Basic
public function addUserPhoneFollowUpV2() public function addUserPhoneFollowUpV2()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
'content' => '跟进内容', 'content' => '跟进内容',
'labels_id' => 1,//g_labels表主键 'labels_id' => 1,//g_labels表主键
'agent_id' => 1, 'agent_id' => 1,
'type' => 1,//0电话跟进 1普通跟进 'type' => 1,//0电话跟进 1普通跟进
'entrust_type' => 1,//委托类型 0找铺 1找办公楼 'entrust_type' => 1,//委托类型 0找铺 1找办公楼
);*/ 'img_arr' => []
);*/
$checkResult = $this->validate($params, "BrokerValidate.add_phone_follow_up_verify"); $checkResult = $this->validate($params, "BrokerValidate.add_phone_follow_up_verify");
...@@ -488,17 +496,25 @@ class Broker extends Basic ...@@ -488,17 +496,25 @@ class Broker extends Basic
return $this->response("101", "身份验证失败!"); return $this->response("101", "身份验证失败!");
} }
$img_arr = isset($params["img_arr"]) ? json_decode($params["img_arr"], true) : "";
unset($params["march_in_img"]);
$entrust_type = $params["entrust_type"]; $entrust_type = $params["entrust_type"];
$result = []; $result = [];
if($entrust_type == 0){ if ($entrust_type == 0) {
$s_phone_follow_up = new UPhoneFollowUpTemporary($this->siteId); $s_phone_follow_up = new UPhoneFollowUpTemporary($this->siteId);
$result = $s_phone_follow_up->savePhoneFollow($params); $result = $s_phone_follow_up->savePhoneFollow($params);
$oImgModel = new UPhoneFollowUpImg();
}else{ } else {
$office_follow_up = new OfficeUPhoneFollowUp($this->siteId); $office_follow_up = new OfficeUPhoneFollowUp($this->siteId);
$result = $office_follow_up->savePhoneFollow($params); $result = $office_follow_up->savePhoneFollow($params);
$oImgModel = new OfficeUPhoneFollowUpImg();
}
if($img_arr && $result){
$oImgModel->addImgAll($result, 1, $img_arr);
} }
if ($result > 0) { if ($result > 0) {
$redis_service = new RedisCacheService(); $redis_service = new RedisCacheService();
$redis_service->delRecordCallRedis($this->agentId, $params['user_id'], $this->siteId); $redis_service->delRecordCallRedis($this->agentId, $params['user_id'], $this->siteId);
...@@ -525,7 +541,7 @@ class Broker extends Basic ...@@ -525,7 +541,7 @@ class Broker extends Basic
$params['pagenum'] ='1'; $params['pagenum'] ='1';
$params['user_id'] ='10';*/ $params['user_id'] ='10';*/
if (!isset($params['phone_or_name']) || !isset($params['user_id'])) { if (!isset($params['phone_or_name']) || !isset($params['user_id'])) {
return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]); return $this->response("300", "参数不全", ['remote_groupid' => '']);
} }
$phone_or_name = trim($params['phone_or_name']); $phone_or_name = trim($params['phone_or_name']);
...@@ -564,9 +580,9 @@ class Broker extends Basic ...@@ -564,9 +580,9 @@ class Broker extends Basic
exit;*/ exit;*/
if ($user_res) { if ($user_res) {
return $this->response("200", "success!", [ 'user_date' => $user_res, 'pagenum' => $pagenum, 'total' => $total ]); return $this->response("200", "success!", ['user_date' => $user_res, 'pagenum' => $pagenum, 'total' => $total]);
} else { } else {
return $this->response("200", "request null", [ 'user_date' => [], 'pagenum' => $pagenum, 'total' => $total ]); return $this->response("200", "request null", ['user_date' => [], 'pagenum' => $pagenum, 'total' => $total]);
} }
} }
...@@ -590,7 +606,7 @@ class Broker extends Basic ...@@ -590,7 +606,7 @@ class Broker extends Basic
);*/ );*/
if (!isset($params['user_id'])) { if (!isset($params['user_id'])) {
return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]); return $this->response("300", "参数不全", ['remote_groupid' => '']);
} }
$user_id = $params['user_id']; $user_id = $params['user_id'];
...@@ -603,25 +619,24 @@ class Broker extends Basic ...@@ -603,25 +619,24 @@ class Broker extends Basic
$user_res['user_pic'] = HEADERIMGURL . $user_res['user_pic']; $user_res['user_pic'] = HEADERIMGURL . $user_res['user_pic'];
$agents_res = $agent->verifyUser('name,phone', '', [ 'id' => $user_res['agent_id'] ]); $agents_res = $agent->verifyUser('name,phone', '', ['id' => $user_res['agent_id']]);
$user_res['agentinfo'] = $agents_res ? $agents_res['name'] . '-' . $agents_res['phone'] : '未知'; $user_res['agentinfo'] = $agents_res ? $agents_res['name'] . '-' . $agents_res['phone'] : '未知';
$data['agent_path'] = AGENTHEADERIMGURL; $data['agent_path'] = AGENTHEADERIMGURL;
/*查询站点名*/ /*查询站点名*/
$site_model = new ASite(); $site_model = new ASite();
foreach (explode(',', $user_res['site_ids']) as $site_k => $site_v) { foreach (explode(',', $user_res['site_ids']) as $site_k => $site_v) {
$site_field = 'city'; $site_field = 'city';
$site_params['id'] = $site_v; $site_params['id'] = $site_v;
$site_model = $site_model->findByOne($site_field,$site_params); $site_model = $site_model->findByOne($site_field, $site_params);
//dump($site_model["city"]); //dump($site_model["city"]);
$user_res['site_name'][]= $site_model["city"] ; $user_res['site_name'][] = $site_model["city"];
} }
/*查询站点名*/ /*查询站点名*/
$orderLog = new OrderLogService(); $orderLog = new OrderLogService();
$data['user_date'] = $orderLog->selectListByUserId($user_id, '',$this->siteId); $data['user_date'] = $orderLog->selectListByUserId($user_id, '', $this->siteId);
/*修改记录部分 start*/ /*修改记录部分 start*/
$records = new GOperatingRecords(); $records = new GOperatingRecords();
...@@ -650,8 +665,8 @@ class Broker extends Basic ...@@ -650,8 +665,8 @@ class Broker extends Basic
/*判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期 start*/ /*判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期 start*/
//查询客户是否在保护期内 //查询客户是否在保护期内
$user_service = new UserService(); $user_service = new UserService();
$is_outstrip_twenty_four_hours = $user_service->isUserProtect($params["user_id"]); $is_outstrip_twenty_four_hours = $user_service->isUserProtect($params["user_id"]);
$data['is_outstrip_twenty_four_hours'] = $is_outstrip_twenty_four_hours; $data['is_outstrip_twenty_four_hours'] = $is_outstrip_twenty_four_hours;
/*判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期 end*/ /*判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期 end*/
...@@ -670,7 +685,7 @@ class Broker extends Basic ...@@ -670,7 +685,7 @@ class Broker extends Basic
} }
} else { } else {
$model = new AAgents(); $model = new AAgents();
$result = $model->searchAgentsByKeyword("id,name,phone", [ "id" => $user_res['referrer_id'] ]); $result = $model->searchAgentsByKeyword("id,name,phone", ["id" => $user_res['referrer_id']]);
if (!$result) { if (!$result) {
$user_invite_info = []; $user_invite_info = [];
} else { } else {
...@@ -693,7 +708,7 @@ class Broker extends Basic ...@@ -693,7 +708,7 @@ class Broker extends Basic
$model = new AAgents(); $model = new AAgents();
$result = $model->searchAgentsByKeyword("id,name,phone", [ "id" => $params["agent_id"] ]); $result = $model->searchAgentsByKeyword("id,name,phone", ["id" => $params["agent_id"]]);
$call = new CallPhoneService(); $call = new CallPhoneService();
$result = $call->getBindNum($user_res['user_phone'], $result[0]['phone']); $result = $call->getBindNum($user_res['user_phone'], $result[0]['phone']);
if ($result != 0) { if ($result != 0) {
...@@ -701,10 +716,10 @@ class Broker extends Basic ...@@ -701,10 +716,10 @@ class Broker extends Basic
} }
//查询当前经纪人是否是某个客方的总监 0:可查看 1:不可查看 //查询当前经纪人是否是某个客方的总监 0:可查看 1:不可查看
$data['is_can_look'] = $user_service->isUserAgentDirector($user_res["agent_id"],$params["agent_id"]); $data['is_can_look'] = $user_service->isUserAgentDirector($user_res["agent_id"], $params["agent_id"]);
$vip_services = new VipService(); $vip_services = new VipService();
//是否可以查看vip客户 0:可查看 1:不可查看 //是否可以查看vip客户 0:可查看 1:不可查看
$data['examine_vip'] = $vip_services->vip($params['agent_id']); $data['examine_vip'] = $vip_services->vip($params['agent_id']);
return $this->response("200", "success!", $data); return $this->response("200", "success!", $data);
} }
...@@ -724,7 +739,7 @@ class Broker extends Basic ...@@ -724,7 +739,7 @@ class Broker extends Basic
return $this->response("101", "请输入需要检索的关键词"); return $this->response("101", "请输入需要检索的关键词");
} }
$orderLog = new OrderLogService(); $orderLog = new OrderLogService();
$data = $orderLog->selectListByUserId($params["user_id"], $params["keyword"],$this->siteId); $data = $orderLog->selectListByUserId($params["user_id"], $params["keyword"], $this->siteId);
$data['agent_path'] = AGENTHEADERIMGURL; $data['agent_path'] = AGENTHEADERIMGURL;
return $this->response("200", "request success", $data); return $this->response("200", "request success", $data);
} }
...@@ -792,7 +807,7 @@ class Broker extends Basic ...@@ -792,7 +807,7 @@ class Broker extends Basic
if ($code == $this->request->param('code') && $jwt_phone == $this->params['phone']) { if ($code == $this->request->param('code') && $jwt_phone == $this->params['phone']) {
$agents->forgetPwd($agent_data['id'], $this->params['pwd']); $agents->forgetPwd($agent_data['id'], $this->params['pwd']);
$data['data'] = [ 'id' => $agent_data['id'] ]; $data['data'] = ['id' => $agent_data['id']];
$data['code'] = 200; $data['code'] = 200;
$data['msg'] = '修改成功'; $data['msg'] = '修改成功';
} else { } else {
...@@ -819,7 +834,7 @@ class Broker extends Basic ...@@ -819,7 +834,7 @@ class Broker extends Basic
$file = request()->file('image'); $file = request()->file('image');
if ($file) { if ($file) {
$path = ROOT_PATH . 'public' . DS . 'static' . DS . 'user_header'; $path = ROOT_PATH . 'public' . DS . 'static' . DS . 'user_header';
$info = $file->validate([ 'size' => 512000, 'ext' => 'jpg,png' ])//限制500KB $info = $file->validate(['size' => 512000, 'ext' => 'jpg,png'])//限制500KB
->move($path); ->move($path);
if ($info) { if ($info) {
$user = new AAgents(); $user = new AAgents();
...@@ -836,7 +851,7 @@ class Broker extends Basic ...@@ -836,7 +851,7 @@ class Broker extends Basic
$data['status'] = 200; $data['status'] = 200;
$data['msg'] = '上传成功'; $data['msg'] = '上传成功';
$data['data'] = [ 'file_name' => AGENTHEADERIMGURL . $img_path ]; $data['data'] = ['file_name' => AGENTHEADERIMGURL . $img_path];
} else { } else {
// 上传失败获取错误信息 // 上传失败获取错误信息
$data['msg'] = $file->getError(); $data['msg'] = $file->getError();
...@@ -859,7 +874,7 @@ class Broker extends Basic ...@@ -859,7 +874,7 @@ class Broker extends Basic
$jwt = new JwtUntils(); $jwt = new JwtUntils();
$data['phone'] = $this->params['phone']; $data['phone'] = $this->params['phone'];
$token = $jwt->createToken($data); $token = $jwt->createToken($data);
return $this->response(200, "", [ 'AuthToken' => $token ]); return $this->response(200, "", ['AuthToken' => $token]);
} }
/** /**
...@@ -914,7 +929,7 @@ class Broker extends Basic ...@@ -914,7 +929,7 @@ class Broker extends Basic
$noteLog = new NoteLog(); $noteLog = new NoteLog();
$send_time = $noteLog->field('send_time')->where('phone', $this->params['phone']) $send_time = $noteLog->field('send_time')->where('phone', $this->params['phone'])
->where('is_success', 1) ->where('is_success', 1)
->where('send_time', 'between time', [ date('Y-m-d') . ' 00:00:00', date('Y-m-d') . ' 23:59:59' ]) ->where('send_time', 'between time', [date('Y-m-d') . ' 00:00:00', date('Y-m-d') . ' 23:59:59'])
->select(); ->select();
$num = count($send_time); //发送数量 $num = count($send_time); //发送数量
...@@ -969,7 +984,7 @@ class Broker extends Basic ...@@ -969,7 +984,7 @@ class Broker extends Basic
$code = new GenerateCodeUntils(); $code = new GenerateCodeUntils();
$url = $this->request->domain() . '/app_broker/index?referrer_source=20&referrer_id=' . $this->agentId; $url = $this->request->domain() . '/app_broker/index?referrer_source=20&referrer_id=' . $this->agentId;
$path = $code->getCode($url, $this->agentId, 2); $path = $code->getCode($url, $this->agentId, 2);
$data['data'] = [ 'path' => $this->request->domain() . '/' . $path ]; $data['data'] = ['path' => $this->request->domain() . '/' . $path];
$data['status'] = 200; $data['status'] = 200;
return $this->response($data['status'], $data['msg'], $data['data']); return $this->response($data['status'], $data['msg'], $data['data']);
} }
...@@ -979,9 +994,10 @@ class Broker extends Basic ...@@ -979,9 +994,10 @@ class Broker extends Basic
* *
* @return \think\Response * @return \think\Response
*/ */
public function getAgentGroupSite() { public function getAgentGroupSite()
{
$service_broker = new \app\index\service\BrokerService(); $service_broker = new \app\index\service\BrokerService();
$site_data = $service_broker->checkSite($this->agentId); $site_data = $service_broker->checkSite($this->agentId);
if ($site_data) { if ($site_data) {
$data['data'] = $site_data; $data['data'] = $site_data;
} else { } else {
...@@ -1023,7 +1039,7 @@ class Broker extends Basic ...@@ -1023,7 +1039,7 @@ class Broker extends Basic
//评价列表信息 //评价列表信息
$result['evaluate'] = $evaluate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']); $result['evaluate'] = $evaluate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']);
//成交记录 //成交记录
$result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, [ 'a.agent_id' => $this->params['agent_id'] ]); $result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, ['a.agent_id' => $this->params['agent_id']]);
$data['data'] = $result; $data['data'] = $result;
break; break;
case 1: case 1:
...@@ -1033,7 +1049,7 @@ class Broker extends Basic ...@@ -1033,7 +1049,7 @@ class Broker extends Basic
break; break;
case 2: case 2:
//成交记录 //成交记录
$result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, [ 'a.agent_id' => $this->params['agent_id'] ]); $result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, ['a.agent_id' => $this->params['agent_id']]);
$data['data'] = $result; $data['data'] = $result;
break; break;
default: default:
...@@ -1058,17 +1074,17 @@ class Broker extends Basic ...@@ -1058,17 +1074,17 @@ class Broker extends Basic
public function getPhoneBook() public function getPhoneBook()
{ {
$params = $this->params; $params = $this->params;
$where = []; $where = [];
$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'];
if (!empty($params['keyword'])) { if (!empty($params['keyword'])) {
$where['Agents.name|Agents.phone'] = [ 'LIKE', '%' . $params['keyword'] . '%' ]; $where['Agents.name|Agents.phone'] = ['LIKE', '%' . $params['keyword'] . '%'];
} }
$field = 'Agents.id as agent_id,'; $field = 'Agents.id as agent_id,';
$field .= 'Agents.name,'; $field .= 'Agents.name,';
$field .= 'Agents.img,'; $field .= 'Agents.img,';
$field .= 'Agents.status,'; $field .= 'Agents.status,';
...@@ -1080,7 +1096,7 @@ class Broker extends Basic ...@@ -1080,7 +1096,7 @@ class Broker extends Basic
} }
$res_total = $this->a_agents->getPhoneBookListTotal($where); $res_total = $this->a_agents->getPhoneBookListTotal($where);
return $this->response("200", "成功",['data'=>$res,'total'=>$res_total]); return $this->response("200", "成功", ['data' => $res, 'total' => $res_total]);
} }
...@@ -1089,20 +1105,21 @@ class Broker extends Basic ...@@ -1089,20 +1105,21 @@ class Broker extends Basic
* *
* @return \think\Response * @return \think\Response
*/ */
public function checkAuth() { public function checkAuth()
{
$url = $this->params['url']; $url = $this->params['url'];
if (empty($url)) { if (empty($url)) {
return $this->response(101, '条件为空'); return $this->response(101, '条件为空');
} }
$code = 200; $code = 200;
$msg = ''; $msg = '';
$vip_service = new VipService(); $vip_service = new VipService();
$is_ = $vip_service->vip($this->agentId, $url); $is_ = $vip_service->vip($this->agentId, $url);
if ($is_) { if ($is_) {
$code = 101; $code = 101;
$msg = '没有权限'; $msg = '没有权限';
} }
return $this->response($code, $msg); return $this->response($code, $msg);
} }
...@@ -1120,9 +1137,9 @@ class Broker extends Basic ...@@ -1120,9 +1137,9 @@ class Broker extends Basic
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"agents_id" => 1550, "agents_id" => 1550,
);*/ );*/
if (!isset($params["agents_id"])) { if (!isset($params["agents_id"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
...@@ -1133,7 +1150,7 @@ class Broker extends Basic ...@@ -1133,7 +1150,7 @@ class Broker extends Basic
$m_secret_report = new SecretReport(); $m_secret_report = new SecretReport();
$field = 'a.id,a.call_time,a.users_id,a.time,b.name'; $field = 'a.id,a.call_time,a.users_id,a.time,b.name';
// $where['a.agents_id'] = $params["agents_id"]; // $where['a.agents_id'] = $params["agents_id"];
$where = []; $where = [];
...@@ -1141,33 +1158,34 @@ class Broker extends Basic ...@@ -1141,33 +1158,34 @@ class Broker extends Basic
// $where['a.call_time'] = array('between', array($params['start_date']. ' 00:00:00', $params['end_date']. ' 23:59:59')); // $where['a.call_time'] = array('between', array($params['start_date']. ' 00:00:00', $params['end_date']. ' 23:59:59'));
// } // }
if (!empty($params['start_date'])) { if (!empty($params['start_date'])) {
$where['a.call_time'] = array('between', array($params['start_date']. ' 00:00:00', $params['start_date']. ' 23:59:59')); $where['a.call_time'] = array('between', array($params['start_date'] . ' 00:00:00', $params['start_date'] . ' 23:59:59'));
} }
if (is_numeric($params['users_type']) && !empty($this->params['users_id'])) { if (is_numeric($params['users_type']) && !empty($this->params['users_id'])) {
$where['a.user_type'] = (int)$params['users_type']; $where['a.user_type'] = (int)$params['users_type'];
$where['a.users_id'] = (int)$params['users_id']; $where['a.users_id'] = (int)$params['users_id'];
} }
$res = $m_secret_report->getCallList($pageNo, $pageSize, '', $field, $where); $res = $m_secret_report->getCallList($pageNo, $pageSize, '', $field, $where);
$res_total = $m_secret_report->getCallListTotal($where); $res_total = $m_secret_report->getCallListTotal($where);
$data['list'] = $res; $data['list'] = $res;
$data['total'] = $res_total; $data['total'] = $res_total;
return $this->response("200", "成功",$data); return $this->response("200", "成功", $data);
} }
public function getAgentDistrictId(){ public function getAgentDistrictId()
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
if (!isset($params["phone"])) { if (!isset($params["phone"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$get_params['a.phone'] = $params['phone']; $get_params['a.phone'] = $params['phone'];
$get_params["a.status"] = array("in","0,3"); $get_params["a.status"] = array("in", "0,3");
$get_params['a.level'] = array('in','30,40'); $get_params['a.level'] = array('in', '30,40');
$data = $this->a_agents->getAgentDistrictId("a.id,a.name,a.site_id,b.name", $get_params); $data = $this->a_agents->getAgentDistrictId("a.id,a.name,a.site_id,b.name", $get_params);
return $this->response("200", "成功",$data); return $this->response("200", "成功", $data);
} }
} }
\ No newline at end of file
<?php
namespace app\model;
/**
* Created by PhpStorm.
* User : zw
* Date : 2019/7/5
* Time : 10:15
* Intro:
*/
use think\Db;
use think\Exception;
use Think\Log;
class OfficeUPhoneFollowUpImg extends BaseModel
{
protected $table = "office_u_phone_follow_up_img";
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
/**
* 新增多张图片
* @param $params
* @param $img_id
* @param $img_type
* @return int|string
* @throws Exception xx
*/
public function addImgAll(int $img_id, int $img_type, array $params): int
{
$imgBin = [];
foreach ($params as $item) {
$insert_["img_id"] = $img_id;
$insert_["img_type"] = $img_type;
$insert_["img_name"] = $item;
$insert_["img_status"] = 0;
array_push($imgBin, $this->imgBin($insert_));
}
Db::startTrans();
try {
$this->saveAll($imgBin);
Db::commit();
return 1;
} catch (Exception $exception) {
Db::rollback();
throw $exception;
}
}
/**
* 修改图片单张
* @param array $params
* @return int
* @throws Exception
*/
public function updateImgStatus(array $params): int
{
$imgBin = $this->imgBin($params);
Db::startTrans();
try {
$this->update($imgBin);
Db::commit();
return $params["id"];
} catch (Exception $exception) {
Db::rollback();
throw $exception;
}
}
/**
* 批量删除
* @param $where
* @param $params
* @return int|string
*/
public function updateImgs($where,$params)
{
Db::startTrans();
try {
$id = $this->db_->where($where)->update($params);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* 根据id和类型获取图片
* @param array $params
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
*/
public function getImgList(array $params, string $field = "id,img_name")
{
if (isset($params["img_id"])) {
$where_["img_id"] = $params["img_id"];
}
if (isset($params["img_type"])) {
$where_["img_type"] = $params["img_type"];
}
$where_["img_status"] = 0;
$data = $this->db_
->field($field)
->where($where_)
->select();
// echo $this->getLastSql();
return $data;
}
/**
* bin
* @param $params
* @return array
*/
private function imgBin($params)
{
$arr = [];
if (isset($params["id"])) {
$arr["id"] = $params["id"];
} else {
$arr["create_time"] = date("Y-m-d H:i:s", time());
}
if (isset($params["img_id"])) {
$arr["img_id"] = $params["img_id"];
}
if (isset($params["img_type"])) {
$arr["img_type"] = $params["img_type"];
}
if (isset($params["img_name"])) {
$arr["img_name"] = $params["img_name"];
}
if (isset($params["img_status"])) {
$arr["img_status"] = $params["img_status"];
}
$arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr;
}
}
\ No newline at end of file
<?php
namespace app\model;
/**
* Created by PhpStorm.
* User : zw
* Date : 2019/7/5
* Time : 10:15
* Intro:
*/
use think\Db;
use think\Exception;
use Think\Log;
class UPhoneFollowUpImg extends BaseModel
{
protected $table = "u_phone_follow_up_img";
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
/**
* 新增多张图片
* @param $params
* @param $img_id
* @param $img_type
* @return int|string
* @throws Exception xx
*/
public function addImgAll(int $img_id, int $img_type, array $params): int
{
$imgBin = [];
foreach ($params as $item) {
$insert_["img_id"] = $img_id;
$insert_["img_type"] = $img_type;
$insert_["img_name"] = $item;
$insert_["img_status"] = 0;
array_push($imgBin, $this->imgBin($insert_));
}
Db::startTrans();
try {
$this->saveAll($imgBin);
Db::commit();
return 1;
} catch (Exception $exception) {
Db::rollback();
throw $exception;
}
}
/**
* 修改图片单张
* @param array $params
* @return int
* @throws Exception
*/
public function updateImgStatus(array $params): int
{
$imgBin = $this->imgBin($params);
Db::startTrans();
try {
$this->update($imgBin);
Db::commit();
return $params["id"];
} catch (Exception $exception) {
Db::rollback();
throw $exception;
}
}
/**
* 批量删除
* @param $where
* @param $params
* @return int|string
*/
public function updateImgs($where,$params)
{
Db::startTrans();
try {
$id = $this->db_->where($where)->update($params);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* 根据id和类型获取图片
* @param array $params
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
*/
public function getImgList(array $params, string $field = "id,img_name")
{
if (isset($params["img_id"])) {
$where_["img_id"] = $params["img_id"];
}
if (isset($params["img_type"])) {
$where_["img_type"] = $params["img_type"];
}
$where_["img_status"] = 0;
$data = $this->db_
->field($field)
->where($where_)
->select();
// echo $this->getLastSql();
return $data;
}
/**
* bin
* @param $params
* @return array
*/
private function imgBin($params)
{
$arr = [];
if (isset($params["id"])) {
$arr["id"] = $params["id"];
} else {
$arr["create_time"] = date("Y-m-d H:i:s", time());
}
if (isset($params["img_id"])) {
$arr["img_id"] = $params["img_id"];
}
if (isset($params["img_type"])) {
$arr["img_type"] = $params["img_type"];
}
if (isset($params["img_name"])) {
$arr["img_name"] = $params["img_name"];
}
if (isset($params["img_status"])) {
$arr["img_status"] = $params["img_status"];
}
$arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment