:poop:代码改进

This commit is contained in:
coward
2024-03-14 15:23:16 +08:00
parent 91a1e61334
commit 8dfef5192e
23 changed files with 443 additions and 83 deletions

View File

@@ -4,6 +4,7 @@ import (
"gitee.ltd/lxh/logger/log"
"github.com/gin-gonic/gin"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"strings"
"wireguard-dashboard/http/param"
"wireguard-dashboard/model/entity"
"wireguard-dashboard/queues"
@@ -43,7 +44,7 @@ func (server) SaveServer(c *gin.Context) {
}
publicKey := privateKey.PublicKey()
serverInfo := &entity.Server{
IpScope: p.IpScope,
IpScope: strings.Join(p.IpScope, ","),
ListenPort: p.ListenPort,
PrivateKey: privateKey.String(),
PublicKey: publicKey.String(),
@@ -82,17 +83,8 @@ func (server) GetServer(c *gin.Context) {
log.Errorf("获取服务端信息失败: %v", err.Error())
}
utils.GinResponse(c).OKWithData(data)
}
// GetGlobalSetting
// @description: 获取全局设置配置
// @receiver server
// @param c
func (server) GetGlobalSetting(c *gin.Context) {
data, err := repository.System().GetServerSetting()
if err != nil {
log.Errorf("获取配置失败: %v", err.Error())
if data.IpScopeStr != "" {
data.IpScope = strings.Split(data.IpScopeStr, ",")
}
utils.GinResponse(c).OKWithData(data)