diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index db22be30f..a05e905ce 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2232,6 +2232,31 @@ function a_array_unique($array){ return $data; } } + /** + * 获取公会等级对应名称 + * @author chenzhi 20200219 + * $id 不传返回所有等级名称 + * 传入ID 返回对应的等级名称 + */ + function getPromoteLeverName($id = -1) + { + $data = array( + ["id"=>1,'name'=>"会长"], + ["id"=>2,'name'=>"部门长"], + ["id"=>3,'name'=>"组长"], + ["id"=>4,'name'=>"组员"], + ); + if($id > -1){ + foreach($data as $k=>$v){ + if($v['id'] == $id){ + return $v['name']; + break; + } + } + }else{ + return $data; + } + } /** * 操作日志 diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index a1ab50267..d70f2f0c3 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -50,7 +50,7 @@ class PromoteController extends ThinkController if (isset($_REQUEST['promote_id'])) { $promoteid = $_REQUEST['promote_id']; - $map['id'] = $_REQUEST['promote_id']; + $map['p.id'] = $_REQUEST['promote_id']; } if (isset($_REQUEST['parent_id'])) { if ($_REQUEST['parent_id']=='全部') { @@ -68,12 +68,12 @@ class PromoteController extends ThinkController if ($promoteid > 0 ) { if (in_array($promoteid,$zidarr)) { # code... - $map['id'] = $promoteid; + $map['p.id'] = $promoteid; }else{ - $map['id'] = 0; + $map['p.id'] = 0; } }else{ - $map['id']=array('in',$zid); + $map['p.id']=array('in',$zid); } // unset($_REQUEST['parent_id']); @@ -87,7 +87,7 @@ class PromoteController extends ThinkController } } 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) { @@ -95,14 +95,14 @@ class PromoteController extends ThinkController } if (I("promote_level")) { - $map['level'] = I("promote_level"); + $map['p.level'] = I("promote_level"); } 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))) { - $map['admin_id'] = I('admin_uid'); + $map['p.admin_id'] = I('admin_uid'); } $this->m_title = '推广员列表'; @@ -149,8 +149,21 @@ class PromoteController extends ThinkController //为数据权限添加 - setPowerPromoteIds($map, 'id'); - $list_data = D(self::model_name)->where($map)->order('id DESC')->page($p, $row)->select(); + setPowerPromoteIds($map, 'p.id'); + $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); $oa_data = []; 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); if ($page) { $this->assign('_page', $page); diff --git a/Application/Admin/Model/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php index c086e0589..6b80b7179 100644 --- a/Application/Admin/Model/PromoteModel.class.php +++ b/Application/Admin/Model/PromoteModel.class.php @@ -421,13 +421,33 @@ class PromoteModel extends Model{ public function parseListData($result) { + //获取是否要隐藏重要信息 + $show_data_power = (is_administrator()|| session('user_auth')['show_data']); $parseData = array(); foreach ($result as $key => $value) { $parseData[$key] = $value; $parseData[$key]['company_belong_str'] = getCompanyBlong($value['company_belong']); $parseData[$key]['company_relation_str'] = getCompanyRelation($value['company_relation']); + $parseData[$key]['create_time'] = set_show_time($value['create_time']); + $parseData[$key]['last_login_time'] = set_show_time($value['last_login_time']); + $parseData[$key]['level_name'] = getPromoteLeverName($value['level']); + $parseData[$key]['status_str'] = get_info_status($value['status'],3) ?:"待审核"; + $parseData[$key]['ver_status'] = get_info_status($value['ver_status'],42) ?:"未认证"; + $parseData[$key]['oa_associated_str'] = $value['oa_associated'] == 1 ? "已关联" : "未关联"; + $parseData[$key]['pay_amount'] = sum_promote_total_money($value['id']); + + + if(!$show_data_power){ + $parseData[$key]['account'] = encryptStr($parseData[$key]['account']); + $parseData[$key]['mobile_phone'] = encryptStr($parseData[$key]['mobile_phone']); + $parseData[$key]['top_account'] = encryptStr($parseData[$key]['top_account']); + + } + + } return $parseData; + } diff --git a/Application/Admin/View/Promote/lists.html b/Application/Admin/View/Promote/lists.html index 3e0fb49bf..e5e6d200d 100644 --- a/Application/Admin/View/Promote/lists.html +++ b/Application/Admin/View/Promote/lists.html @@ -227,67 +227,39 @@ {$data.id} - - {$data.account} - - {$data.account|encryptStr} - + {$data.account} - - {$data.mobile_phone} - - {$data.mobile_phone|encryptStr} - + {$data.mobile_phone} {$data.balance_coin} - {:sum_promote_total_money($data['id'])} - {:set_show_time($data['create_time'])} - {:set_show_time($data['last_login_time'])} - {:get_promote_levels($data['id'])} + {$data['pay_amount']} + {$data['create_time']} + {$data['last_login_time']} + {$data['level_name']} - - {:getTopPromote($data['id'])['account']} - - {:encryptStr(getTopPromote($data['id'])['account'])} - + {$data['top_account']} {$data['company_belong_str']} {$data['company_relation_str']} - {:get_admin_nickname($data['admin_id'])} - {:get_business_affairs_account($data['ba_id'])} + {$data['admin_nickname']} + {$data['b_account']} - - {$status_str} + {$data.status_str} - {$status_str} + {$data.status_str} - {$status_str} + {$data.status_str} - - - 成功 - - - 拒绝 - - - 正在审核 - - - 修改审核中 - - - 未认证 - + {$data['ver_status']} - 已关联 + {$data.oa_associated_str} - 未关联 + {$data.oa_associated_str} 查看 @@ -368,7 +340,7 @@
- 导出 + 导出 {$_page|default=''}
diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index 9be39bf70..b012d784e 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -674,13 +674,13 @@ function get_info_status($type=null,$group=0){ 33 =>array(0=>"待审核",1=>"已通过"), 34 => ["已关闭","已开启"], 35 => array(-1=>"审核中",1=>"正常",2=>"锁定",3=>"驳回"), - 38 => array(0=>'待付款',1=>'交易成功',2=>'交易取消'), - 39 => array(0=>'未打款',1=>'已打款',2=>'已驳回'), + 38 => array(0=>'待付款',1=>'交易成功',2=>'交易取消'), + 39 => array(0=>'未打款',1=>'已打款',2=>'已驳回'), 36 => array(0=>"未打款",1=>"手动打款",2=>"自动打款"), 37 => array(0=>"不参与",1=>"已参与"), - - 40 => array(0=>'未处理',1=>'已处理',2=>'忽略'), - 41 => array(-1=>'已下架',0=>'待审核',1=>'已售出',2=>'已驳回',3=>'出售中',4=>'待发货',5=>'审核中'), + 40 => array(0=>'未处理',1=>'已处理',2=>'忽略'), + 41 => array(-1=>'已下架',0=>'待审核',1=>'已售出',2=>'已驳回',3=>'出售中',4=>'待发货',5=>'审核中'), + 42 => array(0=>'未认证',1=>'成功',2=>'拒绝',3=>'正在审核',4=>'修改审核中'), ); return $arr[$group][$type];