backend/generate/api/common.api

34 lines
732 B
Plaintext
Raw Normal View History

2025-09-30 16:53:31 +00:00
syntax = "v1"
// ================ 通用響應 ================
type (
// 成功響應
OKResp {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data,omitempty"`
}
// 分頁響應
PagerResp {
Total int64 `json:"total"`
Size int64 `json:"size"`
Index int64 `json:"index"`
}
// 錯誤響應
ErrorResp {
Code int `json:"code"`
Msg string `json:"msg"`
Details string `json:"details,omitempty"`
Error interface{} `json:"error,omitempty"` // 可選的錯誤信息
}
BaseReq {}
VerifyHeader {
Token string `header:"token" validate:"required"`
}
)