modelRT/handler/helper.go

33 lines
596 B
Go
Raw Permalink Normal View History

// Package handler provides HTTP handlers for various endpoints.
package handler
import (
"net/http"
"modelRT/network"
"github.com/gin-gonic/gin"
)
2026-01-13 17:23:47 +08:00
func renderRespFailure(c *gin.Context, code int, msg string, payload any) {
resp := network.FailureResponse{
Code: code,
Msg: msg,
}
if payload != nil {
resp.Payload = payload
}
c.JSON(http.StatusOK, resp)
}
func renderRespSuccess(c *gin.Context, code int, msg string, payload any) {
resp := network.SuccessResponse{
Code: code,
Msg: msg,
}
if payload != nil {
resp.Payload = payload
}
c.JSON(http.StatusOK, resp)
}