فهرست منبع

Merge branch '20250522_diywebfr'

15313670163 1 روز پیش
والد
کامیت
799199994a
1فایلهای تغییر یافته به همراه6 افزوده شده و 32 حذف شده
  1. 6 32
      app/JsonRpc/PublicRpcService.php

+ 6 - 32
app/JsonRpc/PublicRpcService.php

@@ -2106,41 +2106,15 @@ class PublicRpcService implements PublicRpcServiceInterface
         if(isset($data['id']) && !empty($data['id'])){
             $where['id'] = $data['id'];
         }
-        $component_type = ComponentType::where($where)->get()->all();
-        $article = Article::first()->toArray();
-        $category = WebsiteCategory::first()->toArray();
-        $footer_category = FooterCategory::first()->toArray();
-        $ad = AdPlace::leftJoin('ad_size','ad_place.ad_size_id','=','ad_size.id')
-        ->select('ad_place.*','ad_size.width','ad_size.height')
-        ->first()->toArray();
-        $type_arr = [1,2,3,4,5,6,7,8,9,14];
-        // return Result::success(in_array(intval($value['id']),$type_arr));
-        foreach($component_type as $key => $value){
-            // 组件分类:1:资讯-头条组件;2:资讯-轮播组件;3:资讯-推荐图类组件;4:资讯-最新类组件;5:资讯-推荐类;6:资讯-热点类组件;
-            // 7:资讯-栏目类组件;8:列表类组件;9:详情类组件;10:二级导航栏类组件;11:广告类;12:静态资源类;13:底部导航类;
-            if(in_array(intval($value['id']),$type_arr)){
-                $component_type[$key]['all_code'] = array_keys($article);
-            }
-            if($value['id'] == 13){
-                $component_type[$key]['all_code'] = array_keys($footer_category);
-
-            } if($value['id'] == 11){
-                $component_type[$key]['all_code'] = array_keys($ad);
-
-            }
-
-            if($value['id'] == 10){
-                $component_type[$key]['all_code'] = array_keys($category);
-            }
-            if($value['com_code']){
-                $component_type[$key]['com_code'] = json_decode($value['com_code'],true);
-            }
-            // $component_type[$key]['com_code'] = json_decode($value['com_code'],true);
+        $component_type = ComponentType::where($where)->first();
+        if(empty($component_type)){
+            return Result::error('组件类型不存在!');
         }
-        if(empty($category)){
+        $default_code = json_decode($component_type['com_code'] ?? '',true);
+        if(empty($default_code)){
             return Result::error('组件类型不存在!');
         }
-        return Result::success($component_type);
+        return Result::success($default_code['listType']);
     }
     /**
      * 组件管理-获取所有组件