Files
nl-im-service/internal/model/response.go

29 lines
929 B
Go
Raw Normal View History

2025-12-03 11:00:47 +08:00
/**
* package model
* 作用定义统一的API响应格式
*/
package model
/**
* InterfaceInfo
* 作用接口信息包含响应时间和服务器标识
*/
type InterfaceInfo struct {
ResultTime string `json:"result_time"` // 响应时间格式XX ms
Ecs string `json:"ecs"` // 服务器标识
}
/**
* ApiResponse
* 作用统一的API响应结构体
* 说明所有API响应都使用此格式HTTP状态码统一返回200错误通过code字段标识
*/
type ApiResponse struct {
Code int `json:"code"` // 业务状态码0=成功非0=失败
Message string `json:"message"` // 响应消息
Result interface{} `json:"result"` // 响应数据
Type string `json:"type"` // 响应类型:"success" 或 "error"
InterfaceInfo InterfaceInfo `json:"interface_info"` // 接口信息
}