|
|
@ -23,17 +23,18 @@ class CustomerCheck extends Common
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 待审核客户列表
|
|
|
|
* 待审核客户列表
|
|
|
|
* @param $request
|
|
|
|
* @param $request
|
|
|
|
* @return
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
public function getDataList($request)
|
|
|
|
public function getDataList($request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$userModel = new \app\admin\model\User();
|
|
|
|
$userModel = new \app\admin\model\User();
|
|
|
|
$fieldModel = new \app\admin\model\Field();
|
|
|
|
$fieldModel = new \app\admin\model\Field();
|
|
|
|
$customer_check_id= $request['customer_check_id'];
|
|
|
|
$customer_check_id = $request['customer_check_id'];
|
|
|
|
$order_field = $request['order_field'];
|
|
|
|
$order_field = $request['order_field'];
|
|
|
|
$order_type = $request['order_type'];
|
|
|
|
$order_type = $request['order_type'];
|
|
|
|
$getCount = $request['getCount'];
|
|
|
|
$getCount = $request['getCount'];
|
|
|
|
|
|
|
|
$user_id = $request['user_id'];
|
|
|
|
$customerCheckIdArray = $request['customerCheckIdArray']; // 待办事项提醒参数
|
|
|
|
$customerCheckIdArray = $request['customerCheckIdArray']; // 待办事项提醒参数
|
|
|
|
unset($request['scene_id']);
|
|
|
|
unset($request['scene_id']);
|
|
|
|
unset($request['search']);
|
|
|
|
unset($request['search']);
|
|
|
@ -52,8 +53,6 @@ class CustomerCheck extends Common
|
|
|
|
$requestMap = $request['map'] ?: [];
|
|
|
|
$requestMap = $request['map'] ?: [];
|
|
|
|
# getCount是代办事项传来的参数,代办事项不需要使用场景
|
|
|
|
# getCount是代办事项传来的参数,代办事项不需要使用场景
|
|
|
|
$sceneMap = [];
|
|
|
|
$sceneMap = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$partMap = [];
|
|
|
|
$partMap = [];
|
|
|
|
$teamMap = $requestMap['team_id'];
|
|
|
|
$teamMap = $requestMap['team_id'];
|
|
|
|
//团队成员 高级筛选
|
|
|
|
//团队成员 高级筛选
|
|
|
@ -65,6 +64,11 @@ class CustomerCheck extends Common
|
|
|
|
$map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
|
|
|
|
$map = $requestMap ? array_merge($sceneMap, $requestMap) : $sceneMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 权限
|
|
|
|
|
|
|
|
$readAuthIds = $userModel->getUserByPer('crm', 'customer', 'read');
|
|
|
|
|
|
|
|
$updateAuthIds = $userModel->getUserByPer('crm', 'customer', 'update');
|
|
|
|
|
|
|
|
$deleteAuthIds = $userModel->getUserByPer('crm', 'customer', 'delete');
|
|
|
|
|
|
|
|
|
|
|
|
//排序
|
|
|
|
//排序
|
|
|
|
if ($order_type && $order_field) {
|
|
|
|
if ($order_type && $order_field) {
|
|
|
|
$order = $fieldModel->getOrderByFormtype('crm_customer_check', 'customer_check', $order_field, $order_type);
|
|
|
|
$order = $fieldModel->getOrderByFormtype('crm_customer_check', 'customer_check', $order_field, $order_type);
|
|
|
@ -86,7 +90,7 @@ class CustomerCheck extends Common
|
|
|
|
|
|
|
|
|
|
|
|
$list = db('crm_customer_check')
|
|
|
|
$list = db('crm_customer_check')
|
|
|
|
->alias('customer_check')
|
|
|
|
->alias('customer_check')
|
|
|
|
->join('__CRM_CUSTOMER__ customer', 'business.customer_id = customer.customer_id', 'LEFT')
|
|
|
|
->join('__CRM_CUSTOMER__ customer', 'customer_check.customer_id = customer.customer_id', 'LEFT')
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->where($partMap)
|
|
|
|
->where($partMap)
|
|
|
|
->where($dealtWhere)
|
|
|
|
->where($dealtWhere)
|
|
|
@ -94,8 +98,36 @@ class CustomerCheck extends Common
|
|
|
|
->field('customer_check.*,customer.name as customer_name')
|
|
|
|
->field('customer_check.*,customer.name as customer_name')
|
|
|
|
->orderRaw($order)
|
|
|
|
->orderRaw($order)
|
|
|
|
->select();
|
|
|
|
->select();
|
|
|
|
# 扩展数据
|
|
|
|
|
|
|
|
$extraData = [];
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
|
|
|
$list[$k]['customer_id_info']['customer_id'] = $v['customer_id'];
|
|
|
|
|
|
|
|
$list[$k]['customer_id_info']['name'] = $v['customer_name'];
|
|
|
|
|
|
|
|
$list[$k]['create_user_id_info'] = isset($v['create_user_id']) ? $userModel->getUserById($v['create_user_id']) : [];
|
|
|
|
|
|
|
|
$list[$k]['owner_user_id_info'] = isset($v['owner_user_id']) ? $userModel->getUserById($v['owner_user_id']) : [];
|
|
|
|
|
|
|
|
$list[$k]['create_user_name'] = !empty($list[$k]['create_user_id_info']['realname']) ? $list[$k]['create_user_id_info']['realname'] : '';
|
|
|
|
|
|
|
|
$list[$k]['owner_user_name'] = !empty($list[$k]['owner_user_id_info']['realname']) ? $list[$k]['owner_user_id_info']['realname'] : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//权限
|
|
|
|
|
|
|
|
$roPre = $userModel->rwPre($user_id, $v['ro_user_id'], $v['rw_user_id'], 'read');
|
|
|
|
|
|
|
|
$rwPre = $userModel->rwPre($user_id, $v['ro_user_id'], $v['rw_user_id'], 'update');
|
|
|
|
|
|
|
|
$permission = [];
|
|
|
|
|
|
|
|
$is_read = 0;
|
|
|
|
|
|
|
|
$is_update = 0;
|
|
|
|
|
|
|
|
$is_delete = 0;
|
|
|
|
|
|
|
|
if (in_array($v['owner_user_id'], $readAuthIds) || $roPre || $rwPre) $is_read = 1;
|
|
|
|
|
|
|
|
if (in_array($v['owner_user_id'], $updateAuthIds) || $rwPre) $is_update = 1;
|
|
|
|
|
|
|
|
if (in_array($v['owner_user_id'], $deleteAuthIds)) $is_delete = 1;
|
|
|
|
|
|
|
|
$permission['is_read'] = $is_read;
|
|
|
|
|
|
|
|
$permission['is_update'] = $is_update;
|
|
|
|
|
|
|
|
$permission['is_delete'] = $is_delete;
|
|
|
|
|
|
|
|
$list[$k]['permission'] = $permission;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 日期
|
|
|
|
|
|
|
|
$list[$k]['create_time'] = !empty($v['create_time']) ? date('Y-m-d H:i:s', $v['create_time']) : null;
|
|
|
|
|
|
|
|
$list[$k]['update_time'] = !empty($v['update_time']) ? date('Y-m-d H:i:s', $v['update_time']) : null;
|
|
|
|
|
|
|
|
# 系统字段 负责人部门 zjf 20210726
|
|
|
|
|
|
|
|
$list[$k]['owner_user_structure_name'] = $list[$k]['owner_user_id_info']['structure_name'];
|
|
|
|
|
|
|
|
}
|
|
|
|
$data = [];
|
|
|
|
$data = [];
|
|
|
|
$data['list'] = $list ?: [];
|
|
|
|
$data['list'] = $list ?: [];
|
|
|
|
$data['dataCount'] = $dataCount ?: 0;
|
|
|
|
$data['dataCount'] = $dataCount ?: 0;
|
|
|
|