import type { PageParam, PageResult } from '@vben/request';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace WxCpNoticeApi {
|
/** 通知状态:0草稿 1已发布 2已撤回 */
|
export const NOTICE_STATUS = {
|
DRAFT: 0,
|
PUBLISHED: 1,
|
REVOKED: 2,
|
} as const;
|
|
/** 通知 */
|
export interface Notice {
|
id?: number;
|
title?: string;
|
content?: string;
|
status?: number;
|
statusName?: string;
|
pushScope?: number;
|
pushScopeName?: string;
|
pushTarget?: string;
|
pushStatus?: number;
|
pushTime?: string;
|
remark?: string;
|
createTime?: string;
|
}
|
|
/** 通知分页查询参数 */
|
export interface NoticePageParams extends PageParam {
|
title?: string;
|
status?: number;
|
pushStatus?: number;
|
}
|
}
|
|
/** 获得通知分页 */
|
export function getNoticePage(params: WxCpNoticeApi.NoticePageParams) {
|
return requestClient.get<PageResult<WxCpNoticeApi.Notice>>(
|
'/wxcp/notice/page',
|
{ params },
|
);
|
}
|
|
/** 获得通知详情 */
|
export function getNotice(id: number) {
|
return requestClient.get<WxCpNoticeApi.Notice>('/wxcp/notice/get', {
|
params: { id },
|
});
|
}
|
|
/** 创建通知(存为草稿) */
|
export function createNotice(data: WxCpNoticeApi.Notice) {
|
return requestClient.post<number>('/wxcp/notice/create', data);
|
}
|
|
/** 修改通知 */
|
export function updateNotice(data: WxCpNoticeApi.Notice) {
|
return requestClient.put<boolean>('/wxcp/notice/update', data);
|
}
|
|
/** 删除通知 */
|
export function deleteNotice(id: number) {
|
return requestClient.delete<boolean>('/wxcp/notice/delete', {
|
params: { id },
|
});
|
}
|
|
/** 发布通知 */
|
export function publishNotice(id: number) {
|
return requestClient.put<boolean>('/wxcp/notice/publish', null, {
|
params: { id },
|
});
|
}
|
|
/** 撤回通知 */
|
export function revokeNotice(id: number) {
|
return requestClient.put<boolean>('/wxcp/notice/revoke', null, {
|
params: { id },
|
});
|
}
|
|
/** 推送通知给企业微信成员 */
|
export function pushNotice(data: {
|
id: number;
|
pushScope?: number;
|
pushTarget?: string;
|
}) {
|
return requestClient.post<{
|
success: boolean;
|
errCode?: null | number;
|
message?: string;
|
}>('/wxcp/notice/push', data);
|
}
|