mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-06 18:10:25 +08:00
用户列表中显示实名审核状态
This commit is contained in:
@@ -226,7 +226,8 @@ func (this *UserDAO) CountAllEnabledUsers(tx *dbs.Tx, clusterId int64, keyword s
|
|||||||
Param("keyword", dbutils.QuoteLike(keyword))
|
Param("keyword", dbutils.QuoteLike(keyword))
|
||||||
}
|
}
|
||||||
if isVerifying {
|
if isVerifying {
|
||||||
query.Attr("isVerified", 0)
|
query.Where("(isVerified=0 OR (id IN (SELECT userId FROM " + SharedUserIdentityDAO.Table + " WHERE status=:identityStatus AND state=1)))")
|
||||||
|
query.Param("identityStatus", userconfigs.UserIdentityStatusSubmitted)
|
||||||
}
|
}
|
||||||
return query.Count()
|
return query.Count()
|
||||||
}
|
}
|
||||||
@@ -235,7 +236,8 @@ func (this *UserDAO) CountAllEnabledUsers(tx *dbs.Tx, clusterId int64, keyword s
|
|||||||
func (this *UserDAO) CountAllVerifyingUsers(tx *dbs.Tx) (int64, error) {
|
func (this *UserDAO) CountAllVerifyingUsers(tx *dbs.Tx) (int64, error) {
|
||||||
query := this.Query(tx)
|
query := this.Query(tx)
|
||||||
query.State(UserStateEnabled)
|
query.State(UserStateEnabled)
|
||||||
query.Attr("isVerified", 0)
|
query.Where("(isVerified=0 OR (id IN (SELECT userId FROM " + SharedUserIdentityDAO.Table + " WHERE status=:identityStatus AND state=1)))")
|
||||||
|
query.Param("identityStatus", userconfigs.UserIdentityStatusSubmitted)
|
||||||
return query.Count()
|
return query.Count()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +253,8 @@ func (this *UserDAO) ListEnabledUsers(tx *dbs.Tx, clusterId int64, keyword strin
|
|||||||
Param("keyword", dbutils.QuoteLike(keyword))
|
Param("keyword", dbutils.QuoteLike(keyword))
|
||||||
}
|
}
|
||||||
if isVerifying {
|
if isVerifying {
|
||||||
query.Attr("isVerified", 0)
|
query.Where("(isVerified=0 OR (id IN (SELECT userId FROM " + SharedUserIdentityDAO.Table + " WHERE status=:identityStatus AND state=1)))")
|
||||||
|
query.Param("identityStatus", userconfigs.UserIdentityStatusSubmitted)
|
||||||
}
|
}
|
||||||
_, err = query.
|
_, err = query.
|
||||||
DescPk().
|
DescPk().
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ func (this *UserIdentityDAO) RejectUserIdentity(tx *dbs.Tx, identityId int64, re
|
|||||||
return this.Query(tx).
|
return this.Query(tx).
|
||||||
Pk(identityId).
|
Pk(identityId).
|
||||||
Set("status", userconfigs.UserIdentityStatusRejected).
|
Set("status", userconfigs.UserIdentityStatusRejected).
|
||||||
Set("rejectedReason", reason).
|
Set("rejectReason", reason).
|
||||||
Set("rejectedAt", time.Now().Unix()).
|
Set("rejectedAt", time.Now().Unix()).
|
||||||
UpdateQuickly()
|
UpdateQuickly()
|
||||||
}
|
}
|
||||||
@@ -207,3 +207,12 @@ func (this *UserIdentityDAO) CheckUserIdentityIsVerified(tx *dbs.Tx, userId int6
|
|||||||
State(UserIdentityStateEnabled).
|
State(UserIdentityStateEnabled).
|
||||||
Exist()
|
Exist()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckUserIdentityStatus 检查状态
|
||||||
|
func (this *UserIdentityDAO) CheckUserIdentityStatus(tx *dbs.Tx, userId int64, status userconfigs.UserIdentityStatus) (bool, error) {
|
||||||
|
return this.Query(tx).
|
||||||
|
Attr("userId", userId).
|
||||||
|
Attr("status", status).
|
||||||
|
State(UserIdentityStateEnabled).
|
||||||
|
Exist()
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type UserIdentity struct {
|
|||||||
SubmittedAt uint64 `field:"submittedAt"` // 提交时间
|
SubmittedAt uint64 `field:"submittedAt"` // 提交时间
|
||||||
RejectedAt uint64 `field:"rejectedAt"` // 拒绝时间
|
RejectedAt uint64 `field:"rejectedAt"` // 拒绝时间
|
||||||
VerifiedAt uint64 `field:"verifiedAt"` // 认证时间
|
VerifiedAt uint64 `field:"verifiedAt"` // 认证时间
|
||||||
RejectedReason string `field:"rejectedReason"` // 拒绝原因
|
RejectReason string `field:"rejectReason"` // 拒绝原因
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserIdentityOperator struct {
|
type UserIdentityOperator struct {
|
||||||
@@ -36,7 +36,7 @@ type UserIdentityOperator struct {
|
|||||||
SubmittedAt interface{} // 提交时间
|
SubmittedAt interface{} // 提交时间
|
||||||
RejectedAt interface{} // 拒绝时间
|
RejectedAt interface{} // 拒绝时间
|
||||||
VerifiedAt interface{} // 认证时间
|
VerifiedAt interface{} // 认证时间
|
||||||
RejectedReason interface{} // 拒绝原因
|
RejectReason interface{} // 拒绝原因
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUserIdentityOperator() *UserIdentityOperator {
|
func NewUserIdentityOperator() *UserIdentityOperator {
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ func (this *UserIdentityService) FindEnabledUserIdentity(ctx context.Context, re
|
|||||||
SubmittedAt: int64(identity.SubmittedAt),
|
SubmittedAt: int64(identity.SubmittedAt),
|
||||||
RejectedAt: int64(identity.RejectedAt),
|
RejectedAt: int64(identity.RejectedAt),
|
||||||
VerifiedAt: int64(identity.VerifiedAt),
|
VerifiedAt: int64(identity.VerifiedAt),
|
||||||
RejectedReason: identity.RejectedReason,
|
RejectReason: identity.RejectReason,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@@ -122,11 +122,27 @@ func (this *UserIdentityService) FindEnabledUserIdentityWithOrgType(ctx context.
|
|||||||
SubmittedAt: int64(identity.SubmittedAt),
|
SubmittedAt: int64(identity.SubmittedAt),
|
||||||
RejectedAt: int64(identity.RejectedAt),
|
RejectedAt: int64(identity.RejectedAt),
|
||||||
VerifiedAt: int64(identity.VerifiedAt),
|
VerifiedAt: int64(identity.VerifiedAt),
|
||||||
RejectedReason: identity.RejectedReason,
|
RejectReason: identity.RejectReason,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckUserIdentityIsSubmitted 检查是否正在审核中
|
||||||
|
func (this *UserIdentityService) CheckUserIdentityIsSubmitted(ctx context.Context, req *pb.CheckUserIdentityIsSubmittedRequest) (*pb.CheckUserIdentityIsSubmittedResponse, error) {
|
||||||
|
_, err := this.ValidateAdmin(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var tx = this.NullTx()
|
||||||
|
isSubmitted, err := models.SharedUserIdentityDAO.CheckUserIdentityStatus(tx, req.UserId, userconfigs.UserIdentityStatusSubmitted)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &pb.CheckUserIdentityIsSubmittedResponse{IsSubmitted: isSubmitted}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// UpdateUserIdentity 修改身份认证信息
|
// UpdateUserIdentity 修改身份认证信息
|
||||||
func (this *UserIdentityService) UpdateUserIdentity(ctx context.Context, req *pb.UpdateUserIdentityRequest) (*pb.RPCSuccess, error) {
|
func (this *UserIdentityService) UpdateUserIdentity(ctx context.Context, req *pb.UpdateUserIdentityRequest) (*pb.RPCSuccess, error) {
|
||||||
userId, err := this.ValidateUserNode(ctx)
|
userId, err := this.ValidateUserNode(ctx)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user