lh 2 дней назад
Родитель
Сommit
ae9f8d0cc8
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      app/Services/DeepSeek/DeepSeekService.php

+ 7 - 1
app/Services/DeepSeek/DeepSeekService.php

@@ -666,7 +666,7 @@ class DeepSeekService
             Utils::throwError('20003:消息不能为空');
         }
 
-        $json = json_decode($products, 256);
+        $json = json_encode($products, 256);
 
         // 批量插入数据
         return DB::table('mp_script_records')->where('id', $rid)->update([
@@ -684,6 +684,7 @@ class DeepSeekService
     public function getScriptChatHistory($data) {
         $uid = Site::getUid();
         $script_id = getProp($data, 'script_id');
+        $rid = getProp($data, 'rid');
         $sequence = getProp($data, 'sequence', null);
 
         if (!$script_id) {
@@ -710,6 +711,11 @@ class DeepSeekService
             $query->where('sequence', $sequence);
         }
 
+        // 记录ID筛选
+        if ($rid) {
+            $query->where('id', $rid);
+        }
+
         // 查询记录并按 id 正序排序
         $records = $query->select('id', 'script_id', 'sequence', 'role', 'content', 'products', 'created_at')
             ->orderBy('created_at', 'asc')