diff --git a/application/crm/controller/Message.php b/application/crm/controller/Message.php index 356fa0b..34d8a56 100644 --- a/application/crm/controller/Message.php +++ b/application/crm/controller/Message.php @@ -185,6 +185,19 @@ class Message extends ApiCommon cache('checkBusinessCount' . $userInfo['id'], $data['checkBusiness']); cache('checkBusinessTime' . $userInfo['id'], time()); } + # 待审核客户捞取 + $checkCustomerCheckTime = cache('$checkCustomerCheckTime' . $userInfo['id']); + $checkCustomerCheckCount = cache('checkCustomerCheckCount' . $userInfo['id']); + if (time() <= $checkCustomerCheckTime) { + $data['checkCustomerCheck'] = (int)$checkCustomerCheckCount; + + } else { + $checkCustomerCheck = $this->checkCustomerCheck(true); + $data['checkCustomerCheck'] = $checkCustomerCheck['dataCount'] ?: 0; + + cache('checkCustomerCheckCount' . $userInfo['id'], $data['checkCustomerCheck']); + cache('$checkCustomerCheckTime' . $userInfo['id'], time()); + } # 待回款提醒 $remindReceivablesPlanTime = cache('remindReceivablesPlanTime' . $userInfo['id']); $remindReceivablesPlanCount = cache('remindReceivablesPlanCount' . $userInfo['id']); @@ -461,6 +474,29 @@ class Message extends ApiCommon return $data; } + /** + * 待审核客户捞取 + * + * @return array|\think\response\Json + * @throws \think\exception\DbException + */ + public function checkCustomerCheck($getCount = false) + { + $param = $this->param; + $userId = $this->userInfo['id']; + $types = $param['types']; + if ($getCount == true) $param['getCount'] = 1; + # 清除与模型无关的数据 + unset($param['types']); + $param['user_id'] = $userId; + $messageLogic = new MessageLogic(); + $data = $messageLogic->checkCustomerCheck($param); + + if ($types == 'list') return resultArray(['data' => $data]); + + return $data; + } + /** * 待回款提醒 * @return diff --git a/application/crm/logic/MessageLogic.php b/application/crm/logic/MessageLogic.php index 319f7f4..add0834 100644 --- a/application/crm/logic/MessageLogic.php +++ b/application/crm/logic/MessageLogic.php @@ -186,6 +186,24 @@ class MessageLogic extends Common return $data; } + /** + *待审核客户捞取 + * + * @author alvin guogaobo + * @version 1.0 版本号 + * @since 2021/5/26 0026 13:35 + */ + public function checkCustomerCheck($param){ + $type = !empty($param['type']) ? $param['type'] : 1; + $isSub = 4; + unset($param['type']); + $customerCheckModel = model('CustomerCheck'); + $request = $this->whereCheck($param, $type,$isSub); + $request['isMessage'] = true; + $data = $customerCheckModel->getDataList($request); + return $data; + } + /** * 审批查询条件 * @param $param @@ -257,6 +275,21 @@ class MessageLogic extends Common $param['flow_user_id'] = ['like', '%,'. $param['user_id'] .',%']; break; } + }elseif($isSub==4){ + switch ($type) { + case '1' : + # 待审核、审核中 + $param['check_status'] = ['lt', 2]; + $param['check_user_id'] = ['like', '%,'. $param['user_id'] .',%']; + # 要提醒的商机ID + $businessIdArray = db('crm_dealt_relation')->where(['types' => ['eq', 'crm_customer_check'], 'user_id' => ['eq', $param['user_id']]])->column('types_id'); + $param['businessIdArray'] = !empty($businessIdArray) ? $businessIdArray : -1; + break; + case '2' : + # 全部 + $param['flow_user_id'] = ['like', '%,'. $param['user_id'] .',%']; + break; + } } return $param; } diff --git a/application/oa/logic/ExamineLogic.php b/application/oa/logic/ExamineLogic.php index 04fcd03..89fd783 100644 --- a/application/oa/logic/ExamineLogic.php +++ b/application/oa/logic/ExamineLogic.php @@ -470,6 +470,30 @@ class ExamineLogic extends Common ->where($where) ->where($whereOr) ->count(); + case 5:// 客户 + $list = db('crm_customer_check') + ->alias('a') + ->join('__ADMIN_USER__ user', 'user.id = a.user_id', 'LEFT') + ->join('__ADMIN_EXAMINE_FLOW__ examine_flow', 'examine_flow.flow_id = a.flow_id', 'LEFT') + ->join('__CRM_CUSTOMER__ customer','customer.customer_id=a.customer_id','LEFT') + ->where($where) + ->where($whereOr) + ->field( + 'a.customer_check_id as catagory_id ,customer.name as customer_name,a.create_time,a.check_status,a.create_user_id,a.check_user_id,a.flow_user_id,user.realname,examine_flow.name as examine_name' + ) + ->page($param['page'], $param['limit']) + ->order('a.create_time desc') + ->select(); + foreach ($list as $k => $v) { + $list[$k]['create_user_info'] = $userModel->getUserById($v['create_user_id']); + + } + $dataCount = db('crm_customer_check') + ->alias('a') + ->join('__ADMIN_USER__ user', 'user.id = a.user_id', 'LEFT') + ->where($where) + ->where($whereOr) + ->count(); } diff --git a/config/route_crm.php b/config/route_crm.php index 3816afc..492cb2d 100644 --- a/config/route_crm.php +++ b/config/route_crm.php @@ -411,6 +411,7 @@ return [ 'crm/message/remindCustomer' => ['crm/message/remindCustomer', ['method' => 'POST']], 'crm/message/checkInvoice' => ['crm/message/checkInvoice', ['method' => 'POST']], 'crm/message/checkBusiness' => ['crm/message/checkBusiness', ['method' => 'POST']], + 'crm/message/checkCustomerCheck' => ['crm/message/checkCustomerCheck', ['method' => 'POST']], 'crm/message/newBusiness' => ['crm/message/newBusiness', ['method' => 'POST']], 'crm/message/visitContract' => ['crm/message/visitContract', ['method' => 'POST']], 'crm/message/allDeal' => ['crm/message/allDeal', ['method' => 'POST']],