From e0679a0ffd2c4c64b5d5f5d06af2e95d8bb26378 Mon Sep 17 00:00:00 2001 From: wangli Date: Fri, 6 Feb 2026 23:53:44 +0800 Subject: [PATCH] init --- src/api/items.ts | 4 ++-- src/api/notifications.ts | 5 +++-- src/pages/notifications/MessageNotifications.tsx | 10 ++++++++-- src/types/index.ts | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/api/items.ts b/src/api/items.ts index c063db7..80b5ada 100644 --- a/src/api/items.ts +++ b/src/api/items.ts @@ -66,10 +66,10 @@ export const batchDeleteItemReplies = (items: { cookie_id: string; item_id: stri // 更新商品多数量发货状态 export const updateItemMultiQuantityDelivery = (cookieId: string, itemId: string, enabled: boolean): Promise => { - return put(`/items/${cookieId}/${itemId}/multi-quantity-delivery`, { multi_quantity_delivery: enabled }) + return put(`/products/${cookieId}/${itemId}/multi-quantity-delivery`, { multi_quantity_delivery: enabled }) } // 更新商品多规格状态 export const updateItemMultiSpec = (cookieId: string, itemId: string, enabled: boolean): Promise => { - return put(`/items/${cookieId}/${itemId}/multi-spec`, { is_multi_spec: enabled }) + return put(`/products/${cookieId}/${itemId}/multi-spec`, { is_multi_spec: enabled }) } diff --git a/src/api/notifications.ts b/src/api/notifications.ts index f3facc2..8cf73db 100644 --- a/src/api/notifications.ts +++ b/src/api/notifications.ts @@ -117,9 +117,10 @@ export const getMessageNotifications = async (): Promise<{ success: boolean; dat if (Array.isArray(channelList)) { for (const item of channelList) { notifications.push({ + id: item.id, cookie_id: cookieId, channel_id: item.channel_id, - channel_name: item.channel_name, + channel_name: item.channel.name, enabled: item.enabled, }) } @@ -134,7 +135,7 @@ export const setMessageNotification = (cookieId: string, channelId: number, enab } // 删除消息通知 -export const deleteMessageNotification = (notificationId: string): Promise => { +export const deleteMessageNotification = (notificationId: number): Promise => { return del(`/message-notifications/${notificationId}`) } diff --git a/src/pages/notifications/MessageNotifications.tsx b/src/pages/notifications/MessageNotifications.tsx index 4deb42b..2ef1848 100644 --- a/src/pages/notifications/MessageNotifications.tsx +++ b/src/pages/notifications/MessageNotifications.tsx @@ -2,7 +2,12 @@ import { useState, useEffect } from 'react' import type { FormEvent } from 'react' import { motion } from 'framer-motion' import { Mail, RefreshCw, Plus, Trash2, Power, PowerOff, X, Loader2 } from 'lucide-react' -import { getMessageNotifications, setMessageNotification, getNotificationChannels } from '@/api/notifications' +import { + getMessageNotifications, + setMessageNotification, + getNotificationChannels, + deleteMessageNotification +} from '@/api/notifications' import { getAccounts } from '@/api/accounts' import { useUIStore } from '@/store/uiStore' import { useAuthStore } from '@/store/authStore' @@ -81,8 +86,9 @@ export function MessageNotifications() { if (!confirm('确定要删除这个消息通知吗?')) return try { // 后端删除接口需要 notification_id,但我们没有这个字段 + await deleteMessageNotification(notification.id) // 改为禁用该通知 - await setMessageNotification(notification.cookie_id, notification.channel_id, false) + // await setMessageNotification(notification.cookie_id, notification.channel_id, false) addToast({ type: 'success', message: '通知已禁用' }) loadNotifications() } catch { diff --git a/src/types/index.ts b/src/types/index.ts index b1d48fc..6f43190 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -165,6 +165,7 @@ export interface NotificationChannel { // 消息通知相关类型 - 匹配后端接口 // 后端返回格式: { cookie_id: { channel_id: { enabled: boolean, channel_name: string } } } export interface MessageNotification { + id: number cookie_id: string channel_id: number channel_name?: string