Просмотр исходного кода

修改接口:自助建站-ai会话-给模板添加导航

FengR 1 месяц назад
Родитель
Сommit
ed56ae7204
1 измененных файлов с 31 добавлено и 6 удалено
  1. 31 6
      app/JsonRpc/PublicRpcService.php

+ 31 - 6
app/JsonRpc/PublicRpcService.php

@@ -4573,12 +4573,37 @@ class PublicRpcService implements PublicRpcServiceInterface
      */
     public function addTemplateCates(array $data): array
     {
-        $session_id = $data['session_id'];
-        $user_id = $data['user_id'];
-        $chat = AiChat::where('session_id',$session_id)->where('user_id',$user_id)->orderBy('send_time','asc')->get()->all();
-        if(empty($chat)){
-            return Result::error('此用户的聊天记录不存在!');
+        $website_template = TemplateDraftbox::where('id',$data['template_id'])->first();
+        if(empty($website_template)){
+            return Result::error('此网站模板不存在!');
+        }
+        // return Result::success($website_template);
+        $template_data = json_decode($website_template['template_data'],true);
+        $template_index = $template_data['template']['index'];
+        if(empty($template_index)){
+            return Result::error('模板数据不能为空!');
+        }
+        $canvas_data = json_decode($website_template['canvas_data'],true);
+        $canvas_index = $canvas_data['template']['index'];
+        if(empty($canvas_index)){
+            return Result::error('画布数据不能为空!');
+        }
+        $cate_column = [
+            'placeid' => 1,
+            'pid' => 0,
+            'num' => 23,
+            'website_id' => $website_template['website_id'],
+            'is_show' => 1,
+        ];
+        $websiteServer = new \App\JsonRpc\WebsiteService();
+        $all_cate_data = $websiteServer->getWebsiteModelCategory($cate_column);
+        $all_cate = $all_cate_data['data'] ?? [];
+        if(count($all_cate) == 0){
+            return Result::error('栏目不存在!');
+        }
+        foreach ($all_cate as $key => $item) {
+            
         }
-        return Result::success($chat);
+        return Result::success($all_cate);
     }
 }