实现租户系统设置落库:欢迎语、工作时间与通知开关

- 新增 TenantSetting 模型与 /api/settings 读写接口
- 设置页接通基本资料、自动回复、工作时间、通知偏好
- Widget 初始化使用欢迎语/离线提示,非工作时间不自动分配
- 补充设置持久化与 Widget 提示集成测试
This commit is contained in:
yml2213
2026-07-15 11:27:15 +08:00
parent b5203f7cbd
commit 318ba8a563
9 changed files with 686 additions and 97 deletions
+19
View File
@@ -142,6 +142,25 @@ export const getChannels = () => get<Channel[]>('/channels')
export const createChannel = (data: { type: string; name?: string }) => post<Channel>('/channels', data)
export const updateChannel = (id: number, data: { name?: string; status?: string }) => put<Channel>(`/channels/${id}`, data)
// Tenant settings
export type WorkHours = Record<string, string>
export interface TenantSettings {
tenant_id: number
display_name: string
agent_nickname: string
timezone: string
welcome_message: string
offline_prompt: string
work_hours: WorkHours
worktime_prompt: string
notify_new_session: boolean
notify_offline_leave: boolean
notify_daily_report: boolean
}
export const getTenantSettings = () => get<TenantSettings>('/settings')
export const updateTenantSettings = (data: Partial<TenantSettings> & { work_hours?: WorkHours }) =>
put<TenantSettings>('/settings', data)
// Statistics
export const getKPIs = () => get<StatisticsKpis>('/statistics/kpi')
export const getSessionTrend = (period: 'today' | 'day' | 'month' = 'day') => get<{ date: string; count: number }[]>(`/statistics/trend?period=${period}`)