You've already forked CasaOS
mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-07-12 23:50:14 +02:00
feat: migrate gin to echo (#1854)
This commit is contained in:
@ -6,28 +6,26 @@ import (
|
||||
"github.com/IceWhaleTech/CasaOS/model"
|
||||
"github.com/IceWhaleTech/CasaOS/pkg/utils/common_err"
|
||||
"github.com/IceWhaleTech/CasaOS/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func PostNotifyMessage(c *gin.Context) {
|
||||
name := c.Param("name")
|
||||
func PostNotifyMessage(ctx echo.Context) error {
|
||||
name := ctx.Param("name")
|
||||
message := make(map[string]interface{})
|
||||
if err := c.ShouldBind(&message); err != nil {
|
||||
c.JSON(http.StatusBadRequest, model.Result{Success: common_err.INVALID_PARAMS, Message: err.Error()})
|
||||
return
|
||||
if err := ctx.Bind(&message); err != nil {
|
||||
return ctx.JSON(http.StatusBadRequest, model.Result{Success: common_err.INVALID_PARAMS, Message: err.Error()})
|
||||
}
|
||||
|
||||
service.MyService.Notify().SendNotify(name, message)
|
||||
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS)})
|
||||
return ctx.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS)})
|
||||
}
|
||||
|
||||
func PostSystemStatusNotify(c *gin.Context) {
|
||||
func PostSystemStatusNotify(ctx echo.Context) error {
|
||||
message := make(map[string]interface{})
|
||||
if err := c.ShouldBind(&message); err != nil {
|
||||
c.JSON(http.StatusBadRequest, model.Result{Success: common_err.INVALID_PARAMS, Message: err.Error()})
|
||||
return
|
||||
if err := ctx.Bind(&message); err != nil {
|
||||
return ctx.JSON(http.StatusBadRequest, model.Result{Success: common_err.INVALID_PARAMS, Message: err.Error()})
|
||||
}
|
||||
|
||||
service.MyService.Notify().SettingSystemTempData(message)
|
||||
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS)})
|
||||
return ctx.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS)})
|
||||
}
|
||||
|
Reference in New Issue
Block a user