Files
frontend/apps/web-antd/src/api/mp/message/index.ts
2025-11-17 13:57:41 +08:00

56 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
/** 消息类型枚举 */
// TODO @xingyu芋艿可能要整理下枚举
export enum MessageType {
IMAGE = 'image', // 图片消息
MPNEWS = 'mpnews', // 公众号图文消息
MUSIC = 'music', // 音乐消息
NEWS = 'news', // 图文消息
TEXT = 'text', // 文本消息
VIDEO = 'video', // 视频消息
VOICE = 'voice', // 语音消息
WXCARD = 'wxcard', // 卡券消息
}
export namespace MpMessageApi {
/** 消息信息 */
export interface Message {
id?: number;
accountId: number;
type: MessageType;
openid: string;
content: string;
mediaId?: string;
status: number;
remark?: string;
createTime?: Date;
}
/** 发送消息请求 */
export interface MessageSendRequestVO {
accountId: number;
openid: string;
type: MessageType;
content: string;
mediaId?: string;
}
}
/** 查询消息列表 */
export function getMessagePage(params: PageParam) {
return requestClient.get<PageResult<MpMessageApi.Message>>(
'/mp/message/page',
{
params,
},
);
}
/** 发送消息 */
export function sendMessage(data: MpMessageApi.MessageSendRequestVO) {
return requestClient.post('/mp/message/send', data);
}