This commit is contained in:
unknown
2026-02-04 20:27:13 +08:00
commit 3b042d1dad
9410 changed files with 1488147 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build plus
package script
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/maps"
timeutil "github.com/iwind/TeaGo/utils/time"
)
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "", "")
}
func (this *IndexAction) RunGet(params struct {
Type string
PrevURL string
ScriptId int64
}) {
this.Data["type"] = params.Type
this.Data["prevURL"] = params.PrevURL
scriptResp, err := this.RPC().UserScriptRPC().FindUserScript(this.AdminContext(), &pb.FindUserScriptRequest{UserScriptId: params.ScriptId})
if err != nil {
this.ErrorPage(err)
return
}
var script = scriptResp.UserScript
if script == nil {
this.NotFound("userScript", params.ScriptId)
return
}
// user
var userMap = maps.Map{
"id": 0,
}
if script.User != nil {
userMap = maps.Map{
"id": script.User.Id,
"username": script.User.Username,
"fullname": script.User.Fullname,
}
}
this.Data["script"] = maps.Map{
"id": script.Id,
"code": script.Code,
"createdTime": timeutil.FormatTime("Y-m-d H:i:s", script.CreatedAt),
"isPassed": script.IsPassed,
"isRejected": script.IsRejected,
"rejectedReason": script.RejectedReason,
"user": userMap,
}
this.Show()
}

View File

@@ -0,0 +1,28 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build plus
package script
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type PassAction struct {
actionutils.ParentAction
}
func (this *PassAction) RunPost(params struct {
ScriptId int64
}) {
defer this.CreateLogInfo(codes.ServerUserScript_LogPassUserScript, params.ScriptId)
_, err := this.RPC().UserScriptRPC().PassUserScript(this.AdminContext(), &pb.PassUserScriptRequest{UserScriptId: params.ScriptId})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}

View File

@@ -0,0 +1,53 @@
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build plus
package script
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
)
type RejectPopupAction struct {
actionutils.ParentAction
}
func (this *RejectPopupAction) Init() {
this.Nav("", "", "")
}
func (this *RejectPopupAction) RunGet(params struct {
ScriptId int64
}) {
this.Data["scriptId"] = params.ScriptId
this.Show()
}
func (this *RejectPopupAction) RunPost(params struct {
ScriptId int64
Reason string
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo(codes.ServerUserScript_LogRejectUserScript, params.ScriptId)
if len(params.Reason) == 0 {
this.FailField("reason", "请输入驳回理由")
return
}
_, err := this.RPC().UserScriptRPC().RejectUserScript(this.AdminContext(), &pb.RejectUserScriptRequest{
UserScriptId: params.ScriptId,
Reason: params.Reason,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}