mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 15:20:25 +08:00
[网站服务]可以审核域名、查看审核结果
This commit is contained in:
@@ -143,9 +143,13 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
|
|
||||||
// 域名列表
|
// 域名列表
|
||||||
serverNames := []*serverconfigs.ServerNameConfig{}
|
serverNames := []*serverconfigs.ServerNameConfig{}
|
||||||
if server.IsAuditing {
|
if server.IsAuditing || (server.AuditingResult != nil && !server.AuditingResult.IsOk) {
|
||||||
server.ServerNamesJSON = server.AuditingServerNamesJSON
|
server.ServerNamesJSON = server.AuditingServerNamesJSON
|
||||||
}
|
}
|
||||||
|
auditingIsOk := true
|
||||||
|
if !server.IsAuditing && server.AuditingResult != nil && !server.AuditingResult.IsOk {
|
||||||
|
auditingIsOk = false
|
||||||
|
}
|
||||||
if len(server.ServerNamesJSON) > 0 {
|
if len(server.ServerNamesJSON) > 0 {
|
||||||
err = json.Unmarshal(server.ServerNamesJSON, &serverNames)
|
err = json.Unmarshal(server.ServerNamesJSON, &serverNames)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -185,6 +189,7 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
"serverNames": serverNames,
|
"serverNames": serverNames,
|
||||||
"countServerNames": countServerNames,
|
"countServerNames": countServerNames,
|
||||||
"isAuditing": server.IsAuditing,
|
"isAuditing": server.IsAuditing,
|
||||||
|
"auditingIsOk": auditingIsOk,
|
||||||
"user": userMap,
|
"user": userMap,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
defer this.CreateLog(oplogs.LevelInfo, "删除代理服务 %d", params.ServerId)
|
defer this.CreateLog(oplogs.LevelInfo, "删除代理服务 %d", params.ServerId)
|
||||||
|
|
||||||
// 执行删除
|
// 执行删除
|
||||||
_, err := this.RPC().ServerRPC().DisableServer(this.AdminContext(), &pb.DisableServerRequest{ServerId: params.ServerId})
|
_, err := this.RPC().ServerRPC().DeleteServer(this.AdminContext(), &pb.DeleteServerRequest{ServerId: params.ServerId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package serverNames
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 审核域名
|
||||||
|
type AuditAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AuditAction) RunPost(params struct {
|
||||||
|
ServerId int64
|
||||||
|
AuditingOK bool
|
||||||
|
AuditingReason string
|
||||||
|
|
||||||
|
CSRF *actionutils.CSRF
|
||||||
|
}) {
|
||||||
|
defer this.CreateLogInfo("提交服务 %d 域名审核", params.ServerId)
|
||||||
|
|
||||||
|
if !params.AuditingOK && len(params.AuditingReason) == 0 {
|
||||||
|
this.FailField("auditingReason", "请输入审核不通过原因")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := this.RPC().ServerRPC().UpdateServerNamesAuditing(this.AdminContext(), &pb.UpdateServerNamesAuditingRequest{
|
||||||
|
ServerId: params.ServerId,
|
||||||
|
AuditingResult: &pb.ServerNameAuditingResult{
|
||||||
|
IsOk: params.AuditingOK,
|
||||||
|
Reason: params.AuditingReason,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -4,10 +4,11 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
|
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
"github.com/iwind/TeaGo/actions"
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 域名管理
|
// 域名管理
|
||||||
@@ -22,14 +23,32 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
server, _, isOk := serverutils.FindServer(this.Parent(), params.ServerId)
|
serverNamesResp, err := this.RPC().ServerRPC().FindServerNames(this.AdminContext(), &pb.FindServerNamesRequest{ServerId: params.ServerId})
|
||||||
if !isOk {
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
serverNamesConfig := []*serverconfigs.ServerNameConfig{}
|
serverNamesConfig := []*serverconfigs.ServerNameConfig{}
|
||||||
if len(server.ServerNamesJSON) > 0 {
|
this.Data["isAuditing"] = serverNamesResp.IsAuditing
|
||||||
err := json.Unmarshal(server.ServerNamesJSON, &serverNamesConfig)
|
this.Data["auditingResult"] = maps.Map{
|
||||||
|
"isOk": true,
|
||||||
|
}
|
||||||
|
if serverNamesResp.IsAuditing {
|
||||||
|
serverNamesResp.ServerNamesJSON = serverNamesResp.AuditingServerNamesJSON
|
||||||
|
} else if serverNamesResp.AuditingResult != nil {
|
||||||
|
if !serverNamesResp.AuditingResult.IsOk {
|
||||||
|
serverNamesResp.ServerNamesJSON = serverNamesResp.AuditingServerNamesJSON
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["auditingResult"] = maps.Map{
|
||||||
|
"isOk": serverNamesResp.AuditingResult.IsOk,
|
||||||
|
"reason": serverNamesResp.AuditingResult.Reason,
|
||||||
|
"createdTime": timeutil.FormatTime("Y-m-d H:i:s", serverNamesResp.AuditingResult.CreatedAt),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(serverNamesResp.ServerNamesJSON) > 0 {
|
||||||
|
err := json.Unmarshal(serverNamesResp.ServerNamesJSON, &serverNamesConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
@@ -37,9 +56,6 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
this.Data["serverNames"] = serverNamesConfig
|
this.Data["serverNames"] = serverNamesConfig
|
||||||
|
|
||||||
// DNS
|
|
||||||
this.Data["dnsName"] = server.DnsName
|
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +63,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
ServerId int64
|
ServerId int64
|
||||||
ServerNames string
|
ServerNames string
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
|
CSRF *actionutils.CSRF
|
||||||
}) {
|
}) {
|
||||||
// 记录日志
|
// 记录日志
|
||||||
defer this.CreateLog(oplogs.LevelInfo, "修改代理服务 %d 域名", params.ServerId)
|
defer this.CreateLog(oplogs.LevelInfo, "修改代理服务 %d 域名", params.ServerId)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ func init() {
|
|||||||
Data("secondMenuItem", "serverName").
|
Data("secondMenuItem", "serverName").
|
||||||
Prefix("/servers/server/settings/serverNames").
|
Prefix("/servers/server/settings/serverNames").
|
||||||
GetPost("", new(IndexAction)).
|
GetPost("", new(IndexAction)).
|
||||||
|
Post("/audit", new(AuditAction)).
|
||||||
EndAll()
|
EndAll()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,8 +59,14 @@
|
|||||||
</span>
|
</span>
|
||||||
<span v-else class="disabled">-</span>
|
<span v-else class="disabled">-</span>
|
||||||
|
|
||||||
|
<!-- 审核中 -->
|
||||||
<div v-if="server.isAuditing" style="margin-top: 0.5em">
|
<div v-if="server.isAuditing" style="margin-top: 0.5em">
|
||||||
<span class="ui label basic tiny red">审核中</span>
|
<a class="ui label basic tiny red" title="点击跳到审核页面" :href="'/servers/server/settings/serverNames?serverId=' + server.id">审核中 <i class="icon long arrow right alternate"></i></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 审核失败 -->
|
||||||
|
<div v-if="!server.auditingIsOk" style="margin-top: 0.5em">
|
||||||
|
<a class="ui label basic tiny red" title="点击跳到审核页面" :href="'/servers/server/settings/serverNames?serverId=' + server.id">审核不通过 <i class="icon long arrow right alternate"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -2,16 +2,58 @@
|
|||||||
{$template "/left_menu"}
|
{$template "/left_menu"}
|
||||||
|
|
||||||
<div class="right-box">
|
<div class="right-box">
|
||||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
<!-- 审核中 -->
|
||||||
<input type="hidden" name="serverId" :value="serverId"/>
|
<div v-show="isAuditing">
|
||||||
<table class="ui table definition selectable">
|
<p class="ui message warning">当前域名正在审核中,请审核域名的所有人、备案情况等。</p>
|
||||||
<tr>
|
<form method="post" class="ui form" data-tea-action=".audit" data-tea-success="auditSuccess">
|
||||||
<td class="title">已绑定的域名</td>
|
<csrf-token></csrf-token>
|
||||||
<td>
|
<input type="hidden" name="serverId" :value="serverId"/>
|
||||||
<server-name-box :v-server-names="serverNames"></server-name-box>
|
<table class="ui table definition selectable">
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<td class="title">审核中域名</td>
|
||||||
</table>
|
<td>
|
||||||
<submit-btn></submit-btn>
|
<span v-for="serverName in allServerNames" class="ui label basic">
|
||||||
</form>
|
{{serverName}}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>审核结果</td>
|
||||||
|
<td>
|
||||||
|
<radio name="auditingOK" :v-value="1" v-model="auditing">审核通过</radio>
|
||||||
|
<radio name="auditingOK" :v-value="0" v-model="auditing">审核不通过</radio>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-show="auditing == 0">
|
||||||
|
<td>审核不通过原因 *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="auditingReason" maxlength="100" placeholder="包含审核不通过的域名等"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<submit-btn>提交审核结果</submit-btn>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 审核不通过 -->
|
||||||
|
<div class="ui message error" v-if="!isAuditing && !auditingResult.isOk">
|
||||||
|
审核不通过,原因:{{auditingResult.reason}} ({{auditingResult.createdTime}})。等待用户重新提交。
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 不在审核中 -->
|
||||||
|
<div v-show="!isAuditing && auditingResult.isOk">
|
||||||
|
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<csrf-token></csrf-token>
|
||||||
|
<input type="hidden" name="serverId" :value="serverId"/>
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td class="title">已绑定的域名</td>
|
||||||
|
<td>
|
||||||
|
<server-name-box :v-server-names="serverNames"></server-name-box>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
Tea.context(function () {
|
Tea.context(function () {
|
||||||
this.success = NotifyReloadSuccess("保存成功")
|
this.success = NotifyReloadSuccess("保存成功")
|
||||||
|
this.auditSuccess = NotifyReloadSuccess("保存成功")
|
||||||
|
|
||||||
|
this.allServerNames = []
|
||||||
|
let that = this
|
||||||
|
this.serverNames.forEach(function (v) {
|
||||||
|
if (v.subNames == null || v.subNames.length == 0) {
|
||||||
|
that.allServerNames.push(v.name)
|
||||||
|
} else {
|
||||||
|
that.allServerNames.$pushAll(v.subNames)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.auditing = 1
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user