From c33c0f45c34dec85a99b0da89a6a5602c70b0656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=90=8C?= <494089941@qq.com> Date: Sat, 4 Mar 2023 13:57:39 +0800 Subject: [PATCH] bug fix --- application/crm/logic/MessageLogic.php | 2 -- application/crm/model/Business.php | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/application/crm/logic/MessageLogic.php b/application/crm/logic/MessageLogic.php index e4fbd05..319f7f4 100644 --- a/application/crm/logic/MessageLogic.php +++ b/application/crm/logic/MessageLogic.php @@ -251,12 +251,10 @@ class MessageLogic extends Common # 要提醒的商机ID $businessIdArray = db('crm_dealt_relation')->where(['types' => ['eq', 'crm_business'], 'user_id' => ['eq', $param['user_id']]])->column('types_id'); $param['businessIdArray'] = !empty($businessIdArray) ? $businessIdArray : -1; - $param['dealt'] = 1; break; case '2' : # 全部 $param['flow_user_id'] = ['like', '%,'. $param['user_id'] .',%']; - $param['dealt'] = 1; break; } } diff --git a/application/crm/model/Business.php b/application/crm/model/Business.php index 11e091c..d2caf71 100644 --- a/application/crm/model/Business.php +++ b/application/crm/model/Business.php @@ -49,6 +49,7 @@ class Business extends Common $businessTypeId = $request['typesId']; // 针对mobile $businessStatusId = $request['statusId']; // 针对mobile $overdue = $request['overdue']; // 待办事项下需联系商机(逾期) + $businessIdArray = $request['businessIdArray']; // 待办事项提醒参数 $isMessage = !empty($request['isMessage']); unset($request['scene_id']); unset($request['search']); @@ -62,6 +63,7 @@ class Business extends Common unset($request['statusId']); unset($request['overdue']); unset($request['isMessage']); + unset($request['businessIdArray']); $request = $this->fmtRequest($request); $requestMap = $request['map'] ?: []; $sceneModel = new \app\admin\model\Scene(); @@ -182,7 +184,9 @@ class Business extends Common $map['is_end'] = abs($businessStatusId); } } - + # 待办事项查询参数 + $dealtWhere = []; + if (!empty($businessIdArray)) $dealtWhere['business.business_id'] = ['in', $businessIdArray]; // 待办事项下需联系商机(逾期) $overdueWhere = ''; if (!empty($overdue)) { @@ -195,7 +199,7 @@ class Business extends Common $dataCount = db('crm_business') ->alias('business') ->join('__CRM_CUSTOMER__ customer', 'business.customer_id = customer.customer_id', 'LEFT') - ->where($map)->where($partMap)->where($authMap)->where($overdueWhere)->count('business_id'); + ->where($map)->where($partMap)->where($authMap)->where($overdueWhere)->where($dealtWhere)->count('business_id'); if (!empty($getCount) && $getCount == 1) { $data['dataCount'] = !empty($dataCount) ? $dataCount : 0; # 商机总金额 @@ -204,6 +208,7 @@ class Business extends Common $data['extraData']['money'] = ['businessSumMoney' => !empty($sumMoney) ? sprintf("%.2f", $sumMoney) : 0.00]; return $data; } + $list = db('crm_business') ->alias('business') ->join('__CRM_CUSTOMER__ customer', 'business.customer_id = customer.customer_id', 'LEFT') @@ -211,6 +216,7 @@ class Business extends Common ->where($partMap) ->where($authMap) ->where($overdueWhere) + ->where($dealtWhere) ->limit($request['offset'], $request['length']) ->field('business.*,customer.name as customer_name') ->orderRaw($order)