63 lines
1.5 KiB
Go
63 lines
1.5 KiB
Go
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
|
|
|
package identity
|
|
|
|
import (
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
|
|
"github.com/TeaOSLab/EdgeUser/internal/web/actions/actionutils"
|
|
"github.com/iwind/TeaGo/maps"
|
|
)
|
|
|
|
type IndexAction struct {
|
|
actionutils.ParentAction
|
|
}
|
|
|
|
func (this *IndexAction) Init() {
|
|
this.Nav("", "", "")
|
|
}
|
|
|
|
func (this *IndexAction) RunGet(params struct{}) {
|
|
// 个人认证
|
|
{
|
|
resp, err := this.RPC().UserIdentityRPC().FindEnabledUserIdentityWithOrgType(this.UserContext(), &pb.FindEnabledUserIdentityWithOrgTypeRequest{
|
|
UserId: this.UserId(),
|
|
OrgType: userconfigs.UserIdentityOrgTypeIndividual,
|
|
})
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
if resp.UserIdentity == nil {
|
|
this.Data["individualIdentity"] = nil
|
|
} else {
|
|
this.Data["individualIdentity"] = maps.Map{
|
|
"realName": resp.UserIdentity.RealName,
|
|
"status": resp.UserIdentity.Status,
|
|
}
|
|
}
|
|
}
|
|
|
|
// 企业认证
|
|
{
|
|
resp, err := this.RPC().UserIdentityRPC().FindEnabledUserIdentityWithOrgType(this.UserContext(), &pb.FindEnabledUserIdentityWithOrgTypeRequest{
|
|
UserId: this.UserId(),
|
|
OrgType: userconfigs.UserIdentityOrgTypeEnterprise,
|
|
})
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
if resp.UserIdentity == nil {
|
|
this.Data["enterpriseIdentity"] = nil
|
|
} else {
|
|
this.Data["enterpriseIdentity"] = maps.Map{
|
|
"realName": resp.UserIdentity.RealName,
|
|
"status": resp.UserIdentity.Status,
|
|
}
|
|
}
|
|
}
|
|
|
|
this.Show()
|
|
}
|