rkljw 2 mesi fa
parent
commit
061659b48f
2 ha cambiato i file con 83 aggiunte e 75 eliminazioni
  1. 75 75
      app/JsonRpc/WebsiteService.php
  2. 8 0
      vendor/composer/installed.php

+ 75 - 75
app/JsonRpc/WebsiteService.php

@@ -1153,32 +1153,32 @@ class WebsiteService implements WebsiteServiceInterface
         if (empty($website['website_column_id'])) {
             return Result::error("请先关联导航池!", 0);
         }
-         // 获取此网站的底部导航  类型   type:  0:内容型底部导航(只有一条详情内容);1:列表型底部导航(可以有多条详情内容)
-         $foot_type = FooterCategory::where('website_id',$data['website_id'])->pluck('type')->toArray();
-         if (empty($foot_type)) {
-             return Result::error("请先关联底部导航池!", 0);
-         } elseif (in_array(1, $foot_type)) {
-             $foot_type = 1;
-         } else {
-             $foot_type = 0;
-         }
-         $result['foot_type'] = $foot_type;
-         //  友情链接类型'1:图片 2:文字 3:底部';
-         $types = Link::where('website_id', $data['website_id'])->pluck('type')->toArray();
-         $missingTypes = [];
-         if (!in_array(1, $types)) {
-             $missingTypes[] = "文字链接";
-         }
-         if (!in_array(2, $types)) {
-             $missingTypes[] = "图片链接";
-         }
-         if (!in_array(3, $types)) {
-             $missingTypes[] = "底部链接";
-         }
-         if (!empty($missingTypes)) {
-             $errorMessage = "请先添加 " . implode(" 和 ", $missingTypes) . "!";
-             return Result::error($errorMessage, 0);
-         }
+        // 获取此网站的底部导航  类型   type:  0:内容型底部导航(只有一条详情内容);1:列表型底部导航(可以有多条详情内容)
+        $foot_type = FooterCategory::where('website_id',$data['website_id'])->pluck('type')->toArray();
+        if (empty($foot_type)) {
+            return Result::error("请先关联底部导航池!", 0);
+        } elseif (in_array(1, $foot_type)) {
+            $foot_type = 1;
+        } else {
+            $foot_type = 0;
+        }
+        $result['foot_type'] = $foot_type;
+        //  友情链接类型'1:图片 2:文字 3:底部';
+        $types = Link::where('website_id', $data['website_id'])->pluck('type')->toArray();
+        $missingTypes = [];
+        if (!in_array(1, $types)) {
+            $missingTypes[] = "文字链接";
+        }
+        if (!in_array(2, $types)) {
+            $missingTypes[] = "图片链接";
+        }
+        if (!in_array(3, $types)) {
+            $missingTypes[] = "底部链接";
+        }
+        if (!empty($missingTypes)) {
+            $errorMessage = "请先添加 " . implode(" 和 ", $missingTypes) . "!";
+            return Result::error($errorMessage, 0);
+        }
         if(isset($data['page_type'])){
             // 删除重复元素并重新索引数组
             $data['page_type'] = array_unique($data['page_type']);
@@ -1191,12 +1191,12 @@ class WebsiteService implements WebsiteServiceInterface
                     $data['page_type'] = json_encode($data['page_type'])??'';
                     // 操作状态:1:填写完成基础信息;2:选择完成模板;0:未构建
                     $data['action_id'] = 1;
-                    
+
                     try {
                         $result = WebsiteTemplateInfo::insertGetId($data);
                     } catch (\Exception $e) {
                         if ($e->getCode() == 22001) {
-                            $errorMessage = $e->getMessage();                    
+                            $errorMessage = $e->getMessage();
                             return Result::error("请检查表单,某个字段超出了长度限制!");
                         } else {
                             // 处理其他类型的数据库错误
@@ -1206,7 +1206,7 @@ class WebsiteService implements WebsiteServiceInterface
                     }
                 } else {
                     return Result::error("该网站已经构建过了!", 0);
-                } 
+                }
             } else {
                 return Result::error("请先选择首页和底部导航详情页!", 0);
             }
@@ -1224,17 +1224,17 @@ class WebsiteService implements WebsiteServiceInterface
      */
     public function getWebsiteTemplateintel(array $data): array
     {
-       
+
         $result = WebsiteTemplateInfo::where('website_template_info.website_id',$data['website_id'])
-        ->leftJoin('footer_category','footer_category.website_id','website_template_info.website_id')
-        ->leftJoin('website','website.id','website_template_info.website_id')
-        ->select(
-            "website_template_info.*",
-            "footer_category.type",
-            "website.website_name",
-            "website.id as website_id"
-        )
-        ->first();
+            ->leftJoin('footer_category','footer_category.website_id','website_template_info.website_id')
+            ->leftJoin('website','website.id','website_template_info.website_id')
+            ->select(
+                "website_template_info.*",
+                "footer_category.type",
+                "website.website_name",
+                "website.id as website_id"
+            )
+            ->first();
         if(empty($result['website_name'])){
             return Result::error("请输入正确的网站id!", 0);
         }
@@ -1249,7 +1249,7 @@ class WebsiteService implements WebsiteServiceInterface
      * 修改网站基础信息
      *
      * @return array
-    */
+     */
     public function upWebsiteTemplateintel(array $data): array
     {
         $web = Website::where('website.id', $data['website_id'])->first();
@@ -1269,12 +1269,12 @@ class WebsiteService implements WebsiteServiceInterface
             //  数组中同时包含值为 1(首页) 和值为 7 (底部导航详情页)的元素
             if (in_array(1, $data['page_type']) && in_array(7, $data['page_type'])) {
                 // 将数组转换为 JSON 字符串
-                $data['page_type'] = json_encode($data['page_type'])??''; 
+                $data['page_type'] = json_encode($data['page_type'])??'';
                 try {
                     $result = WebsiteTemplateInfo::where($where)->update($data);
                 } catch (\Exception $e) {
                     if ($e->getCode() == 22001) {
-                        $errorMessage = $e->getMessage();                    
+                        $errorMessage = $e->getMessage();
                         return Result::error("请检查表单,某个字段超出了长度限制!");
                     } else {
                         // 处理其他类型的数据库错误
@@ -1324,7 +1324,7 @@ class WebsiteService implements WebsiteServiceInterface
                 return Result::error("此网站还未添加基础信息!",0);
             } else{
                 $where = json_decode($page_type['page_type'], true);
-                 // $where = $data["page_type"];
+                // $where = $data["page_type"];
                 if(isset($data['template_class_id']) && !empty($data['template_class_id'])){
                     $template_class = TemplateClass::where('id',$data['template_class_id'])->first();
                     if(empty($template_class)){
@@ -1352,21 +1352,21 @@ class WebsiteService implements WebsiteServiceInterface
 
                     //获取所有模板
                     $rep = Template::where(function ($query) use ($where) {
-                                foreach ($where as $value) {
-                                    $query->whereJsonContains('template_img', ['value' => $value]);
-                                }
-                            })
-                            ->limit($data['pageSize'])
-                            ->offset(($data['page'] - 1) * $data['pageSize'])
-                            ->orderBy("template.updated_at", "desc")
-                            ->get();
+                        foreach ($where as $value) {
+                            $query->whereJsonContains('template_img', ['value' => $value]);
+                        }
+                    })
+                        ->limit($data['pageSize'])
+                        ->offset(($data['page'] - 1) * $data['pageSize'])
+                        ->orderBy("template.updated_at", "desc")
+                        ->get();
                     $count = Template::where(function ($query) use ($where) {
                         foreach ($where as $value) {
                             $query->whereJsonContains('template_img', ['value' => $value]);
                         }
                     })->count();
-                        
-                    
+
+
                 }
                 if(empty($rep) || $rep->count()==0){
                     return Result::error("没有查找到相关数据!",0);
@@ -1378,8 +1378,8 @@ class WebsiteService implements WebsiteServiceInterface
                     //         $filtered_img = array_filter($template_img, function ($img) use ($where) {
                     //             return isset($img['value']) && in_array($img['value'], $where);
                     //         });
-                    //     }   
-                                            
+                    //     }
+
                     //     $item->template_img = $filtered_img;
                     // });
                     // $result = [
@@ -1399,7 +1399,7 @@ class WebsiteService implements WebsiteServiceInterface
                             $item->template_img = []; // 如果无法解码为数组,则设置为空数组
                         }
                     });
-                    
+
                     $result = [
                         "rows" => $rep->toArray(),
                         "count" => $count,
@@ -1407,8 +1407,8 @@ class WebsiteService implements WebsiteServiceInterface
                 }
             }
         }
-            return Result::success($result);
-            
+        return Result::success($result);
+
     }
 
     /**
@@ -1450,23 +1450,23 @@ class WebsiteService implements WebsiteServiceInterface
             ['website_template_info.website_id', $data['website_id']],
             ['template_id', '!=', null],
         ])
-        ->leftJoin('template','template.id','website_template_info.template_id')
-        ->leftJoin('template_class','template_class.id','template.template_class_id')
-        ->where(function ($query) use ($page_type) {
-            // 假设 $data['page_type'] 是一个数组,包含需要匹配的 page_type 值
-            foreach ($page_type as $pageType) {
-                $query->orWhereJsonContains('template.template_img', ['value' => $pageType]);
-            }
-        })
-        ->select(
-            'template.template_name',
-            'template.template_img',
-            'template.id as tid',
-            'template_class.name',
-            'template_class.id as class_id',
-            'website_template_info.page_type',
-            'website_template_info.website_id')
-        ->first();
+            ->leftJoin('template','template.id','website_template_info.template_id')
+            ->leftJoin('template_class','template_class.id','template.template_class_id')
+            ->where(function ($query) use ($page_type) {
+                // 假设 $data['page_type'] 是一个数组,包含需要匹配的 page_type 值
+                foreach ($page_type as $pageType) {
+                    $query->orWhereJsonContains('template.template_img', ['value' => $pageType]);
+                }
+            })
+            ->select(
+                'template.template_name',
+                'template.template_img',
+                'template.id as tid',
+                'template_class.name',
+                'template_class.id as class_id',
+                'website_template_info.page_type',
+                'website_template_info.website_id')
+            ->first();
         // return Result::success($result);
         // 过滤 template_img 字段  只获取 基础信息中 包含的模板图片
         $template_img = $result['template_img'] !== null ? json_decode($result['template_img'], true) : [];

+ 8 - 0
vendor/composer/installed.php

@@ -3,7 +3,11 @@
         'name' => 'hyperf/hyperf-skeleton',
         'pretty_version' => 'dev-master',
         'version' => 'dev-master',
+<<<<<<< HEAD
         'reference' => '7f5b599de24baabc034ff41ae5bf0be5a5d776ec',
+=======
+        'reference' => '38cd939064a4f65d00ccc6738aca35f1e0c27319',
+>>>>>>> web_12_16_liu
         'type' => 'project',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
@@ -457,7 +461,11 @@
         'hyperf/hyperf-skeleton' => array(
             'pretty_version' => 'dev-master',
             'version' => 'dev-master',
+<<<<<<< HEAD
             'reference' => '7f5b599de24baabc034ff41ae5bf0be5a5d776ec',
+=======
+            'reference' => '38cd939064a4f65d00ccc6738aca35f1e0c27319',
+>>>>>>> web_12_16_liu
             'type' => 'project',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),