代码提交

This commit is contained in:
wong
2025-08-30 10:58:34 +08:00
parent fb10e43055
commit f6837f7819
2 changed files with 54 additions and 12 deletions

View File

@@ -16,6 +16,7 @@ class MessageController extends BaseController
*/
public function getMessages()
{
return successJson([], '获取成功');
try {
// 获取用户信息
$userInfo = request()->userInfo;
@@ -37,12 +38,11 @@ class MessageController extends BaseController
if (empty($conversation)) {
$conversationController = new ConversationController();
$result = $conversationController->create(true);
$result = json_decode($result, true);
if ($result['code'] != 200) {
return errorJson('创建会话失败:' . $result['msg']);
$resultData = json_decode($result, true);
if ($resultData['code'] != 200) {
return errorJson('创建会话失败:' . $resultData['msg']);
}
$conversation_id = $result['data']['id'];
$conversation_id = $resultData['data']['id'];
} else {
$conversation_id = $conversation['conversation_id'];
}
@@ -59,6 +59,8 @@ class MessageController extends BaseController
}
}
// 分页参数
$page = input('page', 1);
$limit = input('limit', 20);
@@ -114,4 +116,4 @@ class MessageController extends BaseController
return errorJson('获取对话记录失败:' . $e->getMessage());
}
}
}
}