🔥 改为前后端分离形式

This commit is contained in:
李寻欢
2024-07-04 14:10:46 +08:00
parent f39f46bfbf
commit b806ade655
49 changed files with 387 additions and 62 deletions

27
common/response/result.go Normal file
View File

@@ -0,0 +1,27 @@
package response
// Result
// @description: 响应
// @receiver r
// @param code int 状态码
// @param data any 数据
// @param msg string 消息
// @param err string 错误信息
// @return err error 返回数据错误
func (r *Response) Result() {
type resp struct {
Code int `json:"code"`
Data any `json:"data"`
Msg string `json:"message"`
ErrMsg string `json:"errMsg,omitempty"`
}
rd := resp{
r.code,
r.data,
r.msg,
r.errMsg,
}
// 返回数据
r.ctx.JSON(r.code, rd)
}