增加全局VNC与TELNET设置

This commit is contained in:
dushixiang
2021-02-10 21:56:05 +08:00
committed by dushixiang
parent 622fa65241
commit 25c3c6b929
11 changed files with 783 additions and 765 deletions

View File

@ -1,8 +1,10 @@
package api
import (
"errors"
"fmt"
"github.com/labstack/echo/v4"
"gorm.io/gorm"
"next-terminal/pkg/model"
)
@ -19,11 +21,23 @@ func PropertyUpdateEndpoint(c echo.Context) error {
for key := range item {
value := fmt.Sprintf("%v", item[key])
if value == "" {
value = "-"
}
property := model.Property{
Name: key,
Value: value,
}
model.UpdatePropertyByName(&property, key)
_, err := model.FindPropertyByName(key)
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
if err := model.CreateNewProperty(&property); err != nil {
return err
}
} else {
model.UpdatePropertyByName(&property, key)
}
}
return Success(c, nil)
}