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

添加接口:自助建站-ai会话-删除聊天记录

FengR 1 месяц назад
Родитель
Сommit
df34da203e
2 измененных файлов с 19 добавлено и 0 удалено
  1. 17 0
      app/JsonRpc/PublicRpcService.php
  2. 2 0
      app/JsonRpc/PublicRpcServiceInterface.php

+ 17 - 0
app/JsonRpc/PublicRpcService.php

@@ -4551,4 +4551,21 @@ class PublicRpcService implements PublicRpcServiceInterface
         $result['update_time'] = date('Y-m-d H:i:s', strtotime($latestUpdate));
         return Result::success($result);
     }
+    /**
+     * 自助建站-ai会话-删除聊天记录
+     */
+    public function delAiChatRecord(array $data): array
+    {
+        $chat_id = $data['chat_id'];
+        $user_id = $data['user_id'];
+        $chat = AiChat::where('chat_id',$chat_id)->where('user_id',$user_id)->first();
+        if(empty($chat)){
+            return Result::error('此用户的聊天记录不存在!');
+        }
+        $del_chat = AiChat::where('chat_id',$chat_id)->where('user_id',$user_id)->delete();
+        if(empty($del_chat)){
+            return Result::error('删除失败!');
+        }
+        return Result::success(['删除成功']);
+    }
 }

+ 2 - 0
app/JsonRpc/PublicRpcServiceInterface.php

@@ -246,4 +246,6 @@ interface PublicRpcServiceInterface
     public function checkWebTemplate(array $data): array;
     // 自助建站-ai会话-获取所有皮肤
     public function getAITemplate(array $data): array;
+    //自助建站-ai会话-删除聊天记录
+    public function delAiChatRecord(array $data): array;
 }