Spaces:
Sleeping
Sleeping
File size: 472 Bytes
f0953a4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import { Response } from "express";
interface ResponseData {
code?: number; // 业务状态码
message?: string;
data?: any;
}
export const sendSuccess = (res: Response, response: ResponseData, businessCode: number = 0) => {
response.code = businessCode;
res.status(200).json(response);
};
export const sendError = (res: Response, response: ResponseData, businessCode: number = 10000) => {
response.code = businessCode;
res.status(200).json(response);
};
|