优化代码

This commit is contained in:
GoEdgeLab
2021-01-03 20:25:15 +08:00
parent 900815c509
commit 6ceefaa100
36 changed files with 122 additions and 119 deletions

View File

@@ -3,7 +3,7 @@ package rewrite
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/actions"
@@ -55,7 +55,7 @@ func (this *CreatePopupAction) RunPost(params struct {
Require("请输入目标URL")
// web配置
webConfig, err := webutils.FindWebConfigWithId(this.Parent(), params.WebId)
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithId(this.AdminContext(), params.WebId)
if err != nil {
this.ErrorPage(err)
return

View File

@@ -3,7 +3,7 @@ package rewrite
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
)
@@ -18,7 +18,7 @@ func (this *DeleteAction) RunPost(params struct {
}) {
defer this.CreateLogInfo("从Web %d 中删除重写规则 %d", params.WebId, params.RewriteRuleId)
webConfig, err := webutils.FindWebConfigWithId(this.Parent(), params.WebId)
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithId(this.AdminContext(), params.WebId)
if err != nil {
this.ErrorPage(err)
return

View File

@@ -2,7 +2,7 @@ package rewrite
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
)
type IndexAction struct {
@@ -17,7 +17,7 @@ func (this *IndexAction) Init() {
func (this *IndexAction) RunGet(params struct {
ServerId int64
}) {
webConfig, err := webutils.FindWebConfigWithServerId(this.Parent(), params.ServerId)
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
if err != nil {
this.ErrorPage(err)
return

View File

@@ -3,7 +3,7 @@ package rewrite
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
)
@@ -18,7 +18,7 @@ func (this *SortAction) RunPost(params struct {
}) {
defer this.CreateLogInfo("对Web %d 中的重写规则进行排序", params.WebId)
webConfig, err := webutils.FindWebConfigWithId(this.Parent(), params.WebId)
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithId(this.AdminContext(), params.WebId)
if err != nil {
this.ErrorPage(err)
return

View File

@@ -2,7 +2,7 @@ package rewrite
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/types"
@@ -22,7 +22,7 @@ func (this *UpdatePopupAction) RunGet(params struct {
}) {
this.Data["webId"] = params.WebId
webConfig, err := webutils.FindWebConfigWithId(this.Parent(), params.WebId)
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithId(this.AdminContext(), params.WebId)
if err != nil {
this.ErrorPage(err)
return