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,67 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build plus
package identity
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/users/userutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
"github.com/iwind/TeaGo/maps"
)
type EnterpriseAction struct {
actionutils.ParentAction
}
func (this *EnterpriseAction) Init() {
this.Nav("", "", "identity")
}
func (this *EnterpriseAction) RunGet(params struct {
UserId int64
}) {
err := userutils.InitUser(this.Parent(), params.UserId)
if err != nil {
this.ErrorPage(err)
return
}
userIdentityResp, err := this.RPC().UserIdentityRPC().FindEnabledUserIdentityWithOrgType(this.AdminContext(), &pb.FindEnabledUserIdentityWithOrgTypeRequest{
UserId: params.UserId,
OrgType: userconfigs.UserIdentityOrgTypeEnterprise,
})
if err != nil {
this.ErrorPage(err)
return
}
var identity = userIdentityResp.UserIdentity
if identity == nil {
this.Data["identity"] = nil
this.Show()
return
}
if identity.FileIds == nil {
identity.FileIds = []int64{0}
}
var frontFileId int64 = 0
if len(identity.FileIds) > 0 {
frontFileId = identity.FileIds[0]
}
this.Data["identity"] = maps.Map{
"id": identity.Id,
"realName": identity.RealName,
"number": identity.Number,
"fileIds": identity.FileIds,
"frontFileId": frontFileId,
"status": identity.Status,
"rejectReason": identity.RejectReason,
}
this.Show()
}

View File

@@ -0,0 +1,72 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build plus
package identity
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/users/userutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
"github.com/iwind/TeaGo/maps"
)
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "", "identity")
}
func (this *IndexAction) RunGet(params struct {
UserId int64
}) {
err := userutils.InitUser(this.Parent(), params.UserId)
if err != nil {
this.ErrorPage(err)
return
}
userIdentityResp, err := this.RPC().UserIdentityRPC().FindEnabledUserIdentityWithOrgType(this.AdminContext(), &pb.FindEnabledUserIdentityWithOrgTypeRequest{
UserId: params.UserId,
OrgType: userconfigs.UserIdentityOrgTypeIndividual,
})
if err != nil {
this.ErrorPage(err)
return
}
var identity = userIdentityResp.UserIdentity
if identity == nil {
this.Data["identity"] = nil
this.Show()
return
}
if identity.FileIds == nil {
identity.FileIds = []int64{0, 0}
}
var backFileId int64 = 0
var frontFileId int64 = 0
if len(identity.FileIds) > 0 {
backFileId = identity.FileIds[0]
}
if len(identity.FileIds) > 1 {
frontFileId = identity.FileIds[1]
}
this.Data["identity"] = maps.Map{
"id": identity.Id,
"realName": identity.RealName,
"number": identity.Number,
"fileIds": identity.FileIds,
"backFileId": backFileId,
"frontFileId": frontFileId,
"status": identity.Status,
"rejectReason": identity.RejectReason,
}
this.Show()
}

View File

@@ -0,0 +1,33 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build plus
package identity
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type RejectAction struct {
actionutils.ParentAction
}
func (this *RejectAction) RunPost(params struct {
UserId int64
IdentityId int64
Reason string
}) {
defer this.CreateLogInfo(codes.UserIdentity_LogRejectUserIdentity, params.UserId)
_, err := this.RPC().UserIdentityRPC().RejectUserIdentity(this.AdminContext(), &pb.RejectUserIdentityRequest{
UserIdentityId: params.IdentityId,
Reason: params.Reason,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}

View File

@@ -0,0 +1,31 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build plus
package identity
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type ResetAction struct {
actionutils.ParentAction
}
func (this *ResetAction) RunPost(params struct {
UserId int64
IdentityId int64
}) {
defer this.CreateLogInfo(codes.UserIdentity_LogResetUserIdentity, params.UserId)
_, err := this.RPC().UserIdentityRPC().ResetUserIdentity(this.AdminContext(), &pb.ResetUserIdentityRequest{
UserIdentityId: params.IdentityId,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}

View File

@@ -0,0 +1,31 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
//go:build plus
package identity
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type VerifyAction struct {
actionutils.ParentAction
}
func (this *VerifyAction) RunPost(params struct {
UserId int64
IdentityId int64
}) {
defer this.CreateLogInfo(codes.UserIdentity_LogVerifyUserIdentity, params.UserId)
_, err := this.RPC().UserIdentityRPC().VerifyUserIdentity(this.AdminContext(), &pb.VerifyUserIdentityRequest{
UserIdentityId: params.IdentityId,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}