This commit is contained in:
withchao
2023-03-17 11:14:14 +08:00
parent 15610438d8
commit 835cd6d14a
22 changed files with 5 additions and 5 deletions
+18
View File
@@ -0,0 +1,18 @@
package apiresp
import (
"github.com/gin-gonic/gin"
"net/http"
)
func GinError(c *gin.Context, err error) {
if err == nil {
GinSuccess(c, nil)
return
}
c.JSON(http.StatusOK, apiError(err))
}
func GinSuccess(c *gin.Context, data any) {
c.JSON(http.StatusOK, apiSuccess(data))
}