init: 项目初始化提交
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
This commit is contained in:
105
apps/web-antd/src/api/notification/index.ts
Normal file
105
apps/web-antd/src/api/notification/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace NotificationApi {
|
||||
export interface NotificationItem {
|
||||
id: number;
|
||||
title: string;
|
||||
content?: string;
|
||||
notification_page: string;
|
||||
start_date: string;
|
||||
start_time: string;
|
||||
end_date: string;
|
||||
end_time: string;
|
||||
status: number;
|
||||
create_time: string;
|
||||
update_time: string;
|
||||
}
|
||||
|
||||
export interface NotificationList {
|
||||
total: number;
|
||||
items: NotificationItem[];
|
||||
}
|
||||
|
||||
export interface CreateNotificationRequest {
|
||||
title: string;
|
||||
content: string;
|
||||
notification_page: string;
|
||||
start_date: string;
|
||||
start_time: string;
|
||||
end_date: string;
|
||||
end_time: string;
|
||||
status: 0 | 1;
|
||||
}
|
||||
|
||||
export interface CreateNotificationResponse {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface UpdateNotificationRequest
|
||||
extends Partial<CreateNotificationRequest> {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface UpdateNotificationResponse {
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
export interface DeleteNotificationResponse {
|
||||
success: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通知列表
|
||||
*/
|
||||
async function getNotificationList(params: Recordable<any>) {
|
||||
return requestClient.get<NotificationApi.NotificationList>(
|
||||
'/notification/list',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建通知
|
||||
*/
|
||||
async function createNotification(
|
||||
data: NotificationApi.CreateNotificationRequest,
|
||||
) {
|
||||
return requestClient.post<NotificationApi.CreateNotificationResponse>(
|
||||
'/notification/create',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新通知
|
||||
*/
|
||||
async function updateNotification(
|
||||
id: number,
|
||||
data: NotificationApi.UpdateNotificationRequest,
|
||||
) {
|
||||
return requestClient.put<NotificationApi.UpdateNotificationResponse>(
|
||||
`/notification/update/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除通知
|
||||
*/
|
||||
async function deleteNotification(id: number) {
|
||||
return requestClient.delete<NotificationApi.DeleteNotificationResponse>(
|
||||
`/notification/delete/${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
createNotification,
|
||||
deleteNotification,
|
||||
getNotificationList,
|
||||
updateNotification,
|
||||
};
|
||||
Reference in New Issue
Block a user