approveflow/app/http/base/res/res.go

24 lines
573 B
Go
Raw Permalink Normal View History

2024-11-14 17:02:41 +08:00
package res
import (
"approveflow/app/http/base"
"github.com/Superdanda/hade/framework/gin"
"net/http"
)
func FailWithErr(ctx *gin.Context, err error) {
ctx.ISetStatus(http.StatusInternalServerError).IJson(base.Fail(err.Error()))
}
func Fail(ctx *gin.Context) {
ctx.ISetStatus(http.StatusInternalServerError).IJson(base.Fail("操作失败"))
}
func Success(ctx *gin.Context) {
ctx.ISetStatus(http.StatusOK).IJson(base.SuccessWithOKMessage())
}
func SuccessWithData(ctx *gin.Context, data interface{}) {
ctx.ISetStatus(http.StatusOK).IJson(base.Success(data))
}