init
This commit is contained in:
parent
fe472aed44
commit
e0679a0ffd
@ -66,10 +66,10 @@ export const batchDeleteItemReplies = (items: { cookie_id: string; item_id: stri
|
||||
|
||||
// 更新商品多数量发货状态
|
||||
export const updateItemMultiQuantityDelivery = (cookieId: string, itemId: string, enabled: boolean): Promise<ApiResponse> => {
|
||||
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<ApiResponse> => {
|
||||
return put(`/items/${cookieId}/${itemId}/multi-spec`, { is_multi_spec: enabled })
|
||||
return put(`/products/${cookieId}/${itemId}/multi-spec`, { is_multi_spec: enabled })
|
||||
}
|
||||
|
||||
@ -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<ApiResponse> => {
|
||||
export const deleteMessageNotification = (notificationId: number): Promise<ApiResponse> => {
|
||||
return del(`/message-notifications/${notificationId}`)
|
||||
}
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user