Compare commits

..

5 Commits

@ -628,6 +628,21 @@ class Business extends ApiCommon
'customer_ids' => ',' . $businessInfo['customer_id'] . ',' 'customer_ids' => ',' . $businessInfo['customer_id'] . ','
]); ]);
# 删除待办事项的关联数据
db('crm_dealt_relation')->where(['types' => ['eq', 'crm_business'], 'types_id' => ['eq', $data['business_id']]])->delete();
# 创建待办事项的关联数据
$checkUserIds = db('crm_business')->where('business_id', $data['business_id'])->value('check_user_id');
$checkUserIdArray = stringToArray($checkUserIds);
$dealtData = [];
foreach ($checkUserIdArray AS $kk => $vv) {
$dealtData[] = [
'types' => 'crm_business',
'types_id' => $data['business_id'],
'user_id' => $vv
];
}
if (!empty($dealtData)) db('crm_dealt_relation')->insertAll($dealtData);
//推进记录添加 //推进记录添加
$temp['status_id'] = $status_id ?: 0; $temp['status_id'] = $status_id ?: 0;
$temp['is_end'] = $businessInfo['is_end'] ?: 0; $temp['is_end'] = $businessInfo['is_end'] ?: 0;

@ -735,7 +735,7 @@ class Message extends ApiCommon
} }
# 处理待审核合同、回款、发票 # 处理待审核合同、回款、发票
if (in_array($type, ['checkContract', 'checkReceivables', 'checkInvoice'])) { if (in_array($type, ['checkContract', 'checkReceivables', 'checkInvoice','checkBusiness'])) {
$where['check_status'] = ['lt', '2']; $where['check_status'] = ['lt', '2'];
$where['check_user_id'] = ['like', ',%' . $userId . '%,']; $where['check_user_id'] = ['like', ',%' . $userId . '%,'];
@ -754,6 +754,11 @@ class Message extends ApiCommon
$invoiceId = !empty($typeId) ? $typeId : Db::name('crm_invoice')->where($where)->column('invoice_id'); $invoiceId = !empty($typeId) ? $typeId : Db::name('crm_invoice')->where($where)->column('invoice_id');
db('crm_dealt_relation')->where('user_id', $userId)->where('types', 'crm_invoice')->whereIn('types_id', $invoiceId)->delete(); db('crm_dealt_relation')->where('user_id', $userId)->where('types', 'crm_invoice')->whereIn('types_id', $invoiceId)->delete();
} }
# 商机
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();
}
} }

@ -177,7 +177,7 @@ class MessageLogic extends Common
*/ */
public function checkBusiness($param){ public function checkBusiness($param){
$type = !empty($param['type']) ? $param['type'] : 1; $type = !empty($param['type']) ? $param['type'] : 1;
$isSub = 1; $isSub = 3;
unset($param['type']); unset($param['type']);
$businessModel = model('Business'); $businessModel = model('Business');
$request = $this->whereCheck($param, $type,$isSub); $request = $this->whereCheck($param, $type,$isSub);
@ -242,6 +242,23 @@ class MessageLogic extends Common
$param['dealt'] = 1; $param['dealt'] = 1;
break; break;
} }
}elseif($isSub==3){
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_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;
}
} }
return $param; return $param;
} }

Loading…
Cancel
Save