|
|
|
@ -9039,7 +9039,7 @@ class ExportController extends Controller
|
|
|
|
|
$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(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')
|
|
|
|
|
->field('count(distinct(u.id)) as iosCount, count(distinct(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")
|
|
|
|
|
->where($map)
|
|
|
|
@ -9187,13 +9187,13 @@ class ExportController extends Controller
|
|
|
|
|
$order = 'order by ' . $data_order_type . " " . ($data_order == 3 ? 'desc' : 'asc');
|
|
|
|
|
}
|
|
|
|
|
$map = '1=1';
|
|
|
|
|
if (!empty(I('user_account'))) {
|
|
|
|
|
$map .= " and t.account = '" . I('user_account') . "'";
|
|
|
|
|
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('tab_user as t on creator_id = t.id or handler_id = t.id')
|
|
|
|
|
->join('sys_member as t on creator_id = t.uid or handler_id = t.uid')
|
|
|
|
|
->where($map)
|
|
|
|
|
->select();
|
|
|
|
|
if (empty($userids)) {
|
|
|
|
@ -9204,7 +9204,7 @@ class ExportController extends Controller
|
|
|
|
|
$count = count($userids);
|
|
|
|
|
$list = M('work_order_info', 'tab_')->query("SELECT
|
|
|
|
|
t.id,
|
|
|
|
|
t.account,
|
|
|
|
|
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,
|
|
|
|
@ -9212,8 +9212,8 @@ class ExportController extends Controller
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
u.id,
|
|
|
|
|
u.account,
|
|
|
|
|
u.uid as id,
|
|
|
|
|
u.nickname,
|
|
|
|
|
count(*) AS total_create_count,
|
|
|
|
|
count(
|
|
|
|
|
|
|
|
|
@ -9222,25 +9222,25 @@ class ExportController extends Controller
|
|
|
|
|
NULL AS total_handle_count,
|
|
|
|
|
NULL AS total_complete_count
|
|
|
|
|
FROM
|
|
|
|
|
tab_user u
|
|
|
|
|
LEFT JOIN tab_work_order_info i ON i.creator_id = u.id
|
|
|
|
|
sys_member u
|
|
|
|
|
LEFT JOIN tab_work_order_info i ON i.creator_id = u.uid
|
|
|
|
|
WHERE
|
|
|
|
|
u.id in ({$userids})
|
|
|
|
|
GROUP BY u.id
|
|
|
|
|
u.uid in ({$userids})
|
|
|
|
|
GROUP BY u.uid
|
|
|
|
|
UNION
|
|
|
|
|
SELECT
|
|
|
|
|
u.id,
|
|
|
|
|
u.account,
|
|
|
|
|
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
|
|
|
|
|
tab_user u
|
|
|
|
|
LEFT JOIN tab_work_order_info i ON i.handler_id = u.id
|
|
|
|
|
sys_member u
|
|
|
|
|
LEFT JOIN tab_work_order_info i ON i.handler_id = u.uid
|
|
|
|
|
WHERE
|
|
|
|
|
u.id in ({$userids})
|
|
|
|
|
GROUP BY u.id
|
|
|
|
|
u.uid in ({$userids})
|
|
|
|
|
GROUP BY u.uid
|
|
|
|
|
) AS t
|
|
|
|
|
where {$map}
|
|
|
|
|
GROUP BY t.id
|
|
|
|
@ -9249,7 +9249,7 @@ class ExportController extends Controller
|
|
|
|
|
|
|
|
|
|
$xlsName = '工单统计报表';
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('account', "账号"),
|
|
|
|
|
array('nickname', "账号"),
|
|
|
|
|
array('total_create_count', "发布工单数"),
|
|
|
|
|
array('total_accepted_count', '被接手工单数'),
|
|
|
|
|
array('total_handle_count', "接手工单数"),
|
|
|
|
|