feat(mp): 小程序功能完善 — 服务层扩展 + 页面优化

- 新增 actionInbox 服务层(待办事项列表/线程查询)
- consultation 服务扩展(会话详情/发送消息)
- 多页面代码优化(profile/messages/health/article)
- 新增 navigate 工具函数
This commit is contained in:
iven
2026-05-13 23:26:38 +08:00
parent 93c77c5857
commit 616e0a1539
10 changed files with 141 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
import { api } from './request';
import { api, requestWithTimeout } from './request';
export interface ConsultationSession {
id: string;
@@ -60,3 +60,12 @@ export async function sendMessage(sessionId: string, content: string, contentTyp
export async function markSessionRead(sessionId: string) {
return api.put<void>(`/health/consultation-sessions/${sessionId}/read`);
}
export async function pollMessages(sessionId: string, afterId?: string) {
const params = new URLSearchParams();
if (afterId) params.set('after_id', afterId);
params.set('timeout', '25');
const query = params.toString();
const path = `/health/consultation-sessions/${sessionId}/messages/poll${query ? '?' + query : ''}`;
return requestWithTimeout<ConsultationMessage[]>('GET', path, undefined, 30000);
}