|
|
|
@ -8983,6 +8983,7 @@ class ExportController extends Controller
|
|
|
|
|
array('status','状态'),
|
|
|
|
|
array('user_account','游戏账号'),
|
|
|
|
|
array('creator','创单人'),
|
|
|
|
|
array('handler','创单人'),
|
|
|
|
|
array('created_time', '创单时间'),
|
|
|
|
|
array('score', '分数'),
|
|
|
|
|
array('attachment_type', '附件')
|
|
|
|
@ -8994,6 +8995,7 @@ class ExportController extends Controller
|
|
|
|
|
$item['type'] = $item['type'] == 1 ? '资源' : '反馈';
|
|
|
|
|
$item['status'] = $item['status'] == 1 ? '完成' : '处理中';
|
|
|
|
|
$item['creator'] = get_admin_name($item['creator_id']);
|
|
|
|
|
$item['handler'] = get_admin_name($item['handler_id']);
|
|
|
|
|
$item['created_time'] = date('Y-m-d H:i:s', $item['created_time']);
|
|
|
|
|
$item['attachment_type'] = empty($item['attachment_url']) ? '无' : '有';
|
|
|
|
|
$item['order_no'] = "\t{$item['order_no']}";
|
|
|
|
@ -9035,13 +9037,17 @@ class ExportController extends Controller
|
|
|
|
|
$pdlMap .= " and pdl.create_time < {$endTime}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($info['level'] == PromoteModel::LEVEL_GROUP_LEADER) {
|
|
|
|
|
if ($level == PromoteModel::LEVEL_TEAM_MEMBER) {
|
|
|
|
|
$beginThisweek = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y"));
|
|
|
|
|
$endThisweek = mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y"));
|
|
|
|
|
$xlsData = M('promote', 'tab_')->alias('p')
|
|
|
|
|
->field('p.id, p.level, p.account, count(pdl.id) as lowerCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount')
|
|
|
|
|
->field('p.id, p.level, p.account, count(u.id) as iosCount, count(if (u.register_time between '. $beginThisweek . ' and ' . $endThisweek .', 1, null)) as weekCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount')
|
|
|
|
|
->join("tab_package_download_log pdl on pdl.promote_id = p.id $pdlMap", 'left')
|
|
|
|
|
->join("tab_user u on u.promote_id = p.id and u.device_type=2", 'left')
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('p.id')
|
|
|
|
|
->select();
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
$xlsData = M('promote', 'tab_')->alias('p')
|
|
|
|
|
->field('p.id, p.level, p.account, count(if(p2.level = '.($level+1).', 1, null)) as lowerCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount')
|
|
|
|
@ -9051,14 +9057,28 @@ class ExportController extends Controller
|
|
|
|
|
->group('p.id')
|
|
|
|
|
->select();
|
|
|
|
|
}
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('account', PromoteModel::$levelArr[$level]."账号"),
|
|
|
|
|
array('lowercount', PromoteModel::$levelArr[$level+1]."数量"),
|
|
|
|
|
array('tfcount', 'TF下载数'),
|
|
|
|
|
array('supersigncount', "超级签下载数"),
|
|
|
|
|
array('signcount', "企业签下载数"),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($level == PromoteModel::LEVEL_TEAM_MEMBER) {
|
|
|
|
|
foreach($xlsData as &$item) {
|
|
|
|
|
$item['tfcount'] = $item['tfcount'] . "(" . (empty($item['ioscount']) ? 0 : round( ($item['tfcount'] / $item['ioscount']) * 100 , 2)) . ")%";
|
|
|
|
|
}
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('account', PromoteModel::$levelArr[$level]."账号"),
|
|
|
|
|
array('ioscount', "iOS用户总数"),
|
|
|
|
|
array('weekcount', "新增iOS用户总数"),
|
|
|
|
|
array('tfcount', 'TF下载数/iOS用户总数'),
|
|
|
|
|
array('supersigncount', "超级签下载数"),
|
|
|
|
|
array('signcount', "企业签下载数"),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('account', PromoteModel::$levelArr[$level]."账号"),
|
|
|
|
|
array('lowercount', PromoteModel::$levelArr[$level+1]."数量"),
|
|
|
|
|
array('tfcount', 'TF下载数'),
|
|
|
|
|
array('supersigncount', "超级签下载数"),
|
|
|
|
|
array('signcount', "企业签下载数"),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
$this->exportAddOperationLog('Statistics/packDownload','统计-IOS下载统计-导出');
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
}
|
|
|
|
@ -9157,4 +9177,86 @@ class ExportController extends Controller
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function exportWorkOrderStatistics()
|
|
|
|
|
{
|
|
|
|
|
$order = '';
|
|
|
|
|
if ($_REQUEST['data_order'] != '') {
|
|
|
|
|
$data_order = reset(explode(',', $_REQUEST['data_order']));
|
|
|
|
|
$data_order_type = end(explode(',', $_REQUEST['data_order']));
|
|
|
|
|
$this->assign('userarpu_order', $data_order);
|
|
|
|
|
$this->assign('userarpu_order_type', $data_order_type);
|
|
|
|
|
$order = 'order by ' . $data_order_type . " " . ($data_order == 3 ? 'desc' : 'asc');
|
|
|
|
|
}
|
|
|
|
|
$map = '1=1';
|
|
|
|
|
if (!empty(I('nickname'))) {
|
|
|
|
|
$map .= " and t.nickname = '" . I('nickname') . "'";
|
|
|
|
|
}
|
|
|
|
|
// 获取所有传单或者接单用户id
|
|
|
|
|
$userids = M('work_order_info', 'tab_')
|
|
|
|
|
->field("concat(creator_id, ',', handler_id) as userid")
|
|
|
|
|
->join('sys_member as t on creator_id = t.uid or handler_id = t.uid')
|
|
|
|
|
->where($map)
|
|
|
|
|
->select();
|
|
|
|
|
if (empty($userids)) {
|
|
|
|
|
$list = [];
|
|
|
|
|
$count = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$userids = implode(',', array_unique(array_filter(explode(',', implode(',', array_column($userids, 'userid'))))));
|
|
|
|
|
$count = count($userids);
|
|
|
|
|
$list = M('work_order_info', 'tab_')->query("SELECT
|
|
|
|
|
t.id,
|
|
|
|
|
t.nickname,
|
|
|
|
|
sum(total_create_count) as total_create_count,
|
|
|
|
|
sum(total_accepted_count) as total_accepted_count,
|
|
|
|
|
sum(total_handle_count) as total_handle_count,
|
|
|
|
|
sum(total_complete_count) as total_complete_count
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
u.uid as id,
|
|
|
|
|
u.nickname,
|
|
|
|
|
count(*) AS total_create_count,
|
|
|
|
|
count(
|
|
|
|
|
|
|
|
|
|
IF (i.`handler_id` > 0, 1, NULL)
|
|
|
|
|
) AS total_accepted_count,
|
|
|
|
|
NULL AS total_handle_count,
|
|
|
|
|
NULL AS total_complete_count
|
|
|
|
|
FROM
|
|
|
|
|
sys_member u
|
|
|
|
|
LEFT JOIN tab_work_order_info i ON i.creator_id = u.uid
|
|
|
|
|
WHERE
|
|
|
|
|
u.uid in ({$userids})
|
|
|
|
|
GROUP BY u.uid
|
|
|
|
|
UNION
|
|
|
|
|
SELECT
|
|
|
|
|
u.uid as id,
|
|
|
|
|
u.nickname,
|
|
|
|
|
NULL AS total_create_count,
|
|
|
|
|
NULL AS total_accepted_count,
|
|
|
|
|
count(*) AS total_handle_count,
|
|
|
|
|
count(IF(i.`status` = 1, 1, NULL)) AS total_complete_count
|
|
|
|
|
FROM
|
|
|
|
|
sys_member u
|
|
|
|
|
JOIN tab_work_order_info i ON i.handler_id = u.uid
|
|
|
|
|
WHERE
|
|
|
|
|
u.uid in ({$userids})
|
|
|
|
|
GROUP BY u.uid
|
|
|
|
|
) AS t
|
|
|
|
|
where {$map}
|
|
|
|
|
GROUP BY t.id
|
|
|
|
|
$order");
|
|
|
|
|
}
|
|
|
|
|
$xlsName = '工单统计报表';
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('nickname', "账号"),
|
|
|
|
|
array('total_create_count', "发布工单数"),
|
|
|
|
|
array('total_accepted_count', '被接手工单数'),
|
|
|
|
|
array('total_handle_count', "接手工单数"),
|
|
|
|
|
array('total_complete_count', "完成工单数"),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$this->exportAddOperationLog('Statistics/exportWorkOrderStatistics','用户-工单统计-导出');
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|