You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wkcrm/application/oa/common.php

38 lines
1.2 KiB

<?php
//权限控制
\think\Hook::add('check_auth','app\\common\\behavior\\AuthenticateBehavior');
use think\Db;
use app\crm\model\Leads;
//添加关联关系 数据表名+业务ID+数组
function addRelation( $moudle ='',$id='',$param = array() ){
switch ($module) {
case 'event':
$module = 'OaEventRelation';
$fieldname = 'event_id';
break;
case 'task':
$module = 'TaskRelation';
$fieldname = 'task_id';
break;
case 'log':
$module = 'OaLogRelation';
$fieldname = 'log_id';
break;
default:
$module = 'WorkRelation';
$fieldname = 'work_id';
break;
}
$rdata['customer_ids'] = count($param['customer_ids']) ? ','.implode(',',$param['customer_ids']).',' : '';
$rdata['contacts_ids'] = count($param['contacts_ids']) ? ','.implode(',',$param['contacts_ids']).',' : '';
$rdata['business_ids'] = count($param['business_ids']) ? ','.implode(',',$param['business_ids']).',' : '';
$rdata['contract_ids'] = count($param['contract_ids']) ? ','.implode(',',$param['contract_ids']).',' : '';
$rdata['status'] = 1;
$rdata[$fieldname] = $id;
$rdata['create_time'] = time();
$flag = Db::name($module)->insert($rdata);
return true;
}