|
|
|
@ -15,68 +15,27 @@ class OldCountController extends \Think\Controller
|
|
|
|
|
public function moreDepartment()
|
|
|
|
|
{
|
|
|
|
|
//1.新增组
|
|
|
|
|
$manager = M('auth_group','sys_')->where("title = '高级市场专员'")->find();
|
|
|
|
|
$dbres = M('auth_group','sys_')->where("title LIKE '%市场%' AND id != 18")->select();
|
|
|
|
|
$dbres = M('auth_group','sys_')->where("department_id = 2 and department_level != 5")->select();
|
|
|
|
|
// $ids = '32,33,34,35';
|
|
|
|
|
$ids = '';
|
|
|
|
|
foreach ($dbres as &$v) {
|
|
|
|
|
if($v['id'] == 25){
|
|
|
|
|
$v['rules'] = $manager['rules'];
|
|
|
|
|
$v['data_empower_type'] =3;
|
|
|
|
|
$v['show_data'] =1;
|
|
|
|
|
$v['show_market_admin'] =1;
|
|
|
|
|
$v['show_promote'] =1;
|
|
|
|
|
}
|
|
|
|
|
if(mb_strpos($v['title'],"初级")){
|
|
|
|
|
$v['department_level'] = 1;
|
|
|
|
|
}
|
|
|
|
|
if(mb_strpos($v['title'],"中级")){
|
|
|
|
|
$v['department_level'] = 2;
|
|
|
|
|
}
|
|
|
|
|
if(mb_strpos($v['title'],"高级")){
|
|
|
|
|
$v['department_level'] = 3;
|
|
|
|
|
}
|
|
|
|
|
if(mb_strpos($v['title'],"经理")){
|
|
|
|
|
$v['department_level'] = 4;
|
|
|
|
|
}
|
|
|
|
|
if(mb_strpos($v['title'],"总监")){
|
|
|
|
|
$v['department_level'] = 5;
|
|
|
|
|
}
|
|
|
|
|
$v['title'] = "一部".$v['title'];
|
|
|
|
|
$v['department_id'] = 1;
|
|
|
|
|
$v['department_name'] = "市场一部";
|
|
|
|
|
M('auth_group','sys_')->save($v);
|
|
|
|
|
|
|
|
|
|
unset($v['id']);
|
|
|
|
|
$v['title'] = str_replace("一部","二部",$v['title']);
|
|
|
|
|
$v['department_id'] = 2;
|
|
|
|
|
$v['department_name'] = '市场二部';
|
|
|
|
|
M('auth_group','sys_')->add($v);
|
|
|
|
|
$v['title'] = str_replace("一部","长沙",$v['title']);
|
|
|
|
|
$v['department_id'] = 3;
|
|
|
|
|
$v['department_name'] = '长沙分部';
|
|
|
|
|
$ids .= ( M('auth_group','sys_')->add($v) . ",");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ids = rtrim($ids,',');
|
|
|
|
|
|
|
|
|
|
//3.增加部门表数据
|
|
|
|
|
M("department")->add([
|
|
|
|
|
'id'=>1,
|
|
|
|
|
'name'=>'市场一部',
|
|
|
|
|
'group_ids'=>'11,12,14,21,25',
|
|
|
|
|
'id'=>3,
|
|
|
|
|
'name'=>'长沙分部',
|
|
|
|
|
'group_ids'=>$ids,
|
|
|
|
|
'leader_group'=>'14',
|
|
|
|
|
'create_time'=>time(),
|
|
|
|
|
'update_time'=>time()
|
|
|
|
|
]);
|
|
|
|
|
M("department")->add([
|
|
|
|
|
'id'=>2,
|
|
|
|
|
'name'=>'市场二部',
|
|
|
|
|
'group_ids'=>'26,27,28,29,30',
|
|
|
|
|
'leader_group'=>'28',
|
|
|
|
|
'create_time'=>time(),
|
|
|
|
|
'update_time'=>time()
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
//4.修改旧等级
|
|
|
|
|
M("market_altogether","tab_")->where("level = 21")->save(['level'=>1]);
|
|
|
|
|
M("market_altogether","tab_")->where("level = 11")->save(['level'=>2]);
|
|
|
|
|
M("market_altogether","tab_")->where("level = 12")->save(['level'=>3]);
|
|
|
|
|
M("market_altogether","tab_")->where("level = 25")->save(['level'=>4]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setDataPresidentInit()
|
|
|
|
|