下载添加部门/小组

master
liaojinling 5 years ago
parent d789a175f8
commit 843a429b43

@ -6,6 +6,7 @@ use Base\Model\UserPlayInfoModel;
use Base\Model\UserPlayModel; use Base\Model\UserPlayModel;
use Base\Model\UserModel; use Base\Model\UserModel;
use Base\Tool\IdCard; use Base\Tool\IdCard;
use Base\Tool\Registry;
use Think\Model; use Think\Model;
class PromoteService { class PromoteService {
@ -1005,4 +1006,62 @@ class PromoteService {
} }
return null; return null;
} }
public function getPromoteGroups($topPromoteId)
{
$promoteGroups = [];
if (Registry::has('promoteGroups')) {
$promoteGroups = Registry::get('promoteGroups');
}
if (!isset($promoteGroups[$topPromoteId])) {
$data = [];
$promotes = M('promote', 'tab_')->field(['id', 'level', 'group_remark', 'parent_id'])->where(['level' => ['in', [2, 3]], 'chain' => ['like', '/'.$topPromoteId.'/%']])->select();
foreach ($promotes as $promote) {
if ($promote['level'] == 2) {
$data[$promote['id']] = [
'name' => $promote['group_remark'],
'subs' => []
];
}
}
foreach ($promotes as $promote) {
if ($promote['level'] == 3) {
$data[$promote['parent_id']]['subs'][$promote['id']] = [
'name' => $promote['group_remark'],
];
}
}
/*echo '<pre>';
var_dump($data);
echo '</pre>';die();*/
$promoteGroups[$topPromoteId] = $data;
Registry::set('promoteGroups', $promoteGroups);
}
return $promoteGroups[$topPromoteId];
}
public function getGroupNameByChain($chain, $promoteId)
{
$chain = trim($chain, '/');
if ($chain == '') {
return '';
}
$row = explode('/', $chain);
$promoteGroups = $this->getPromoteGroups($row[0]);
$groupName = '';
if (isset($row[1])) {
$groupName .= $promoteGroups[$row[1]]['name'];
if (isset($row[2])) {
$groupName .= '/' . $promoteGroups[$row[1]]['subs'][$row[2]]['name'];
}
}
if (count($row) == 2) {
$groupName .= '/' . $promoteGroups[$row[1]]['subs'][$promoteId]['name'];
}
if (count($row) == 1) {
$groupName .= $promoteGroups[$promoteId]['name'];
}
return $groupName;
}
} }

@ -0,0 +1,27 @@
<?php
namespace Base\Tool;
class Registry
{
public static $data;
public static function get(string $name)
{
return self::$data[$name] ?? null;
}
public static function set(string $name, $value)
{
self::$data[$name] = $value;
}
public static function has($name)
{
return isset(self::$data[$name]);
}
public static function delete($name)
{
unset(self::$data[$name]);
}
}

@ -2982,4 +2982,9 @@ function db2csv(&$data,$title,$header=false){
readfile($filename); readfile($filename);
unlink($filename); unlink($filename);
die(); die();
}
function hideRealName($realName)
{
return mb_strlen($realName,'utf-8') == 2 ? mb_substr($realName,0,1,'utf-8').'*':mb_substr($realName,0,1,'utf-8').'**';
} }

@ -1474,7 +1474,7 @@ class DownloadController extends BaseController {
if ($promoteId > 0) { if ($promoteId > 0) {
$map['id'] = $promoteId; $map['id'] = $promoteId;
} }
$data = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level'])->where($map)->select(); $data = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map)->select();
$ids = array_column($data, 'id'); $ids = array_column($data, 'id');
$rows = []; $rows = [];
if (count($ids) > 0) { if (count($ids) > 0) {
@ -3043,11 +3043,12 @@ class DownloadController extends BaseController {
} }
public function achievementExcelInfo($tid,$map) { public function achievementExcelInfo($tid, $map) {
$xlsName = "推广员业绩"; $xlsName = "推广员业绩";
$xlsCell = array( $xlsCell = array(
array('account','账号'), array('account','账号'),
array('real_name','姓名'), array('real_name','姓名'),
array('promote_group', '部门/小组'),
array('create_role_count','创角数'), array('create_role_count','创角数'),
array('create_role_user_count','创角用户'), array('create_role_user_count','创角用户'),
array('new_create_role_user_count','新创角用户'), array('new_create_role_user_count','新创角用户'),
@ -3106,7 +3107,7 @@ class DownloadController extends BaseController {
$rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params);
$rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params);
} }
$promoteService = new PromoteService();
$records = []; $records = [];
if (I('p', 1) == 1) { if (I('p', 1) == 1) {
$selfParams = $params; $selfParams = $params;
@ -3120,7 +3121,8 @@ class DownloadController extends BaseController {
$record = [ $record = [
'id' => $parent['id'], 'id' => $parent['id'],
'account' => $parent['account'], 'account' => $parent['account'],
'real_name' => mb_strlen($parent['real_name'],'utf-8') == 2 ? mb_substr($parent['real_name'],0,1,'utf-8').'*':mb_substr($parent['real_name'],0,1,'utf-8').'**', 'promote_group' => $promoteService->getGroupNameByChain($parent['chain'], $parent['id']),
'real_name' => hideRealName($parent['real_name']),
'level' => $parent['level'], 'level' => $parent['level'],
'create_role_count' => $selfCreateRoleCountList[$parent['id']], 'create_role_count' => $selfCreateRoleCountList[$parent['id']],
'create_role_user_count' => $selfCreateRoleUserCountList[$parent['id']], 'create_role_user_count' => $selfCreateRoleUserCountList[$parent['id']],
@ -3148,7 +3150,8 @@ class DownloadController extends BaseController {
$record = [ $record = [
'id' => $id, 'id' => $id,
'account' => $promote['account'], 'account' => $promote['account'],
'real_name' => mb_strlen($promote['real_name'],'utf-8') == 2 ? mb_substr($promote['real_name'],0,1,'utf-8').'*':mb_substr($promote['real_name'],0,1,'utf-8').'**', 'promote_group' => $promoteService->getGroupNameByChain($promote['chain'], $promote['id']),
'real_name' => hideRealName($promote['real_name']),
'level' => $promote['level'], 'level' => $promote['level'],
'create_role_count' => $createRoleCountList[$id], 'create_role_count' => $createRoleCountList[$id],
'create_role_user_count' => $createRoleUserCountList[$id], 'create_role_user_count' => $createRoleUserCountList[$id],
@ -3248,7 +3251,7 @@ class DownloadController extends BaseController {
unset($map['begintime']); unset($map['begintime']);
unset($map['endtime']); unset($map['endtime']);
$map['uc.pay_status'] = 1; $map['uc.pay_status'] = 1;
$fieldS = "sum(uc.pay_amount) recharge_cost, count(*) recharge_count, uc.user_id, uc.user_account, uc.promote_account, uc.game_name, uc.sdk_version, uc.server_name, SUBSTRING_INDEX(GROUP_CONCAT(uc.game_player_name order by uc.id desc), ',', 1) as game_player_name"; $fieldS = "sum(uc.pay_amount) recharge_cost, count(*) recharge_count, uc.user_id, uc.user_account, uc.promote_id, uc.promote_account, uc.game_name, uc.sdk_version, uc.server_name, SUBSTRING_INDEX(GROUP_CONCAT(uc.game_player_name order by uc.id desc), ',', 1) as game_player_name";
$fieldUser = 'u.register_time, u.login_time'; $fieldUser = 'u.register_time, u.login_time';
$now = date('Y-m-d'); $now = date('Y-m-d');
@ -3312,6 +3315,12 @@ class DownloadController extends BaseController {
->table($subQuery) ->table($subQuery)
->limit(($i-1)*$perSize ,$perSize) ->limit(($i-1)*$perSize ,$perSize)
->select(); ->select();
$promoteService = new PromoteService();
$promoteIds = array_column($data, 'promote_id');
$promotes = M('promote', 'tab_')->field(['id', 'chain', 'account'])->where(['id' => ['in', $promoteIds]])->select();
$promotes = index_by_column('id', $promotes);
foreach($data as $key => $value) { foreach($data as $key => $value) {
// if (empty($value['user_account']) ) { // if (empty($value['user_account']) ) {
// $value['user_account'] = $users[$value['user_id']] ?? ''; // $value['user_account'] = $users[$value['user_id']] ?? '';
@ -3335,7 +3344,12 @@ class DownloadController extends BaseController {
$csvData['create_time'] = empty($value['register_time']) ? '--' : date('Y-m-d H:i:s', $value['register_time']); $csvData['create_time'] = empty($value['register_time']) ? '--' : date('Y-m-d H:i:s', $value['register_time']);
$csvData['login_time'] = empty($value['login_time']) ? '--' :date('Y-m-d H:i:s',$value['login_time']); $csvData['login_time'] = empty($value['login_time']) ? '--' :date('Y-m-d H:i:s',$value['login_time']);
$csvData['promote_account'] = empty($value['promote_account']) ? '--' :$value['promote_account']; $csvData['promote_account'] = empty($value['promote_account']) ? '--' :$value['promote_account'];
if (isset($promotes[$value['promote_id']])) {
$groupName = $promoteService->getGroupNameByChain($promotes[$value['promote_id']]['chain'], $value['promote_id']);
if ($groupName) {
$csvData['promote_account'] .= '(' . $groupName . ')';
}
}
mb_convert_variables('GBK', 'UTF-8', $csvData); mb_convert_variables('GBK', 'UTF-8', $csvData);
fputcsv($fp, $csvData); fputcsv($fp, $csvData);
$xlsData[] = $csvData; $xlsData[] = $csvData;

@ -8,6 +8,7 @@ use OT\DataDictionary;
use Base\Repository\PromoteRepository; use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository; use Base\Repository\SpendRepository;
use Base\Repository\UserRepository; use Base\Repository\UserRepository;
use Base\Service\PromoteService;
/** /**
* 财务管理 * 财务管理
@ -230,7 +231,7 @@ class FinanceController extends BaseController
} }
} }
$data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_time,selle_status,pay_status,withdraw_id') $data = $model->field('pay_order_number,game_name,user_account,promote_id,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_time,selle_status,pay_status,withdraw_id')
->where($map) ->where($map)
->order('id desc') ->order('id desc')
->page($page, $row) ->page($page, $row)
@ -257,6 +258,11 @@ class FinanceController extends BaseController
->where(array('id' => ['in', $withdrawIds])) ->where(array('id' => ['in', $withdrawIds]))
->getField('id,status'); ->getField('id,status');
$promoteService = new PromoteService();
$promoteIds = array_column($data, 'promote_id');
$promotes = M('promote', 'tab_')->field(['id', 'chain', 'account'])->where(['id' => ['in', $promoteIds]])->select();
$promotes = index_by_column('id', $promotes);
foreach ($data as &$list) { foreach ($data as &$list) {
//提现状态 //提现状态
if ($list['pay_status'] == 1) { if ($list['pay_status'] == 1) {
@ -279,6 +285,7 @@ class FinanceController extends BaseController
$list['income'] = bcmul($list['pay_amount'], bcdiv($list['selle_ratio'], 100, 2), 2); $list['income'] = bcmul($list['pay_amount'], bcdiv($list['selle_ratio'], 100, 2), 2);
$list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']); $list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']);
$list['user_account'] = encryption($list['user_account']); $list['user_account'] = encryption($list['user_account']);
$list['promote_group'] = isset($promotes[$list['promote_id']]) ? $promoteService->getGroupNameByChain($promotes[$list['promote_id']]['chain'], $list['promote_id']) : '';
} }
} }

@ -1862,7 +1862,7 @@ class QueryController extends BaseController
} }
$map['s.pay_time'] = ['between', [$begTime, $endTime - 1]]; $map['s.pay_time'] = ['between', [$begTime, $endTime - 1]];
$fieldS = "sum(s.pay_amount) recharge_cost, count(*) recharge_count, s.user_id, s.user_account, s.promote_account, s.game_name, s.sdk_version, s.server_name, SUBSTRING_INDEX(GROUP_CONCAT(s.game_player_name order by s.id desc), ',', 1) as game_player_name"; $fieldS = "sum(s.pay_amount) recharge_cost, count(*) recharge_count, s.user_id, s.user_account, s.promote_id, s.promote_account, s.game_name, s.sdk_version, s.server_name, SUBSTRING_INDEX(GROUP_CONCAT(s.game_player_name order by s.id desc), ',', 1) as game_player_name";
$fieldUser = 'u.register_time, u.login_time'; $fieldUser = 'u.register_time, u.login_time';
$spendMap['_string'] = 'today.user_id = s.user_id and today.game_id = s.game_id and today.server_id = s.server_id and today.game_player_id = s.game_player_id and today.promote_id = s.promote_id'; $spendMap['_string'] = 'today.user_id = s.user_id and today.game_id = s.game_id and today.server_id = s.server_id and today.game_player_id = s.game_player_id and today.promote_id = s.promote_id';
@ -1905,6 +1905,10 @@ class QueryController extends BaseController
$total['recharge_cost_today'] = empty($total['recharge_cost_today']) ? '0.00' : $total['recharge_cost_today']; $total['recharge_cost_today'] = empty($total['recharge_cost_today']) ? '0.00' : $total['recharge_cost_today'];
if (!empty($records)) { if (!empty($records)) {
$promoteService = new PromoteService();
$promoteIds = array_column($records, 'promote_id');
$promotes = M('promote', 'tab_')->field(['id', 'chain', 'account'])->where(['id' => ['in', $promoteIds]])->select();
$promotes = index_by_column('id', $promotes);
foreach ($records as &$list) { foreach ($records as &$list) {
$list['user_account'] = empty($list['user_account']) ? '--' : encryption($list['user_account']); $list['user_account'] = empty($list['user_account']) ? '--' : encryption($list['user_account']);
$list['game_name'] = empty($list['game_name']) ? '--' : $list['game_name']; $list['game_name'] = empty($list['game_name']) ? '--' : $list['game_name'];
@ -1915,6 +1919,7 @@ class QueryController extends BaseController
$list['login_time'] = empty($list['login_time']) ? '--' : date('Y-m-d H:i:s', $list['login_time']); $list['login_time'] = empty($list['login_time']) ? '--' : date('Y-m-d H:i:s', $list['login_time']);
$list['register_time'] = empty($list['register_time']) ? '--' : date('Y-m-d H:i:s', $list['register_time']); $list['register_time'] = empty($list['register_time']) ? '--' : date('Y-m-d H:i:s', $list['register_time']);
$list['promote_account'] = empty($list['promote_account']) ? '--' : $list['promote_account']; $list['promote_account'] = empty($list['promote_account']) ? '--' : $list['promote_account'];
$list['promote_group'] = isset($promotes[$list['promote_id']]) ? $promoteService->getGroupNameByChain($promotes[$list['promote_id']]['chain'], $list['promote_id']) : '';
$list['recharge_cost_today'] = empty($list['recharge_cost_today']) ? '0.00' : $list['recharge_cost_today']; $list['recharge_cost_today'] = empty($list['recharge_cost_today']) ? '0.00' : $list['recharge_cost_today'];
} }
} }
@ -2065,7 +2070,7 @@ class QueryController extends BaseController
$map['id'] = $promoteId; $map['id'] = $promoteId;
} }
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level'])->where($map); $query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map);
list($promotes, $pagination, $count) = $this->paginate($query); list($promotes, $pagination, $count) = $this->paginate($query);
$ids = array_column($promotes, 'id'); $ids = array_column($promotes, 'id');
@ -2124,6 +2129,8 @@ class QueryController extends BaseController
$rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params);
} }
$promoteService = new PromoteService();
if (I('p', 1) == 1) { if (I('p', 1) == 1) {
$selfParams = $params; $selfParams = $params;
$selfParams['isContainSubs'] = false; $selfParams['isContainSubs'] = false;
@ -2136,7 +2143,8 @@ class QueryController extends BaseController
$record = [ $record = [
'id' => $parent['id'], 'id' => $parent['id'],
'account' => $parent['account'], 'account' => $parent['account'],
'real_name' => mb_strlen($parent['real_name'],'utf-8') == 2 ? mb_substr($parent['real_name'],0,1,'utf-8').'*':mb_substr($parent['real_name'],0,1,'utf-8').'**', 'promote_group' => $promoteService->getGroupNameByChain($parent['chain'], $parent['id']),
'real_name' => hideRealName($parent['real_name']),
'level' => $parent['level'], 'level' => $parent['level'],
'create_role_count' => $selfCreateRoleCountList[$parent['id']], 'create_role_count' => $selfCreateRoleCountList[$parent['id']],
'create_role_user_count' => $selfCreateRoleUserCountList[$parent['id']], 'create_role_user_count' => $selfCreateRoleUserCountList[$parent['id']],
@ -2164,7 +2172,8 @@ class QueryController extends BaseController
$record = [ $record = [
'id' => $id, 'id' => $id,
'account' => $promote['account'], 'account' => $promote['account'],
'real_name' => mb_strlen($promote['real_name'],'utf-8') == 2 ? mb_substr($promote['real_name'],0,1,'utf-8').'*':mb_substr($promote['real_name'],0,1,'utf-8').'**', 'promote_group' => $promoteService->getGroupNameByChain($promote['chain'], $promote['id']),
'real_name' => hideRealName($promote['real_name']),
'level' => $promote['level'], 'level' => $promote['level'],
'create_role_count' => $createRoleCountList[$id], 'create_role_count' => $createRoleCountList[$id],
'create_role_user_count' => $createRoleUserCountList[$id], 'create_role_user_count' => $createRoleUserCountList[$id],

@ -161,7 +161,7 @@
<td>{$vo.pay_order_number}</td> <td>{$vo.pay_order_number}</td>
<td>{$vo.game_name}</td> <td>{$vo.game_name}</td>
<td>{$vo.user_account}</td> <td>{$vo.user_account}</td>
<td>{$vo.promote_account}</td> <td>{$vo.promote_account}<?php if($vo['promote_group']):?>({$vo.promote_group})<?php endif;?></td>
<td>{$vo.pay_amount}</td> <td>{$vo.pay_amount}</td>
<if condition="$vo.pay_way eq -1"> <if condition="$vo.pay_way eq -1">
<td>0.00</td> <td>0.00</td>

@ -100,7 +100,11 @@
<else /> <else />
<volist name="records" id="record" mod="2"> <volist name="records" id="record" mod="2">
<tr data-id="{$vo.id}" class="<eq name='mod' value='1'>odd</eq>"> <tr data-id="{$vo.id}" class="<eq name='mod' value='1'>odd</eq>">
<td>{$record.account}({$record.real_name}) <td>{$record.account}({$record.real_name}
<?php if($record['promote_group'] != ''):?>
/{$record.promote_group}
<?php endif;?>
)
<?php if($record['current_display'] != ''):?> <?php if($record['current_display'] != ''):?>
<span style="color: #06C;">[{$record['current_display']}]</span> <span style="color: #06C;">[{$record['current_display']}]</span>
<?php endif;?> <?php endif;?>

@ -190,7 +190,7 @@
<td>{$record.user_game_login_count}</td> <td>{$record.user_game_login_count}</td>
<td>{$record.register_time}</td> <td>{$record.register_time}</td>
<td>{$record.login_time}</td> <td>{$record.login_time}</td>
<td>{$record.promote_account}</td> <td>{$record.promote_account}<?php if($record['promote_group']):?>(<?=$record['promote_group']?>)<?php endif;?></td>
</tr> </tr>
</volist> </volist>
<tr> <tr>

Loading…
Cancel
Save