diff --git a/app/AdminAgent/Controllers/WorkorderController.php b/app/AdminAgent/Controllers/WorkorderController.php index 7a24c90..668273c 100755 --- a/app/AdminAgent/Controllers/WorkorderController.php +++ b/app/AdminAgent/Controllers/WorkorderController.php @@ -41,6 +41,11 @@ class WorkorderController extends AdminController ->orderByDesc('updated_at') ->get(); + // 先这么处理吧 + if ($workorderId == 0 && !empty($workorder)) { + return redirect('/admin-agent/workorder_item?workorder_id='.$workorder[0]->id); + } + foreach ($workorder as $v) { $item = WorkorderItem::query()->where('workorder_id',$v->id)->orderByDesc('updated_at')->first(); $arr = [ diff --git a/app/AdminGuide/Controllers/WorkorderController.php b/app/AdminGuide/Controllers/WorkorderController.php index 9b7bca7..97958fb 100755 --- a/app/AdminGuide/Controllers/WorkorderController.php +++ b/app/AdminGuide/Controllers/WorkorderController.php @@ -41,6 +41,12 @@ class WorkorderController extends AdminController }) ->orderByDesc('updated_at') ->get(); + + // 先这么处理吧 + if ($workorderId == 0 && !empty($workorder)) { + return redirect('/admin-agent/workorder_item?workorder_id='.$workorder[0]->id); + } + foreach ($workorder as $v) { $item = WorkorderItem::query()->where('workorder_id',$v->id)->orderByDesc('updated_at')->first(); $arr = [ diff --git a/app/AdminSupplier/Controllers/WorkorderController.php b/app/AdminSupplier/Controllers/WorkorderController.php index 1d6260b..e8a6640 100755 --- a/app/AdminSupplier/Controllers/WorkorderController.php +++ b/app/AdminSupplier/Controllers/WorkorderController.php @@ -41,6 +41,11 @@ class WorkorderController extends AdminController ->orderByDesc('updated_at') ->get(); + // 先这么处理吧 + if ($workorderId == 0 && !empty($workorder)) { + return redirect('/admin-agent/workorder_item?workorder_id='.$workorder[0]->id); + } + foreach ($workorder as $v) { $item = WorkorderItem::query()->where('workorder_id',$v->id)->orderByDesc('updated_at')->first(); $arr = [ diff --git a/app/Models/Agent.php b/app/Models/Agent.php index e6841df..523ccc6 100644 --- a/app/Models/Agent.php +++ b/app/Models/Agent.php @@ -44,6 +44,11 @@ class Agent extends BaseModel return $this->morphOne('App\Models\DemandBidding', 'biddingUser'); } + public function workoorder() + { + return $this->morphOne('App\Models\Workorder', 'publisher'); + } + public function workoorderitem() { return $this->morphOne('App\Models\WorkorderItem', 'publisher'); diff --git a/app/Models/Guide.php b/app/Models/Guide.php index 374795c..eae6bd9 100644 --- a/app/Models/Guide.php +++ b/app/Models/Guide.php @@ -32,6 +32,11 @@ class Guide extends BaseModel return $this->morphOne('App\Models\DemandBidding', 'biddingUser'); } + public function workoorder() + { + return $this->morphOne('App\Models\Workorder', 'publisher'); + } + public function workoorderitem() { return $this->morphOne('App\Models\WorkorderItem', 'publisher'); diff --git a/resources/views/admin/pages/index.blade.php b/resources/views/admin/pages/index.blade.php index 5ef91bf..76e2749 100644 --- a/resources/views/admin/pages/index.blade.php +++ b/resources/views/admin/pages/index.blade.php @@ -37,103 +37,109 @@
- @foreach($user_list as $key => $item) - @if($workorder['workorder_id']==$item['workorder_id']) -
- @else -
- @endif -
-
- 头像 -
-
- {{$item['name']}} -
-
-
- {{$item['content']}} -
-
- {{$item['last_message']}} -
-
- {{$item['last_message_time']}} -
- {{--@if($item['unread'] == true)--}} - {{--
--}} - {{--@else--}} - {{--
--}} - {{--@endif--}} -
- @endforeach -
- -
- -
- -
-
发送
- -
-
- @foreach($msg_list as $key => $item) - - @if($item['type'] == 'op') -
-
+ @if(empty($user_list)) +
暂无工单数据
+ @else + @foreach($user_list as $key => $item) + @if($workorder['workorder_id']==$item['workorder_id']) +
+ @else +
+ @endif
头像
- {{$item['name']}}
-
- @if($item['it_type'] == 1) - {{$item['content']}} - @elseif($item['it_type'] == 2) - 图片 - @endif +
+ {{$item['content']}} +
+
+ {{$item['last_message']}}
-
- {{$item['created_at_text']}} + {{$item['last_message_time']}}
+ {{--@if($item['unread'] == true)--}} + {{--
--}} + {{--@else--}} + {{--
--}} + {{--@endif--}}
-
- @elseif($item['type'] == 'my') -
-
-
-
- {{$item['name']}} + @endforeach + @endif +
+ +
+ @if(empty($msg_list)) +
暂无工单数据
+ @else +
+ +
+
发送
+ +
+
+ @foreach($msg_list as $key => $item) + + @if($item['type'] == 'op') +
+
+
+
+ 头像 +
+
+ + {{$item['name']}} +
-
- 头像 +
+ @if($item['it_type'] == 1) + {{$item['content']}} + @elseif($item['it_type'] == 2) + 图片 + @endif
-
-
- @if($item['it_type'] == 1) - {{$item['content']}} - @elseif($item['it_type'] == 2) - 图片 - @endif +
+ {{$item['created_at_text']}} +
+
+ @elseif($item['type'] == 'my') +
+
+
+
+ {{$item['name']}} +
+
+ 头像 +
+
-
- {{$item['created_at_text']}} +
+ @if($item['it_type'] == 1) + {{$item['content']}} + @elseif($item['it_type'] == 2) + 图片 + @endif +
+ +
+ {{$item['created_at_text']}} +
-
- @endif - @endforeach -
- + @endif + @endforeach +
+ @endif