@ -47,9 +47,14 @@ class FieldGrantLogic
'number', 'visit_time', 'owner_user_id', 'shape', 'customer_id', 'contacts_id', 'contract_id', 'satisfaction',
'number', 'visit_time', 'owner_user_id', 'shape', 'customer_id', 'contacts_id', 'contract_id', 'satisfaction',
'feedback', 'create_user_id', 'create_time', 'update_time'
'feedback', 'create_user_id', 'create_time', 'update_time'
],
],
'invoice' => [
'invoice' => [
'invoice_apple_number', 'customer_id', 'contract_id', 'contract_money', 'invoice_date', 'invoice_money', 'invoice_type', 'remark'
'invoice_apple_number', 'customer_id', 'contract_id', 'contract_money', 'invoice_date', 'invoice_money', 'invoice_type', 'remark'
],
],
'receivables_plan' => [
'receivables_id','un_money','real_money','real_data', 'num', 'money', 'owner_user_id', 'return_date', 'customer_id', 'remind', 'contract_id', 'create_user_id', 'create_time', 'update_time'
]
];
];
/**
/**
@ -70,7 +75,6 @@ class FieldGrantLogic
};
};
$count = Db::name('admin_field_grant')->where($where)->count();
$count = Db::name('admin_field_grant')->where($where)->count();
# 如果该角色下没有字段授权数据则自动添加
# 如果该角色下没有字段授权数据则自动添加
if ($count == 0 & & Db::name('admin_group')->where('id', $param['role_id'])->find()) {
if ($count == 0 & & Db::name('admin_group')->where('id', $param['role_id'])->find()) {
$this->createCrmFieldGrant($param['role_id']);
$this->createCrmFieldGrant($param['role_id']);
@ -113,6 +117,9 @@ class FieldGrantLogic
$this->createVisitFieldGrant($roleId);
$this->createVisitFieldGrant($roleId);
# 添加发票字段授权信息
# 添加发票字段授权信息
$this->createInvoiceFieldGrant($roleId);
$this->createInvoiceFieldGrant($roleId);
# 添加回款计划字段授权信息
$this->createReceivablesPlanFieldGrant($roleId);
}
}
/**
/**
@ -157,12 +164,12 @@ class FieldGrantLogic
$list = Db::name('admin_field_grant')->where('module', 'crm')->where('role_id', $copyId)->select();
$list = Db::name('admin_field_grant')->where('module', 'crm')->where('role_id', $copyId)->select();
foreach ($list AS $key => $value) {
foreach ($list as $key => $value) {
$data[] = [
$data[] = [
'role_id' => $roleId,
'role_id' => $roleId,
'module' => $value['module'],
'module' => $value['module'],
'column' => $value['column'],
'column' => $value['column'],
'content' => $value['content'],
'content' => $value['content'],
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
];
];
@ -192,7 +199,7 @@ class FieldGrantLogic
# 查询自定义字段表
# 查询自定义字段表
$fieldBaseData = [];
$fieldBaseData = [];
$fieldList = Db::name('admin_field')->field(['name', 'field'])->where('types', $types)->select();
$fieldList = Db::name('admin_field')->field(['name', 'field'])->where('types', $types)->select();
foreach ($fieldList AS $key => $value) {
foreach ($fieldList as $key => $value) {
# 排除掉固定字段
# 排除掉固定字段
if (in_array($value['field'], $this->except[$typesArray[1]])) continue;
if (in_array($value['field'], $this->except[$typesArray[1]])) continue;
@ -203,11 +210,11 @@ class FieldGrantLogic
$grantList = Db::name('admin_field_grant')->field(['grant_id', 'content'])->where('column', $typesArray[1])->select();
$grantList = Db::name('admin_field_grant')->field(['grant_id', 'content'])->where('column', $typesArray[1])->select();
# 处理授权字段的数据更新
# 处理授权字段的数据更新
foreach ($grantList AS $key => $value) {
foreach ($grantList as $key => $value) {
$content = unserialize($value['content']);
$content = unserialize($value['content']);
$fieldData = $fieldBaseData;
$fieldData = $fieldBaseData;
foreach ($content AS $k => $v) {
foreach ($content as $k => $v) {
# 只处理自定义字段
# 只处理自定义字段
if ($v['is_diy'] == 0) continue;
if ($v['is_diy'] == 0) continue;
@ -216,7 +223,7 @@ class FieldGrantLogic
unset($content[(int)$k]);
unset($content[(int)$k]);
} else {
} else {
# 【处理更新:】如果在$fieldData找到, 则进行同步更新。
# 【处理更新:】如果在$fieldData找到, 则进行同步更新。
$content[$k]['name'] = $fieldData[$v['field']]['name'];
$content[$k]['name'] = $fieldData[$v['field']]['name'];
$content[$k]['field'] = $fieldData[$v['field']]['field'];
$content[$k]['field'] = $fieldData[$v['field']]['field'];
# 删除$fieldData的数据, 方便统计新增的自定义字段。
# 删除$fieldData的数据, 方便统计新增的自定义字段。
@ -227,15 +234,15 @@ class FieldGrantLogic
# 【处理新增】如果$fieldData还有数据, 说明是新增的, 则进行同步新增。
# 【处理新增】如果$fieldData还有数据, 说明是新增的, 则进行同步新增。
if (!empty($fieldData)) {
if (!empty($fieldData)) {
foreach ($fieldData AS $k => $v) {
foreach ($fieldData as $k => $v) {
$content[] = [
$content[] = [
'name' => $v['name'],
'name' => $v['name'],
'field' => $v['field'],
'field' => $v['field'],
'read' => 1,
'read' => 1,
'read_operation' => 1,
'read_operation' => 1,
'write' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
}
}
@ -257,46 +264,46 @@ class FieldGrantLogic
{
{
# 固定字段
# 固定字段
$content = [
$content = [
['field' => 'name', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '线索名称'],
['field' => 'name', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '线索名称'],
['field' => 'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'],
['field' => 'email', 'maskType' => 0, 'form_type'=>'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'],
['field' => 'source', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '线索来源'],
['field' => 'source', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '线索来源'],
['field' => 'mobile', 'read' => 1 , 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '手机'],
['field' => 'mobile', 'maskType' => 0, 'read' => 1,'form_type'=>'mobile' , 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '手机'],
['field' => 'telephone', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '电话'],
['field' => 'telephone', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '电话'],
['field' => 'detail_address', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '地址'],
['field' => 'detail_address', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '地址'],
['field' => 'industry', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户行业'],
['field' => 'industry', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户行业'],
['field' => 'level', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户级别'],
['field' => 'level', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户级别'],
['field' => 'next_time', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '下次联系时间'],
['field' => 'next_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '下次联系时间'],
['field' => 'remark', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'remark', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'owner_user_id', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'owner_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'last_record', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进记录'],
['field' => 'last_record', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进记录'],
['field' => 'create_user_id', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_user_id', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'create_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'update_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'update_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'last_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
['field' => 'last_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
];
];
$leadsList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_leads')->select();
$leadsList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_leads')->select();
# 自定义字段
# 自定义字段
foreach ($leadsList AS $key => $value) {
foreach ($leadsList as $key => $value) {
if (in_array($value['field'], $this->except['leads'])) continue;
if (in_array($value['field'], $this->except['leads'])) continue;
$content[] = [
$content[] = [
'name' => $value['name'],
'name' => $value['name'],
'field' => $value['field'],
'field' => $value['field'],
'read' => 1,
'form_type'=>$value['form_type'],
'read_operation' => 1,
'read' => 1,
'write' => 1,
'read_operation' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
Db::name('admin_field_grant')->insert([
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'role_id' => $roleId,
'module' => 'crm',
'module' => 'crm',
'column' => 'leads',
'column' => 'leads',
'content' => serialize($content),
'content' => serialize($content),
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
]);
]);
@ -313,50 +320,50 @@ class FieldGrantLogic
{
{
# 固定字段
# 固定字段
$content = [
$content = [
['field' => 'name', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'name', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'source', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户来源'],
['field' => 'source', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户来源'],
['field' => 'mobile', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '手机'],
['field' => 'mobile', 'maskType' => 0,'form_type'=>'mobile', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '手机'],
['field' => 'telephone', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '电话'],
['field' => 'telephone', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '电话'],
['field' => 'website', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '网址'],
['field' => 'website', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '网址'],
['field' => 'industry', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户行业'],
['field' => 'industry', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户行业'],
['field' => 'level', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户级别'],
['field' => 'level', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户级别'],
['field' => 'next_time', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '下次联系时间'],
['field' => 'next_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '下次联系时间'],
['field' => 'remark', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'remark', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'],
['field' => 'email', 'maskType' => 0,'form_type'=>'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'],
['field' => 'owner_user_id', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'owner_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'last_record', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进记录'],
['field' => 'last_record', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进记录'],
['field' => 'create_user_id', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_user_id', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'create_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'update_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'update_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'last_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
['field' => 'last_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
['field' => 'obtain_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人获取客户时间'],
['field' => 'obtain_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人获取客户时间'],
['field' => 'deal_status', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '成交状态'],
['field' => 'deal_status', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '成交状态'],
['field' => 'is_lock', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '锁定状态'],
['field' => 'is_lock', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '锁定状态'],
['field' => 'pool_day', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '距进入公海天数'],
['field' => 'pool_day', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '距进入公海天数'],
];
];
$customerList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_customer')->select();
$customerList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_customer')->select();
# 自定义字段
# 自定义字段
foreach ($customerList AS $key => $value) {
foreach ($customerList as $key => $value) {
if (in_array($value['field'], $this->except['customer'])) continue;
if (in_array($value['field'], $this->except['customer'])) continue;
$content[] = [
$content[] = [
'name' => $value['name'],
'name' => $value['name'],
'field' => $value['field'],
'field' => $value['field'],
'read' => 1,
'read' => 1,
'read_operation' => 1,
'read_operation' => 1,
'write' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
Db::name('admin_field_grant')->insert([
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'role_id' => $roleId,
'module' => 'crm',
'module' => 'crm',
'column' => 'customer',
'column' => 'customer',
'content' => serialize($content),
'content' => serialize($content),
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
]);
]);
@ -373,46 +380,46 @@ class FieldGrantLogic
{
{
# 固定字段
# 固定字段
$content = [
$content = [
['field' => 'name', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '姓名'],
['field' => 'name', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '姓名'],
['field' => 'customer_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'customer_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'mobile', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '手机'],
['field' => 'mobile', 'maskType' => 0,'form_type'=>'mobile', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '手机'],
['field' => 'telephone', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '电话'],
['field' => 'telephone', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '电话'],
['field' => 'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'],
['field' => 'email', 'maskType' => 0, 'form_type'=>'email', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '邮箱'],
['field' => 'post', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '职务'],
['field' => 'post', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '职务'],
['field' => 'decision', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '是否关键决策人'],
['field' => 'decision', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '是否关键决策人'],
['field' => 'detail_address', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '地址'],
['field' => 'detail_address', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '地址'],
['field' => 'next_time', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '下次联系时间'],
['field' => 'next_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '下次联系时间'],
['field' => 'remark', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'remark', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'sex', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '性别'],
['field' => 'sex', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '性别'],
['field' => 'owner_user_id', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'owner_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'create_user_id', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_user_id', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'create_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'update_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'update_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'last_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
['field' => 'last_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
];
];
$contactsList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_contacts')->select();
$contactsList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_contacts')->select();
# 自定义字段
# 自定义字段
foreach ($contactsList AS $key => $value) {
foreach ($contactsList as $key => $value) {
if (in_array($value['field'], $this->except['contacts'])) continue;
if (in_array($value['field'], $this->except['contacts'])) continue;
$content[] = [
$content[] = [
'name' => $value['name'],
'name' => $value['name'],
'field' => $value['field'],
'field' => $value['field'],
'read' => 1,
'read' => 1,
'read_operation' => 1,
'read_operation' => 1,
'write' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
Db::name('admin_field_grant')->insert([
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'role_id' => $roleId,
'module' => 'crm',
'module' => 'crm',
'column' => 'contacts',
'column' => 'contacts',
'content' => serialize($content),
'content' => serialize($content),
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
]);
]);
@ -429,42 +436,42 @@ class FieldGrantLogic
{
{
# 固定字段
# 固定字段
$content = [
$content = [
['field' => 'name', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '商机名称'],
['field' => 'name', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '商机名称'],
['field' => 'customer_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'customer_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'money', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '商机金额'],
['field' => 'money', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '商机金额'],
['field' => 'deal_date', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '预计成交日期'],
['field' => 'deal_date', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '预计成交日期'],
['field' => 'remark', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'remark', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'status_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '商机阶段'],
['field' => 'status_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '商机阶段'],
['field' => 'type_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '商机状态组'],
['field' => 'type_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '商机状态组'],
['field' => 'owner_user_id', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'owner_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'create_user_id', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_user_id', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'create_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'update_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'update_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'last_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
['field' => 'last_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
];
];
$BusinessList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_business')->select();
$BusinessList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_business')->select();
# 自定义字段
# 自定义字段
foreach ($BusinessList AS $key => $value) {
foreach ($BusinessList as $key => $value) {
if (in_array($value['field'], $this->except['business'])) continue;
if (in_array($value['field'], $this->except['business'])) continue;
$content[] = [
$content[] = [
'name' => $value['name'],
'name' => $value['name'],
'field' => $value['field'],
'field' => $value['field'],
'read' => 1,
'read' => 1,
'read_operation' => 1,
'read_operation' => 1,
'write' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
Db::name('admin_field_grant')->insert([
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'role_id' => $roleId,
'module' => 'crm',
'module' => 'crm',
'column' => 'business',
'column' => 'business',
'content' => serialize($content),
'content' => serialize($content),
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
]);
]);
@ -481,50 +488,50 @@ class FieldGrantLogic
{
{
# 固定字段
# 固定字段
$content = [
$content = [
['field' => 'name', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同名称'],
['field' => 'name', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同名称'],
['field' => 'num', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同编号'],
['field' => 'num', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同编号'],
['field' => 'customer_id', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'customer_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'business_id', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '商机名称'],
['field' => 'business_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '商机名称'],
['field' => 'money', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同金额'],
['field' => 'money', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同金额'],
['field' => 'order_date', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '下单时间'],
['field' => 'order_date', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '下单时间'],
['field' => 'start_time', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同开始时间'],
['field' => 'start_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同开始时间'],
['field' => 'end_time', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同结束时间'],
['field' => 'end_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同结束时间'],
['field' => 'contacts_id', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户签约人'],
['field' => 'contacts_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户签约人'],
['field' => 'order_user_id', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '公司签约人'],
['field' => 'order_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '公司签约人'],
['field' => 'remark', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'remark', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'owner_user_id', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'owner_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'create_user_id', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_user_id', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'create_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'update_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'update_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'last_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
['field' => 'last_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进时间'],
['field' => 'last_record', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进记录'],
['field' => 'last_record', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '最后跟进记录'],
['field' => 'done_money', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '已收款金额'],
['field' => 'done_money', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '已收款金额'],
['field' => 'un_money', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '未收款金额'],
['field' => 'un_money', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '未收款金额'],
['field' => 'check_status', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '审核状态'],
['field' => 'check_status', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '审核状态'],
];
];
$contractList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_contract')->select();
$contractList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_contract')->select();
# 自定义字段
# 自定义字段
foreach ($contractList AS $key => $value) {
foreach ($contractList as $key => $value) {
if (in_array($value['field'], $this->except['contract'])) continue;
if (in_array($value['field'], $this->except['contract'])) continue;
$content[] = [
$content[] = [
'name' => $value['name'],
'name' => $value['name'],
'field' => $value['field'],
'field' => $value['field'],
'read' => 1,
'read' => 1,
'read_operation' => 1,
'read_operation' => 1,
'write' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
Db::name('admin_field_grant')->insert([
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'role_id' => $roleId,
'module' => 'crm',
'module' => 'crm',
'column' => 'contract',
'column' => 'contract',
'content' => serialize($content),
'content' => serialize($content),
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
]);
]);
@ -541,44 +548,44 @@ class FieldGrantLogic
{
{
# 固定字段
# 固定字段
$content = [
$content = [
['field' => 'number', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回款编号'],
['field' => 'number', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回款编号'],
['field' => 'customer_id', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'customer_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'contract_id', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同编号'],
['field' => 'contract_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '合同编号'],
['field' => 'plan_id', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '期数'],
['field' => 'plan_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '期数'],
['field' => 'return_time', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回款日期'],
['field' => 'return_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回款日期'],
['field' => 'money', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回款金额'],
['field' => 'money', 'maskType' => 0,'form_type'=>'floatnumber', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回款金额'],
['field' => 'return_type', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回款方式'],
['field' => 'return_type', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回款方式'],
['field' => 'remark', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'remark', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'contract_money', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '合同金额'],
['field' => 'contract_money', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '合同金额'],
['field' => 'owner_user_id', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'owner_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'create_user_id', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_user_id', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'create_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'update_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'update_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'check_status', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '审核状态'],
['field' => 'check_status', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '审核状态'],
];
];
$receivablesList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_receivables')->select();
$receivablesList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_receivables')->select();
# 自定义字段
# 自定义字段
foreach ($receivablesList AS $key => $value) {
foreach ($receivablesList as $key => $value) {
if (in_array($value['field'], $this->except['receivables'])) continue;
if (in_array($value['field'], $this->except['receivables'])) continue;
$content[] = [
$content[] = [
'name' => $value['name'],
'name' => $value['name'],
'field' => $value['field'],
'field' => $value['field'],
'read' => 1,
'read' => 1,
'read_operation' => 1,
'read_operation' => 1,
'write' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
Db::name('admin_field_grant')->insert([
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'role_id' => $roleId,
'module' => 'crm',
'module' => 'crm',
'column' => 'receivables',
'column' => 'receivables',
'content' => serialize($content),
'content' => serialize($content),
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
]);
]);
@ -595,41 +602,41 @@ class FieldGrantLogic
{
{
# 固定字段
# 固定字段
$content = [
$content = [
['field' => 'name', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品名称'],
['field' => 'name', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品名称'],
['field' => 'category_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品类型'],
['field' => 'category_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品类型'],
['field' => 'unit', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品单位'],
['field' => 'unit', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品单位'],
['field' => 'num', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品编码'],
['field' => 'num', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品编码'],
['field' => 'price', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '价格'],
['field' => 'price', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '价格'],
['field' => 'description', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品描述'],
['field' => 'description', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '产品描述'],
['field' => 'status', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '是否上下架'],
['field' => 'status', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '是否上下架'],
['field' => 'owner_user_id', 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'owner_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'create_user_id', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_user_id', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'create_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'update_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'update_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
];
];
$productList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_product')->select();
$productList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_product')->select();
# 自定义字段
# 自定义字段
foreach ($productList AS $key => $value) {
foreach ($productList as $key => $value) {
if (in_array($value['field'], $this->except['product'])) continue;
if (in_array($value['field'], $this->except['product'])) continue;
$content[] = [
$content[] = [
'name' => $value['name'],
'name' => $value['name'],
'field' => $value['field'],
'field' => $value['field'],
'read' => 1,
'read' => 1,
'read_operation' => 1,
'read_operation' => 1,
'write' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
Db::name('admin_field_grant')->insert([
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'role_id' => $roleId,
'module' => 'crm',
'module' => 'crm',
'column' => 'product',
'column' => 'product',
'content' => serialize($content),
'content' => serialize($content),
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
]);
]);
@ -645,49 +652,49 @@ class FieldGrantLogic
private function createVisitFieldGrant($roleId)
private function createVisitFieldGrant($roleId)
{
{
$content = [
$content = [
['field' => 'number', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回访编号'],
['field' => 'number', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回访编号'],
['field' => 'visit_time', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回访时间'],
['field' => 'visit_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回访时间'],
['field' => 'owner_user_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '回访人'],
['field' => 'owner_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '回访人'],
['field' => 'shape', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回访形式'],
['field' => 'shape', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '回访形式'],
['field' => 'customer_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'customer_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'contacts_id', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '联系人'],
['field' => 'contacts_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '联系人'],
['field' => 'contract_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '合同编号'],
['field' => 'contract_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '合同编号'],
['field' => 'satisfaction', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户满意度'],
['field' => 'satisfaction', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户满意度'],
['field' => 'feedback', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户反馈'],
['field' => 'feedback', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '客户反馈'],
['field' => 'create_user_id', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_user_id', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'create_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'update_time', 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
['field' => 'update_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
];
];
$visitList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_visit')->select();
$visitList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_visit')->select();
# 处理自定义字段
# 处理自定义字段
foreach ($visitList AS $key => $value) {
foreach ($visitList as $key => $value) {
if (in_array($value['field'], $this->except['visit'])) continue;
if (in_array($value['field'], $this->except['visit'])) continue;
$content[] = [
$content[] = [
'name' => $value['name'],
'name' => $value['name'],
'field' => $value['field'],
'field' => $value['field'],
'read' => 1,
'read' => 1,
'read_operation' => 1,
'read_operation' => 1,
'write' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
Db::name('admin_field_grant')->insert([
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'role_id' => $roleId,
'module' => 'crm',
'module' => 'crm',
'column' => 'visit',
'column' => 'visit',
'content' => serialize($content),
'content' => serialize($content),
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
]);
]);
}
}
/**
/**
* 处理回访 字段授权信息
* 处理发票 字段授权信息
*
*
* @param $roleId
* @param $roleId
* @author fanqi
* @author fanqi
@ -696,38 +703,86 @@ class FieldGrantLogic
private function createInvoiceFieldGrant($roleId)
private function createInvoiceFieldGrant($roleId)
{
{
$content = [
$content = [
['field' => 'invoice_apple_number', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '发票申请编号'],
['field' => 'invoice_apple_number', 'maskType' => 0, ' read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '发票申请编号'],
['field' => 'customer_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'customer_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'contract_id', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '合同编号'],
['field' => 'contract_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '合同编号'],
['field' => 'contract_money', 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '合同金额'],
['field' => 'contract_money', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '合同金额'],
['field' => 'invoice_money', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '开票金额'],
['field' => 'invoice_money', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '开票金额'],
['field' => 'invoice_date', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '开票日期'],
['field' => 'invoice_date', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '开票日期'],
['field' => 'invoice_type', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '开票类型'],
['field' => 'invoice_type', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '开票类型'],
['field' => 'remark', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
['field' => 'remark', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '备注'],
];
];
$invoiceList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_invoice')->select();
$invoiceList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_invoice')->select();
# 处理自定义字段
# 处理自定义字段
foreach ($invoiceList AS $key => $value) {
foreach ($invoiceList as $key => $value) {
if (in_array($value['field'], $this->except['invoice'])) continue;
if (in_array($value['field'], $this->except['invoice'])) continue;
$content[] = [
$content[] = [
'name' => $value['name'],
'name' => $value['name'],
'field' => $value['field'],
'field' => $value['field'],
'read' => 1,
'read' => 1,
'read_operation' => 1,
'read_operation' => 1,
'write' => 1,
'write' => 1,
'write_operation' => 1,
'write_operation' => 1,
'is_diy' => 1
'is_diy' => 1
];
];
}
}
Db::name('admin_field_grant')->insert([
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'role_id' => $roleId,
'module' => 'crm',
'module' => 'crm',
'column' => 'invoice',
'column' => 'invoice',
'content' => serialize($content),
'content' => serialize($content),
'create_time' => time(),
'update_time' => time()
]);
}
/**
* 处理回款计划字段授权信息
*
* @param int $roleId
* @author fanqi
* @date 2021-03-22
*/
private function createReceivablesPlanFieldGrant($roleId)
{
$content = [
['field' => 'num', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '期数'],
['field' => 'money', 'maskType' => 0, 'form_type'=>'floatnumber', 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '计划回款金额'],
['field' => 'owner_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '负责人'],
['field' => 'return_date', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '计划回款日期'],
['field' => 'customer_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '客户名称'],
['field' => 'remind', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 1, 'write_operation' => 1, 'is_diy' => 0, 'name' => '提前几日提醒'],
['field' => 'contract_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 0, 'write' => 1, 'write_operation' => 0, 'is_diy' => 0, 'name' => '合同编号'],
['field' => 'create_user_id', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建人'],
['field' => 'create_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '创建时间'],
['field' => 'update_time', 'maskType' => 0, 'read' => 1, 'read_operation' => 1, 'write' => 0, 'write_operation' => 0, 'is_diy' => 0, 'name' => '更新时间'],
];
$visitList = Db::name('admin_field')->field(['name', 'field'])->where('types', 'crm_receivables_plan')->select();
# 处理自定义字段
foreach ($visitList as $key => $value) {
if (in_array($value['field'], $this->except['receivables_plan'])) continue;
$content[] = [
'name' => $value['name'],
'field' => $value['field'],
'read' => 1,
'read_operation' => 1,
'write' => 1,
'write_operation' => 1,
'is_diy' => 1
];
}
Db::name('admin_field_grant')->insert([
'role_id' => $roleId,
'module' => 'crm',
'column' => 'receivables_plan',
'content' => serialize($content),
'create_time' => time(),
'create_time' => time(),
'update_time' => time()
'update_time' => time()
]);
]);