|
|
@ -15,68 +15,83 @@ class OldCountController extends \Think\Controller
|
|
|
|
public function moreDepartment()
|
|
|
|
public function moreDepartment()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//1.新增组
|
|
|
|
//1.新增组
|
|
|
|
// $manager = M('auth_group','sys_')->where("title = '高级市场专员'")->find();
|
|
|
|
$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("title LIKE '%市场%' AND id != 18")->select();
|
|
|
|
// foreach ($dbres as &$v) {
|
|
|
|
foreach ($dbres as &$v) {
|
|
|
|
// if($v['id'] == 25){
|
|
|
|
if($v['id'] == 25){
|
|
|
|
// $v['rules'] = $manager['rules'];
|
|
|
|
$v['rules'] = $manager['rules'];
|
|
|
|
// $v['data_empower_type'] =3;
|
|
|
|
$v['data_empower_type'] =3;
|
|
|
|
// $v['show_data'] =1;
|
|
|
|
$v['show_data'] =1;
|
|
|
|
// $v['show_market_admin'] =1;
|
|
|
|
$v['show_market_admin'] =1;
|
|
|
|
// $v['show_promote'] =1;
|
|
|
|
$v['show_promote'] =1;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// if(mb_strpos($v['title'],"初级")){
|
|
|
|
if(mb_strpos($v['title'],"初级")){
|
|
|
|
// $v['department_level'] = 1;
|
|
|
|
$v['department_level'] = 1;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// if(mb_strpos($v['title'],"中级")){
|
|
|
|
if(mb_strpos($v['title'],"中级")){
|
|
|
|
// $v['department_level'] = 2;
|
|
|
|
$v['department_level'] = 2;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// if(mb_strpos($v['title'],"高级")){
|
|
|
|
if(mb_strpos($v['title'],"高级")){
|
|
|
|
// $v['department_level'] = 3;
|
|
|
|
$v['department_level'] = 3;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// if(mb_strpos($v['title'],"经理")){
|
|
|
|
if(mb_strpos($v['title'],"经理")){
|
|
|
|
// $v['department_level'] = 4;
|
|
|
|
$v['department_level'] = 4;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// if(mb_strpos($v['title'],"总监")){
|
|
|
|
if(mb_strpos($v['title'],"总监")){
|
|
|
|
// $v['department_level'] = 5;
|
|
|
|
$v['department_level'] = 5;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// $v['title'] = "一部".$v['title'];
|
|
|
|
$v['title'] = "一部".$v['title'];
|
|
|
|
// $v['department_id'] = 1;
|
|
|
|
$v['department_id'] = 1;
|
|
|
|
// $v['department_name'] = "市场一部";
|
|
|
|
$v['department_name'] = "市场一部";
|
|
|
|
// M('auth_group','sys_')->save($v);
|
|
|
|
M('auth_group','sys_')->save($v);
|
|
|
|
|
|
|
|
|
|
|
|
// unset($v['id']);
|
|
|
|
unset($v['id']);
|
|
|
|
// $v['title'] = str_replace("一部","二部",$v['title']);
|
|
|
|
$v['title'] = str_replace("一部","二部",$v['title']);
|
|
|
|
// $v['department_id'] = 2;
|
|
|
|
$v['department_id'] = 2;
|
|
|
|
// $v['department_name'] = '市场二部';
|
|
|
|
$v['department_name'] = '市场二部';
|
|
|
|
// M('auth_group','sys_')->add($v);
|
|
|
|
M('auth_group','sys_')->add($v);
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//3.增加部门表数据
|
|
|
|
//3.增加部门表数据
|
|
|
|
// M("department")->add([
|
|
|
|
M("department")->add([
|
|
|
|
// 'id'=>1,
|
|
|
|
'id'=>1,
|
|
|
|
// 'name'=>'市场一部',
|
|
|
|
'name'=>'市场一部',
|
|
|
|
// 'group_ids'=>'11,12,14,21,25',
|
|
|
|
'group_ids'=>'11,12,14,21,25',
|
|
|
|
// 'leader_group'=>'14',
|
|
|
|
'leader_group'=>'14',
|
|
|
|
// 'create_time'=>time(),
|
|
|
|
'create_time'=>time(),
|
|
|
|
// 'update_time'=>time()
|
|
|
|
'update_time'=>time()
|
|
|
|
// ]);
|
|
|
|
]);
|
|
|
|
// M("department")->add([
|
|
|
|
M("department")->add([
|
|
|
|
// 'id'=>2,
|
|
|
|
'id'=>2,
|
|
|
|
// 'name'=>'市场二部',
|
|
|
|
'name'=>'市场二部',
|
|
|
|
// 'group_ids'=>'26,27,28,29,30',
|
|
|
|
'group_ids'=>'26,27,28,29,30',
|
|
|
|
// 'leader_group'=>'28',
|
|
|
|
'leader_group'=>'28',
|
|
|
|
// 'create_time'=>time(),
|
|
|
|
'create_time'=>time(),
|
|
|
|
// 'update_time'=>time()
|
|
|
|
'update_time'=>time()
|
|
|
|
// ]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
//4.修改旧等级
|
|
|
|
//4.修改旧等级
|
|
|
|
// M("market_altogether","tab_")->where("level = 21")->save(['level'=>1]);
|
|
|
|
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 = 11")->save(['level'=>2]);
|
|
|
|
// M("market_altogether","tab_")->where("level = 12")->save(['level'=>3]);
|
|
|
|
M("market_altogether","tab_")->where("level = 12")->save(['level'=>3]);
|
|
|
|
// M("market_altogether","tab_")->where("level = 25")->save(['level'=>4]);
|
|
|
|
M("market_altogether","tab_")->where("level = 25")->save(['level'=>4]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function setDataPresidentInit()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$marketEvent = A("Market","Event");
|
|
|
|
|
|
|
|
//获取所有二部公司
|
|
|
|
|
|
|
|
$uids = $marketEvent->getDepartmentUserId(2);
|
|
|
|
|
|
|
|
$promoteids = M("Promote","tab_")->where(["admin_id"=>['in',$uids],"level"=>1])->getField("id",true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$marketEvent->removePresident($promoteids);
|
|
|
|
|
|
|
|
$save = [
|
|
|
|
|
|
|
|
"id"=>28,
|
|
|
|
|
|
|
|
"data_president"=>implode(",",$promoteids)
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
M('auth_group','sys_')->save($save);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|