待办事项添加记录添加

pull/8/head
张萌 2 years ago
parent 0191e053db
commit 9de3b06f53

@ -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();
}
} }

@ -248,7 +248,7 @@ class MessageLogic extends Common
# 待审核、审核中 # 待审核、审核中
$param['check_status'] = ['lt', 2]; $param['check_status'] = ['lt', 2];
$param['check_user_id'] = ['like', '%,'. $param['user_id'] .',%']; $param['check_user_id'] = ['like', '%,'. $param['user_id'] .',%'];
# 要提醒的发票ID # 要提醒的商机ID
$businessIdArray = db('crm_dealt_relation')->where(['types' => ['eq', 'crm_business'], 'user_id' => ['eq', $param['user_id']]])->column('types_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['businessIdArray'] = !empty($businessIdArray) ? $businessIdArray : -1;
$param['dealt'] = 1; $param['dealt'] = 1;

Loading…
Cancel
Save