Files
AllinSSL/frontend/apps/allin-ssl/mock/template.ts
2026-01-13 17:47:39 +08:00

25 lines
634 B
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.
/**
* @description 成功模板
* @param {string} msg 消息
* @returns
*/
export const listTemplate = <T>(data: T, count: number) => ({
code: 200, // 状态码
count, // 总数仅data 为数组时有效
data, // 数据
message: '', // 消息
status: true, // 消息状态true 为成功false 为失败
})
/**
* @description 消息模板
* @param {object} data 数据
* @returns
*/
export const messageTemplate = (message: string, status: boolean) => ({
code: 200, // 状态码
count: 0, // 总数仅data 为数组时有效
message, // 消息
status, // 消息状态true 为成功false 为失败
})