@ -54,16 +54,28 @@ class QueryController extends BaseController
$userAccount = trim(I('user_account', ''));
$payOrderNumber = trim(I('pay_order_number', ''));
$nowTime = date('Y-m-d');
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$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');
< < < < < < < HEAD
$begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
$endTime += 3600 * 24;
=======
$begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
$endTime += 3600 * 24;
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$payedBegTime = I("payed_begtime", '');
if ($payedBegTime) $payedBegTime = strtotime($payedBegTime);
$payedEndTime = I("payed_endtime", '');
@ -78,7 +90,11 @@ class QueryController extends BaseController
$endTime = 0;
}
}
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$loginPromote = $this->getLoginPromote();
@ -136,16 +152,25 @@ class QueryController extends BaseController
if ($payedBegTime & & $payedEndTime) {
$map['tab_spend.payed_time'] = ['between', [$payedBegTime, $payedEndTime - 1]];
}
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$map = $this->spendRepository->withIsCheck($map, 'tab_spend.is_check');
$data = [];
$count = 0;
$income = '0.00';
< < < < < < < HEAD
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) {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$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')
@ -186,7 +211,11 @@ class QueryController extends BaseController
$promoteData = [];
if (!empty($promoteIdData)) {
$promoteIdData = array_unique($promoteIdData);
< < < < < < < HEAD
$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');
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
foreach ($data as & $list) {
switch ($list['level']) {
@ -215,12 +244,34 @@ class QueryController extends BaseController
$list['p_pro_group_remark'] = $promoteData[$list['parent_id']]['group_remark'];
break;
}
< < < < < < < HEAD
$list['user_account'] = getUserAccountOfPromote($list['user_account'], $loginPromote);
=======
$list['user_account'] = substr($list['user_account'], 0, 2) . '******' . substr($list['user_account'], 8);
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$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']);
< < < < < < < HEAD
$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);
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
}
@ -269,7 +320,11 @@ class QueryController extends BaseController
{
$page = intval(I('p', 1));
$row = intval(I('row', 10));
< < < < < < < HEAD
$ownId = intval(I('own_id'), 0); //本账号
=======
$ownId = intval(I('own_id'), 0);//本账号
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$account = trim(I('account', ''));
$id = intval(I('id', 0));
$nowTime = date('Y-m-d');
@ -326,6 +381,7 @@ class QueryController extends BaseController
->where($loginMap)
->order('login_time desc')
->find();
< < < < < < < HEAD
$list['new_login_time'] = date('Y-m-d H:i:s', $newLoginData['login_time']);
$list['new_login_ip'] = $newLoginData['login_ip'];
@ -333,6 +389,16 @@ class QueryController extends BaseController
if (!empty($list['device_number'])) {
$list['device_number'] = encryption($list['device_number']);
}
=======
$list['new_login_time'] = date('Y-m-d H:i:s', $newLoginData['login_time']);
$list['new_login_ip'] = $newLoginData['login_ip'];
$list['account'] = substr($list['account'], 0, 2) . '******' . substr($list['account'], 8);
if(!empty($list['device_number'])) {
$list['device_number'] = encryption($list['device_number']);
}
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
}
@ -582,6 +648,10 @@ 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);
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
} else {
$promote_child = get_zi_promote_id(PID);
if (empty($promote_child)) {
@ -601,10 +671,18 @@ class QueryController extends BaseController
$mmap = array($mapp, $map);
$user = A('User', 'Event');
$user->check_child_bill($model, $p, $mmap);
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
} else {
$this->meta_title = '子渠道结算';
$this->display();
}
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
public function generatesub()
@ -700,6 +778,10 @@ class QueryController extends BaseController
public function son_apply_withdraw($settlement_number = '')
{
$map['settlement_number'] = $settlement_number;
< < < < < < < HEAD
=======
$with_map['settlement_number'] = $totalSett['settlement_number'];
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$result = M("SonSettlement", "tab_")->where($map)->save(array('ti_status' => 0));
if ($result !== false) {
echo json_encode(array("status" => 1));
@ -711,6 +793,10 @@ class QueryController extends BaseController
public function audit_withdraw($settlement_number = '')
{
$map['settlement_number'] = $settlement_number;
< < < < < < < HEAD
=======
$with_map['settlement_number'] = $totalSett['settlement_number'];
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$result = M("SonSettlement", "tab_")->where($map)->save(array('ti_status' => 1));
if ($result !== false) {
$this->success('审核成功');
@ -945,6 +1031,10 @@ 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})";
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
$spend2 = D('Spend');
$data = M('Apply', 'tab_')->field('game_id, game_name')->where(['promote_id' => $promote_id])->order('game_id desc')->select();
@ -1062,6 +1152,10 @@ class QueryController extends BaseController
{
$this->meta_title = '留存统计';
A('User', 'Event')->retention_analysis();
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
public function details()
@ -1108,7 +1202,11 @@ class QueryController extends BaseController
$loginPromote = $this->getLoginPromote();
< < < < < < < HEAD
$ownId = intval(I('own_id'), 0); //本账号
=======
$ownId = intval(I('own_id'), 0);//本账号
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
if ($ownId) {
$params['promote_id'] = $queryPromote['id'];
} else {
@ -1150,6 +1248,7 @@ class QueryController extends BaseController
if (intval($endTime - $begTime) / (24 * 3600) < = 31) {
$userRepository = new UserRepository();
$spendRepository = new SpendRepository();
< < < < < < < HEAD
$roleNumList = $userRepository->getCreateRoleCountByDay($params); //创角数
$userNumList = $userRepository->getCreateRoleUserCountByDay($params); //创角用户
$newUserNumList = $userRepository->getNewCreateRoleUserCountByDay($params); //新创角用户
@ -1166,6 +1265,24 @@ class QueryController extends BaseController
$spendGenericList = $spendRepository->getPayAmountGroupByDayAndType($params); //通用币充值
$params['pay_way'] = -1;
$spendBindingList = $spendRepository->getPayAmountGroupByDayAndType($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);//充值总额
$params['pay_way'] = ['in', '1,2,3,4,5,6'];
$spendCashList = $spendRepository->getPayAmountGroupByDayAndType($params);//现金充值
$params['pay_way'] = 0;
$spendGenericList = $spendRepository->getPayAmountGroupByDayAndType($params);//通用币充值
$params['pay_way'] = -1;
$spendBindingList = $spendRepository->getPayAmountGroupByDayAndType($params);//绑定币充值
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
$allData['role_num'] = 0;
@ -1258,7 +1375,11 @@ class QueryController extends BaseController
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10));
< < < < < < < HEAD
$ownId = intval(I('own_id'), 0); //本账号
=======
$ownId = intval(I('own_id'), 0);//本账号
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$relationGameId = intval(I('relation_game_id', 0));
$sdkVersion = intval(I('sdk_version', 0));
$serverId = I('server_id', '');
@ -1284,9 +1405,15 @@ class QueryController extends BaseController
$parameter['own_id'] = $ownId;
$parameter['p'] = $page;
$parameter['row'] = $row;
< < < < < < < HEAD
$loginPromote = $this->getLoginPromote();
=======
$loginPromote = $this->getLoginPromote();
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$map = [];
$map = ['_string' => '1=1'];
if ($ownId) {
@ -1309,16 +1436,27 @@ class QueryController extends BaseController
$params['begin_time'] = $begTime;
$params['end_time'] = $endTime - 1;
< < < < < < < HEAD
$promoteService = new PromoteService();
$allGameIs = $promoteService->getHistoryGameIds($loginPromote);
=======
$promoteService = new PromoteService();
$allGameIs = $promoteService->getHistoryGameIds($loginPromote);
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
if ($allGameIs & & count($allGameIs) > 0) {
$map['_string'] .= ' and id in(' . implode(',', $allGameIs) . ')';
} else {
$map['_string'] .= '1=0';
}
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$data = M('game', 'tab_')->where($map)->order('sort desc,id desc')->page($page, $row)->select();
$count = M('game', 'tab_')->where($map)->count();
$records = [];
@ -1330,6 +1468,7 @@ class QueryController extends BaseController
$userRepository = new UserRepository();
$spendRepository = new SpendRepository();
< < < < < < < HEAD
$roleNumList = $userRepository->getCreateRoleCountByGame($params); //创角数
$userNumList = $userRepository->getCreateRoleUserCountByGame($params); //创角用户
$newUserNumList = $userRepository->getNewCreateRoleUserCountByGame($params); //新创角用户
@ -1346,6 +1485,24 @@ class QueryController extends BaseController
$spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params); //通用币充值
$params['pay_way'] = -1;
$spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($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);//充值总额
$params['pay_way'] = ['in', '1,2,3,4,5,6'];
$spendCashList = $spendRepository->getPayAmountGroupByGameAndType($params);//现金充值
$params['pay_way'] = 0;
$spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params);//通用币充值
$params['pay_way'] = -1;
$spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params);//绑定币充值
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
foreach ($data as $list) {
$gameId = $list['id'];
@ -1375,6 +1532,7 @@ class QueryController extends BaseController
}
$params['all_data'] = 1;
$params['game_ids'] = $allGameIs;
< < < < < < < HEAD
$allData['role_num'] = $userRepository->getCreateRoleCountByGame($params); //创角数
$allData['user_num'] = $userRepository->getCreateRoleUserCountByGame($params); //创角用户
$allData['new_user_num'] = $userRepository->getNewCreateRoleUserCountByGame($params); //新创角用户
@ -1392,6 +1550,25 @@ class QueryController extends BaseController
$allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params)); //通用币充值
$params['pay_way'] = -1;
$allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($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);//充值次数
unset($params['pay_way']);
$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));//现金充值
$params['pay_way'] = 0;
$allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//通用币充值
$params['pay_way'] = -1;
$allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//绑定币充值
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$allData['spend_discount'] = '0.00';
$allData['spend_voucher'] = '0.00';
}
@ -1463,12 +1640,20 @@ class QueryController extends BaseController
$promote = $_REQUEST['promote_id'];
if (PID == $promote) {
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
} else {
$pids = get_prmoote_chlid_account($promote);
$pro_arr = array_column($pids, 'id');
$pro_arr[] = $promote;
$promote = implode(',', $pro_arr);
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
$game = M('apply', 'tab_')
@ -1575,8 +1760,12 @@ class QueryController extends BaseController
public function viewRole($p = 0)
{
$promoteId = D('User')->where('id = %d', I('get.id'))->getField('promote_id');
< < < < < < < HEAD
$permission = hasPromotePermission(PID, $promoteId); //是否有该推广员权限
$loginPromote = $this->getLoginPromote();
=======
$permission = hasPromotePermission(PID, $promoteId);//是否有该推广员权限
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
if ($permission === false) {
$this->error('无推广员权限');
@ -1621,7 +1810,11 @@ class QueryController extends BaseController
if (!empty($data)) {
foreach ($data as & $list) {
< < < < < < < HEAD
$list['user_account'] = getUserAccountOfPromote($list['user_account'], $loginPromote);
=======
$list['user_account'] = substr($list['user_account'], 0, 2) . '******' . substr($list['user_account'], 8);
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
}
@ -1696,11 +1889,16 @@ class QueryController extends BaseController
$roleLevelBegin = intval(I('role_level_begin', 0));
$roleLevelEnd = intval(I('role_level_end', 0));
$headmanPromoteId = I('headman_promote_id', 0);
< < < < < < < HEAD
$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));
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
< < < < < < < HEAD
$loginPromote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote, function () use ($loginPromote) {
@ -1709,6 +1907,16 @@ class QueryController extends BaseController
return $promoteService->getTopPromote($loginPromote);
} else {
return $loginPromote;
=======
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote, function() use ($promote) {
if ($promote['shift_over_apply'] == 1) {
$promoteService = new PromoteService();
return $promoteService->getTopPromote($promote);
} else {
return $promote;
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
});
@ -1728,8 +1936,12 @@ class QueryController extends BaseController
}
if ($roleName != '') {
$map['role_name'] = ['like', '%' . $roleName . '%'];
< < < < < < < HEAD
}
if ($roleId != '') {
=======
}if ($roleId != '') {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$map['role_id'] = $roleId;
}
if ($userAccount != '') {
@ -1826,13 +2038,33 @@ class QueryController extends BaseController
// var_dump($records);die();
foreach ($records as $key => $value) {
< < < < < < < HEAD
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) {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$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']);
}
< < < < < < < HEAD
$records[$key]['user_account'] = getUserAccountOfPromote($value['user_account'], $loginPromote);
=======
$records[$key]['user_account'] = substr($value['user_account'], 0, $strLen) . $hideChar . substr($value['user_account'], $orderLen - $strLen);
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$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']);
@ -1858,7 +2090,11 @@ class QueryController extends BaseController
$this->assign('unique_user_count', $uniqueCountRow['user_count']);
$this->assign('unique_count', $uniqueCountRow['count']);
$this->assign('sort', $sort);
< < < < < < < HEAD
$this->assign('setdate', date('Y-m-d'));
=======
$this->assign('setdate', date('Y-m-d', $nowTime));
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$this->assign('games', $games);
$this->assign('records', $records);
$this->assign('pagination', $pagination);
@ -1893,7 +2129,11 @@ class QueryController extends BaseController
$nowTime = strtotime($nowTime);
$nowTimeEnd = $nowTime + 3600 * 24 - 1;
< < < < < < < HEAD
$loginPromote = $this->getLoginPromote();
=======
$promote = $this->getLoginPromote();
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
@ -2013,7 +2253,11 @@ 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) {
< < < < < < < HEAD
$list['user_account'] = empty($list['user_account']) ? '--' : getUserAccountOfPromote($list['user_account'], $loginPromote);
=======
$list['user_account'] = empty($list['user_account']) ? '--' : encryption($list['user_account']);
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$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'];
@ -2097,7 +2341,11 @@ class QueryController extends BaseController
if ($id > 0) {
$promoteId = D('Spend')->where('id = %d', $id)->getField('promote_id');
< < < < < < < HEAD
$permission = hasPromotePermission(PID, $promoteId); //是否有该推广员权限
=======
$permission = hasPromotePermission(PID, $promoteId);//是否有该推广员权限
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
if ($permission) {
$map['id'] = $id;
@ -2223,7 +2471,11 @@ class QueryController extends BaseController
// $newCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds($ids, $params);
$newCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds($ids, $params);
$loginUserCountList = $promoteRepository->getLoginUserCountByIds($ids, $params);
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$rechargeCountList = [];
$rechargeUserCountList = [];
$rechargeAmountList = [];
@ -2438,7 +2690,11 @@ class QueryController extends BaseController
$record = [
'id' => $parent['id'],
'account' => $parent['account'],
< < < < < < < HEAD
'real_name' => hideRealName($parent['real_name']),
=======
'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').'**',
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
'level' => $parent['level'],
'game_name' => $game['game_name'],
'sdk_version_text' => $game['sdk_version_text'],
@ -2453,7 +2709,11 @@ class QueryController extends BaseController
$record = [
'id' => $id,
'account' => $promote['account'],
< < < < < < < HEAD
'real_name' => hideRealName($promote['real_name']),
=======
'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').'**',
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
'level' => $promote['level'],
'game_name' => $game['game_name'],
'sdk_version_text' => $game['sdk_version_text'],
@ -2490,7 +2750,10 @@ class QueryController extends BaseController
$roleLevelEnd = intval(I('level_end', 0));
$promoteId = I('promote_id', 0);
$isSelf = I('is_self', 0);
< < < < < < < HEAD
$loginPromote = $this->getLoginPromote();
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
if ($relationGameId != 0 || $sdkVersion != 0) {
$gameIds = gameSearch($relationGameId, $sdkVersion);
@ -2525,7 +2788,24 @@ 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) {
< < < < < < < HEAD
$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);
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
$this->assign('records', $records);
@ -2583,8 +2863,12 @@ class QueryController extends BaseController
return M('server', 'tab_')->where($map)->getField('server_name');
}
< < < < < < < HEAD
public function iosDownLoadData()
{
=======
public function iosDownLoadData() {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10));
@ -2595,7 +2879,11 @@ class QueryController extends BaseController
$map = [];
if ($queryPromote['level'] == 4) {
$map['id'] = $queryPromote['id'];
< < < < < < < HEAD
} else {
=======
}else {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '%'];
}
$iostime = time();
@ -2636,11 +2924,16 @@ class QueryController extends BaseController
$map = [];
$map['tab_package_download_log.promote_id'] = ['in', $ids];
< < < < < < < HEAD
// $data = M('package_download_log','tab_')->where($map)->select();
=======
// $data = M('package_download_log','tab_')->where($map)->select();
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$listData = [];
$allUserMap['promote_id'] = ['in', $allids];
$allUserMap['device_type'] = 2;
$allUserMap['register_time'] = ['between', [$begTime, $endTime]];
< < < < < < < HEAD
$allTFMap['promote_id'] = ['in', $allids];
$allTFMap['type'] = 2;
$allTFMap['create_time'] = ['between', [$begTime, $endTime]];
@ -2648,6 +2941,15 @@ class QueryController extends BaseController
$allSuperMap['type'] = 3;
$allSuperMap['create_time'] = ['between', [$begTime, $endTime]];
$companyMap['promote_id'] = ['in', $allids];
=======
$allTFMap['promote_id'] = ['in', $allids];
$allTFMap['type'] = 2;
$allTFMap['create_time'] = ['between', [$begTime, $endTime]];
$allSuperMap['promote_id'] = ['in', $allids];
$allSuperMap['type'] = 3;
$allSuperMap['create_time'] = ['between', [$begTime, $endTime]];
$companyMap['promote_id'] = ['in', $allids];
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$companyMap['type'] = 1;
$companyMap['create_time'] = ['between', [$begTime, $endTime]];
$alliosMap['promote_id'] = ['in', $allids];
@ -2655,19 +2957,33 @@ class QueryController extends BaseController
$alliosMap['register_time'] = ['between', [$sunday, $iostime]];
$allUsersCounts = M('user', 'tab_')->where($allUserMap)->count();
$allIosCounts = M('user', 'tab_')->where($alliosMap)->count();
< < < < < < < HEAD
$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();
=======
$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();
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
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;
< < < < < < < HEAD
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 {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$listData[$key]['account'] = $promote['account'];
}
$iosTimeMap['promote_id'] = $id;
@ -2690,23 +3006,37 @@ class QueryController extends BaseController
$usersCounts = M('user', 'tab_')->where($map10)->count();
$listData[$key]['userscounts'] = intval($usersCounts);
$listData[$key]['tfcounts'] = intval($tfCounts);
< < < < < < < HEAD
$listData[$key]['tfpercent'] = number_format((intval($tfCounts) / intval($usersCounts)), 2, '.', '') * 100;
if (intval($usersCounts) == 0) {
$listData[$key]['tfpercent'] = 0;
}
if ($promote['level'] == 1) {
=======
$listData[$key]['tfpercent'] = number_format((intval($tfCounts) / intval($usersCounts)),2,'.','') * 100;
if (intval($usersCounts) == 0) {
$listData[$key]['tfpercent'] = 0;
}
if($promote['level'] == 1) {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$listData[$key]['belongs_president'] = $promote['account'];
$listData[$key]['belongs_department'] = "无所属部门长";
$listData[$key]['belongs_group'] = "无所属组长";
}
if ($promote['level'] == 2) {
< < < < < < < HEAD
$parentPromote = M('promote', 'tab_')->field('account')->where(['id' => $promote['parent_id']])->select();
=======
$parentPromote = M('promote', 'tab_')->field('account')->where(['id'=>$promote['parent_id']])->select();
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$listData[$key]['belongs_president'] = $parentPromote[0]['account'];
$listData[$key]['belongs_department'] = $promote['account'];
$listData[$key]['belongs_group'] = "无所属组长";
}
if ($promote['level'] == 3) {
< < < < < < < HEAD
$chainArr = explode('/', $chain);
$presidentAccount = M('promote', 'tab_')->where(['id' => $chainArr[1]])->getField('account');
$departmentAccount = M('promote', 'tab_')->where(['id' => $chainArr[2]])->getField('account');
@ -2726,6 +3056,27 @@ class QueryController extends BaseController
}
}
$totalpercent = number_format($allTFCounts / $allUsersCounts, 2, '.', '') * 100;
=======
$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;
}
}
$totalpercent = number_format($allTFCounts/$allUsersCounts,2,'.','') * 100;
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
if ($allUsersCounts == 0) {
$totalpercent = '0';
}
@ -2739,6 +3090,7 @@ class QueryController extends BaseController
$this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime);
$this->assign('allIosCounts', $allIosCounts);
< < < < < < < HEAD
$this->display();
}
@ -2779,12 +3131,56 @@ class QueryController extends BaseController
$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) {
=======
$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;
//$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) {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$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'] = "企业签下载";
}
< < < < < < < HEAD
if ($package['type'] == 2) {
$packAges[$key]['typename'] = "TF下载";
}
@ -2793,20 +3189,42 @@ class QueryController extends BaseController
}
$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();
=======
if($package['type'] == 2) {
$packAges[$key]['typename'] = "TF下载";
}
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();
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$packAges[$key]['promote_account'] = $promoteInfo['account'];
$packAges[$key]['belongs_president'] = $belongs_president;
$packAges[$key]['belongs_department'] = $belongs_department;
$packAges[$key]['belongs_group'] = $belongs_group;
< < < < < < < HEAD
$packAges[$key]['account'] = getUserAccountOfPromote($packAges[$key]['account'], $loginPromote);
}
$tfMap['promote_id'] = $promote_id;
$tfMap['type'] = 2;
=======
$packAges[$key]['account'] = encryption($packAges[$key]['account']);
}
$tfMap['promote_id'] = $promote_id;
$tfMap['type'] = 2;
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$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();
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$companyMap['promote_id'] = $promote_id;
$companyMap['type'] = 1;
$companyCounts = M('package_download_log', 'tab_')->where($companyMap)->count();
@ -2827,8 +3245,13 @@ class QueryController extends BaseController
public function multisort($records, $column, $type = 'asc')
{
$length = count($records);
< < < < < < < HEAD
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 ++) {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
if ($type == 'asc') {
if ($records[$i][$column] > $records[$j][$column]) {
$temp = $records[$i];
@ -2851,7 +3274,11 @@ class QueryController extends BaseController
{
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
< < < < < < < HEAD
$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'));
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
@ -2877,7 +3304,11 @@ class QueryController extends BaseController
$orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc';
}
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$status = true;
$data = false;
$error = '';
@ -2887,7 +3318,11 @@ class QueryController extends BaseController
}
$startTime = strtotime($start . ' 00:00:00');
$endTime = strtotime($end . ' 23:59:59') + 1;
< < < < < < < HEAD
if ((($endTime - $startTime) / (24 * 3600)) > 31) {
=======
if ((($endTime - $startTime)/(24*3600)) > 31) {
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$error = '时间间隔不能超过31天';
$status = false;
}
@ -2916,7 +3351,11 @@ class QueryController extends BaseController
'game_ids' => $gameIds,
]
]);
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$result = (string)$response->getBody();
$result = json_decode($result, true);
if (!$result) {
@ -2926,14 +3365,26 @@ class QueryController extends BaseController
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
$gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name'];
$promoteName = '全部';
< < < < < < < HEAD
=======
if ($promoteId) {
$promoteName = get_promote_account($promoteId);
}
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
foreach ($data as $key => $item) {
$item['promote_name'] = $promoteName;
$item['game_name'] = $gameName;
foreach ($dayList as $day) {
if ($item['register_count'] > 0) {
< < < < < < < HEAD
$item['retention_day' . $day] = round($item['retention_day' . $day] / $item['register_count'], 4) * 100;
} else {
$item['retention_day' . $day] = '--';
=======
$item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100;
} else {
$item['retention_day'. $day] = '--';
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
}
}
$data[$key] = $item;
@ -2961,7 +3412,11 @@ class QueryController extends BaseController
{
$gameId = I('game_id', 0);
$serverId = I('server_id', '');
< < < < < < < HEAD
$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'));
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
@ -2980,7 +3435,11 @@ class QueryController extends BaseController
$start = $timeRangeRow[0];
$end = $timeRangeRow[0];
}
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$spendMap = ['pay_status' => 1, '_string' => '1=1'];
$roleMap = ['_string' => '1=1'];
$map = [];
@ -2988,7 +3447,11 @@ 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];
< < < < < < < HEAD
=======
>>>>>>> a2bb9f000757e13fa3ca589d6763340af1fcf41a
$promoteService = new PromoteService();
$subInSql = $promoteService->subInSql($queryPromote);