mager: 合并11.3版本,包名和主线一样方便复制

This commit is contained in:
TsMask committed 2024-11-23 18:54:02 +08:00
1 parent c0368c07ef
commit d5954d40c8
514 files changed
+24297 -17778

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
package cm_omc
import (
"fmt"
"net/http"
"be.ems/lib/services"
"github.com/gin-gonic/gin"
)
func (o *ConfigOMC) Get(c *gin.Context) {
paramName := c.Param("paramName")
results, err := o.Query(paramName)
if err != nil {
c.JSON(http.StatusInternalServerError, services.ErrResp(err.Error()))
return
}
c.JSON(http.StatusOK, services.DataResp(results))
}
func (o *ConfigOMC) Post(c *gin.Context) {
err := fmt.Errorf("method not allowed")
c.JSON(http.StatusMethodNotAllowed, services.ErrResp(err.Error()))
}
func (o *ConfigOMC) Put(c *gin.Context) {
paramName := c.Param("paramName")
var paramData map[string]any
if err := c.ShouldBindJSON(&paramData); err != nil {
c.JSON(http.StatusBadRequest, services.ErrResp(err.Error()))
return
}
result, err := o.Modify(paramName, paramData)
if err != nil {
c.JSON(http.StatusInternalServerError, services.ErrResp(err.Error()))
return
}
c.JSON(http.StatusOK, services.DataResp(result))
}
func (o *ConfigOMC) Delete(c *gin.Context) {
err := fmt.Errorf("method not allowed")
c.JSON(http.StatusMethodNotAllowed, services.ErrResp(err.Error()))
}