Merge pull request '优化' (#454) from feature/market_department_search into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/454
master
廖金灵 3 years ago
commit 4f457abcc6

@ -1162,16 +1162,10 @@ class ExportController extends Controller
unset($_REQUEST['pay_game_status']);
}
$marketAdminId = I('market_admin_id', 0);
if ($marketAdminId) {
$map['market_admin_id'] = $marketAdminId;
}
$isMarketAdmin = isMarketAdmin();
if ($isMarketAdmin) {
$userAuth = session('user_auth');
$map['market_admin_id'] = $userAuth['uid'];
}
$marketAdminIds = getSearchAdminIds('market_admin_id');
if (is_array($marketAdminIds)) {
$map['market_admin_id'] = ['in', $marketAdminIds];
}
setPowerPromoteIds($map,'promote_id');
@ -1231,6 +1225,7 @@ class ExportController extends Controller
'game_id' => '所属CP',
'promote_account' => L('Subordinate_channel'),
'0 as company_name' => '所属推广公司',
'1 as admin_department' => '所属市场部',
'market_admin_id' => '所属市场专员',
'merchant_id' => '所属商户',
'spend_ip' => '充值ip',
@ -1305,8 +1300,10 @@ class ExportController extends Controller
->limit(($i-1)*$perSize ,$perSize)
->order($order ? $order : 'pay_time desc')
->select();
$adminIds = array_column($xlsData, 'market_admin_id');
$adminDepartments = getAdminDepartmentList($adminIds);
if ($showMarketAdmin == 1) {
$adminUsernameList = getAdminUsernameList(array_column($xlsData, 'market_admin_id'));
$adminUsernameList = getAdminUsernameList($adminIds);
}
$promoters = D('Promote')->where(['id'=>['in', array_unique(array_column($xlsData, 'promote_id'))]])->field('id, company_id')->select();
$promoters = $promoters ? array_column($promoters, 'company_id', 'id') : [];
@ -1341,6 +1338,7 @@ class ExportController extends Controller
$value['pay_way'] = get_pay_way($value['pay_way']);
$value['pay_status'] = get_info_status($value['pay_status'],9);
$value['pay_game_status'] = get_info_status($value['pay_game_status'],14);
$value['admin_department'] = $adminDepartments[$value['market_admin_id']] ?? '无';
if ($showMarketAdmin == 1) {
$value['market_admin_id'] = $adminUsernameList[$value['market_admin_id']] ?? '无';
}

@ -98,16 +98,12 @@ class SpendController extends ThinkController
}
}
$marketAdminId = 0;
$isMarketAdmin = isMarketAdmin();
if ($isMarketAdmin) {
$userAuth = session('user_auth');
$marketAdminId = $userAuth['uid'];
} else {
$marketAdminId = I('market_admin_id', 0);
}
if ($marketAdminId > 0) {
$map['market_admin_id'] = $marketAdminId;
$isMarketLeader = isMarketLeader();
$marketAdminIds = getSearchAdminIds('market_admin_id');
if (is_array($marketAdminIds)) {
$map['market_admin_id'] = ['in', $marketAdminIds];
}
setPowerPromoteIds($map,'promote_id');
@ -146,10 +142,13 @@ class SpendController extends ThinkController
$data = D(self::model_name)->lists($_GET["p"], $map, $order);
if (!empty($data['data'])) {
$adminUsernameList = getAdminUsernameList(array_column($data['data'], 'market_admin_id'));
$adminIds = array_column($data['data'], 'market_admin_id');
$adminUsernameList = getAdminUsernameList($adminIds);
$adminDepartments = getAdminDepartmentList($adminIds);
foreach ($data['data'] as $key=>&$value) {
($value['promote_account']=='官方渠道')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
$value['market_admin_username'] = $adminUsernameList[$value['market_admin_id']] ?? '无';
$value['admin_department'] = $adminDepartments[$value['market_admin_id']] ?? '无';
$value['is_check_str'] = D(self::model_name)::IsCheckStr[$value['is_check']];
$value['is_refund_str'] = D(self::model_name)::IsRefundStr[$value['is_refund']];
//拆分游戏名称和设备类型
@ -159,6 +158,10 @@ class SpendController extends ThinkController
}
}
$departments = M('department', 'sys_')->select();
$this->assign('departments', $departments);
$this->assign('isMarketLeader', $isMarketLeader);
$this->assign('showMarketAdmin', session('user_auth')['show_market_admin']);
$this->assign('showPromote', session('user_auth')['show_promote']);
$this->assign('isMarketAdmin', $isMarketAdmin);

@ -160,6 +160,17 @@
</div>
<?php endif;?>
<?php if(!$isMarketAdmin && !$isMarketLeader):?>
<div class="input-list input-list-server search_label_rehab">
<select id="department_id" name="department_id" class="select_gallery" style="width:120px;">
<option value="">请选择市场部</option>
<?php foreach($departments as $department):?>
<option value="<?=$department['id']?>" <?php if($department['id'] == I('department_id')):?>selected<?php endif;?>><?=$department['name']?></option>
<?php endforeach;?>
</select>
</div>
<?php endif;?>
<?php if(!$isMarketAdmin && $showMarketAdmin == 1):?>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="market_admin_id" style="color:#444" class="select_gallery" id="market_admin_id">
@ -169,8 +180,8 @@
<?php endforeach;?>
</select>
</div>
<?php endif;?>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="platform_type" style="color:#444" class="select_gallery" id="platform_type">
<option value="0">游戏平台</option>
@ -246,6 +257,7 @@
<?php if($showPromote == 1):?>
<th>所属推广员</th>
<?php endif;?>
<th>所属市场部</th>
<?php if($showMarketAdmin == 1):?>
<th>所属市场专员</th>
<?php endif;?>
@ -320,6 +332,7 @@
</eq>
</td>
<?php endif;?>
<td >{$data.admin_department}</td>
<?php if($showMarketAdmin == 1):?>
<td >{$data.market_admin_username}</td>
<?php endif;?>
@ -386,7 +399,7 @@
<if condition="$rule_count_check">
<tr class="data_summary">
<td colspan="2">汇总</td>
<td colspan="22">
<td colspan="99">
当页充值:{:null_to_0(array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount')))}
累计充值:{$total}(此处只汇总充值成功的订单)
@ -676,6 +689,39 @@
})
});
var adminId = "{:I('market_admin_id')}";
var departmentId = "{:I('department_id')}";
function getAdminsByDepartmentId() {
var departmentId = $("#department_id option:selected").val();
if(!departmentId){
departmentId = -1;
}
$.ajax({
url: "{:U('Ajax/getAdminsByDepartment')}",
type: "get",
data: { department_id: departmentId},
dataType: 'json',
success: function (response) {
str = '<option value="">请选择市场专员</option>';
admins = response.data.admins;
for (var i in admins) {
str += "<option value='" + admins[i].uid + "' " + (adminId && admins[i].uid == adminId ? 'selected' : '') + ">" + admins[i].nickname + "</option>"
}
$("#market_admin_id").empty();
$("#market_admin_id").append(str);
$("#market_admin_id").select2();
}
})
}
getAdminsByDepartmentId();
$("#market_admin_id").change(function(){
adminId = $("#admin_id option:selected").val();
})
$("#department_id").change(function(){
getAdminsByDepartmentId();
})
})
var promote_id = "{:I('promote_id')}";

Loading…
Cancel
Save