下载数据加密

master
sunke 5 years ago
parent 12a40d4ad4
commit e9b234df02

@ -793,7 +793,14 @@ class DownloadController extends BaseController {
* @author sunke
*/
public function regist_data_export() {
if (empty(I('begtime')) || empty(I('endtime'))) {
$this->error('请选择起止时间');
}
$beginTime = strtotime(I('begtime') . ' 00:00:00');
$endtime = strtotime(I('endtime') . ' 23:59:59');
if (($endtime - $beginTime) > 31 * 24 * 3600) {
$this->error('时间范围不能超过31天');
}
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
$childPromoteIds = '';
@ -912,7 +919,7 @@ class DownloadController extends BaseController {
$addtime = time();
$type = "/Home/Promote/children/promote_type/".$promoteType;
$data = [
'logid' => 'cz_'.time(),
'logid' => 'promote_'.time(),
'admin_id' => PID,
'type' => $type,
'dataname' => '渠道管理',
@ -1123,7 +1130,7 @@ class DownloadController extends BaseController {
}
$beginTime = strtotime(I('begtime') . ' 00:00:00');
$endtime = strtotime(I('endtime') . ' 23:59:59');
if (($endTime - $beginTime) > 31 * 24 * 3600) {
if (($endtime - $beginTime) > 31 * 24 * 3600) {
$this->error('时间范围不能超过31天');
}
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
@ -1393,8 +1400,11 @@ class DownloadController extends BaseController {
$roleLevelBegin = intval(I('role_level_begin', 0));
$roleLevelEnd = intval(I('role_level_end', 0));
$headmanPromoteId = I('headman_promote_id', 0);
$playTime = I('play_time', '');
$playTime = I('create_time', '');
$promote = $this->getLoginPromote();
if (empty($playTime)) {
$this->error('请选择创建时间');
}
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
$childPromoteIds = '';
@ -1468,6 +1478,9 @@ class DownloadController extends BaseController {
$playTimeBegin = strtotime($playTimeRow[0] . ' 00:00:00');
$playTimeEnd = strtotime($playTimeRow[0] . ' 23:59:59');
}
if (($playTimeEnd - $playTimeBegin) > 31 * 24 * 3600) {
$this->error('时间范围不能超过31天');
}
$map['play_time'] = ['between', [$playTimeBegin, $playTimeEnd]];
}
if ($isSelf) {
@ -1629,7 +1642,6 @@ class DownloadController extends BaseController {
$this->rechargeExcelInfo($id,$map);
break;
case "充值玩家数据":
var_dump('ss');die();
$this->userRechargeExcelInfo($id,$map);
break;
case "推广员业绩":
@ -1704,6 +1716,7 @@ class DownloadController extends BaseController {
//var_dump($data);
$xlsData = [];
foreach ($data as $key1 => $value1) {
$value1['account'] = $this->encryption($value1['account']);
$xlsData[] = $value1;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
@ -1724,6 +1737,7 @@ class DownloadController extends BaseController {
$data = $model->field('user_account,promote_account,game_name,server_name,user_nickname,role_level')->where($map)->select();
$xlsData = [];
foreach ($data as $key1 => $value1) {
$value1['user_account'] = $this->encryption($value1['user_account']);
$xlsData[] = $value1;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
@ -1750,7 +1764,6 @@ class DownloadController extends BaseController {
array('spend_discount','折扣币充值'),
array('spend_voucher','代金券使用'),
);
if(!empty($map['tab_apply.promote_id'][1])) {
$params['promote_ids'] = $map['tab_apply.promote_id'][1];
@ -1880,7 +1893,8 @@ class DownloadController extends BaseController {
if($value1['status'] == 2) {
$value1['promotestatus'] = "冻结中";
}
$value1['account'] = substr_replace($value1['account'],'****',2);
$value1['idcard'] = substr_replace($value1['idcard'],'************',3,12);
$value1['create_time'] = date('Y-m-d H:i:s',$value1['create_time']);
$xlsData[] = $value1;
}
@ -1939,7 +1953,7 @@ class DownloadController extends BaseController {
foreach ($data as $item) {
$records[] = [
'id' => $item['id'],
'sn' => $item['sn'],
'sn' => $this->encryption($item['sn']),
'type_text' => $service->getTypeText($item['type']),
'sub_type_text' => $service->getSubTypeText($item['sub_type']),
'target_type_text' => $service->getTargetTypeText($item['target_type'], $item['target_level']),
@ -1961,7 +1975,7 @@ class DownloadController extends BaseController {
$xlsName = "平台币转移";
$xlsCell = array(
array("sn","订单号"),
array("source_name","收款方账号"),
array("target_account","收款方账号"),
array("game_name","适用游戏"),
array("handle_type","账号类型"),
array("num","转账数量"),
@ -2010,8 +2024,8 @@ class DownloadController extends BaseController {
}
$records[] = [
'id' => $log['id'],
'sn' => $log['sn'],
'target_account' => $targetAccount,
'sn' => $this->encryption($log['sn']),
'target_account' => $this->encryption($targetAccount),
'game_name' => isset($games[$log['game_id']]) ? $games[$log['game_id']]['game_name'] : '所有游戏',
'target_type_text' => $service->getTargetTypeText($log['target_type'], $log['target_level']),
'num' => $log['num'],
@ -2049,6 +2063,7 @@ class DownloadController extends BaseController {
->select();
foreach ($data as $key => $value) {
$value['create_time'] = date("Y-m-d H:i:s", $value['create_time']);
$value['user_account'] = $this->encryption($value['user_account']);
//获取累计发放
$where = array(
"user_id"=>$value['user_id'],
@ -2092,6 +2107,7 @@ class DownloadController extends BaseController {
);
$data=M('test_resource','tab_')->where($map)->order('id desc')->select();
foreach($data as $key => $value) {
$data[$key]['user_account'] = $this->encryption($value['user_account']);
if($value['apply_status'] == 1) {
$data[$key]['apply_status'] = "审核未通过";
}
@ -2128,6 +2144,7 @@ class DownloadController extends BaseController {
->select();
foreach ($data as $key => $value) {
$data[$key]['create_time'] = date('Y-m-d H:m:i',$value['create_time']);
$data[$key]['user_account'] = $this->encryption($value['user_account']);
if($value['check_status'] == 1) {
$data[$key]['check_status'] = "冻结";
}else {
@ -2575,7 +2592,7 @@ class DownloadController extends BaseController {
);
$params['isContainSubs'] =$map['isContainSubs'];
$params['isContainSubs'] = $map['isContainSubs'];
$params['basicPromotes'] = json_decode($map['basicPromotes'],TRUE);
$ids = $map['ids'];
$promotes = json_decode($map["promotes"],TRUE);
@ -2593,8 +2610,6 @@ class DownloadController extends BaseController {
}
$params['begin_time'] = $map['begin_time'];
$params['end_time'] = $map['end_time'];
// var_dump($params);die();
$promoteRepository = new PromoteRepository();
$createRoleCountList = $promoteRepository->getCreateRoleCountByIds($ids, $params);
$createRoleUserCountList = $promoteRepository->getCreateRoleUserCountByIds($ids, $params);
@ -2605,7 +2620,6 @@ class DownloadController extends BaseController {
$rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params);
$rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params);
$rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params);
$records = [];
foreach ($promotes as $promote) {
$id = $promote['id'];
@ -2631,11 +2645,85 @@ class DownloadController extends BaseController {
}
$xlsData = [];
foreach ($records as $key1 => $value1) {
$value1['account'] = $this->encryption($value1['account']);
$xlsData[] = $value1;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData,$tid);
}
public function userRechargeExcelInfo($id,$map) {
$xlsName = "充值玩家";
$xlsCell = array(
array('user_account','玩家账号'),
array('game_name','游戏名称'),
array('server_name','游戏区服'),
array('sdk_version','平台'),
array('role_name','角色名'),
array('role_level','等级'),
array('recharge_cost','充值总额'),
array('recharge_count','充值次数'),
array('recharge_cost_today','今日充值'),
array('unlogin_day','未登录天数'),
array('play_time','最后登录时间'),
array('promote_account','组长|推广员'),
);
if(!empty($map['promote_id'])) {
$spendMap['promote_id'] = $map['promote_id'];
}
$map['create_time'] = ['between', [strtotime(date('Y-m-d 00:00:00')) - 31*24*3600, strtotime(date('Y-m-d 23:59:59'))]];
$roles = M('user_play_info','tab_')->where($map)->select();
$roleIds = array_column($roles, 'role_id');
$spendMap['pay_status'] = 1;
$spendMap['pay_game_status'] = 1;
if (count($roleIds) > 0) {
$spendMap['game_player_id'] = ['in', $roleIds];
} else {
$spendMap['_string'] = '1<>1';
}
$allRecharges = M('spend', 'tab_')->field('count(*) count, sum(cost) cost, game_player_id')->where($spendMap)->group('game_player_id')->select();
$allRecords = [];
foreach ($allRecharges as $recharge) {
$allRecords[$recharge['game_player_id']] = $recharge;
}
$map['pay_time'] = ['between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]];
$todayRecharges = M('spend', 'tab_')->field('sum(cost) cost, game_player_id')->where($map)->group('game_player_id')->select();
$todayRecords = [];
foreach ($todayRecharges as $recharge) {
$todayRecords[$recharge['game_player_id']] = $recharge;
}
$records = [];
foreach ($roles as $role) {
$records[] = [
'user_account' => $role['user_account'],
'game_name' => $role['game_name'],
'role_name' => $role['role_name'],
'role_id' => $role['role_id'],
'role_level' => $role['role_level'],
'server_id' => $role['server_id'],
'server_name' => $role['server_name'],
'recharge_cost' => isset($allRecords[$role['role_id']]) ? round(floatval($allRecords[$role['role_id']]['cost']), 2) : 0,
'recharge_count' => isset($allRecords[$role['role_id']]) ? $allRecords[$role['role_id']]['count'] : 0,
'recharge_cost_today' => isset($todayRecords[$role['role_id']]) ? round(floatval($todayRecords[$role['role_id']]['cost']), 2) : 0,
'play_time' => $role['play_time'],
'play_ip' => $role['play_ip'],
'promote_id' => $role['promote_id'],
'promote_account' => $role['promote_account'],
'sdk_version' => $role['sdk_version'],
'unlogin_day' => intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $role['play_time']))) / (24 * 3600))
];
}
$xlsData = [];
foreach ($records as $key1 => $value1) {
$value1['user_account'] = $this->encryption($value1['user_account']);
$xlsData[] = $value1;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
}
public function rechargeExcelInfo($id,$map) {
$xlsName = "订单查询";
$xlsCell = array(
@ -2658,7 +2746,6 @@ class DownloadController extends BaseController {
->join('left join tab_promote on tab_spend.promote_id = tab_promote.id')
->where($map)
->order('tab_spend.id desc')
->limit(1)
->select();
$xlsData = [];
foreach ($data as $key1 => $value1) {
@ -2667,6 +2754,9 @@ class DownloadController extends BaseController {
$value1['p_p_proinfo'] = $value1['pro_account'].'('.$value1['pro_real_name'].')';
$value1['p_proinfo'] = $value1['pro_account'].'('.$value1['pro_real_name'].')';
$value1['proinfo'] = $value1['pro_account'].'('.$value1['pro_real_name'].')';
// $value1['user_account'] = substr_replace($value1['user_account'],'************',3,12);
$value1['user_account'] = $this->encryption($value1['user_account']);
$value1['order_number'] = $this->encryption($value1['order_number']);
if(!empty($value1['chain'])) {
$chain = trim($value1['chain'],'/');
$chainArr = explode('/', $chain);
@ -2872,5 +2962,22 @@ class DownloadController extends BaseController {
}
return $records;
}
public function encryption($string) {
$orderLen = strlen($string);
$strLen = 3;
$hideChar = '';
if($orderLen <=8) {
$strLen = 2;
}
for($i = 0;$i<$orderLen-$strLen*2;$i++) {
$hideChar .='*';
}
return substr($string, 0, $strLen) . $hideChar . substr($string, $orderLen-$strLen);
}
}

Loading…
Cancel
Save