Skip to content

Commit

Permalink
72crm_update_190509
Browse files Browse the repository at this point in the history
【重要提示】将更新包中的SQL文件(/public/sql/update_sql_190508.sql)执行导入,此sql文件只用于本次(版本号:72crm_9.0.1_20190509)升级,请勿重复执行。

新增:

1、  跟进记录增加删除功能

2、 联系人、产品导入导出功能

3、 商业智能“员工客户分析、员工业绩分析、客户画像分析、产品分析、排行榜分析”等29个多维度报表

修复:

1、创建员工选择完角色后,在对应的“角色员工”列表没有员工信息,且在“角色员工”处主动关联员工也无法关联

2、员工和部门管理第一大类(办公室)无法更改,一更改就显示参数错误

3、商机自定义字段后,商机详情商机阶段显示错误,且不能正常推进,只能选择最后一步,且编辑商机时商机组及商机阶段显示为id

4、合同、回款 操作记录没有显示

5、审批流为固定审批流,且指定某一人时,审批人在“待我审批”列表看不到数据

6、客户不选中时导出只能导出20条数据

7、日志编辑失败

8、编辑商机状态组,商机阶段展示为数字ID

9、公告结束时间选择为当天,会创建到已结束里

10、  仪表盘目标金额不显示

11、   普通员工将自己添加的场景设为默认的时候,提示“无权操作”

12、   添加完任务之后,在工作台不显示对应动态

13、    商机列表根据商机状态筛选,搜索不出数据

优化:

1、  新建商机、合同时,“总金额”调整为可编辑,可以根据总金额和产品金额自动计算整单折扣

2、 仪表盘时间筛选优化

3、最高管理员可删除所有日志

4、商机状态筛选中,增加“赢单、输单、无效”三个选项

5、系统中显示的当前版本号V9.0.0升级后可以自动更新

6、在线索列表场景中筛选“已转化线索”,勾选之后,将“转移、转化为客户”的操作按钮隐藏
  • Loading branch information
WukongSoftware committed May 9, 2019
1 parent 3b077b4 commit ced9614
Show file tree
Hide file tree
Showing 315 changed files with 11,219 additions and 1,084 deletions.
15 changes: 11 additions & 4 deletions application/admin/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,18 @@ function decrypt($str, $key = 'kls8in1e')

/**
* 部门树形数组
* @param
* @param type 0 下属数组, 1包含自己
*/
function getSubObj($id, $objList, $separate) {
$array = array();
foreach ($objList AS $value) {
function getSubObj($id, $objList, $separate, $is_first = 0) {
$array = array();
foreach ($objList as $key => $value) {
if ($key == 0 && $is_first == 1) {
if ($value['id'] == 1) {
$id = 0;
} else {
$id = $value['pid'];
}
}
if ($id == $value['pid']) {
$array[] = array('id' => $value['id'], 'name' => $separate.$value['name']);
$array = array_merge($array, getSubObj($value['id'], $objList, $separate.'--'));
Expand Down
11 changes: 8 additions & 3 deletions application/admin/controller/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function login()
$password = $param['password'];
$verifyCode = !empty($param['verifyCode'])? $param['verifyCode']: '';
$isRemember = !empty($param['isRemember'])? $param['isRemember']: '';
$type = $param['type'] ? : '';
$data = $userModel->login($username, $password, $verifyCode, $isRemember, $type, $authKey);
$is_mobile = $param['is_mobile'] ? : '';
$data = $userModel->login($username, $password, $verifyCode, $isRemember, $type, $authKey, $is_mobile);

Session::set('user_id', $data['userInfo']['id']);
if (!$data) {
Expand All @@ -35,8 +35,13 @@ public function login()
//退出登录
public function logout()
{
$param = $this->param;
$header = Request::instance()->header();
cache('Auth_'.$header['authkey'], null);
if ($param['mobile'] == 1) {
cache('Auth_'.$header['authkey'].'mobile', null);
} else {
cache('Auth_'.$header['authkey'], null);
}
session('null', 'admin');
session('admin','null');
session('user_id','null');
Expand Down
2 changes: 1 addition & 1 deletion application/admin/controller/ExamineFlow.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function _initialize()
//权限判断
$unAction = ['steplist','userlist','recordlist'];
$adminTypes = adminGroupTypes($userInfo['id']);
if (!in_array(4,$adminTypes) && !in_array(1,$adminTypes) && !in_array($a, $unAction)) {
if (!in_array(4,$adminTypes) && !in_array(1,$adminTypes) && !in_array(2,$adminTypes) && !in_array($a, $unAction)) {
header('Content-Type:application/json; charset=utf-8');
exit(json_encode(['code'=>102,'error'=>'无权操作']));
}
Expand Down
19 changes: 16 additions & 3 deletions application/admin/controller/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function _initialize()
{
$action = [
'permission'=>[''],
'allow'=>['index','getfield','update','read','config','validates','configindex','columnwidth']
'allow'=>['index','getfield','update','read','config','validates','configindex','columnwidth','uniquefield']
];
Hook::listen('check_auth',$action);
$request = Request::instance();
Expand All @@ -35,7 +35,7 @@ public function _initialize()
//权限判断
$unAction = ['getfield','read','config','validates','configindex','columnwidth'];
$adminTypes = adminGroupTypes($userInfo['id']);
if (!in_array(6,$adminTypes) && !in_array(1,$adminTypes) && !in_array($a, $unAction)) {
if (!in_array(6,$adminTypes) && !in_array(1,$adminTypes) && !in_array(2,$adminTypes) && !in_array($a, $unAction)) {
header('Content-Type:application/json; charset=utf-8');
exit(json_encode(['code'=>102,'error'=>'无权操作']));
}
Expand Down Expand Up @@ -345,5 +345,18 @@ public function configIndex()
return resultArray(['error' => $userFieldModel->getError()]);
}
return resultArray(['data' => $res]);
}
}

/**
* 自定义验重字段
* @param types 分类
* @param
*/
public function uniqueField()
{
$param = $this->param;
$list = db('admin_field')->where(['types' => $param['types'],'is_unique' => 1])->column('name');
$list = $list ? implode(',',$list) : '';
return resultArray(['data' => $list]);
}
}
4 changes: 3 additions & 1 deletion application/admin/controller/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function _initialize()
$userInfo = $this->userInfo;
//权限判断
$adminTypes = adminGroupTypes($userInfo['id']);
if (!in_array(3,$adminTypes) && !in_array(1,$adminTypes)) {
if (!in_array(1,$adminTypes) && !in_array(2,$adminTypes) && !in_array(3,$adminTypes)) {
header('Content-Type:application/json; charset=utf-8');
exit(json_encode(['code'=>102,'error'=>'无权操作']));
}
Expand Down Expand Up @@ -174,6 +174,8 @@ public function copy()
}
$dataInfo = json_decode($dataInfo, true);
unset($dataInfo['id']);
$titleCount = db('admin_group')->where(['title' => $dataInfo['title']])->count();
$dataInfo['title'] = $dataInfo['title'].'('.$titleCount.')';
$data = $groupModel->createData($dataInfo);
if (!$data) {
return resultArray(['error' => $groupModel->getError()]);
Expand Down
4 changes: 2 additions & 2 deletions application/admin/controller/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function authList()
$ruleMap = [];
$adminTypes = adminGroupTypes($u_id);
if (in_array(1,$adminTypes)) {
$map['status'] = 1;
$ruleMap['status'] = 1;
} else {
$userModel = new \app\admin\model\User();
$groups = $userModel->get($u_id)->groups;
Expand All @@ -92,7 +92,7 @@ public function authList()
}
$newRuleIds = [];
// 重新设置ruleIds,除去部分已删除或禁用的权限。
$rules = Db::name('admin_rule')->where($ruleMap)->select();
$rules = Db::name('admin_rule')->where($ruleMap)->order('types asc')->select();
foreach ($rules as $k => $v) {
$newRuleIds[] = $v['id'];
$rules[$k]['name'] = strtolower($v['name']);
Expand Down
2 changes: 1 addition & 1 deletion application/admin/controller/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ private function checkNnv()
'php' => ['PHP版本', '5.6', '5.6.x', PHP_VERSION, 'ok'],
];
session('install_error','');
if ($items['php'][3] < $items['php'][1]) {
if (substr($items['php'][3],0,3) < $items['php'][1]) {
$items['php'][4] = 'no';
session('install_error', true);
}
Expand Down
12 changes: 8 additions & 4 deletions application/admin/controller/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,22 @@ public function update()
* @param
* @return
*/
public function delete($id)
public function delete()
{
$recordModel = model('Record');
$param = $this->param;
$userInfo = $this->userInfo;
//权限判断
$dataInfo = $recordModel->getDataById($param['id']);
if (!$dataInfo) {
return resultArray(['error' => '数据不存在或已删除']);
}

// $resData = $recordModel->delDataById($param['id']);
$resData = $recordModel->signDelById($param['id']); //逻辑删
//自己(24小时)或者管理员
$adminTypes = adminGroupTypes($userInfo['id']);
if (!in_array(1,$adminTypes) && ($dataInfo['create_user_id'] !== $userInfo['id'] && ((time()-$dataInfo['create_time']) > 86400))) {
return resultArray(['error' => '超过24小时,不能删除']);
}
$resData = $recordModel->delDataById($param['id']);
if (!$resData) {
return resultArray(['error' => $recordModel->getError()]);
}
Expand Down
2 changes: 1 addition & 1 deletion application/admin/controller/Scene.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function _initialize()
{
$action = [
'permission'=>[''],
'allow'=>['index','save','read','update','delete','sort','default']
'allow'=>['index','save','read','update','delete','sort','defaults']
];
Hook::listen('check_auth',$action);
$request = Request::instance();
Expand Down
20 changes: 11 additions & 9 deletions application/admin/controller/Structures.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function _initialize()
{
$action = [
'permission'=>[''],
'allow'=>['index','read','save','update','delete','deletes','enables','listdialog','subindex']
'allow'=>['index','read','save','update','delete','deletes','enables','listdialog','subindex','getsubuserbystructrue']
];
Hook::listen('check_auth',$action);
$request = Request::instance();
Expand All @@ -34,7 +34,7 @@ public function _initialize()

$userInfo = $this->userInfo;
//权限判断
$unAction = ['index','listdialog','subindex'];
$unAction = ['index','listdialog','subindex','getsubuserbystructrue'];
$adminTypes = adminGroupTypes($userInfo['id']);
if (!in_array(3,$adminTypes) && !in_array(1,$adminTypes) && !in_array(2,$adminTypes) && !in_array($a, $unAction)) {
header('Content-Type:application/json; charset=utf-8');
Expand All @@ -45,18 +45,23 @@ public function _initialize()
//获取权限范围内的部门
public function subIndex()
{
$param = $this->param;
$userInfo = $this->userInfo;
$userModel = model('User');
$ret = $userModel->getUserByPer();
$m = $param['m'] ? : '';
$c = $param['c'] ? : '';
$a = $param['a'] ? : '';
$ret = $userModel->getUserByPer($m, $c, $a);
$where['au.id'] = ['in',$ret];
$list = Db::name('AdminUser')
->alias('au')
->join('AdminStructure ast','ast.id = au.structure_id','LEFT')
->field('ast.*')
->where($where)
->group('structure_id')
->order('structure_id asc')
->select();
$result = getSubObj(0, $list,'');
$result = getSubObj(0, $list, '', 1);
return resultArray(['data'=>$result]);
}

Expand Down Expand Up @@ -137,12 +142,9 @@ public function update()
$structureModel = model('Structure');
$param = $this->param;
$dataInfo = $structureModel->getDataByID($param['id']);
if (empty($dataInfo['pid'])) {
if (empty($dataInfo['pid']) || $param['id'] == '1') {
unset($param['pid']);
}
if (!$param['pid']) {
return resultArray(['error' => '参数错误']);
}
$data = $structureModel->updateDataById($param, $param['id']);
if (!$data) {
return resultArray(['error' => $structureModel->getError()]);
Expand Down Expand Up @@ -207,7 +209,7 @@ public function listDialog()
}
}
}
$structureList = getSubObj(0, $structureList, '');
$structureList = getSubObj(0, $structureList, '', 1);
return resultArray(['data' => $structureList]);
}
}
Expand Down
48 changes: 25 additions & 23 deletions application/admin/controller/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ public function update()
$userModel = model('User');
$param = $this->param;
$userInfo = $this->userInfo;
$userData = db('admin_user')->where(['id' => $param['id']])->find();
if (!$param['id']) {
//修改个人信息
$param['user_id'] = $userInfo['id'];
$param['user_id'] = $userData['id'];
} else {
//权限判断
$adminTypes = adminGroupTypes($userInfo['id']);
Expand All @@ -114,12 +115,13 @@ public function update()
exit(json_encode(['code'=>102,'error'=>'无权操作']));
}
}
unset($param['username']);
$data = $userModel->updateDataById($param, $param['id']);
if (!$data) {
return resultArray(['error' => $userModel->getError()]);
}

$param['userInfo'] = $userInfo;
$param['userInfo'] = $userData;
$resSync = model('Sync')->syncData($param);

return resultArray(['data' => '编辑成功']);
Expand Down Expand Up @@ -157,9 +159,9 @@ public function enables()
$ids = $param['id'];
}
//顶级管理员不能修改
foreach ($ids as $v) {
if ($v == 1) {
unset($ids[$v]);
foreach ($ids as $k=>$v) {
if ((int)$v == 1 && $param['status'] == '0') {
unset($ids[$k]);
}
}
$data = $userModel->enableDatas($ids, $param['status']);
Expand All @@ -178,26 +180,26 @@ public function getUserList()
{
$userModel = model('User');
$param = $this->param;
$by = $param['by'];
$by = $param['by'] ? : '';
if ($param['m'] && $param['c'] && $param['a']) {
if ($param['m'] == 'oa' && $param['c'] == 'task') {
$belowIds = getSubUserId(true, 1);
}
$belowIds = $userModel->getUserByPer($param['m'], $param['c'], $param['a']);
} else {
// if ($by == 'all') {
// $belowIds = getSubUserId(true, 1);
// } else {
// $userInfo = $this->userInfo;
// $adminIds = $userModel->getAdminId();
// if (in_array($userInfo['id'],$adminIds)) {
// $belowIds = getSubUserId(true, 1);
// } else {
// //下属id
// $belowIds = getSubUserId();
// }
// }
$belowIds = getSubUserId(true, 1);
if ($by == 'sub') {
$userInfo = $this->userInfo;
$adminIds = $userModel->getAdminId();
if (in_array($userInfo['id'],$adminIds)) {
$belowIds = getSubUserId(true, 1);
} else {
//下属id
$belowIds = getSubUserId();
}
} else {
$belowIds = getSubUserId(true, 1);
}
// $belowIds = getSubUserId(true, 1);
}
$userList = db('admin_user')
->where(['user.id' => ['in',$belowIds]])
Expand Down Expand Up @@ -321,9 +323,9 @@ public function groups()
$resData = false;
}
}
if ($resData == false) {
return resultArray(['error' => '操作失败,请重试']);
}
// if ($resData == false) {
// return resultArray(['error' => '操作失败,请重试']);
// }
return resultArray(['data' => '创建成功']);
}

Expand Down Expand Up @@ -356,7 +358,7 @@ public function groupsDel()
public function structureUserList()
{
$structure_list = db('admin_structure')->select();
$structureList = getSubObj(0, $structure_list, '');
$structureList = getSubObj(0, $structure_list, '', 1);
foreach ($structureList as $k=>$v) {
$userList = [];
$userList = db('admin_user')->where(['structure_id' => $v['id'],'status' => array('in',['1','3'])])->field('id,realname')->select();
Expand Down
Loading

0 comments on commit ced9614

Please sign in to comment.