index.ts
1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import request from '@/config/axios'
// 消息模板 VO
export interface MsgTemplateVO {
id: number // 模版主键
accountId: number // 公众号账号的编号
appId: string // appId
templateId: string // 公众号模板 ID
title: string // 标题
content: string // 模板内容
example: string // 模板示例
primaryIndustry: string // 模板所属行业的一级行业
deputyIndustry: string // 模板所属行业的二级行业
createTime: Date // 创建时间
}
// 发送消息模板请求 VO
export interface MsgTemplateSendVO {
id: number // 模板编号
userId: number // 用户编号
data?: string // 模板数据(JSON 格式字符串)
url?: string // 跳转链接
miniProgramAppId?: string // 小程序 appId
miniProgramPagePath?: string // 小程序页面路径
miniprogram?: string // 小程序信息(JSON 格式字符串)
}
// 公众号消息模板 API
export const MessageTemplateApi = {
// 查询消息模板分页
getMessageTemplateList: async (params: any) => {
return await request.get({ url: `/mp/message-template/list`, params })
},
// 删除消息模板
deleteMessageTemplate: async (id: number) => {
return await request.delete({ url: `/mp/message-template/delete?id=` + id })
},
// 同步公众号模板
syncMessageTemplate: async (accountId: number) => {
return await request.post({ url: `/mp/message-template/sync?accountId=` + accountId })
},
// 发送消息模板
sendMessageTemplate: async (data: MsgTemplateSendVO) => {
return await request.post({ url: `/mp/message-template/send`, data })
}
}