@ -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;
@ -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')
@ -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);
}
}
}
}
@ -349,7 +335,6 @@ class QueryController extends BaseController
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()
@ -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_')
@ -1602,6 +1578,7 @@ class QueryController extends BaseController
{
{
$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 );
}
}
}
}
@ -1727,14 +1704,14 @@ class QueryController extends BaseController
$sort = intval(I('sort', 1));
$sort = intval(I('sort', 1));
$p romote = $this->getLoginPromote();
$loginP romote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote, function() use ($p romote) {
$queryPromote = $this->getQueryPromote($levelPromote, function () use ($loginP romote) {
if ($p romote['shift_over_apply'] == 1) {
if ($loginP romote['shift_over_apply'] == 1) {
$promoteService = new PromoteService();
$promoteService = new PromoteService();
return $promoteService->getTopPromote($p romote);
return $promoteService->getTopPromote($loginP romote);
} else {
} else {
return $p romote;
return $loginP romote;
}
}
});
});
@ -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) {
//隐藏算法
$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']);
$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;
$p romote = $this->getLoginPromote();
$loginP romote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$queryPromote = $this->getQueryPromote($levelPromote);
@ -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'];
@ -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));
@ -2784,16 +2739,17 @@ 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'];
$promote_id = $_REQUEST['promote_id'];
$belongs_president = $_REQUEST['belongs_president'];
$belongs_president = $_REQUEST['belongs_president'];
$belongs_department = $_REQUEST['belongs_department'];
$belongs_department = $_REQUEST['belongs_department'];
$belongs_group = $_REQUEST['belongs_group'];
$belongs_group = $_REQUEST['belongs_group'];
// $createTime = I('create_time', '');
// $createTime = I('create_time', '');
$loginPromote = $this->getLoginPromote();
$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)));
@ -2818,7 +2774,6 @@ class QueryController extends BaseController
}
}
if (!empty(I('type'))) {
if (!empty(I('type'))) {
$map['type'] = 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();
@ -2843,8 +2798,7 @@ class QueryController extends BaseController
$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;
@ -2899,7 +2853,6 @@ 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);
@ -2973,9 +2925,7 @@ 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;