diff --git a/back/services/system.ts b/back/services/system.ts index c3bb467a..967eb092 100644 --- a/back/services/system.ts +++ b/back/services/system.ts @@ -393,12 +393,13 @@ export default class SystemService { } let notifyType: string | undefined; - try { - const notifConfig = await this.getDb({ type: AuthDataType.notification }); - notifyType = notifConfig.info?.type as string | undefined; - } catch (e) {} if (notificationInfo?.type) { notifyType = typeString || (notificationInfo.type as string); + } else { + try { + const notifConfig = await this.getDb({ type: AuthDataType.notification }); + notifyType = notifConfig.info?.type as string | undefined; + } catch (e) {} } const isSuccess = await this.notificationService.notify( diff --git a/src/pages/setting/notifyLog.tsx b/src/pages/setting/notifyLog.tsx index de466296..7af6befb 100644 --- a/src/pages/setting/notifyLog.tsx +++ b/src/pages/setting/notifyLog.tsx @@ -3,15 +3,24 @@ import React from 'react'; import { Table, Tag } from 'antd'; import dayjs from 'dayjs'; -enum NotifyStatus { - '成功', - '失败', +interface NotifyLogItem { + id?: number; + timestamp?: number; + title?: string; + content?: string; + status?: number; + notifyType?: string; } -enum NotifyStatusColor { - 'success', - 'error', -} +const NotifyStatusLabel: Record = { + 0: '成功', + 1: '失败', +}; + +const NotifyStatusColor: Record = { + 0: 'success', + 1: 'error', +}; const columns = [ { @@ -56,13 +65,14 @@ const columns = [ dataIndex: 'status', key: 'status', width: 90, - render: (text: string, record: any) => { + render: (text: string, record: NotifyLogItem) => { + const statusKey = record.status ?? 1; return ( - {intl.get(NotifyStatus[record.status])} + {intl.get(NotifyStatusLabel[statusKey])} ); }, @@ -73,7 +83,7 @@ const NotifyLog = ({ data, height, }: { - data: Array; + data: Array; height: number; }) => { return (