作者 lyh

gx

... ... @@ -40,17 +40,17 @@ class GoogleKeywordInsightLogic extends BaseLogic
$this->service = new RapIdApIService();
$data = $this->service->requestUrl($this->param['keyword']);
if(!empty($data)){
DB::beginTransaction();
// DB::beginTransaction();
//保存数据库
try {
// try {
$detailModel = new GoogleKeywordInsightDetail();
$this->model->saveInsight($this->user['project_id'],$this->param['keyword'],$data);
$detailModel->saveInsightDetail($this->user['project_id'],$this->param['keyword'],$data);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('保存失败,请联系管理员');
}
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('保存失败,请联系管理员');
// }
}
}
return $this->success();
... ...
... ... @@ -64,9 +64,10 @@ class ChatLogic extends BaseLogic
$data = ['message' => $message];
$stream = $gptService->get_ai_chat($data); // 获取流
$streamHelper = new Stream($stream);
$streamHelper->echo();
$res_message = $streamHelper->getData();
$this->saveChatItem($chatId, $res_message,1);
return $streamHelper->echo();
return $res_message;
}
/**
... ...