Merge pull request '客户捞取待办事项' (#11) from zm into master

Reviewed-on: mengfucius/wkcrm#11
pull/40/head
张萌 2 years ago
commit c799780ea0

@ -185,6 +185,19 @@ class Message extends ApiCommon
cache('checkBusinessCount' . $userInfo['id'], $data['checkBusiness']); cache('checkBusinessCount' . $userInfo['id'], $data['checkBusiness']);
cache('checkBusinessTime' . $userInfo['id'], time()); 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']); $remindReceivablesPlanTime = cache('remindReceivablesPlanTime' . $userInfo['id']);
$remindReceivablesPlanCount = cache('remindReceivablesPlanCount' . $userInfo['id']); $remindReceivablesPlanCount = cache('remindReceivablesPlanCount' . $userInfo['id']);
@ -461,6 +474,29 @@ class Message extends ApiCommon
return $data; 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 * @return

@ -186,6 +186,24 @@ class MessageLogic extends Common
return $data; 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 * @param $param
@ -257,6 +275,21 @@ class MessageLogic extends Common
$param['flow_user_id'] = ['like', '%,'. $param['user_id'] .',%']; $param['flow_user_id'] = ['like', '%,'. $param['user_id'] .',%'];
break; 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; return $param;
} }

@ -470,6 +470,30 @@ class ExamineLogic extends Common
->where($where) ->where($where)
->where($whereOr) ->where($whereOr)
->count(); ->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();
} }

@ -411,6 +411,7 @@ return [
'crm/message/remindCustomer' => ['crm/message/remindCustomer', ['method' => 'POST']], 'crm/message/remindCustomer' => ['crm/message/remindCustomer', ['method' => 'POST']],
'crm/message/checkInvoice' => ['crm/message/checkInvoice', ['method' => 'POST']], 'crm/message/checkInvoice' => ['crm/message/checkInvoice', ['method' => 'POST']],
'crm/message/checkBusiness' => ['crm/message/checkBusiness', ['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/newBusiness' => ['crm/message/newBusiness', ['method' => 'POST']],
'crm/message/visitContract' => ['crm/message/visitContract', ['method' => 'POST']], 'crm/message/visitContract' => ['crm/message/visitContract', ['method' => 'POST']],
'crm/message/allDeal' => ['crm/message/allDeal', ['method' => 'POST']], 'crm/message/allDeal' => ['crm/message/allDeal', ['method' => 'POST']],

Loading…
Cancel
Save