|
|
|
@ -613,6 +613,8 @@ class Message extends ApiCommon
|
|
|
|
|
if ($isSub) {
|
|
|
|
|
$param['owner_user_id'] = array('in', getSubUserId(false));
|
|
|
|
|
}
|
|
|
|
|
$businessIdArray = db('crm_dealt_relation')->where(['types' => ['eq', 'crm_business_new'], 'user_id' => ['eq', $param['user_id']]])->column('types_id');
|
|
|
|
|
$param['businessIdArray'] = !empty($businessIdArray) ? $businessIdArray : -1;
|
|
|
|
|
$data = $businessModel->getDataList($param);
|
|
|
|
|
// p($contractModel->getLastSql());
|
|
|
|
|
if ($types == 'list') {
|
|
|
|
@ -774,7 +776,7 @@ class Message extends ApiCommon
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 处理待审核合同、回款、发票
|
|
|
|
|
if (in_array($type, ['checkContract', 'checkReceivables', 'checkInvoice', 'checkBusiness'])) {
|
|
|
|
|
if (in_array($type, ['checkContract', 'checkReceivables', 'checkInvoice', 'checkBusiness','checkCustomerCheck','new_business'])) {
|
|
|
|
|
$where['check_status'] = ['lt', '2'];
|
|
|
|
|
$where['check_user_id'] = ['like', ',%' . $userId . '%,'];
|
|
|
|
|
|
|
|
|
@ -795,8 +797,19 @@ class Message extends ApiCommon
|
|
|
|
|
}
|
|
|
|
|
# 商机
|
|
|
|
|
if ($type == 'checkBusiness') {
|
|
|
|
|
$invoiceId = !empty($typeId) ? $typeId : Db::name('crm_business')->where($where)->column('business_id');
|
|
|
|
|
db('crm_dealt_relation')->where('user_id', $userId)->where('types', 'crm_business')->whereIn('types_id', $invoiceId)->delete();
|
|
|
|
|
$businessId = !empty($typeId) ? $typeId : Db::name('crm_business')->where($where)->column('business_id');
|
|
|
|
|
db('crm_dealt_relation')->where('user_id', $userId)->where('types', 'crm_business')->whereIn('types_id', $businessId)->delete();
|
|
|
|
|
}
|
|
|
|
|
# 客户捞取
|
|
|
|
|
if ($type == 'checkCustomerCheck') {
|
|
|
|
|
$customerCheckId = !empty($typeId) ? $typeId : Db::name('crm_customer_check')->where($where)->column('customer_check_id');
|
|
|
|
|
db('crm_dealt_relation')->where('user_id', $userId)->where('types', 'crm_customer_check')->whereIn('types_id', $customerCheckId)->delete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 新商机
|
|
|
|
|
if ($type == 'new_business') {
|
|
|
|
|
$newBusinessId = !empty($typeId) ? $typeId : Db::name('crm_business')->where($where)->column('business_id');
|
|
|
|
|
db('crm_dealt_relation')->where('user_id', $userId)->where('types', 'crm_business_new')->whereIn('types_id', $newBusinessId)->delete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -884,6 +897,9 @@ class Message extends ApiCommon
|
|
|
|
|
cache::rm('visitContractCount' . $userId);
|
|
|
|
|
cache::rm('endContractCount' . $userId);
|
|
|
|
|
cache::rm('remindCustomerCount' . $userId);
|
|
|
|
|
cache::rm('checkCustomerCheckCount' . $userId);
|
|
|
|
|
cache::rm('checkBusinessCount' . $userId);
|
|
|
|
|
cache::rm('newBusinessCount' . $userId);
|
|
|
|
|
|
|
|
|
|
cache::rm('todayLeadsTime' . $userId);
|
|
|
|
|
cache::rm('todayCustomerTime' . $userId);
|
|
|
|
@ -898,6 +914,9 @@ class Message extends ApiCommon
|
|
|
|
|
cache::rm('visitContractTime' . $userId);
|
|
|
|
|
cache::rm('endContractTime' . $userId);
|
|
|
|
|
cache::rm('remindCustomerTime' . $userId);
|
|
|
|
|
cache::rm('checkCustomerCheckTime' . $userId);
|
|
|
|
|
cache::rm('checkBusinessTime' . $userId);
|
|
|
|
|
cache::rm('newBusinessTime' . $userId);
|
|
|
|
|
return resultArray(['data' => '操作成功!']);
|
|
|
|
|
}
|
|
|
|
|
}
|