master
yulingwei 5 years ago
parent 312448c724
commit e462305587

@ -9039,7 +9039,7 @@ class ExportController extends Controller
$beginThisweek = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")); $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")); $endThisweek = mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y"));
$xlsData = M('promote', 'tab_')->alias('p') $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_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") ->join("tab_user u on u.promote_id = p.id and u.device_type=2")
->where($map) ->where($map)
@ -9187,13 +9187,13 @@ class ExportController extends Controller
$order = 'order by ' . $data_order_type . " " . ($data_order == 3 ? 'desc' : 'asc'); $order = 'order by ' . $data_order_type . " " . ($data_order == 3 ? 'desc' : 'asc');
} }
$map = '1=1'; $map = '1=1';
if (!empty(I('user_account'))) { if (!empty(I('nickname'))) {
$map .= " and t.account = '" . I('user_account') . "'"; $map .= " and t.nickname = '" . I('nickname') . "'";
} }
// 获取所有传单或者接单用户id // 获取所有传单或者接单用户id
$userids = M('work_order_info', 'tab_') $userids = M('work_order_info', 'tab_')
->field("concat(creator_id, ',', handler_id) as userid") ->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) ->where($map)
->select(); ->select();
if (empty($userids)) { if (empty($userids)) {
@ -9204,7 +9204,7 @@ class ExportController extends Controller
$count = count($userids); $count = count($userids);
$list = M('work_order_info', 'tab_')->query("SELECT $list = M('work_order_info', 'tab_')->query("SELECT
t.id, t.id,
t.account, t.nickname,
sum(total_create_count) as total_create_count, sum(total_create_count) as total_create_count,
sum(total_accepted_count) as total_accepted_count, sum(total_accepted_count) as total_accepted_count,
sum(total_handle_count) as total_handle_count, sum(total_handle_count) as total_handle_count,
@ -9212,8 +9212,8 @@ class ExportController extends Controller
FROM FROM
( (
SELECT SELECT
u.id, u.uid as id,
u.account, u.nickname,
count(*) AS total_create_count, count(*) AS total_create_count,
count( count(
@ -9222,25 +9222,25 @@ class ExportController extends Controller
NULL AS total_handle_count, NULL AS total_handle_count,
NULL AS total_complete_count NULL AS total_complete_count
FROM FROM
tab_user u sys_member u
LEFT JOIN tab_work_order_info i ON i.creator_id = u.id LEFT JOIN tab_work_order_info i ON i.creator_id = u.uid
WHERE WHERE
u.id in ({$userids}) u.uid in ({$userids})
GROUP BY u.id GROUP BY u.uid
UNION UNION
SELECT SELECT
u.id, u.uid as id,
u.account, u.nickname,
NULL AS total_create_count, NULL AS total_create_count,
NULL AS total_accepted_count, NULL AS total_accepted_count,
count(*) AS total_handle_count, count(*) AS total_handle_count,
count(IF(i.`status` = 1, 1, NULL)) AS total_complete_count count(IF(i.`status` = 1, 1, NULL)) AS total_complete_count
FROM FROM
tab_user u sys_member u
LEFT JOIN tab_work_order_info i ON i.handler_id = u.id LEFT JOIN tab_work_order_info i ON i.handler_id = u.uid
WHERE WHERE
u.id in ({$userids}) u.uid in ({$userids})
GROUP BY u.id GROUP BY u.uid
) AS t ) AS t
where {$map} where {$map}
GROUP BY t.id GROUP BY t.id
@ -9249,7 +9249,7 @@ class ExportController extends Controller
$xlsName = '工单统计报表'; $xlsName = '工单统计报表';
$xlsCell = array( $xlsCell = array(
array('account', "账号"), array('nickname', "账号"),
array('total_create_count', "发布工单数"), array('total_create_count', "发布工单数"),
array('total_accepted_count', '被接手工单数'), array('total_accepted_count', '被接手工单数'),
array('total_handle_count', "接手工单数"), array('total_handle_count', "接手工单数"),

@ -367,13 +367,13 @@ class WorkOrderController extends ThinkController
$order = 'order by ' . $data_order_type . " " . ($data_order == 3 ? 'desc' : 'asc'); $order = 'order by ' . $data_order_type . " " . ($data_order == 3 ? 'desc' : 'asc');
} }
$map = '1=1'; $map = '1=1';
if (!empty(I('user_account'))) { if (!empty(I('nickname'))) {
$map .= " and t.account = '" . I('user_account') . "'"; $map .= " and t.nickname = '" . I('nickname') . "'";
} }
// 获取所有传单或者接单用户id // 获取所有传单或者接单用户id
$userids = M('work_order_info', 'tab_') $userids = M('work_order_info', 'tab_')
->field("concat(creator_id, ',', handler_id) as userid") ->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) ->where($map)
->select(); ->select();
if (empty($userids)) { if (empty($userids)) {
@ -384,7 +384,7 @@ class WorkOrderController extends ThinkController
$count = count($userids); $count = count($userids);
$list = M('work_order_info', 'tab_')->query("SELECT $list = M('work_order_info', 'tab_')->query("SELECT
t.id, t.id,
t.account, t.nickname,
sum(total_create_count) as total_create_count, sum(total_create_count) as total_create_count,
sum(total_accepted_count) as total_accepted_count, sum(total_accepted_count) as total_accepted_count,
sum(total_handle_count) as total_handle_count, sum(total_handle_count) as total_handle_count,
@ -392,8 +392,8 @@ class WorkOrderController extends ThinkController
FROM FROM
( (
SELECT SELECT
u.id, u.uid as id,
u.account, u.nickname,
count(*) AS total_create_count, count(*) AS total_create_count,
count( count(
@ -402,25 +402,25 @@ class WorkOrderController extends ThinkController
NULL AS total_handle_count, NULL AS total_handle_count,
NULL AS total_complete_count NULL AS total_complete_count
FROM FROM
tab_user u sys_member u
LEFT JOIN tab_work_order_info i ON i.creator_id = u.id LEFT JOIN tab_work_order_info i ON i.creator_id = u.uid
WHERE WHERE
u.id in ({$userids}) u.uid in ({$userids})
GROUP BY u.id GROUP BY u.uid
UNION UNION
SELECT SELECT
u.id, u.uid as id,
u.account, u.nickname,
NULL AS total_create_count, NULL AS total_create_count,
NULL AS total_accepted_count, NULL AS total_accepted_count,
count(*) AS total_handle_count, count(*) AS total_handle_count,
count(IF(i.`status` = 1, 1, NULL)) AS total_complete_count count(IF(i.`status` = 1, 1, NULL)) AS total_complete_count
FROM FROM
tab_user u sys_member u
LEFT JOIN tab_work_order_info i ON i.handler_id = u.id LEFT JOIN tab_work_order_info i ON i.handler_id = u.uid
WHERE WHERE
u.id in ({$userids}) u.uid in ({$userids})
GROUP BY u.id GROUP BY u.uid
) AS t ) AS t
where {$map} where {$map}
GROUP BY t.id GROUP BY t.id

@ -56,7 +56,7 @@
<input id="serverid" name="server_id" type="text" value="{:I('server_id')}" style="display:none"> <input id="serverid" name="server_id" type="text" value="{:I('server_id')}" style="display:none">
</div> </div>
<div class="input-list input-list-game search_label_rehab"> <div class="input-list input-list-game search_label_rehab">
<input type="text" name="user_account" value="{$_GET['user_account']}" placeholder="账号"> <input type="text" name="nickname" value="{$_GET['nickname']}" placeholder="账号">
</div> </div>
<input type="hidden" name="" value="" class="sortBy"> <input type="hidden" name="" value="" class="sortBy">
<div class="input-list"> <div class="input-list">
@ -117,7 +117,7 @@
<else/> <else/>
<volist name="list_data" id="data"> <volist name="list_data" id="data">
<tr> <tr>
<td>{$data.account}</td> <td>{$data.nickname}</td>
<td>{$data.total_create_count}</td> <td>{$data.total_create_count}</td>
<td>{$data.total_accepted_count}</td> <td>{$data.total_accepted_count}</td>
<td>{$data.total_handle_count}</td> <td>{$data.total_handle_count}</td>

Loading…
Cancel
Save