Browse Source

update

master
shenjiachi 1 day ago
parent
commit
17061b9620
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      app/svc/member_center/svc_user_management.go

+ 5
- 4
app/svc/member_center/svc_user_management.go View File

@@ -6,9 +6,10 @@ import (
)

func UserManagementGetUsers(engine *xorm.Engine, req *md.UserManagementGetUserListReq) (*[]md.UserInfo, int64, error) {
var users []md.UserInfo
session := engine.SQL("SELECT a.*, user_tag_records.tag_id AS tag_id, b.phone AS parent_phone, b.system_invite_code AS parent_system_invite_code, b.custom_invite_code AS parent_custom_invite_code FROM `user` AS a, `user` AS b, `user_tag_records`" +
"WHERE a.parent_uid = b.id AND user_tag_records.uid = a.id")
users := make([]md.UserInfo, 0)
session := engine.Table("user").Alias("a").
Join("LEFT OUTER", []string{"user", "b"}, "a.parent_uid = b.id").
Join("LEFT OUTER", "user_tag_records", "user_tag_records.uid = a.id")
if req.ID != 0 {
session = session.Where("a.id = ?", req.ID)
}
@@ -60,7 +61,7 @@ func UserManagementGetUsers(engine *xorm.Engine, req *md.UserManagementGetUserLi
if req.LoginBefore != "" && req.LoginAfter != "" {
session = session.Where("a.update_at > ? and a.update_at < ?", req.LoginBefore, req.LoginAfter)
}
total, err := session.Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&users)
total, err := session.Limit(req.Limit, (req.Page-1)*req.Limit).Asc("a.id").FindAndCount(&users)
if err != nil {
return nil, 0, err
}


Loading…
Cancel
Save