mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-06 17:40:25 +08:00
相关接口增加实名认证状态字段
This commit is contained in:
@@ -185,7 +185,7 @@ func (this *UserIdentityDAO) FindUserIdentityStatus(tx *dbs.Tx, identityId int64
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FindEnabledUserIdentityWithOrgType 查找某个类型的认证信息
|
// FindEnabledUserIdentityWithOrgType 查找某个类型的认证信息
|
||||||
func (this *UserIdentityDAO) FindEnabledUserIdentityWithOrgType(tx *dbs.Tx, userId int64, orgType string) (*UserIdentity, error) {
|
func (this *UserIdentityDAO) FindEnabledUserIdentityWithOrgType(tx *dbs.Tx, userId int64, orgType userconfigs.UserIdentityOrgType) (*UserIdentity, error) {
|
||||||
one, err := this.Query(tx).
|
one, err := this.Query(tx).
|
||||||
Attr("userId", userId).
|
Attr("userId", userId).
|
||||||
Attr("orgType", orgType).
|
Attr("orgType", orgType).
|
||||||
@@ -197,3 +197,13 @@ func (this *UserIdentityDAO) FindEnabledUserIdentityWithOrgType(tx *dbs.Tx, user
|
|||||||
}
|
}
|
||||||
return one.(*UserIdentity), nil
|
return one.(*UserIdentity), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckUserIdentityIsVerified 检查实名认证
|
||||||
|
func (this *UserIdentityDAO) CheckUserIdentityIsVerified(tx *dbs.Tx, userId int64, orgType userconfigs.UserIdentityOrgType) (bool, error) {
|
||||||
|
return this.Query(tx).
|
||||||
|
Attr("userId", userId).
|
||||||
|
Attr("orgType", orgType).
|
||||||
|
Attr("status", userconfigs.UserIdentityStatusVerified).
|
||||||
|
State(UserIdentityStateEnabled).
|
||||||
|
Exist()
|
||||||
|
}
|
||||||
|
|||||||
@@ -233,13 +233,17 @@ func (this *UserService) ListEnabledUsers(ctx context.Context, req *pb.ListEnabl
|
|||||||
|
|
||||||
// FindEnabledUser 查询单个用户信息
|
// FindEnabledUser 查询单个用户信息
|
||||||
func (this *UserService) FindEnabledUser(ctx context.Context, req *pb.FindEnabledUserRequest) (*pb.FindEnabledUserResponse, error) {
|
func (this *UserService) FindEnabledUser(ctx context.Context, req *pb.FindEnabledUserRequest) (*pb.FindEnabledUserResponse, error) {
|
||||||
_, _, err := this.ValidateAdminAndUser(ctx)
|
_, userId, err := this.ValidateAdminAndUser(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var tx = this.NullTx()
|
var tx = this.NullTx()
|
||||||
|
|
||||||
|
if userId > 0 {
|
||||||
|
req.UserId = userId
|
||||||
|
}
|
||||||
|
|
||||||
user, err := models.SharedUserDAO.FindEnabledUser(tx, req.UserId, nil)
|
user, err := models.SharedUserDAO.FindEnabledUser(tx, req.UserId, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -261,21 +265,34 @@ func (this *UserService) FindEnabledUser(ctx context.Context, req *pb.FindEnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 认证信息
|
||||||
|
isIndividualIdentified, err := models.SharedUserIdentityDAO.CheckUserIdentityIsVerified(tx, req.UserId, userconfigs.UserIdentityOrgTypeIndividual)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
isEnterpriseIdentified, err := models.SharedUserIdentityDAO.CheckUserIdentityIsVerified(tx, req.UserId, userconfigs.UserIdentityOrgTypeEnterprise)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &pb.FindEnabledUserResponse{User: &pb.User{
|
return &pb.FindEnabledUserResponse{User: &pb.User{
|
||||||
Id: int64(user.Id),
|
Id: int64(user.Id),
|
||||||
Username: user.Username,
|
Username: user.Username,
|
||||||
Fullname: user.Fullname,
|
Fullname: user.Fullname,
|
||||||
Mobile: user.Mobile,
|
Mobile: user.Mobile,
|
||||||
Tel: user.Tel,
|
Tel: user.Tel,
|
||||||
Email: user.Email,
|
Email: user.Email,
|
||||||
Remark: user.Remark,
|
Remark: user.Remark,
|
||||||
IsOn: user.IsOn,
|
IsOn: user.IsOn,
|
||||||
CreatedAt: int64(user.CreatedAt),
|
CreatedAt: int64(user.CreatedAt),
|
||||||
RegisteredIP: user.RegisteredIP,
|
RegisteredIP: user.RegisteredIP,
|
||||||
IsVerified: user.IsVerified,
|
IsVerified: user.IsVerified,
|
||||||
IsRejected: user.IsRejected,
|
IsRejected: user.IsRejected,
|
||||||
RejectReason: user.RejectReason,
|
RejectReason: user.RejectReason,
|
||||||
NodeCluster: pbCluster,
|
NodeCluster: pbCluster,
|
||||||
|
IsIndividualIdentified: isIndividualIdentified,
|
||||||
|
IsEnterpriseIdentified: isEnterpriseIdentified,
|
||||||
}}, nil
|
}}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user