优化推广公会列表导出

master
chenzhi 5 years ago
parent f2148320a8
commit 55d49e8b4b

@ -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;
}
}
/**
* 操作日志

@ -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);

@ -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;
}

@ -227,67 +227,39 @@
<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
<td>{$data.id}</td>
<td>
<if condition="$show_data_power eq true ">
{$data.account}
<else />
{$data.account|encryptStr}
</if>
</td>
<td>
<if condition="$show_data_power eq true ">
{$data.mobile_phone}
<else />
{$data.mobile_phone|encryptStr}
</if>
</td>
<td>{$data.balance_coin}</td>
<td>{:sum_promote_total_money($data['id'])}</td>
<td>{:set_show_time($data['create_time'])}</td>
<td>{:set_show_time($data['last_login_time'])}</td>
<td>{:get_promote_levels($data['id'])}</td>
<td>{$data['pay_amount']}</td>
<td>{$data['create_time']}</td>
<td>{$data['last_login_time']}</td>
<td>{$data['level_name']}</td>
<td>
<if condition="$show_data_power eq true ">
{:getTopPromote($data['id'])['account']}
<else />
{:encryptStr(getTopPromote($data['id'])['account'])}
</if>
{$data['top_account']}
</td>
<td>{$data['company_belong_str']}</td>
<td>{$data['company_relation_str']}</td>
<td>{:get_admin_nickname($data['admin_id'])}</td>
<td>{:get_business_affairs_account($data['ba_id'])}</td>
<td>{$data['admin_nickname']}</td>
<td>{$data['b_account']}</td>
<td>
<?php $status_str = get_info_status($data['status'],3); $status_str = $status_str ?: '待审核';?>
<if condition="$data['status'] eq 0">
<span class="preview_status">{$status_str}</span>
<span class="preview_status">{$data.status_str}</span>
<elseif condition="$data['status'] eq 2 " />
<span class="disabled_status">{$status_str}</span>
<span class="disabled_status">{$data.status_str}</span>
<else/>
{$status_str}
{$data.status_str}
</if>
</td>
<td>
<?php if($data['ver_status'] == 1) {?>
<span>成功</span>
<?php }?>
<?php if(intval($data['ver_status']) == 2) {?>
<span>拒绝</span>
<?php }?>
<?php if(intval($data['ver_status']) == 3) {?>
<span>正在审核</span>
<?php }?>
<?php if(intval($data['ver_status']) == 4) {?>
<span>修改审核中</span>
<?php }?>
<?php if(intval($data['ver_status']) == 0) {?>
<span>未认证</span>
<?php }?>
{$data['ver_status']}
</td>
<if condition="$data['oa_associated'] eq 1">
<td>已关联</td>
<td>{$data.oa_associated_str}</td>
<else />
<td style="color: red;">未关联</td>
<td style="color: red;">{$data.oa_associated_str}</td>
</if>
<td><a class="ajax-view" data-id="{$data.id}">查看</a></td>
<td>
@ -368,7 +340,7 @@
</div>
<div class="page">
<if condition="$is_admin eq true ">
<a class="sch-btn" href="{:U('Export/promote_list',array_merge(['xlsname'=>'推广员管理_推广员列表'.((I('type',1)==2)?'_混服申请':'_推广员列表')],I('get.')))}">导出</a>
<a class="sch-btn" href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
</if>
{$_page|default=''}
</div>

@ -678,9 +678,9 @@ function get_info_status($type=null,$group=0){
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=>'审核中'),
42 => array(0=>'未认证',1=>'成功',2=>'拒绝',3=>'正在审核',4=>'修改审核中'),
);
return $arr[$group][$type];

Loading…
Cancel
Save