2022-11-29 17:17:14 +00:00
|
|
|
package v1
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/IceWhaleTech/CasaOS/model"
|
|
|
|
"github.com/IceWhaleTech/CasaOS/pkg/utils/common_err"
|
|
|
|
"github.com/IceWhaleTech/CasaOS/service"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
func PostNotifyMessage(c *gin.Context) {
|
2023-02-06 07:47:29 +00:00
|
|
|
name := c.Param("name")
|
2022-11-29 17:17:14 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-02-06 07:47:29 +00:00
|
|
|
service.MyService.Notify().SendNotify(name, message)
|
2022-11-29 17:17:14 +00:00
|
|
|
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS)})
|
|
|
|
}
|
|
|
|
|
|
|
|
func PostSystemStatusNotify(c *gin.Context) {
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
service.MyService.Notify().SettingSystemTempData(message)
|
|
|
|
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS)})
|
|
|
|
}
|