master
elf 2 years ago
parent 6f0b05fb04
commit 1b33139ee3

@ -1802,6 +1802,7 @@ function get_parent_name($id){
* @return [type] [description] * @return [type] [description]
*/ */
function array_order($arr){ function array_order($arr){
$i = 0;
foreach ($arr as $key => $value) { foreach ($arr as $key => $value) {
$arr[$key]['rand']=++$i; $arr[$key]['rand']=++$i;
} }
@ -3106,4 +3107,41 @@ function encodeStr($str)
// ceil($length/2) 算出从第几个字符开始 // ceil($length/2) 算出从第几个字符开始
} }
return $newStr; return $newStr;
}
function getUserAccountOfPromote($account, $promote = null)
{
if ($promote && $promote['level_id'] == 1) {
return $account;
}
return substr($account, 0, 2) . '******' . substr($account, 8);
}
function hideOrderNumber($orderNumber)
{
$orderLen = strlen($orderNumber);
$strLen = 4;
$hideChar = '';
if ($orderLen <= 8) {
$strLen = 2;
}
for ($i = 0; $i < $orderLen - $strLen * 2; $i++) {
$hideChar .= '*';
}
return substr($orderNumber, 0, $strLen) . $hideChar . substr($orderNumber, $orderLen - $strLen);
}
function hidePromoteAccount($account) {
$orderLen = strlen($account);
$strLen = 3;
$hideChar = '';
if ($orderLen <= 8) { $strLen = 2;}
for ($i = 0; $i < $orderLen - $strLen * 2; $i++) {
$hideChar .= '*';
}
return substr($account, 0, $strLen) . $hideChar . substr($account, $orderLen - $strLen);
} }

File diff suppressed because it is too large Load Diff

@ -2,8 +2,6 @@
namespace Home\Controller; namespace Home\Controller;
use OT\DataDictionary;
use User\Api\PromoteApi;
use Base\Repository\PromoteRepository; use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository; use Base\Repository\SpendRepository;
use Base\Repository\UserRepository; use Base\Repository\UserRepository;
@ -54,16 +52,16 @@ class QueryController extends BaseController
$userAccount = trim(I('user_account', '')); $userAccount = trim(I('user_account', ''));
$payOrderNumber = trim(I('pay_order_number', '')); $payOrderNumber = trim(I('pay_order_number', ''));
$nowTime = date('Y-m-d'); $nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime))); $initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime'); $initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
$initEndTime = $nowTime; $initEndTime = $nowTime;
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime'); $initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
$begTime = strtotime($initBegTime); $begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime); $endTime = strtotime($initEndTime);
$endTime += 3600 * 24; $endTime += 3600 * 24;
$payedBegTime = I("payed_begtime", ''); $payedBegTime = I("payed_begtime", '');
if ($payedBegTime) $payedBegTime = strtotime($payedBegTime); if ($payedBegTime) $payedBegTime = strtotime($payedBegTime);
$payedEndTime = I("payed_endtime", ''); $payedEndTime = I("payed_endtime", '');
@ -78,7 +76,7 @@ class QueryController extends BaseController
$endTime = 0; $endTime = 0;
} }
} }
$levelPromote = $this->getLevelPromote(); $levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote); $queryPromote = $this->getQueryPromote($levelPromote);
$loginPromote = $this->getLoginPromote(); $loginPromote = $this->getLoginPromote();
@ -136,7 +134,7 @@ class QueryController extends BaseController
if ($payedBegTime && $payedEndTime) { if ($payedBegTime && $payedEndTime) {
$map['tab_spend.payed_time'] = ['between', [$payedBegTime, $payedEndTime - 1]]; $map['tab_spend.payed_time'] = ['between', [$payedBegTime, $payedEndTime - 1]];
} }
$map = $this->spendRepository->withIsCheck($map, 'tab_spend.is_check'); $map = $this->spendRepository->withIsCheck($map, 'tab_spend.is_check');
$data = []; $data = [];
@ -146,8 +144,10 @@ class QueryController extends BaseController
'pay_amount' => '0.00', 'pay_amount' => '0.00',
'discount_amount' => '0.00', 'discount_amount' => '0.00',
]; ];
if (intval($endTime - $begTime) / (24 * 3600) <= 31 if (
|| intval($payedEndTime - $payedBegTime) / (24 * 3600) <= 31) { intval($endTime - $begTime) / (24 * 3600) <= 31
|| intval($payedEndTime - $payedBegTime) / (24 * 3600) <= 31
) {
$data = M('Spend', 'tab_') $data = M('Spend', 'tab_')
->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.chain as chain,tab_promote.level,tab_promote.parent_id') ->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.chain as chain,tab_promote.level,tab_promote.parent_id')
->join('tab_game on tab_spend.game_id = tab_game.id') ->join('tab_game on tab_spend.game_id = tab_game.id')
@ -188,7 +188,7 @@ class QueryController extends BaseController
$promoteData = []; $promoteData = [];
if (!empty($promoteIdData)) { if (!empty($promoteIdData)) {
$promoteIdData = array_unique($promoteIdData); $promoteIdData = array_unique($promoteIdData);
$promoteData = M('promote', 'tab_')->where(array('id' => ['in',$promoteIdData]))->getField('id,account,real_name,group_remark'); $promoteData = M('promote', 'tab_')->where(array('id' => ['in', $promoteIdData]))->getField('id,account,real_name,group_remark');
} }
foreach ($data as &$list) { foreach ($data as &$list) {
switch ($list['level']) { switch ($list['level']) {
@ -217,26 +217,12 @@ class QueryController extends BaseController
$list['p_pro_group_remark'] = $promoteData[$list['parent_id']]['group_remark']; $list['p_pro_group_remark'] = $promoteData[$list['parent_id']]['group_remark'];
break; break;
} }
$list['user_account'] = substr($list['user_account'], 0, 2) . '******' . substr($list['user_account'], 8); $list['user_account'] = getUserAccountOfPromote($list['user_account'], $loginPromote);
$list['spend_time'] = date('Y-m-d H:i:s', $list['spend_time']); $list['spend_time'] = date('Y-m-d H:i:s', $list['spend_time']);
$list['pay_time'] = ($list['pay_status'] == 1) ? date('Y-m-d H:i:s', $list['pay_time']) : '--'; $list['pay_time'] = ($list['pay_status'] == 1) ? date('Y-m-d H:i:s', $list['pay_time']) : '--';
$list['pay_status'] = isset(QueryController::$payStatus[$list['pay_status']]) ? QueryController::$payStatus[$list['pay_status']] : '未知状态'; $list['pay_status'] = isset(QueryController::$payStatus[$list['pay_status']]) ? QueryController::$payStatus[$list['pay_status']] : '未知状态';
$list['sdk_version'] = getSDKTypeName($list['sdk_version']); $list['sdk_version'] = getSDKTypeName($list['sdk_version']);
$list['pay_order_number'] = hideOrderNumber($list['pay_order_number']);
//订单隐藏算法
$orderLen = strlen($list['pay_order_number']);
$strLen = 4;
$hideChar = '';
if ($orderLen <= 8) {
$strLen = 2;
}
for ($i = 0; $i < $orderLen - $strLen * 2; $i++) {
$hideChar .= '*';
}
$list['pay_order_number'] = substr($list['pay_order_number'], 0, $strLen) . $hideChar . substr($list['pay_order_number'], $orderLen - $strLen);
} }
} }
@ -285,7 +271,7 @@ class QueryController extends BaseController
{ {
$page = intval(I('p', 1)); $page = intval(I('p', 1));
$row = intval(I('row', 10)); $row = intval(I('row', 10));
$ownId = intval(I('own_id'), 0);//本账号 $ownId = intval(I('own_id'), 0); //本账号
$account = trim(I('account', '')); $account = trim(I('account', ''));
$id = intval(I('id', 0)); $id = intval(I('id', 0));
$nowTime = date('Y-m-d'); $nowTime = date('Y-m-d');
@ -342,14 +328,13 @@ class QueryController extends BaseController
->where($loginMap) ->where($loginMap)
->order('login_time desc') ->order('login_time desc')
->find(); ->find();
$list['new_login_time'] = date('Y-m-d H:i:s', $newLoginData['login_time']); $list['new_login_time'] = date('Y-m-d H:i:s', $newLoginData['login_time']);
$list['new_login_ip'] = $newLoginData['login_ip']; $list['new_login_ip'] = $newLoginData['login_ip'];
$list['account'] = getHideAccount($list['account']); $list['account'] = getHideAccount($list['account']);
if(!empty($list['device_number'])) { if (!empty($list['device_number'])) {
$list['device_number'] = encryption($list['device_number']); $list['device_number'] = encryption($list['device_number']);
} }
} }
} }
@ -599,7 +584,6 @@ class QueryController extends BaseController
$promote_child = get_sub_channel_id($chid, PRO_GRADE + 1); $promote_child = get_sub_channel_id($chid, PRO_GRADE + 1);
$map['s.promote_id'] = $mapp['u.promote_id'] = array('in', $promote_child); $map['s.promote_id'] = $mapp['u.promote_id'] = array('in', $promote_child);
} else { } else {
$promote_child = get_zi_promote_id(PID); $promote_child = get_zi_promote_id(PID);
if (empty($promote_child)) { if (empty($promote_child)) {
@ -619,12 +603,10 @@ class QueryController extends BaseController
$mmap = array($mapp, $map); $mmap = array($mapp, $map);
$user = A('User', 'Event'); $user = A('User', 'Event');
$user->check_child_bill($model, $p, $mmap); $user->check_child_bill($model, $p, $mmap);
} else { } else {
$this->meta_title = '子渠道结算'; $this->meta_title = '子渠道结算';
$this->display(); $this->display();
} }
} }
public function generatesub() public function generatesub()
@ -720,7 +702,6 @@ class QueryController extends BaseController
public function son_apply_withdraw($settlement_number = '') public function son_apply_withdraw($settlement_number = '')
{ {
$map['settlement_number'] = $settlement_number; $map['settlement_number'] = $settlement_number;
$with_map['settlement_number'] = $totalSett['settlement_number'];
$result = M("SonSettlement", "tab_")->where($map)->save(array('ti_status' => 0)); $result = M("SonSettlement", "tab_")->where($map)->save(array('ti_status' => 0));
if ($result !== false) { if ($result !== false) {
echo json_encode(array("status" => 1)); echo json_encode(array("status" => 1));
@ -732,7 +713,6 @@ class QueryController extends BaseController
public function audit_withdraw($settlement_number = '') public function audit_withdraw($settlement_number = '')
{ {
$map['settlement_number'] = $settlement_number; $map['settlement_number'] = $settlement_number;
$with_map['settlement_number'] = $totalSett['settlement_number'];
$result = M("SonSettlement", "tab_")->where($map)->save(array('ti_status' => 1)); $result = M("SonSettlement", "tab_")->where($map)->save(array('ti_status' => 1));
if ($result !== false) { if ($result !== false) {
$this->success('审核成功'); $this->success('审核成功');
@ -967,7 +947,6 @@ class QueryController extends BaseController
$map_list['promote_id'] = array('in', $pro_arr); $map_list['promote_id'] = array('in', $pro_arr);
$promote_id = implode(',', $pro_arr); $promote_id = implode(',', $pro_arr);
$join .= " AND u.promote_id in ({$promote_id})"; $join .= " AND u.promote_id in ({$promote_id})";
} }
$spend2 = D('Spend'); $spend2 = D('Spend');
$data = M('Apply', 'tab_')->field('game_id, game_name')->where(['promote_id' => $promote_id])->order('game_id desc')->select(); $data = M('Apply', 'tab_')->field('game_id, game_name')->where(['promote_id' => $promote_id])->order('game_id desc')->select();
@ -1085,7 +1064,6 @@ class QueryController extends BaseController
{ {
$this->meta_title = '留存统计'; $this->meta_title = '留存统计';
A('User', 'Event')->retention_analysis(); A('User', 'Event')->retention_analysis();
} }
public function details() public function details()
@ -1132,7 +1110,7 @@ class QueryController extends BaseController
$loginPromote = $this->getLoginPromote(); $loginPromote = $this->getLoginPromote();
$ownId = intval(I('own_id'), 0);//本账号 $ownId = intval(I('own_id'), 0); //本账号
if ($ownId) { if ($ownId) {
$params['promote_id'] = $queryPromote['id']; $params['promote_id'] = $queryPromote['id'];
} else { } else {
@ -1174,22 +1152,22 @@ class QueryController extends BaseController
if (intval($endTime - $begTime) / (24 * 3600) <= 31) { if (intval($endTime - $begTime) / (24 * 3600) <= 31) {
$userRepository = new UserRepository(); $userRepository = new UserRepository();
$spendRepository = new SpendRepository(); $spendRepository = new SpendRepository();
$roleNumList = $userRepository->getCreateRoleCountByDay($params);//创角数 $roleNumList = $userRepository->getCreateRoleCountByDay($params); //创角数
$userNumList = $userRepository->getCreateRoleUserCountByDay($params);//创角用户 $userNumList = $userRepository->getCreateRoleUserCountByDay($params); //创角用户
$newUserNumList = $userRepository->getNewCreateRoleUserCountByDay($params);//新创角用户 $newUserNumList = $userRepository->getNewCreateRoleUserCountByDay($params); //新创角用户
$newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByDay($params);//新创角设备 $newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByDay($params); //新创角设备
$newIpNumList = $userRepository->getNewCreateRoleIpCountByDay($params);//新创角IP $newIpNumList = $userRepository->getNewCreateRoleIpCountByDay($params); //新创角IP
$loginUserNumList = $userRepository->getLoginCountGroupByDayNew($params);//登录用户数 $loginUserNumList = $userRepository->getLoginCountGroupByDayNew($params); //登录用户数
if ($this->canViewUserRecharge) { if ($this->canViewUserRecharge) {
$spendUserNumList = $spendRepository->getPayUserCountGroupByDayNew($params);//充值人数 $spendUserNumList = $spendRepository->getPayUserCountGroupByDayNew($params); //充值人数
$spendNumList = $spendRepository->getPayCountGroupByDay($params);//充值次数 $spendNumList = $spendRepository->getPayCountGroupByDay($params); //充值次数
$spendAllAmountList = $spendRepository->getPayAmountGroupByDayAndType($params);//充值总额 $spendAllAmountList = $spendRepository->getPayAmountGroupByDayAndType($params); //充值总额
$params['pay_way'] = ['in', '1,2,3,4,5,6']; $params['pay_way'] = ['in', '1,2,3,4,5,6'];
$spendCashList = $spendRepository->getPayAmountGroupByDayAndType($params);//现金充值 $spendCashList = $spendRepository->getPayAmountGroupByDayAndType($params); //现金充值
$params['pay_way'] = 0; $params['pay_way'] = 0;
$spendGenericList = $spendRepository->getPayAmountGroupByDayAndType($params);//通用币充值 $spendGenericList = $spendRepository->getPayAmountGroupByDayAndType($params); //通用币充值
$params['pay_way'] = -1; $params['pay_way'] = -1;
$spendBindingList = $spendRepository->getPayAmountGroupByDayAndType($params);//绑定币充值 $spendBindingList = $spendRepository->getPayAmountGroupByDayAndType($params); //绑定币充值
} }
$allData['role_num'] = 0; $allData['role_num'] = 0;
@ -1282,7 +1260,7 @@ class QueryController extends BaseController
$page = intval(I('get.p', 1)); $page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage $page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10)); $row = intval(I('get.row', 10));
$ownId = intval(I('own_id'), 0);//本账号 $ownId = intval(I('own_id'), 0); //本账号
$relationGameId = intval(I('relation_game_id', 0)); $relationGameId = intval(I('relation_game_id', 0));
$sdkVersion = intval(I('sdk_version', 0)); $sdkVersion = intval(I('sdk_version', 0));
$serverId = I('server_id', ''); $serverId = I('server_id', '');
@ -1308,9 +1286,9 @@ class QueryController extends BaseController
$parameter['own_id'] = $ownId; $parameter['own_id'] = $ownId;
$parameter['p'] = $page; $parameter['p'] = $page;
$parameter['row'] = $row; $parameter['row'] = $row;
$loginPromote = $this->getLoginPromote(); $loginPromote = $this->getLoginPromote();
$map = []; $map = [];
$map = ['_string' => '1=1']; $map = ['_string' => '1=1'];
if ($ownId) { if ($ownId) {
@ -1333,16 +1311,16 @@ class QueryController extends BaseController
$params['begin_time'] = $begTime; $params['begin_time'] = $begTime;
$params['end_time'] = $endTime - 1; $params['end_time'] = $endTime - 1;
$promoteService = new PromoteService(); $promoteService = new PromoteService();
$allGameIs = $promoteService->getHistoryGameIds($loginPromote); $allGameIs = $promoteService->getHistoryGameIds($loginPromote);
if ($allGameIs && count($allGameIs) > 0) { if ($allGameIs && count($allGameIs) > 0) {
$map['_string'] .= ' and id in(' . implode(',', $allGameIs) . ')'; $map['_string'] .= ' and id in(' . implode(',', $allGameIs) . ')';
} else { } else {
$map['_string'] .= '1=0'; $map['_string'] .= '1=0';
} }
$data = M('game', 'tab_')->where($map)->order('sort desc,id desc')->page($page, $row)->select(); $data = M('game', 'tab_')->where($map)->order('sort desc,id desc')->page($page, $row)->select();
$count = M('game', 'tab_')->where($map)->count(); $count = M('game', 'tab_')->where($map)->count();
$records = []; $records = [];
@ -1354,22 +1332,22 @@ class QueryController extends BaseController
$userRepository = new UserRepository(); $userRepository = new UserRepository();
$spendRepository = new SpendRepository(); $spendRepository = new SpendRepository();
$roleNumList = $userRepository->getCreateRoleCountByGame($params);//创角数 $roleNumList = $userRepository->getCreateRoleCountByGame($params); //创角数
$userNumList = $userRepository->getCreateRoleUserCountByGame($params);//创角用户 $userNumList = $userRepository->getCreateRoleUserCountByGame($params); //创角用户
$newUserNumList = $userRepository->getNewCreateRoleUserCountByGame($params);//新创角用户 $newUserNumList = $userRepository->getNewCreateRoleUserCountByGame($params); //新创角用户
$newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备 $newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByGame($params); //新创角设备
$newIpNumList = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP $newIpNumList = $userRepository->getNewCreateRoleIpCountByGame($params); //新创角IP
$loginUserNumList = $userRepository->getLoginCountGroupByGame($params);//登录用户数 $loginUserNumList = $userRepository->getLoginCountGroupByGame($params); //登录用户数
if ($this->canViewUserRecharge) { if ($this->canViewUserRecharge) {
$spendUserNumList = $spendRepository->getPayUserCountGroupByGame($params);//充值人数 $spendUserNumList = $spendRepository->getPayUserCountGroupByGame($params); //充值人数
$spendNumList = $spendRepository->getPayCountGroupByGame($params);//充值次数 $spendNumList = $spendRepository->getPayCountGroupByGame($params); //充值次数
$spendAllAmountList = $spendRepository->getPayAmountGroupByGameAndType($params);//充值总额 $spendAllAmountList = $spendRepository->getPayAmountGroupByGameAndType($params); //充值总额
$params['pay_way'] = ['in', '1,2,3,4,5,6']; $params['pay_way'] = ['in', '1,2,3,4,5,6'];
$spendCashList = $spendRepository->getPayAmountGroupByGameAndType($params);//现金充值 $spendCashList = $spendRepository->getPayAmountGroupByGameAndType($params); //现金充值
$params['pay_way'] = 0; $params['pay_way'] = 0;
$spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params);//通用币充值 $spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params); //通用币充值
$params['pay_way'] = -1; $params['pay_way'] = -1;
$spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params);//绑定币充值 $spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params); //绑定币充值
} }
foreach ($data as $list) { foreach ($data as $list) {
$gameId = $list['id']; $gameId = $list['id'];
@ -1399,23 +1377,23 @@ class QueryController extends BaseController
} }
$params['all_data'] = 1; $params['all_data'] = 1;
$params['game_ids'] = $allGameIs; $params['game_ids'] = $allGameIs;
$allData['role_num'] = $userRepository->getCreateRoleCountByGame($params);//创角数 $allData['role_num'] = $userRepository->getCreateRoleCountByGame($params); //创角数
$allData['user_num'] = $userRepository->getCreateRoleUserCountByGame($params);//创角用户 $allData['user_num'] = $userRepository->getCreateRoleUserCountByGame($params); //创角用户
$allData['new_user_num'] = $userRepository->getNewCreateRoleUserCountByGame($params);//新创角用户 $allData['new_user_num'] = $userRepository->getNewCreateRoleUserCountByGame($params); //新创角用户
$allData['new_device_num'] = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备 $allData['new_device_num'] = $userRepository->getNewCreateRoleDeviceCountByGame($params); //新创角设备
$allData['new_ip_num'] = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP $allData['new_ip_num'] = $userRepository->getNewCreateRoleIpCountByGame($params); //新创角IP
$allData['login_user_num'] = $userRepository->getLoginCountGroupByGame($params);//登录用户数 $allData['login_user_num'] = $userRepository->getLoginCountGroupByGame($params); //登录用户数
if ($this->canViewUserRecharge) { if ($this->canViewUserRecharge) {
$allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数 $allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params); //充值人数
$allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数 $allData['spend_num'] = $spendRepository->getPayCountByGame($params); //充值次数
unset($params['pay_way']); unset($params['pay_way']);
$allData['spend_all_amount'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//充值总额 $allData['spend_all_amount'] = null_to_0($spendRepository->getPayAmountByGameAndType($params)); //充值总额
$params['pay_way'] = ['in', '1,2,3,4,5,6']; $params['pay_way'] = ['in', '1,2,3,4,5,6'];
$allData['spend_cash'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//现金充值 $allData['spend_cash'] = null_to_0($spendRepository->getPayAmountByGameAndType($params)); //现金充值
$params['pay_way'] = 0; $params['pay_way'] = 0;
$allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//通用币充值 $allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params)); //通用币充值
$params['pay_way'] = -1; $params['pay_way'] = -1;
$allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//绑定币充值 $allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($params)); //绑定币充值
$allData['spend_discount'] = '0.00'; $allData['spend_discount'] = '0.00';
$allData['spend_voucher'] = '0.00'; $allData['spend_voucher'] = '0.00';
} }
@ -1487,14 +1465,12 @@ class QueryController extends BaseController
$promote = $_REQUEST['promote_id']; $promote = $_REQUEST['promote_id'];
if (PID == $promote) { if (PID == $promote) {
} else { } else {
$pids = get_prmoote_chlid_account($promote); $pids = get_prmoote_chlid_account($promote);
$pro_arr = array_column($pids, 'id'); $pro_arr = array_column($pids, 'id');
$pro_arr[] = $promote; $pro_arr[] = $promote;
$promote = implode(',', $pro_arr); $promote = implode(',', $pro_arr);
} }
$game = M('apply', 'tab_') $game = M('apply', 'tab_')
@ -1601,7 +1577,8 @@ class QueryController extends BaseController
public function viewRole($p = 0) public function viewRole($p = 0)
{ {
$promoteId = D('User')->where('id = %d', I('get.id'))->getField('promote_id'); $promoteId = D('User')->where('id = %d', I('get.id'))->getField('promote_id');
$permission = hasPromotePermission(PID, $promoteId);//是否有该推广员权限 $permission = hasPromotePermission(PID, $promoteId); //是否有该推广员权限
$loginPromote = $this->getLoginPromote();
if ($permission === false) { if ($permission === false) {
$this->error('无推广员权限'); $this->error('无推广员权限');
@ -1646,7 +1623,7 @@ class QueryController extends BaseController
if (!empty($data)) { if (!empty($data)) {
foreach ($data as &$list) { foreach ($data as &$list) {
$list['user_account'] = substr($list['user_account'], 0, 2) . '******' . substr($list['user_account'], 8); $list['user_account'] = getUserAccountOfPromote($list['user_account'], $loginPromote);
} }
} }
@ -1721,20 +1698,20 @@ class QueryController extends BaseController
$roleLevelBegin = intval(I('role_level_begin', 0)); $roleLevelBegin = intval(I('role_level_begin', 0));
$roleLevelEnd = intval(I('role_level_end', 0)); $roleLevelEnd = intval(I('role_level_end', 0));
$headmanPromoteId = I('headman_promote_id', 0); $headmanPromoteId = I('headman_promote_id', 0);
$createTime = I('create_time', date('Y-m-d') . ' 至 ' . date('Y-m-d', time()-7*24*3600)); $createTime = I('create_time', date('Y-m-d') . ' 至 ' . date('Y-m-d', time() - 7 * 24 * 3600));
$lastSortName = trim(I('last_sort_name', '')); $lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', '')); $sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1)); $sort = intval(I('sort', 1));
$promote = $this->getLoginPromote(); $loginPromote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote(); $levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote, function() use ($promote) { $queryPromote = $this->getQueryPromote($levelPromote, function () use ($loginPromote) {
if ($promote['shift_over_apply'] == 1) { if ($loginPromote['shift_over_apply'] == 1) {
$promoteService = new PromoteService(); $promoteService = new PromoteService();
return $promoteService->getTopPromote($promote); return $promoteService->getTopPromote($loginPromote);
} else { } else {
return $promote; return $loginPromote;
} }
}); });
@ -1754,7 +1731,8 @@ class QueryController extends BaseController
} }
if ($roleName != '') { if ($roleName != '') {
$map['role_name'] = ['like', '%' . $roleName . '%']; $map['role_name'] = ['like', '%' . $roleName . '%'];
}if ($roleId != '') { }
if ($roleId != '') {
$map['role_id'] = $roleId; $map['role_id'] = $roleId;
} }
if ($userAccount != '') { if ($userAccount != '') {
@ -1851,25 +1829,13 @@ class QueryController extends BaseController
// var_dump($records);die(); // var_dump($records);die();
foreach ($records as $key => $value) { foreach ($records as $key => $value) {
if ($records[$key]['create_time'] == 0) {
//隐藏算法
$orderLen = strlen($value['user_account']);
$strLen = 3;
$hideChar = '';
if ($orderLen <= 8) {
$strLen = 2;
}
for ($i = 0; $i < $orderLen - $strLen * 2; $i++) {
$hideChar .= '*';
}
if($records[$key]['create_time'] == 0) {
$records[$key]['create_time'] = date('Y-m-d', $value['play_time']) . '<br>' . date('H:i:s', $value['play_time']); $records[$key]['create_time'] = date('Y-m-d', $value['play_time']) . '<br>' . date('H:i:s', $value['play_time']);
} else { } else {
$records[$key]['create_time'] = date('Y-m-d', $value['create_time']) . '<br>' . date('H:i:s', $value['create_time']); $records[$key]['create_time'] = date('Y-m-d', $value['create_time']) . '<br>' . date('H:i:s', $value['create_time']);
} }
$records[$key]['user_account'] = substr($value['user_account'], 0, $strLen) . $hideChar . substr($value['user_account'], $orderLen - $strLen); $records[$key]['user_account'] = getUserAccountOfPromote($value['user_account'], $loginPromote);
$records[$key]['register_time'] = date('Y-m-d', $value['register_time']) . '<br>' . date('H:i:s', $value['register_time']); $records[$key]['register_time'] = date('Y-m-d', $value['register_time']) . '<br>' . date('H:i:s', $value['register_time']);
$records[$key]['login_time'] = date('Y-m-d', $value['login_time']) . '<br>' . date('H:i:s', $value['login_time']); $records[$key]['login_time'] = date('Y-m-d', $value['login_time']) . '<br>' . date('H:i:s', $value['login_time']);
@ -1928,7 +1894,7 @@ class QueryController extends BaseController
$nowTime = strtotime($nowTime); $nowTime = strtotime($nowTime);
$nowTimeEnd = $nowTime + 3600 * 24 - 1; $nowTimeEnd = $nowTime + 3600 * 24 - 1;
$promote = $this->getLoginPromote(); $loginPromote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote(); $levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote); $queryPromote = $this->getQueryPromote($levelPromote);
@ -1998,7 +1964,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_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"; $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';
$spendMap['today.pay_status'] = 1; $spendMap['today.pay_status'] = 1;
$spendMap['today.pay_time'] = ['between', [$nowTime, $nowTimeEnd]]; $spendMap['today.pay_time'] = ['between', [$nowTime, $nowTimeEnd]];
@ -2048,7 +2014,7 @@ class QueryController extends BaseController
$promotes = M('promote', 'tab_')->field(['id', 'chain', 'account'])->where(['id' => ['in', $promoteIds]])->select(); $promotes = M('promote', 'tab_')->field(['id', 'chain', 'account'])->where(['id' => ['in', $promoteIds]])->select();
$promotes = index_by_column('id', $promotes); $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']) ? '--' : getUserAccountOfPromote($list['user_account'], $loginPromote);
$list['game_name'] = empty($list['game_name']) ? '--' : $list['game_name']; $list['game_name'] = empty($list['game_name']) ? '--' : $list['game_name'];
$list['sdk_version'] = empty($list['sdk_version']) ? '--' : getSDKTypeName($list['sdk_version']); $list['sdk_version'] = empty($list['sdk_version']) ? '--' : getSDKTypeName($list['sdk_version']);
$list['server_name'] = empty($list['server_name']) ? '--' : $list['server_name']; $list['server_name'] = empty($list['server_name']) ? '--' : $list['server_name'];
@ -2132,7 +2098,7 @@ class QueryController extends BaseController
if ($id > 0) { if ($id > 0) {
$promoteId = D('Spend')->where('id = %d', $id)->getField('promote_id'); $promoteId = D('Spend')->where('id = %d', $id)->getField('promote_id');
$permission = hasPromotePermission(PID, $promoteId);//是否有该推广员权限 $permission = hasPromotePermission(PID, $promoteId); //是否有该推广员权限
if ($permission) { if ($permission) {
$map['id'] = $id; $map['id'] = $id;
@ -2258,7 +2224,7 @@ class QueryController extends BaseController
// $newCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds($ids, $params); // $newCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds($ids, $params);
$newCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds($ids, $params); $newCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds($ids, $params);
$loginUserCountList = $promoteRepository->getLoginUserCountByIds($ids, $params); $loginUserCountList = $promoteRepository->getLoginUserCountByIds($ids, $params);
$rechargeCountList = []; $rechargeCountList = [];
$rechargeUserCountList = []; $rechargeUserCountList = [];
$rechargeAmountList = []; $rechargeAmountList = [];
@ -2472,7 +2438,7 @@ 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').'**', 'real_name' => hideRealName($parent['real_name']),
'level' => $parent['level'], 'level' => $parent['level'],
'game_name' => $game['game_name'], 'game_name' => $game['game_name'],
'sdk_version_text' => $game['sdk_version_text'], 'sdk_version_text' => $game['sdk_version_text'],
@ -2487,7 +2453,7 @@ 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').'**', 'real_name' => hideRealName($promote['real_name']),
'level' => $promote['level'], 'level' => $promote['level'],
'game_name' => $game['game_name'], 'game_name' => $game['game_name'],
'sdk_version_text' => $game['sdk_version_text'], 'sdk_version_text' => $game['sdk_version_text'],
@ -2524,6 +2490,7 @@ class QueryController extends BaseController
$roleLevelEnd = intval(I('level_end', 0)); $roleLevelEnd = intval(I('level_end', 0));
$promoteId = I('promote_id', 0); $promoteId = I('promote_id', 0);
$isSelf = I('is_self', 0); $isSelf = I('is_self', 0);
$loginPromote = $this->getLoginPromote();
if ($relationGameId != 0 || $sdkVersion != 0) { if ($relationGameId != 0 || $sdkVersion != 0) {
$gameIds = gameSearch($relationGameId, $sdkVersion); $gameIds = gameSearch($relationGameId, $sdkVersion);
@ -2558,20 +2525,7 @@ class QueryController extends BaseController
$query = M('user_play_info', 'tab_')->where($map)->order('create_time desc'); $query = M('user_play_info', 'tab_')->where($map)->order('create_time desc');
list($records, $pagination, $count) = $this->paginate($query); list($records, $pagination, $count) = $this->paginate($query);
foreach ($records as $key => $value) { foreach ($records as $key => $value) {
//订单隐藏算法 $records[$key]['user_account'] = getUserAccountOfPromote($value['user_account'], $loginPromote);
$orderLen = strlen($value['user_account']);
$strLen = 3;
$hideChar = '';
if ($orderLen <= 8) {
$strLen = 2;
}
for ($i = 0; $i < $orderLen - $strLen * 2; $i++) {
$hideChar .= '*';
}
$records[$key]['user_account'] = substr($value['user_account'], 0, $strLen) . $hideChar . substr($value['user_account'], $orderLen - $strLen);
} }
$this->assign('records', $records); $this->assign('records', $records);
@ -2629,7 +2583,8 @@ class QueryController extends BaseController
return M('server', 'tab_')->where($map)->getField('server_name'); return M('server', 'tab_')->where($map)->getField('server_name');
} }
public function iosDownLoadData() { public function iosDownLoadData()
{
$page = intval(I('get.p', 1)); $page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage $page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10)); $row = intval(I('get.row', 10));
@ -2640,7 +2595,7 @@ class QueryController extends BaseController
$map = []; $map = [];
if ($queryPromote['level'] == 4) { if ($queryPromote['level'] == 4) {
$map['id'] = $queryPromote['id']; $map['id'] = $queryPromote['id'];
}else { } else {
$map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '%']; $map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '%'];
} }
$iostime = time(); $iostime = time();
@ -2681,18 +2636,18 @@ class QueryController extends BaseController
$map = []; $map = [];
$map['tab_package_download_log.promote_id'] = ['in', $ids]; $map['tab_package_download_log.promote_id'] = ['in', $ids];
// $data = M('package_download_log','tab_')->where($map)->select(); // $data = M('package_download_log','tab_')->where($map)->select();
$listData = []; $listData = [];
$allUserMap['promote_id'] = ['in', $allids]; $allUserMap['promote_id'] = ['in', $allids];
$allUserMap['device_type'] = 2; $allUserMap['device_type'] = 2;
$allUserMap['register_time'] = ['between', [$begTime, $endTime]]; $allUserMap['register_time'] = ['between', [$begTime, $endTime]];
$allTFMap['promote_id'] = ['in', $allids]; $allTFMap['promote_id'] = ['in', $allids];
$allTFMap['type'] = 2; $allTFMap['type'] = 2;
$allTFMap['create_time'] = ['between', [$begTime, $endTime]]; $allTFMap['create_time'] = ['between', [$begTime, $endTime]];
$allSuperMap['promote_id'] = ['in', $allids]; $allSuperMap['promote_id'] = ['in', $allids];
$allSuperMap['type'] = 3; $allSuperMap['type'] = 3;
$allSuperMap['create_time'] = ['between', [$begTime, $endTime]]; $allSuperMap['create_time'] = ['between', [$begTime, $endTime]];
$companyMap['promote_id'] = ['in', $allids]; $companyMap['promote_id'] = ['in', $allids];
$companyMap['type'] = 1; $companyMap['type'] = 1;
$companyMap['create_time'] = ['between', [$begTime, $endTime]]; $companyMap['create_time'] = ['between', [$begTime, $endTime]];
$alliosMap['promote_id'] = ['in', $allids]; $alliosMap['promote_id'] = ['in', $allids];
@ -2700,19 +2655,19 @@ class QueryController extends BaseController
$alliosMap['register_time'] = ['between', [$sunday, $iostime]]; $alliosMap['register_time'] = ['between', [$sunday, $iostime]];
$allUsersCounts = M('user', 'tab_')->where($allUserMap)->count(); $allUsersCounts = M('user', 'tab_')->where($allUserMap)->count();
$allIosCounts = M('user', 'tab_')->where($alliosMap)->count(); $allIosCounts = M('user', 'tab_')->where($alliosMap)->count();
$allTFCounts = M('package_download_log', 'tab_')->where($allTFMap)->count(); $allTFCounts = M('package_download_log', 'tab_')->where($allTFMap)->count();
$allSuperCounts = M('package_download_log', 'tab_')->where($allSuperMap)->count(); $allSuperCounts = M('package_download_log', 'tab_')->where($allSuperMap)->count();
$allCompanyCounts = M('package_download_log', 'tab_')->where($companyMap)->count(); $allCompanyCounts = M('package_download_log', 'tab_')->where($companyMap)->count();
foreach ($ids as $key => $id) { foreach ($ids as $key => $id) {
$promote1 = M('promote', 'tab_')->field('account, level, parent_id, chain')->where(['id' => $id])->select(); $promote1 = M('promote', 'tab_')->field('account, level, parent_id, chain')->where(['id' => $id])->select();
$promote = $promote1[0]; $promote = $promote1[0];
$chain = $promote['chain']; $chain = $promote['chain'];
$listData[$key]['promote_id'] = $id; $listData[$key]['promote_id'] = $id;
if($id == PID) { if ($id == PID) {
$listData[$key]['account'] = $promote['account'].'<span style="color:blue;">'.'['.'自己'.']'.'</span>'; $listData[$key]['account'] = $promote['account'] . '<span style="color:blue;">' . '[' . '自己' . ']' . '</span>';
}else { } else {
$listData[$key]['account'] = $promote['account']; $listData[$key]['account'] = $promote['account'];
} }
$iosTimeMap['promote_id'] = $id; $iosTimeMap['promote_id'] = $id;
@ -2735,42 +2690,42 @@ class QueryController extends BaseController
$usersCounts = M('user', 'tab_')->where($map10)->count(); $usersCounts = M('user', 'tab_')->where($map10)->count();
$listData[$key]['userscounts'] = intval($usersCounts); $listData[$key]['userscounts'] = intval($usersCounts);
$listData[$key]['tfcounts'] = intval($tfCounts); $listData[$key]['tfcounts'] = intval($tfCounts);
$listData[$key]['tfpercent'] = number_format((intval($tfCounts) / intval($usersCounts)),2,'.','') * 100; $listData[$key]['tfpercent'] = number_format((intval($tfCounts) / intval($usersCounts)), 2, '.', '') * 100;
if (intval($usersCounts) == 0) { if (intval($usersCounts) == 0) {
$listData[$key]['tfpercent'] = 0; $listData[$key]['tfpercent'] = 0;
} }
if($promote['level'] == 1) { if ($promote['level'] == 1) {
$listData[$key]['belongs_president'] = $promote['account']; $listData[$key]['belongs_president'] = $promote['account'];
$listData[$key]['belongs_department'] = "无所属部门长"; $listData[$key]['belongs_department'] = "无所属部门长";
$listData[$key]['belongs_group'] = "无所属组长"; $listData[$key]['belongs_group'] = "无所属组长";
} }
if ($promote['level'] == 2) { if ($promote['level'] == 2) {
$parentPromote = M('promote', 'tab_')->field('account')->where(['id'=>$promote['parent_id']])->select(); $parentPromote = M('promote', 'tab_')->field('account')->where(['id' => $promote['parent_id']])->select();
$listData[$key]['belongs_president'] = $parentPromote[0]['account']; $listData[$key]['belongs_president'] = $parentPromote[0]['account'];
$listData[$key]['belongs_department'] = $promote['account']; $listData[$key]['belongs_department'] = $promote['account'];
$listData[$key]['belongs_group'] = "无所属组长"; $listData[$key]['belongs_group'] = "无所属组长";
} }
if ($promote['level'] == 3) { if ($promote['level'] == 3) {
$chainArr = explode('/', $chain); $chainArr = explode('/', $chain);
$presidentAccount = M('promote', 'tab_')->where(['id' => $chainArr[1]])->getField('account'); $presidentAccount = M('promote', 'tab_')->where(['id' => $chainArr[1]])->getField('account');
$departmentAccount = M('promote', 'tab_')->where(['id' => $chainArr[2]])->getField('account'); $departmentAccount = M('promote', 'tab_')->where(['id' => $chainArr[2]])->getField('account');
$listData[$key]['belongs_president'] = $presidentAccount; $listData[$key]['belongs_president'] = $presidentAccount;
$listData[$key]['belongs_department'] = $departmentAccount; $listData[$key]['belongs_department'] = $departmentAccount;
$listData[$key]['belongs_group'] = $promote['account']; $listData[$key]['belongs_group'] = $promote['account'];
} }
if ($promote['level'] == 4) { if ($promote['level'] == 4) {
$chainArr = explode('/', $chain); $chainArr = explode('/', $chain);
$presidentAccount = M('promote', 'tab_')->where(['id' => $chainArr[1]])->getField('account'); $presidentAccount = M('promote', 'tab_')->where(['id' => $chainArr[1]])->getField('account');
$departmentAccount = M('promote', 'tab_')->where(['id' => $chainArr[2]])->getField('account'); $departmentAccount = M('promote', 'tab_')->where(['id' => $chainArr[2]])->getField('account');
$groupAccount = M('promote', 'tab_')->where(['id' => $chainArr[3]])->getField('account'); $groupAccount = M('promote', 'tab_')->where(['id' => $chainArr[3]])->getField('account');
$listData[$key]['belongs_president'] = $presidentAccount; $listData[$key]['belongs_president'] = $presidentAccount;
$listData[$key]['belongs_department'] = $departmentAccount; $listData[$key]['belongs_department'] = $departmentAccount;
$listData[$key]['belongs_group'] = $groupAccount; $listData[$key]['belongs_group'] = $groupAccount;
} }
} }
$totalpercent = number_format($allTFCounts/$allUsersCounts,2,'.','') * 100; $totalpercent = number_format($allTFCounts / $allUsersCounts, 2, '.', '') * 100;
if ($allUsersCounts == 0) { if ($allUsersCounts == 0) {
$totalpercent = '0'; $totalpercent = '0';
} }
@ -2784,76 +2739,75 @@ class QueryController extends BaseController
$this->assign('initBegTime', $initBegTime); $this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime); $this->assign('initEndTime', $initEndTime);
$this->assign('allIosCounts', $allIosCounts); $this->assign('allIosCounts', $allIosCounts);
$this->assign('tfpercent', $tfpercent);
$this->display(); $this->display();
} }
public function iosDownLoadDetail() { public function iosDownLoadDetail()
$promote_id = $_REQUEST['promote_id']; {
$belongs_president = $_REQUEST['belongs_president']; $promote_id = $_REQUEST['promote_id'];
$belongs_department = $_REQUEST['belongs_department']; $belongs_president = $_REQUEST['belongs_president'];
$belongs_group = $_REQUEST['belongs_group']; $belongs_department = $_REQUEST['belongs_department'];
// $createTime = I('create_time', ''); $belongs_group = $_REQUEST['belongs_group'];
// $createTime = I('create_time', '');
$nowTime = date('Y-m-d'); $loginPromote = $this->getLoginPromote();
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime'); $nowTime = date('Y-m-d');
$initEndTime = $nowTime; $initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime'); $initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
$begTime = strtotime($initBegTime); $initEndTime = $nowTime;
$endTime = strtotime($initEndTime); $initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
$endTime += 3600 * 24; $begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
$map['create_time'] = ['between', [$begTime, $endTime]]; $endTime += 3600 * 24;
$tfMap['create_time'] = ['between', [$begTime, $endTime]];
$superMap['create_time'] = ['between', [$begTime, $endTime]]; $map['create_time'] = ['between', [$begTime, $endTime]];
$companyMap['create_time'] = ['between', [$begTime, $endTime]]; $tfMap['create_time'] = ['between', [$begTime, $endTime]];
$superMap['create_time'] = ['between', [$begTime, $endTime]];
if(!empty(I('user_account'))) { $companyMap['create_time'] = ['between', [$begTime, $endTime]];
$user_id = M('user', 'tab_')->where(['account'=>I('user_account')])->getField('id');
$map['user_id'] = $user_id; if (!empty(I('user_account'))) {
$tfMap['user_id'] = $user_id; $user_id = M('user', 'tab_')->where(['account' => I('user_account')])->getField('id');
$superMap['user_id'] = $user_id; $map['user_id'] = $user_id;
$companyMap['user_id'] = $user_id; $tfMap['user_id'] = $user_id;
} $superMap['user_id'] = $user_id;
if(!empty(I('type'))) { $companyMap['user_id'] = $user_id;
$map['type'] = I('type'); }
if (!empty(I('type'))) {
} $map['type'] = I('type');
$map['promote_id'] = $promote_id; }
$map['promote_id'] = $promote_id;
//$packAges = M('package_download_log', 'tab_')->field('id,game_id,user_id,type,create_time')->where(['promote_id'=>$promote_id])->select(); //$packAges = M('package_download_log', 'tab_')->field('id,game_id,user_id,type,create_time')->where(['promote_id'=>$promote_id])->select();
$query = M('package_download_log', 'tab_')->field('id,game_id,user_id,type,create_time')->where($map); $query = M('package_download_log', 'tab_')->field('id,game_id,user_id,type,create_time')->where($map);
list($packAges, $pagination, $count) = $this->paginate($query); list($packAges, $pagination, $count) = $this->paginate($query);
foreach ($packAges as $key =>$package) { foreach ($packAges as $key => $package) {
$user_id = $package['user_id']; $user_id = $package['user_id'];
$usersAccount = M('user', 'tab_')->where(['id' => $user_id])->getField('account'); $usersAccount = M('user', 'tab_')->where(['id' => $user_id])->getField('account');
$packAges[$key]['account'] = $usersAccount; $packAges[$key]['account'] = $usersAccount;
if ($package['type'] == 1) { if ($package['type'] == 1) {
$packAges[$key]['typename'] = "企业签下载"; $packAges[$key]['typename'] = "企业签下载";
} }
if($package['type'] == 2) { if ($package['type'] == 2) {
$packAges[$key]['typename'] = "TF下载"; $packAges[$key]['typename'] = "TF下载";
} }
if($package['type'] == 3) { if ($package['type'] == 3) {
$packAges[$key]['typename'] = "超级签下载"; $packAges[$key]['typename'] = "超级签下载";
} }
$packAges[$key]['create_time'] = date('Y-m-d H:i:s', $package['create_time']); $packAges[$key]['create_time'] = date('Y-m-d H:i:s', $package['create_time']);
$promoteInfo = M('promote', 'tab_')->field('account')->where(['id'=>$promote_id])->find(); $promoteInfo = M('promote', 'tab_')->field('account')->where(['id' => $promote_id])->find();
$packAges[$key]['promote_account'] = $promoteInfo['account']; $packAges[$key]['promote_account'] = $promoteInfo['account'];
$packAges[$key]['belongs_president'] = $belongs_president; $packAges[$key]['belongs_president'] = $belongs_president;
$packAges[$key]['belongs_department'] = $belongs_department; $packAges[$key]['belongs_department'] = $belongs_department;
$packAges[$key]['belongs_group'] = $belongs_group; $packAges[$key]['belongs_group'] = $belongs_group;
$packAges[$key]['account'] = encryption($packAges[$key]['account']); $packAges[$key]['account'] = getUserAccountOfPromote($packAges[$key]['account'], $loginPromote);
} }
$tfMap['promote_id'] = $promote_id; $tfMap['promote_id'] = $promote_id;
$tfMap['type'] = 2; $tfMap['type'] = 2;
$TFCounts = M('package_download_log', 'tab_')->where($tfMap)->count(); $TFCounts = M('package_download_log', 'tab_')->where($tfMap)->count();
$superMap['promote_id'] = $promote_id; $superMap['promote_id'] = $promote_id;
$superMap['type'] = 3; $superMap['type'] = 3;
$superCounts = M('package_download_log', 'tab_')->where($superMap)->count(); $superCounts = M('package_download_log', 'tab_')->where($superMap)->count();
$companyMap['promote_id'] = $promote_id; $companyMap['promote_id'] = $promote_id;
$companyMap['type'] = 1; $companyMap['type'] = 1;
$companyCounts = M('package_download_log', 'tab_')->where($companyMap)->count(); $companyCounts = M('package_download_log', 'tab_')->where($companyMap)->count();
@ -2874,8 +2828,8 @@ class QueryController extends BaseController
public function multisort($records, $column, $type = 'asc') public function multisort($records, $column, $type = 'asc')
{ {
$length = count($records); $length = count($records);
for ($i = 0; $i < $length; $i ++) { for ($i = 0; $i < $length; $i++) {
for ($j = $i + 1; $j < $length; $j ++) { for ($j = $i + 1; $j < $length; $j++) {
if ($type == 'asc') { if ($type == 'asc') {
if ($records[$i][$column] > $records[$j][$column]) { if ($records[$i][$column] > $records[$j][$column]) {
$temp = $records[$i]; $temp = $records[$i];
@ -2898,8 +2852,7 @@ class QueryController extends BaseController
{ {
$baseGameId = I('game_id', 0); $baseGameId = I('game_id', 0);
$deviceType = I('device_type', ''); $deviceType = I('device_type', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d')); $timeRange = I('time_range', date('Y-m-d', strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', '')); $sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1)); $sort = intval(I('sort', 1));
@ -2914,7 +2867,6 @@ class QueryController extends BaseController
$end = $timeRangeRow[0]; $end = $timeRangeRow[0];
} }
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote(); $levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote); $queryPromote = $this->getQueryPromote($levelPromote);
@ -2924,7 +2876,7 @@ class QueryController extends BaseController
$orderColumn = $sortName; $orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc'; $orderType = ($sort == 1) ? 'desc' : 'asc';
} }
$status = true; $status = true;
$data = false; $data = false;
$error = ''; $error = '';
@ -2934,7 +2886,7 @@ class QueryController extends BaseController
} }
$startTime = strtotime($start . ' 00:00:00'); $startTime = strtotime($start . ' 00:00:00');
$endTime = strtotime($end . ' 23:59:59') + 1; $endTime = strtotime($end . ' 23:59:59') + 1;
if ((($endTime - $startTime)/(24*3600)) > 31) { if ((($endTime - $startTime) / (24 * 3600)) > 31) {
$error = '时间间隔不能超过31天'; $error = '时间间隔不能超过31天';
$status = false; $status = false;
} }
@ -2963,7 +2915,7 @@ class QueryController extends BaseController
'game_ids' => $gameIds, 'game_ids' => $gameIds,
] ]
]); ]);
$result = (string)$response->getBody(); $result = (string)$response->getBody();
$result = json_decode($result, true); $result = json_decode($result, true);
if (!$result) { if (!$result) {
@ -2973,17 +2925,15 @@ class QueryController extends BaseController
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30]; $dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
$gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name']; $gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name'];
$promoteName = '全部'; $promoteName = '全部';
if ($promoteId) {
$promoteName = get_promote_account($promoteId);
}
foreach ($data as $key => $item) { foreach ($data as $key => $item) {
$item['promote_name'] = $promoteName; $item['promote_name'] = $promoteName;
$item['game_name'] = $gameName; $item['game_name'] = $gameName;
foreach ($dayList as $day) { foreach ($dayList as $day) {
if ($item['register_count'] > 0) { if ($item['register_count'] > 0) {
$item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100; $item['retention_day' . $day] = round($item['retention_day' . $day] / $item['register_count'], 4) * 100;
} else { } else {
$item['retention_day'. $day] = '--'; $item['retention_day' . $day] = '--';
} }
} }
$data[$key] = $item; $data[$key] = $item;
@ -3010,7 +2960,7 @@ class QueryController extends BaseController
{ {
$gameId = I('game_id', 0); $gameId = I('game_id', 0);
$serverId = I('server_id', ''); $serverId = I('server_id', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d')); $timeRange = I('time_range', date('Y-m-d', strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', '')); $lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', '')); $sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1)); $sort = intval(I('sort', 1));
@ -3029,7 +2979,7 @@ class QueryController extends BaseController
$start = $timeRangeRow[0]; $start = $timeRangeRow[0];
$end = $timeRangeRow[0]; $end = $timeRangeRow[0];
} }
$spendMap = ['pay_status' => 1, '_string' => '1=1']; $spendMap = ['pay_status' => 1, '_string' => '1=1'];
$roleMap = ['_string' => '1=1']; $roleMap = ['_string' => '1=1'];
$map = []; $map = [];
@ -3037,7 +2987,7 @@ class QueryController extends BaseController
$betweenTime = [strtotime($start . ' 00:00:00'), strtotime($end . ' 23:59:59')]; $betweenTime = [strtotime($start . ' 00:00:00'), strtotime($end . ' 23:59:59')];
$spendMap['pay_time'] = ['between', $betweenTime]; $spendMap['pay_time'] = ['between', $betweenTime];
$roleMap['create_time'] = ['between', $betweenTime]; $roleMap['create_time'] = ['between', $betweenTime];
$promoteService = new PromoteService(); $promoteService = new PromoteService();
$subInSql = $promoteService->subInSql($queryPromote); $subInSql = $promoteService->subInSql($queryPromote);

@ -348,7 +348,7 @@ class IndexController extends BaseController {
//生成二维码图片 //生成二维码图片
//echo $_SERVER['REQUEST_URI']; //echo $_SERVER['REQUEST_URI'];
ob_clean(); ob_clean();
$object = new \QRcode(); $object = new \QRcode(null);
echo $object->png($url, false, $errorCorrectionLevel, $matrixPointSize, 2); echo $object->png($url, false, $errorCorrectionLevel, $matrixPointSize, 2);
} }

Loading…
Cancel
Save