Преглед на файлове

路由修改和终端打印修改

ajun преди 4 години
родител
ревизия
df2278f654
променени са 2 файла, в които са добавени 8 реда и са изтрити 19 реда
  1. 8 7
      app/Http/Controllers/TerminalController.php
  2. 0 12
      routes/web.php

+ 8 - 7
app/Http/Controllers/TerminalController.php

@@ -12,9 +12,10 @@ class TerminalController extends Controller
 {
     use AsyncResponse;
 
+    // index 页面
     public function index(TerminalRequest $request)
     {
-//        if (!Gate::allows('基础设置-快递打印-终端'))return redirect("/");
+        if (Gate::denies('基础设置-快递打印-终端'))return redirect("/");
 
         $terminals =  Terminal::query()->orderByDesc('id')->paginate($request['paginate'] ?? 50);
 
@@ -25,8 +26,8 @@ class TerminalController extends Controller
 
     public function storeApi(TerminalRequest  $request): array
     {
-//        if (!Gate::allows('基础设置-快递打印-终端-添加'))
-//            return ['success' => false, 'message' => '没有对应权限'];
+        if (Gate::denies('基础设置-快递打印-终端-添加'))
+            return ['success' => false, 'message' => '没有对应权限'];
 
         $terminal = Terminal::query()->create($request->all());
         return ['success' => true, 'data' => $terminal];
@@ -34,8 +35,8 @@ class TerminalController extends Controller
 
     public function destroyApi($id): array
     {
-//        if (!Gate::allows('基础设置-快递打印-终端-删除'))
-//            return ['success' => false, 'message' => '没有对应权限'];
+        if (Gate::denies('基础设置-快递打印-终端-删除'))
+            return ['success' => false, 'message' => '没有对应权限'];
 
         $terminal = Terminal::query()->find($id);
         if (!$terminal) return ['success' => false , 'message' => '对应的终端不存在'];
@@ -46,8 +47,8 @@ class TerminalController extends Controller
 
     public function updateApi(TerminalRequest $request): array
     {
-//        if (!Gate::allows('基础设置-快递打印-终端-编辑'))
-//            return ['success' => false, 'message' => '没有对应权限'];
+        if (Gate::denies('基础设置-快递打印-终端-编辑'))
+            return ['success' => false, 'message' => '没有对应权限'];
 
         $terminal = Terminal::query()->find($request['id']);
         if (!$terminal) return ['success' => false, 'message' => '对应的终端不存在'];

+ 0 - 12
routes/web.php

@@ -297,19 +297,7 @@ Route::group(['middleware'=>'auth'],function ($route){
         Route::get('/print/index','PrintController@index');
         Route::group(['prefix'=>'expressPrinting'],function(){
             Route::get("index",'PrintController@index');
-            Route::group(['prefix' => 'part'],function(){
-                Route::get('/index','PrintPartController@index');
-                Route::get('/create','PrintPartController@create');
-            });
-            Route::prefix('image')->group(function(){
-                Route::get('index','PrintPartImageController@index');
 
-            });
-            Route::group(['prefix'=>'template'],function(){
-                Route::get('/index','PrintTemplateController@index');
-                Route::get('/create','PrintTemplateController@create');
-                Route::get('/edit/{id}','PrintTemplateController@edit');
-            });
             Route::group(['prefix' => 'setting'] ,function (){
                 Route::get('/terminal/index','TerminalController@index');
                 Route::get('/printer/index','TerminalPrinterController@index');