master
elf 2 years ago
parent 6f0b05fb04
commit 1b33139ee3

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

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

Loading…
Cancel
Save