Browse Source

修改接口:添加组件、修改组件;

15313670163 2 days ago
parent
commit
4cd81da632
1 changed files with 13 additions and 6 deletions
  1. 13 6
      app/JsonRpc/PublicRpcService.php

+ 13 - 6
app/JsonRpc/PublicRpcService.php

@@ -1296,6 +1296,10 @@ class PublicRpcService implements PublicRpcServiceInterface
         if(!empty($component_id)){
             return Result::error('组件编号已存在!');
         }
+        $component_type = ComponentType::where('id',$data['type_id'])->first();
+        if(empty($component_type)){
+            return Result::error('组件分类不存在!');
+        }
         // 组件分类:1:资讯-头条组件;2:资讯-轮播组件;3:资讯-推荐图类组件;4:资讯-最新类组件;5:资讯-推荐类;6:资讯-热点类组件;
         // 7:资讯-栏目类组件;8:列表类组件;9:详情类组件;10:二级导航栏类组件;11:广告类;12:静态资源类;13:底部导航类;
         $data['type_id'] = intval($data['type_id']);
@@ -1308,6 +1312,7 @@ class PublicRpcService implements PublicRpcServiceInterface
             'component_height' => $data['component_height'],
             'type_id' => intval($data['type_id']),
             'component_keyword' => $data['component_keyword'],
+            'component_column' => $component_type['com_code'],
         ];
         switch($data['type_id']){
         //    组件分类:1:资讯-头条组件;2:资讯-轮播组件;3:资讯-推荐图类组件;4:资讯-最新类组件;5:资讯-推荐类;6:资讯-热点类组件;
@@ -1449,10 +1454,12 @@ class PublicRpcService implements PublicRpcServiceInterface
         if(!empty($component_id) || $component_id != null){
             return Result::error('组件编号已存在!');
         }
-        // return Result::success($component_id);
-        // return Result::success($component_place);
-        //    组件分类:1:资讯-头条组件;2:资讯-轮播组件;3:资讯-推荐图类组件;4:资讯-最新类组件;5:资讯-推荐类;6:资讯-热点类组件;
-        //    7:资讯-栏目类组件;8:列表类组件;9:详情类组件;10:二级导航栏类组件;11:广告类;12:静态资源类;13:底部导航类;
+        $component_type = ComponentType::where('id',$data['type_id'])->first();
+        if(empty($component_type)){
+            return Result::error('组件分类不存在!');
+        }
+        // 组件分类:1:资讯-头条组件;2:资讯-轮播组件;3:资讯-推荐图类组件;4:资讯-最新类组件;5:资讯-推荐类;6:资讯-热点类组件;
+        // 7:资讯-栏目类组件;8:列表类组件;9:详情类组件;10:二级导航栏类组件;11:广告类;12:静态资源类;13:底部导航类;
         $data['type_id'] = intval($data['type_id']);
         $add_arr = [
             // 'template_id' => intval($data['template_id']),
@@ -1463,8 +1470,8 @@ class PublicRpcService implements PublicRpcServiceInterface
             'component_height' => $data['component_height'],
             'type_id' => intval($data['type_id']),
             'component_keyword' => $data['component_keyword'],
-        ];
-        
+            'component_column' => $component_type['com_code'],
+        ];        
         switch($data['type_id']){
             case 1:                         //1:资讯-头条组件;
                  $add_arr['level'] = 1;