Browse Source

获取及搜索网站模板

15313670163 2 months ago
parent
commit
bd91e11be3
3 changed files with 79 additions and 11 deletions
  1. 8 10
      app/JsonRpc/WebsiteService.php
  2. 1 1
      runtime/hyperf.pid
  3. 70 0
      runtime/logs/hyperf.log

+ 8 - 10
app/JsonRpc/WebsiteService.php

@@ -1222,7 +1222,8 @@ class WebsiteService implements WebsiteServiceInterface
         ->select(
             "website_template_info.*",
             "footer_category.type",
-            "website.website_name"
+            "website.website_name",
+            "website.id as website_id"
         )
         ->first();
         if(empty($result['website_name'])){
@@ -1296,18 +1297,18 @@ class WebsiteService implements WebsiteServiceInterface
     {
         $website = Website::where('website.id',$data['website_id'])->first();
         if(empty($website)){
-            $message = "请输入正确的网站id!";
+            return Result::error("请输入正确的网站id!",0);
         }else{
             $page_type = WebsiteTemplateInfo::where('website_id',$data['website_id'])->select('page_type')->first();
             if(empty($page_type)){
-                $message = "此网站还未添加基础信息!";
+                return Result::error("此网站还未添加基础信息!",0);
             } else{
                 $where = json_decode($page_type['page_type'], true);
                  // $where = $data["page_type"];
                 if(isset($data['template_class_id'])){
                     $template_class = TemplateClass::where('id',$data['template_class_id'])->first();
                     if(empty($template_class)){
-                        $message = "请输入正确的模板风格id!";
+                        return Result::error("请输入正确的模板风格id!",0);
                     }else{
                         // 获取指定风格下的模板
                         $rep = Template::where('template_class_id', $data['template_class_id'])
@@ -1350,7 +1351,7 @@ class WebsiteService implements WebsiteServiceInterface
                             
                 }
                 if(empty($rep) || $rep->count()==0){
-                    $message = "没有查找到相关数据!";
+                    return Result::error("没有查找到相关数据!",0);
                 }else{
                     // 过滤 template_img 字段 只获取 基础信息中 包含的模板图片
                     $rep->each(function ($item) use ($where) {
@@ -1359,7 +1360,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 = [
@@ -1369,11 +1371,7 @@ class WebsiteService implements WebsiteServiceInterface
                 }
             }  
         }
-        if(!empty($message)){
-            return Result::error($message,0);
-        }else{
             return Result::success($result);
-        }
     }
 
     /**

+ 1 - 1
runtime/hyperf.pid

@@ -1 +1 @@
-19254
+25119

+ 70 - 0
runtime/logs/hyperf.log

@@ -2743,3 +2743,73 @@
 [2025-02-05T15:41:18.621839+08:00] sql.INFO: [43.63] select * from `website` where `id` = '2' limit 1 [] []
 [2025-02-05T15:41:26.621844+08:00] sql.INFO: [29.71] select * from `website_template_info` where `website_id` = '2' limit 1 [] []
 [2025-02-05T15:41:26.654669+08:00] sql.INFO: [31.78] select `template`.`template_name`, `template`.`template_img`, `template`.`id` as `tid`, `template_class`.`name`, `template_class`.`id` as `class_id`, `website_template_info`.* from `website_template_info` left join `template` on `template`.`id` = `website_template_info`.`template_id` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (`website_template_info`.`website_id` = '2' and `template_id` is not null) and (json_contains(`template`.`template_img`, '{"value":"1"}') or json_contains(`template`.`template_img`, '{"value":"2"}') or json_contains(`template`.`template_img`, '{"value":"7"}')) limit 1 [] []
+[2025-02-05T16:08:20.569153+08:00] sql.INFO: [61.2] select * from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:08:20.604096+08:00] sql.INFO: [16.18] select `template`.`template_name`, `template`.`template_img`, `template`.`id` as `tid`, `template_class`.`name`, `template_class`.`id` as `class_id`, `website_template_info`.* from `website_template_info` left join `template` on `template`.`id` = `website_template_info`.`template_id` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (`website_template_info`.`website_id` = '2' and `template_id` is not null) and (json_contains(`template`.`template_img`, '{"value":"1"}') or json_contains(`template`.`template_img`, '{"value":"2"}') or json_contains(`template`.`template_img`, '{"value":"7"}')) limit 1 [] []
+[2025-02-05T16:11:06.237142+08:00] sql.INFO: [1075.69] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:11:06.255654+08:00] sql.INFO: [17.1] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:11:06.279482+08:00] sql.INFO: [16.39] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:11:06.293832+08:00] sql.INFO: [13.26] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:11:15.284787+08:00] sql.INFO: [16.68] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:11:15.298702+08:00] sql.INFO: [12.74] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:11:15.316948+08:00] sql.INFO: [17.46] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:11:15.333129+08:00] sql.INFO: [14.82] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:12:09.537760+08:00] sql.INFO: [17.39] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:12:09.552889+08:00] sql.INFO: [14.25] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:12:09.571263+08:00] sql.INFO: [17.11] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:12:09.588867+08:00] sql.INFO: [16.2] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:12:10.449171+08:00] sql.INFO: [16.51] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:12:10.463065+08:00] sql.INFO: [13.03] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:12:10.480306+08:00] sql.INFO: [16.1] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:12:10.495438+08:00] sql.INFO: [13.83] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:12:14.711721+08:00] sql.INFO: [899.87] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:12:14.741698+08:00] sql.INFO: [13.73] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:12:14.765006+08:00] sql.INFO: [14.76] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:12:14.779669+08:00] sql.INFO: [13.49] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:20:57.370395+08:00] sql.INFO: [56.86] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:20:57.402722+08:00] sql.INFO: [14.23] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:20:57.426500+08:00] sql.INFO: [13.95] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:20:57.440647+08:00] sql.INFO: [12.86] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:21:00.901923+08:00] sql.INFO: [70.65] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:21:00.936353+08:00] sql.INFO: [14.88] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:21:00.962434+08:00] sql.INFO: [16.57] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:21:00.980205+08:00] sql.INFO: [16.57] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:21:03.031792+08:00] sql.INFO: [17.32] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:21:03.049948+08:00] sql.INFO: [17.2] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:21:03.068220+08:00] sql.INFO: [17.39] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:21:03.086775+08:00] sql.INFO: [17.22] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:21:04.274744+08:00] sql.INFO: [16.52] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:21:04.292927+08:00] sql.INFO: [17.18] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:21:04.310080+08:00] sql.INFO: [16.11] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:21:04.328055+08:00] sql.INFO: [16.55] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:21:27.459075+08:00] sql.INFO: [17.91] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:21:27.477003+08:00] sql.INFO: [17.15] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:21:27.495141+08:00] sql.INFO: [17.16] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:21:27.512840+08:00] sql.INFO: [16.38] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:21:28.626517+08:00] sql.INFO: [16.08] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:21:28.642728+08:00] sql.INFO: [15.42] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:21:28.660852+08:00] sql.INFO: [17.26] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:21:28.678687+08:00] sql.INFO: [16.35] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:21:31.970821+08:00] sql.INFO: [67.13] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:21:31.997369+08:00] sql.INFO: [13.71] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:21:32.023677+08:00] sql.INFO: [18.59] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:21:32.039464+08:00] sql.INFO: [14.63] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:21:34.351528+08:00] sql.INFO: [17.55] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:21:34.367431+08:00] sql.INFO: [14.8] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:21:34.384914+08:00] sql.INFO: [16.43] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:21:34.399343+08:00] sql.INFO: [13.01] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:22:55.814630+08:00] sql.INFO: [54.97] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:22:55.829017+08:00] sql.INFO: [13.56] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:22:55.846924+08:00] sql.INFO: [17.03] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:22:55.860663+08:00] sql.INFO: [12.43] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:23:00.444534+08:00] sql.INFO: [69.76] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:23:00.481594+08:00] sql.INFO: [16.02] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:23:00.508055+08:00] sql.INFO: [18.31] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:23:00.524097+08:00] sql.INFO: [14.75] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:24:32.596100+08:00] sql.INFO: [275.74] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:24:32.629961+08:00] sql.INFO: [13.94] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:24:32.935117+08:00] sql.INFO: [295.71] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:24:33.185784+08:00] sql.INFO: [249.06] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []
+[2025-02-05T16:24:56.425475+08:00] sql.INFO: [1124.1] select * from `website` where `website`.`id` = '2' limit 1 [] []
+[2025-02-05T16:24:56.457082+08:00] sql.INFO: [13.35] select `page_type` from `website_template_info` where `website_id` = '2' limit 1 [] []
+[2025-02-05T16:24:56.480637+08:00] sql.INFO: [15.61] select `template`.*, `template_class`.`name`, `template_class`.`id` as `class_id` from `template` left join `template_class` on `template_class`.`id` = `template`.`template_class_id` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) order by `template`.`updated_at` desc limit 10 offset 0 [] []
+[2025-02-05T16:24:56.495899+08:00] sql.INFO: [13.91] select count(*) as aggregate from `template` where (json_contains(`template_img`, '{"value":"1"}') and json_contains(`template_img`, '{"value":"2"}') and json_contains(`template_img`, '{"value":"7"}')) [] []