53 lines
1.3 KiB
Go
53 lines
1.3 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 IndividualAction struct {
|
|
actionutils.ParentAction
|
|
}
|
|
|
|
func (this *IndividualAction) Init() {
|
|
this.Nav("", "", "")
|
|
}
|
|
|
|
func (this *IndividualAction) RunGet(params struct{}) {
|
|
resp, err := this.RPC().UserIdentityRPC().FindEnabledUserIdentityWithOrgType(this.UserContext(), &pb.FindEnabledUserIdentityWithOrgTypeRequest{
|
|
OrgType: userconfigs.UserIdentityOrgTypeIndividual,
|
|
})
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
|
|
var userIdentity = resp.UserIdentity
|
|
if userIdentity == nil {
|
|
this.Data["identity"] = nil
|
|
this.Show()
|
|
return
|
|
}
|
|
if len(userIdentity.FileIds) != 2 {
|
|
this.Data["identity"] = nil
|
|
this.Show()
|
|
return
|
|
}
|
|
|
|
this.Data["identity"] = maps.Map{
|
|
"id": userIdentity.Id,
|
|
"realName": userIdentity.RealName,
|
|
"number": userIdentity.Number,
|
|
"status": userIdentity.Status,
|
|
"frontFileId": userIdentity.FileIds[1],
|
|
"backFileId": userIdentity.FileIds[0],
|
|
"rejectReason": userIdentity.RejectReason,
|
|
}
|
|
|
|
this.Show()
|
|
}
|