ios 下载新需求

master
sunke 5 years ago
parent 4cebf390fa
commit 7a392806bf

@ -255,19 +255,15 @@ class DownloadController extends BaseController {
$map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
}
$createTime = I('create_time', '');
if ($createTime != '') {
$createTimeRow = explode(' 至 ', $createTime);
$createTimeBegin = 0;
$createTimeEnd = 0;
if (count($createTimeRow) == 2) {
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[1] . ' 23:59:59');
} else {
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[0] . ' 23:59:59');
}
$map['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
}
$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]];
$map['pid'] = PID;
$conditions = json_encode($map,TRUE);
$addtime = time();
@ -2343,7 +2339,8 @@ public function iosDetailExcelInfo($id,$map) {
$xlsName ="IOS下载数统计";
$xlsCell = array(
'推广员账号',
'玩家人数',
'IOS用户总数',
'新增IOS用户总数',
'TF下载次数',
'超级签下载次数',
'企业签下载次数',
@ -2357,10 +2354,15 @@ public function iosDetailExcelInfo($id,$map) {
$map1['chain'] = $map['chain'];
}
if (!empty($map['create_time'])) {
$map1['create_time'] = $map['create_time'];
// $map1['create_time'] = $map['create_time'];
$tfMap['create_time'] = $map['create_time'];
$companyMap['create_time'] = $map['create_time'];
$superMap['create_time'] = $map['create_time'];
$allTFMap['create_time'] = $map['create_time'];
$companyMap['create_time'] = $map['create_time'];
$allSuperMap['create_time'] = $map['create_time'];
$iosTimeMap['register_time'] = $map['create_time'];
$alliosMap['register_time'] = $map['create_time'];
}
if (!empty($map['id'])) {
$map1['id'] = $map['id'];
@ -2372,6 +2374,7 @@ public function iosDetailExcelInfo($id,$map) {
$allids = array_column($rs, 'id');
array_push($allids, PID);
$allUserMap['promote_id'] = ['in', $allids];
$allUserMap['device_type'] = 2;
$allTFMap['promote_id'] = ['in', $allids];
$allTFMap['type'] = 2;
$allSuperMap['promote_id'] = ['in', $allids];
@ -2382,6 +2385,9 @@ public function iosDetailExcelInfo($id,$map) {
$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();
$alliosMap['promote_id'] = ['in', $allids];
$alliosMap['device_type'] = 2;
$allIosCounts = M('user', 'tab_')->where($alliosMap)->count();
$csvFileName = $xlsName.'.csv';
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.ms-excel');
@ -2406,13 +2412,14 @@ public function iosDetailExcelInfo($id,$map) {
$promote1 = M('promote', 'tab_')->field('account, level, parent_id, chain')->where(['id' => $id])->select();
$promote = $promote1[0];
$chain = $promote['chain'];
//$csvData['promote_id'] = $id;
if($id == PID) {
$csvData['account'] = $promote['account'].'[自己]';
}else {
$csvData['account'] = $promote['account'];
}
$iosTimeMap['promote_id'] = $id;
$iosTimeMap['device_type'] = 2;
$iosCount = M('user', 'tab_')->where($iosTimeMap)->count();
$tfMap['promote_id'] = $id;
$tfMap['type'] = 2;
$companyMap['promote_id'] = $id;
@ -2423,8 +2430,13 @@ public function iosDetailExcelInfo($id,$map) {
$companyCounts = M('package_download_log', 'tab_')->where($companyMap)->count(); //企业签下载量
$superCounts = M('package_download_log', 'tab_')->where($superMap)->count(); //超级签下载量
$usersCounts = M('user', 'tab_')->where(['promote_id' => $id])->count();
$tfpercent = 1;
if ($iosCount == 0) {
$tfpercent = 0;
}
$csvData['userscounts'] = intval($usersCounts);
$csvData['tfcounts'] = intval($tfCounts);
$csvData['ioscount'] = $iosCount;
$csvData['tfcounts'] = intval($tfCounts).'('.$tfpercent.'%)';
$csvData['supercounts'] = intval($superCounts);
$csvData['companycounts'] = intval($companyCounts);
@ -2467,6 +2479,7 @@ public function iosDetailExcelInfo($id,$map) {
}
$allData['account'] = '汇总';
$allData['userscounts'] = $allUsersCounts;
$allData['iosycounts'] = $allIosCounts;
$allData['tfcounts'] = $allTFCounts;
$allData['supercounts'] = $allSuperCounts;
$allData['companycounts'] = $allCompanyCounts;

@ -2491,7 +2491,6 @@ class QueryController extends BaseController
}
public function iosDownLoadData() {
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10));
@ -2504,31 +2503,32 @@ class QueryController extends BaseController
}else {
$map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
}
$createTime = I('create_time', '');
if ($createTime != '') {
$createTimeRow = explode(' 至 ', $createTime);
$createTimeBegin = 0;
$createTimeEnd = 0;
if (count($createTimeRow) == 2) {
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[1] . ' 23:59:59');
} else {
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[0] . ' 23:59:59');
}
$tfMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
$companyMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
$superMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
$iostime = time();
$sunday = strtotime('-1 sunday', $iostime) + 24 * 3600;
if (I('begtime') && I('endtime')) {
$iostime = strtotime(I('endtime'));
$sunday = strtotime(I('begtime'));
}
$iosTimeMap['register_time'] = ['between', [$sunday, $iostime]];
$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;
$tfMap['create_time'] = ['between', [$begTime, $endTime]];
$companyMap['create_time'] = ['between', [$begTime, $endTime]];
$superMap['create_time'] = ['between', [$begTime, $endTime]];
$query = M('promote', 'tab_')->field(['id'])->where($map);
list($promotes, $pagination, $count) = $this->paginate($query);
$ids = array_column($promotes, 'id');
if ($page == 1) {
array_push($ids, PID);
}
// var_dump($ids);die();
// $ids = M('promote', 'tab_')->where($map)->getField('id', true);
// $ids[] = $queryPromote['id'];
$allPromote = M('promote', 'tab_')->field(['id'])->where($map)->select();
$allids = array_column($allPromote, 'id');
array_push($allids, PID);
@ -2538,13 +2538,22 @@ class QueryController extends BaseController
// $data = M('package_download_log','tab_')->where($map)->select();
$listData = [];
$allUserMap['promote_id'] = ['in', $allids];
$allUserMap['device_type'] = 2;
$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];
$companyMap['type'] = 1;
$companyMap['create_time'] = ['between', [$begTime, $endTime]];
$alliosMap['promote_id'] = ['in', $allids];
$alliosMap['device_type'] = 2;
$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();
@ -2559,6 +2568,10 @@ class QueryController extends BaseController
}else {
$listData[$key]['account'] = $promote['account'];
}
$iosTimeMap['promote_id'] = $id;
$iosTimeMap['device_type'] = 2;
$iosCount = M('user', 'tab_')->where($iosTimeMap)->count();
$listData[$key]['ioscount'] = $iosCount;
$tfMap['promote_id'] = $id;
$tfMap['type'] = 2;
$companyMap['promote_id'] = $id;
@ -2569,9 +2582,13 @@ class QueryController extends BaseController
$companyCounts = M('package_download_log', 'tab_')->where($companyMap)->count(); //企业签下载量
$superCounts = M('package_download_log', 'tab_')->where($superMap)->count(); //超级签下载量
$listData[$key]['tfcounts'] = intval($tfCounts);
$listData[$key]['tfpercent'] = (intval($tfcounts) / intval($iosCount)) * 100;
if (intval($iosCount) == 0) {
$listData[$key]['tfpercent'] = 0;
}
$listData[$key]['companycounts'] = intval($companyCounts);
$listData[$key]['supercounts'] = intval($superCounts);
$usersCounts = M('user', 'tab_')->where(['promote_id' => $id])->count();
$usersCounts = M('user', 'tab_')->where(['promote_id' => $id, 'device_type' => 2])->count();
$listData[$key]['userscounts'] = intval($usersCounts);
if($promote['level'] == 1) {
$listData[$key]['belongs_president'] = $promote['account'];
@ -2610,6 +2627,10 @@ class QueryController extends BaseController
$this->assign('totalsupercounts', $allSuperCounts);
$this->assign('pagination', $pagination);
$this->assign('totalcompanycounts', $allCompanyCounts);
$this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime);
$this->assign('allIosCounts', $allIosCounts);
$this->assign('tfpercent', $tfpercent);
$this->display();
}
@ -2619,22 +2640,21 @@ class QueryController extends BaseController
$belongs_department = $_REQUEST['belongs_department'];
$belongs_group = $_REQUEST['belongs_group'];
$createTime = I('create_time', '');
if ($createTime != '') {
$createTimeRow = explode(' 至 ', $createTime);
$createTimeBegin = 0;
$createTimeEnd = 0;
if (count($createTimeRow) == 2) {
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[1] . ' 23:59:59');
} else {
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[0] . ' 23:59:59');
}
$map['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
$tfMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
$superMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
$companyMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
}
$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;

@ -25,9 +25,15 @@
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
<include file="Public/promote_select" />
<div class="form-group normal_space fr">
<label>创建时间:</label>
<input type="text" class="txt range-date" name="create_time" placeholder="创建时间" value="{:I('create_time')}" >
<div class="form-group normal_space fr" style="display: flex;">
<label class="form-title select-title" style="position: relative;">创建时间:</label>
<div class="select-time">
<input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{$initBegTime}">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="结束时间" value="{$initEndTime}">
</div>
</div>
<div class="form-group normal_space">
<input type="submit" class="submit" id='submit' url="{:U('Query/iosDownLoadData','model='.$model['name'],false)}"
@ -38,7 +44,8 @@
<table class="table normal_table">
<tr class="odd">
<th>推广员账号</th>
<th>玩家人数</th>
<th>IOS用户总数</th>
<th>新增IOS用户总数</th>
<th>TF下载次数</th>
<th>超级签下载次数</th>
<th>企业签下载次数</th>
@ -54,7 +61,8 @@
<tr>
<td>{$data.account}</td>
<td>{$data.userscounts}</td>
<td>{$data.tfcounts}</td>
<td>{$data.ioscount}</td>
<td>{$data.tfcounts}({$data.tfpercent}%)</td>
<td>{$data.supercounts}</td>
<td>{$data.companycounts}</td>
<td>{$data.belongs_president}</td>
@ -68,6 +76,7 @@
<tr>
<td>汇总(所有数据)</td>
<td>{$totaluserscounts}</td>
<td>{$allIosCounts}</td>
<td>{$totaltfcounts}</td>
<td>{$totalsupercounts}</td>
<td>{$totalcompanycounts}</td>
@ -99,23 +108,58 @@
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script>
setValue('row', '{:I("get.row",10)}');
$(".select_gallery").select2();
var date = "{$setdate}";
console.log(date);
$('#sdate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
$('#edate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left',
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
});
</script>
<script type="text/javascript">
$(function() {
setValue('row', '{:I("get.row",10)}');
var defaultDate = $('.range-date').val()
defaultDate = defaultDate == '' ? [] : defaultDate.split(' 至 ')
$('.range-date').flatpickr({
mode: 'range',
locale: 'zh',
dateFormat: "Y-m-d",
defaultDate: defaultDate,
})
//defaultDate = defaultDate == '' ? [] : defaultDate.split(' 至 ')
// $('.range-date').flatpickr({
// mode: 'range',
// locale: 'zh',
// dateFormat: "Y-m-d",
// defaultDate: defaultDate,
// })
$('.select_gallery').select2()
var gameId = $('#game-select').val();
var sdkVersion = $('#sdk_version').val();

Loading…
Cancel
Save