重新初始化仓库
This commit is contained in:
62
response/response.go
Normal file
62
response/response.go
Normal file
@ -0,0 +1,62 @@
|
||||
// Package response...
|
||||
//
|
||||
// Description : response...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021-08-09 6:42 下午
|
||||
package response
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// ManagerAPIResponseData 管理类API响应的数据结构
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 6:42 下午 2021/8/9
|
||||
type ManagerAPIResponseData struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// ManagerAPISuccess 管理类API处理成功
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 6:45 下午 2021/8/9
|
||||
func ManagerAPISuccess(ctx *gin.Context, data interface{}) {
|
||||
responseData := &ManagerAPIResponseData{
|
||||
Code: 0,
|
||||
Message: "success",
|
||||
Data: data,
|
||||
}
|
||||
ctx.JSON(http.StatusOK, responseData)
|
||||
}
|
||||
|
||||
// ManagerAPIFail 管理类API请求失败
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 6:47 下午 2021/8/9
|
||||
func ManagerAPIFail(ctx *gin.Context, code int, data interface{}) {
|
||||
responseData := &ManagerAPIResponseData{
|
||||
Code: code,
|
||||
Message: "fail",
|
||||
Data: data,
|
||||
}
|
||||
ctx.JSON(http.StatusOK, responseData)
|
||||
}
|
||||
|
||||
// ReadConfigAPISuccess 读取配置API
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 6:48 下午 2021/8/9
|
||||
func ReadConfigAPISuccess(ctx *gin.Context, data string) {
|
||||
ctx.String(http.StatusOK, data)
|
||||
}
|
Reference in New Issue
Block a user