Commit 5b2f77a5 authored by 冯超鹏's avatar 冯超鹏

user用户工单列表

parent 68363ce4
Pipeline #214 canceled with stages
...@@ -29,6 +29,7 @@ class AlarmOrderController extends Controller ...@@ -29,6 +29,7 @@ class AlarmOrderController extends Controller
if($request->input('isuser') == 'user'){ if($request->input('isuser') == 'user'){
$where[] = ['u.id','=',Auth::id()]; $where[] = ['u.id','=',Auth::id()];
print_r(explode(',',$request->input('userstate')));
} }
if($request->input('order_num')) { if($request->input('order_num')) {
$where[] = ['alarm_order.order_num' , '=', $request->input('order_num')]; $where[] = ['alarm_order.order_num' , '=', $request->input('order_num')];
...@@ -66,8 +67,10 @@ class AlarmOrderController extends Controller ...@@ -66,8 +67,10 @@ class AlarmOrderController extends Controller
->limit($limit) ->limit($limit)
->get()->toArray(); ->get()->toArray();
$count = AlarmOrder::leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id') $count = AlarmOrder::leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.id')
->whereBetween('alarm_order.created_at',$whereBetween) ->whereBetween('alarm_order.created_at',$whereBetween)
->where($where)->count(); ->where($where)
->count();
$meta = [ $meta = [
'count' => $count, 'count' => $count,
'current_page' => $request->input('page'), 'current_page' => $request->input('page'),
...@@ -77,6 +80,26 @@ class AlarmOrderController extends Controller ...@@ -77,6 +80,26 @@ class AlarmOrderController extends Controller
} }
public function userworklist(Request $request){
$orders = AlarmOrder::selectRaw('
FROM_UNIXTIME(r.starttime) AS start_time,
FROM_UNIXTIME(r.endtime) AS end_time,
alarm_order.*,
r.devicenumber, r.concentration, r.location, r.policestatus, r.shutoff_status,
d.devicecoord, d.username,t.tname,
u.name, u.phone_number,
s.status_name
')
->leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id')
->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.id')
->leftjoin('status AS s', 's.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('device_type AS t', 'r.policestatus', '=', 't.tid')
->whereIn('alarm_order.state',explode(',',$request->input('userstate')))
->where('u.id','=',Auth::id())
->get()->toArray();
return $this->jsonSuccessData($orders);
}
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
......
...@@ -56,6 +56,7 @@ Route::group(['middleware' => 'auth:api'], function () { ...@@ -56,6 +56,7 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::get('alarm_order/user', 'AlarmOrderController@getUserInfo'); // 获取派单人员 Route::get('alarm_order/user', 'AlarmOrderController@getUserInfo'); // 获取派单人员
Route::get('alarm_order/show', 'AlarmOrderController@show'); // 工单详情 Route::get('alarm_order/show', 'AlarmOrderController@show'); // 工单详情
Route::get('alarm_order/order_in', 'AlarmOrderController@orderin'); // 获取当前订单为第几步 Route::get('alarm_order/order_in', 'AlarmOrderController@orderin'); // 获取当前订单为第几步
Route::get('alarm_order/userworklist', 'AlarmOrderController@userworklist'); // 获取当前订单为第几步
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment