mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-02 22:10:26 +08:00
用户列表页增加手机号绑定状态筛选
This commit is contained in:
@@ -322,8 +322,8 @@ func (this *UserDAO) UpdateUserPassword(tx *dbs.Tx, userId int64, password strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CountAllEnabledUsers 计算用户数量
|
// CountAllEnabledUsers 计算用户数量
|
||||||
func (this *UserDAO) CountAllEnabledUsers(tx *dbs.Tx, clusterId int64, keyword string, isVerifying bool) (int64, error) {
|
func (this *UserDAO) CountAllEnabledUsers(tx *dbs.Tx, clusterId int64, keyword string, isVerifying bool, mobileIsVerifiedFlag int32) (int64, error) {
|
||||||
query := this.Query(tx)
|
var query = this.Query(tx)
|
||||||
query.State(UserStateEnabled)
|
query.State(UserStateEnabled)
|
||||||
if clusterId > 0 {
|
if clusterId > 0 {
|
||||||
query.Attr("clusterId", clusterId)
|
query.Attr("clusterId", clusterId)
|
||||||
@@ -336,6 +336,14 @@ func (this *UserDAO) CountAllEnabledUsers(tx *dbs.Tx, clusterId int64, keyword s
|
|||||||
query.Where("(isVerified=0 OR (id IN (SELECT userId FROM " + SharedUserIdentityDAO.Table + " WHERE status=:identityStatus AND state=1)))")
|
query.Where("(isVerified=0 OR (id IN (SELECT userId FROM " + SharedUserIdentityDAO.Table + " WHERE status=:identityStatus AND state=1)))")
|
||||||
query.Param("identityStatus", userconfigs.UserIdentityStatusSubmitted)
|
query.Param("identityStatus", userconfigs.UserIdentityStatusSubmitted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 手机号是否已验证
|
||||||
|
if mobileIsVerifiedFlag == 1 {
|
||||||
|
query.Where("LENGTH(verifiedMobile)>0")
|
||||||
|
} else if mobileIsVerifiedFlag == 0 {
|
||||||
|
query.Where("(verifiedMobile IS NULL OR LENGTH(verifiedMobile)=0)")
|
||||||
|
}
|
||||||
|
|
||||||
return query.Count()
|
return query.Count()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,8 +357,8 @@ func (this *UserDAO) CountAllVerifyingUsers(tx *dbs.Tx) (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ListEnabledUsers 列出单页用户
|
// ListEnabledUsers 列出单页用户
|
||||||
func (this *UserDAO) ListEnabledUsers(tx *dbs.Tx, clusterId int64, keyword string, isVerifying bool, offset int64, size int64) (result []*User, err error) {
|
func (this *UserDAO) ListEnabledUsers(tx *dbs.Tx, clusterId int64, keyword string, isVerifying bool, mobileIsVerifiedFlag int32, offset int64, size int64) (result []*User, err error) {
|
||||||
query := this.Query(tx)
|
var query = this.Query(tx)
|
||||||
query.State(UserStateEnabled)
|
query.State(UserStateEnabled)
|
||||||
if clusterId > 0 {
|
if clusterId > 0 {
|
||||||
query.Attr("clusterId", clusterId)
|
query.Attr("clusterId", clusterId)
|
||||||
@@ -363,6 +371,14 @@ func (this *UserDAO) ListEnabledUsers(tx *dbs.Tx, clusterId int64, keyword strin
|
|||||||
query.Where("(isVerified=0 OR (id IN (SELECT userId FROM " + SharedUserIdentityDAO.Table + " WHERE status=:identityStatus AND state=1)))")
|
query.Where("(isVerified=0 OR (id IN (SELECT userId FROM " + SharedUserIdentityDAO.Table + " WHERE status=:identityStatus AND state=1)))")
|
||||||
query.Param("identityStatus", userconfigs.UserIdentityStatusSubmitted)
|
query.Param("identityStatus", userconfigs.UserIdentityStatusSubmitted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 手机号是否已验证
|
||||||
|
if mobileIsVerifiedFlag == 1 {
|
||||||
|
query.Where("LENGTH(verifiedMobile)>0")
|
||||||
|
} else if mobileIsVerifiedFlag == 0 {
|
||||||
|
query.Where("(verifiedMobile IS NULL OR LENGTH(verifiedMobile)=0)")
|
||||||
|
}
|
||||||
|
|
||||||
_, err = query.
|
_, err = query.
|
||||||
DescPk().
|
DescPk().
|
||||||
Offset(offset).
|
Offset(offset).
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ func (this *AdminService) ComposeAdminDashboard(ctx context.Context, req *pb.Com
|
|||||||
|
|
||||||
// 用户数
|
// 用户数
|
||||||
this.BeginTag(ctx, "SharedUserDAO.CountAllEnabledUsers")
|
this.BeginTag(ctx, "SharedUserDAO.CountAllEnabledUsers")
|
||||||
countUsers, err := models.SharedUserDAO.CountAllEnabledUsers(tx, 0, "", false)
|
countUsers, err := models.SharedUserDAO.CountAllEnabledUsers(tx, 0, "", false, -1)
|
||||||
this.EndTag(ctx, "SharedUserDAO.CountAllEnabledUsers")
|
this.EndTag(ctx, "SharedUserDAO.CountAllEnabledUsers")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ func (this *ServerStatBoardService) ComposeServerStatNodeClusterBoard(ctx contex
|
|||||||
}
|
}
|
||||||
result.CountInactiveNodes = countInactiveNodes
|
result.CountInactiveNodes = countInactiveNodes
|
||||||
|
|
||||||
countUsers, err := models.SharedUserDAO.CountAllEnabledUsers(tx, req.NodeClusterId, "", false)
|
countUsers, err := models.SharedUserDAO.CountAllEnabledUsers(tx, req.NodeClusterId, "", false, -1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ func (this *UserService) CountAllEnabledUsers(ctx context.Context, req *pb.Count
|
|||||||
|
|
||||||
var tx = this.NullTx()
|
var tx = this.NullTx()
|
||||||
|
|
||||||
count, err := models.SharedUserDAO.CountAllEnabledUsers(tx, 0, req.Keyword, req.IsVerifying)
|
count, err := models.SharedUserDAO.CountAllEnabledUsers(tx, 0, req.Keyword, req.IsVerifying, req.MobileIsVerified)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ func (this *UserService) ListEnabledUsers(ctx context.Context, req *pb.ListEnabl
|
|||||||
|
|
||||||
var tx = this.NullTx()
|
var tx = this.NullTx()
|
||||||
|
|
||||||
users, err := models.SharedUserDAO.ListEnabledUsers(tx, 0, req.Keyword, req.IsVerifying, req.Offset, req.Size)
|
users, err := models.SharedUserDAO.ListEnabledUsers(tx, 0, req.Keyword, req.IsVerifying, req.MobileIsVerified, req.Offset, req.Size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -160,19 +160,20 @@ func (this *UserService) ListEnabledUsers(ctx context.Context, req *pb.ListEnabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = append(result, &pb.User{
|
result = append(result, &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,
|
VerifiedMobile: user.VerifiedMobile,
|
||||||
Email: user.Email,
|
Tel: user.Tel,
|
||||||
Remark: user.Remark,
|
Email: user.Email,
|
||||||
IsOn: user.IsOn,
|
Remark: user.Remark,
|
||||||
RegisteredIP: user.RegisteredIP,
|
IsOn: user.IsOn,
|
||||||
IsVerified: user.IsVerified,
|
RegisteredIP: user.RegisteredIP,
|
||||||
IsRejected: user.IsRejected,
|
IsVerified: user.IsVerified,
|
||||||
CreatedAt: int64(user.CreatedAt),
|
IsRejected: user.IsRejected,
|
||||||
NodeCluster: pbCluster,
|
CreatedAt: int64(user.CreatedAt),
|
||||||
|
NodeCluster: pbCluster,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,7 +647,7 @@ func (this *UserService) ComposeUserGlobalBoard(ctx context.Context, req *pb.Com
|
|||||||
|
|
||||||
var result = &pb.ComposeUserGlobalBoardResponse{}
|
var result = &pb.ComposeUserGlobalBoardResponse{}
|
||||||
var tx = this.NullTx()
|
var tx = this.NullTx()
|
||||||
totalUsers, err := models.SharedUserDAO.CountAllEnabledUsers(tx, 0, "", false)
|
totalUsers, err := models.SharedUserDAO.CountAllEnabledUsers(tx, 0, "", false, -1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user