From 809b786f7dc76852ab9026147358d9f4a7815ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=90=8C?= <494089941@qq.com> Date: Mon, 6 Mar 2023 16:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/crm/model/CustomerCheck.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/application/crm/model/CustomerCheck.php b/application/crm/model/CustomerCheck.php index dd49f59..18d1ca9 100644 --- a/application/crm/model/CustomerCheck.php +++ b/application/crm/model/CustomerCheck.php @@ -88,6 +88,19 @@ class CustomerCheck extends Common return $data; } + $indexField = $fieldModel->getIndexField('crm_customer', $user_id, 1) ?: array('name'); // 列表展示字段 + $userField = $fieldModel->getFieldByFormType('crm_customer', 'user'); // 人员类型 + $structureField = $fieldModel->getFieldByFormType('crm_customer', 'structure'); // 部门类型 + # 处理人员和部门类型的排序报错问题(前端传来的是包含_name的别名字段) + $temporaryField = str_replace('_name', '', $order_field); + if (in_array($temporaryField, $userField) || in_array($temporaryField, $structureField)) { + $order_field = $temporaryField; + } + $customerField = ''; + foreach ($indexField as $k => $v) { + $customerField += 'customer.' + $v; + } + $list = db('crm_customer_check') ->alias('customer_check') ->join('__CRM_CUSTOMER__ customer', 'customer_check.customer_id = customer.customer_id', 'LEFT') @@ -95,7 +108,7 @@ class CustomerCheck extends Common ->where($partMap) ->where($dealtWhere) ->limit($request['offset'], $request['length']) - ->field('customer_check.*,customer.name as name') + ->field('customer_check.*,customer.name as name'+$customerField) ->orderRaw($order) ->select();