|
|
@ -50,7 +50,7 @@ class PromoteController extends ThinkController
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
$promoteid = $_REQUEST['promote_id'];
|
|
|
|
$promoteid = $_REQUEST['promote_id'];
|
|
|
|
|
|
|
|
|
|
|
|
$map['id'] = $_REQUEST['promote_id'];
|
|
|
|
$map['p.id'] = $_REQUEST['promote_id'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isset($_REQUEST['parent_id'])) {
|
|
|
|
if (isset($_REQUEST['parent_id'])) {
|
|
|
|
if ($_REQUEST['parent_id']=='全部') {
|
|
|
|
if ($_REQUEST['parent_id']=='全部') {
|
|
|
@ -68,12 +68,12 @@ class PromoteController extends ThinkController
|
|
|
|
if ($promoteid > 0 ) {
|
|
|
|
if ($promoteid > 0 ) {
|
|
|
|
if (in_array($promoteid,$zidarr)) {
|
|
|
|
if (in_array($promoteid,$zidarr)) {
|
|
|
|
# code...
|
|
|
|
# code...
|
|
|
|
$map['id'] = $promoteid;
|
|
|
|
$map['p.id'] = $promoteid;
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$map['id'] = 0;
|
|
|
|
$map['p.id'] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$map['id']=array('in',$zid);
|
|
|
|
$map['p.id']=array('in',$zid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
unset($_REQUEST['parent_id']);
|
|
|
|
unset($_REQUEST['parent_id']);
|
|
|
@ -87,7 +87,7 @@ class PromoteController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (I('status') || I('status', -1) == 0) {
|
|
|
|
if (I('status') || I('status', -1) == 0) {
|
|
|
|
$map['status'] = I('status');
|
|
|
|
$map['p.status'] = I('status');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (I('ver_status') || I('ver_status', -1) == 0) {
|
|
|
|
if (I('ver_status') || I('ver_status', -1) == 0) {
|
|
|
@ -95,14 +95,14 @@ class PromoteController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (I("promote_level")) {
|
|
|
|
if (I("promote_level")) {
|
|
|
|
$map['level'] = I("promote_level");
|
|
|
|
$map['p.level'] = I("promote_level");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (strlen(I('company_belong'))) {
|
|
|
|
if (strlen(I('company_belong'))) {
|
|
|
|
$map['company_belong'] = I("company_belong");
|
|
|
|
$map['p.company_belong'] = I("company_belong");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!is_null(I('admin_uid', null))) {
|
|
|
|
if (!is_null(I('admin_uid', null))) {
|
|
|
|
$map['admin_id'] = I('admin_uid');
|
|
|
|
$map['p.admin_id'] = I('admin_uid');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->m_title = '推广员列表';
|
|
|
|
$this->m_title = '推广员列表';
|
|
|
@ -149,8 +149,21 @@ class PromoteController extends ThinkController
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//为数据权限添加
|
|
|
|
//为数据权限添加
|
|
|
|
setPowerPromoteIds($map, 'id');
|
|
|
|
setPowerPromoteIds($map, 'p.id');
|
|
|
|
$list_data = D(self::model_name)->where($map)->order('id DESC')->page($p, $row)->select();
|
|
|
|
$list_data = D(self::model_name)
|
|
|
|
|
|
|
|
->alias("p")
|
|
|
|
|
|
|
|
->field("p.*,IFNULL(m.nickname,'无') admin_nickname,IFNULL(b.account,'暂无') b_account,IFNULL(if(substring_index(substring_index(p.`chain`,'/',2),'/',-1)='',p.id,substring_index(substring_index(p.`chain`,'/',2),'/',-1)),0) top_id")
|
|
|
|
|
|
|
|
->join("sys_member m on p.admin_id = m.uid","left")
|
|
|
|
|
|
|
|
->join("tab_business_affairs b on p.ba_id = b.id","left")
|
|
|
|
|
|
|
|
->where($map)->order('id DESC');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_REQUEST['export'])){
|
|
|
|
|
|
|
|
$list_data = $list_data->select(false);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$list_data = $list_data->page($p, $row)->select(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$list_data = M()->table("(".$list_data.") a")->field("a.*,pr.account top_account")->join("tab_promote pr on a.top_id = pr.id")->select();
|
|
|
|
$list_data = D(self::model_name)->parseListData($list_data);
|
|
|
|
$list_data = D(self::model_name)->parseListData($list_data);
|
|
|
|
$oa_data = [];
|
|
|
|
$oa_data = [];
|
|
|
|
if (I('oa_associated', -1) == -1) {
|
|
|
|
if (I('oa_associated', -1) == -1) {
|
|
|
@ -178,7 +191,33 @@ class PromoteController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$count = D(self::model_name)->where($map)->count();
|
|
|
|
//导出
|
|
|
|
|
|
|
|
if(isset($_REQUEST['export'])){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$GetData = $_GET;
|
|
|
|
|
|
|
|
unset($GetData['export']);
|
|
|
|
|
|
|
|
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData),'menu'=>"推广员-推广员管理-推广员列表-导出"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data2csv($list_data,'推广员列表',array(
|
|
|
|
|
|
|
|
"id"=>"推广员ID",
|
|
|
|
|
|
|
|
"account"=>"推广员账号",
|
|
|
|
|
|
|
|
"mobile_phone"=>"手机号码",
|
|
|
|
|
|
|
|
"balance_coin"=>"平台币余额",
|
|
|
|
|
|
|
|
"pay_amount"=>"总流水",
|
|
|
|
|
|
|
|
"create_time"=>"注册时间",
|
|
|
|
|
|
|
|
"last_login_time"=>"最后登录时间",
|
|
|
|
|
|
|
|
"level_name"=>"渠道类型",
|
|
|
|
|
|
|
|
"top_account"=>"所属会长",
|
|
|
|
|
|
|
|
"company_belong_str"=>"公会归属",
|
|
|
|
|
|
|
|
"company_relation_str"=>"公会关系",
|
|
|
|
|
|
|
|
"admin_nickname"=>"归属管理员",
|
|
|
|
|
|
|
|
"b_account"=>"商务专员",
|
|
|
|
|
|
|
|
"status_str"=>"状态",
|
|
|
|
|
|
|
|
"ver_status"=>"身份状态",
|
|
|
|
|
|
|
|
"oa_associated_str"=>"oa关联"
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$count = D(self::model_name)->alias("p")->where($map)->count();
|
|
|
|
$page = set_pagination($count, $row);
|
|
|
|
$page = set_pagination($count, $row);
|
|
|
|
if ($page) {
|
|
|
|
if ($page) {
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
$this->assign('_page', $page);
|
|
|
@ -245,6 +284,9 @@ class PromoteController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$company_belong = $_REQUEST['company_belong'] ?? 0;
|
|
|
|
$company_belong = $_REQUEST['company_belong'] ?? 0;
|
|
|
|
$company_relation = $_REQUEST['company_relation'] ?? 0;
|
|
|
|
$company_relation = $_REQUEST['company_relation'] ?? 0;
|
|
|
|
|
|
|
|
if($company_id && $company_id > 0){
|
|
|
|
|
|
|
|
$company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id = {$company_id}")->find()['company_belong'];
|
|
|
|
|
|
|
|
}
|
|
|
|
$data = array(
|
|
|
|
$data = array(
|
|
|
|
'account'=>$account,
|
|
|
|
'account'=>$account,
|
|
|
|
'password'=>$password,
|
|
|
|
'password'=>$password,
|
|
|
@ -359,10 +401,13 @@ class PromoteController extends ThinkController
|
|
|
|
if ($promote['level'] ==1) {//如果是会长才能修改的选项
|
|
|
|
if ($promote['level'] ==1) {//如果是会长才能修改的选项
|
|
|
|
if (!is_null($company_id)) {
|
|
|
|
if (!is_null($company_id)) {
|
|
|
|
$data['company_id'] = $company_id;//推广公司
|
|
|
|
$data['company_id'] = $company_id;//推广公司
|
|
|
|
|
|
|
|
if($company_id == 0){
|
|
|
|
|
|
|
|
$data['company_belong'] = 0;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$data['company_belong'] = M("PromoteCompany","tab_")->field("company_belong")->where("id = {$company_id}")->find()['company_belong'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
$data['company_belong'] = I('company_belong');//工会归属
|
|
|
|
// $data['company_relation'] = I('company_relation');//工会关系
|
|
|
|
$data['company_relation'] = I('company_relation');//工会关系
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$settlementType = intval(I('settlement_type', 1));
|
|
|
|
$settlementType = intval(I('settlement_type', 1));
|
|
|
|
if (!empty(I('settlement_type')) && in_array($settlementType, [1, 2])) {
|
|
|
|
if (!empty(I('settlement_type')) && in_array($settlementType, [1, 2])) {
|
|
|
@ -373,6 +418,12 @@ class PromoteController extends ThinkController
|
|
|
|
if ($promote['level'] == 1) {//修改会长底下推广员的推广公司
|
|
|
|
if ($promote['level'] == 1) {//修改会长底下推广员的推广公司
|
|
|
|
$array = array();
|
|
|
|
$array = array();
|
|
|
|
if ($promote['company_id'] != $company_id) {
|
|
|
|
if ($promote['company_id'] != $company_id) {
|
|
|
|
|
|
|
|
//内外团关系也要跟着公司走
|
|
|
|
|
|
|
|
if($company_id == 0){
|
|
|
|
|
|
|
|
$array['company_belong'] = 0;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$array['company_belong'] = M("PromoteCompany","tab_")->field("company_belong")->where("id = {$company_id}")->find()['company_belong'];
|
|
|
|
|
|
|
|
}
|
|
|
|
$array['company_id'] = I('company_id');
|
|
|
|
$array['company_id'] = I('company_id');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if ($promote['company_belong'] != I('company_belong')) {
|
|
|
|
// if ($promote['company_belong'] != I('company_belong')) {
|
|
|
@ -1275,6 +1326,9 @@ class PromoteController extends ThinkController
|
|
|
|
if (strlen(I('company_relation'))) {
|
|
|
|
if (strlen(I('company_relation'))) {
|
|
|
|
$map['pb.company_relation'] = I('company_relation');
|
|
|
|
$map['pb.company_relation'] = I('company_relation');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_REQUEST['company_belong'])) {
|
|
|
|
|
|
|
|
$map['p.company_belong'] = $_REQUEST['company_belong'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (strlen(I('verify_status'))) {
|
|
|
|
if (strlen(I('verify_status'))) {
|
|
|
|
$map['verify_status'] = I('verify_status');
|
|
|
|
$map['verify_status'] = I('verify_status');
|
|
|
@ -1309,11 +1363,17 @@ class PromoteController extends ThinkController
|
|
|
|
//为数据权限添加
|
|
|
|
//为数据权限添加
|
|
|
|
setPowerPromoteIds($map, 'pb.promote_id');
|
|
|
|
setPowerPromoteIds($map, 'pb.promote_id');
|
|
|
|
$model = M('promote_belong', 'tab_');
|
|
|
|
$model = M('promote_belong', 'tab_');
|
|
|
|
|
|
|
|
$default_company = C('DEFAULT_COMPANY');
|
|
|
|
|
|
|
|
$field = "
|
|
|
|
|
|
|
|
pb.id,pb.promote_id,pb.verify_status,pb.company_relation,pb.remark,pb.can_view_recharge,pb.approver_name,pb.applicant_name,pb.verify_time,pb.applicant_time,pb.company_type,
|
|
|
|
|
|
|
|
IFNULL(pc.company_name,'{$default_company}') company_name,
|
|
|
|
|
|
|
|
p.company_belong,p.account,p.mobile_phone,p.admin_id,p.ver_status,p.status,p.create_time
|
|
|
|
|
|
|
|
";
|
|
|
|
$list_data = $model->alias('pb')
|
|
|
|
$list_data = $model->alias('pb')
|
|
|
|
->join('left join tab_promote as p on p.id=pb.promote_id')
|
|
|
|
->join('left join tab_promote as p on p.id=pb.promote_id')
|
|
|
|
->join('left join tab_promote_company as pc on pc.id = p.company_id')
|
|
|
|
->join('left join tab_promote_company as pc on pc.id = p.company_id')
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->field('p.*,pb.*, pc.company_name')
|
|
|
|
->field($field)
|
|
|
|
->page($p, $row)
|
|
|
|
->page($p, $row)
|
|
|
|
->order('verify_status asc,applicant_time asc')
|
|
|
|
->order('verify_status asc,applicant_time asc')
|
|
|
|
->select();
|
|
|
|
->select();
|
|
|
|