Forráskód Böngészése

修改接口:通栏版式管理-、修改通栏版式

15313670163 19 órája
szülő
commit
fbb562802f
1 módosított fájl, 9 hozzáadás és 6 törlés
  1. 9 6
      app/JsonRpc/PublicRpcService.php

+ 9 - 6
app/JsonRpc/PublicRpcService.php

@@ -1679,7 +1679,7 @@ class PublicRpcService implements PublicRpcServiceInterface
     {
         // 1:通栏;2:组件;
         if($data['type_id'] == 1){
-            $sector_place = SectorPlace::where('sector_type', $data['type'])->first();
+            $sector_place = SectorPlace::where('sector_type', $data['type'])->first(); 
             if(!empty($sector_place)){
                 return Result::error('通栏版式类别编号已存在!');
             }
@@ -1693,7 +1693,7 @@ class PublicRpcService implements PublicRpcServiceInterface
                 'type_id' => $data['type_id'],
             ];
         }else{
-            $sector_type = SectorPlace::where('sector_type', $data['sector_type'])->where('type_id',1)->first();
+            $sector_type = SectorPlace::where('sector_type', $data['sector_type'])->where('type_id',1)->first(); 
             if(empty($sector_type)){
                 return Result::error('通栏版式类别不存在!');
             }
@@ -1730,7 +1730,7 @@ class PublicRpcService implements PublicRpcServiceInterface
         $id = $data['id'];
        // 1:通栏;2:组件;
         if($data['type_id'] == 1){
-            $sector_place = SectorPlace::where('id','!=',$id)->where('sector_type', $data['type'])->first();
+            $sector_place = SectorPlace::where('id','!=',$id)->where('sector_type', $data['type'])->first(); 
             if(!empty($sector_place)){
                 return Result::error('通栏版式类别编号已存在!');
             }
@@ -1744,11 +1744,11 @@ class PublicRpcService implements PublicRpcServiceInterface
                 'type_id' => $data['type_id'],
             ];
         }else{
-            $sector_type = SectorPlace::where('sector_type', $data['sector_type'])->where('type_id',1)->first();
+            $sector_type = SectorPlace::where('sector_type', $data['sector_type'])->where('type_id',1)->first(); 
             if(empty($sector_type)){
                 return Result::error('通栏版式类别不存在!');
             }
-            $component = SectorPlace::where('id','!=',$id)
+            $component = SectorPlace::where('id','!=',$id) 
             ->where('sector_type', $data['sector_type'])
             ->where('component_type', $data['type'])
             ->where('type_id',2)
@@ -1785,7 +1785,10 @@ class PublicRpcService implements PublicRpcServiceInterface
         }
         if($sector_place['type_id'] == 1){
             $sector = Sector::where('place_type', $sector_place['sector_type'])->first();
-            if(!empty($sector)){
+            $component = SectorPlace::where('place_type', $sector_place['sector_type'])
+            ->where('type_id',2)
+            ->first();
+            if(!empty($sector) || !empty($component)){
                 return Result::error('通栏版式分类已应用,暂不可删除!');
             }
         }else{