修改邀请码关系查询的数据表
This commit is contained in:
parent
8fec641ffd
commit
0ec920e08e
@ -1029,7 +1029,7 @@ func GetInvitedUserList(in *artistInfoUser.GetInvitedUserListRequest) (res *arti
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通过受邀请人的邀请码,查询他的邀请人列表
|
// 通过受邀请人的邀请码,查询他的邀请人列表 (被哪些人邀请过)
|
||||||
func GetInviterUserList(in *artistInfoUser.GetInviterUserListRequest) (res *artistInfoUser.GetInvitedUserListResponse, err error) {
|
func GetInviterUserList(in *artistInfoUser.GetInviterUserListRequest) (res *artistInfoUser.GetInvitedUserListResponse, err error) {
|
||||||
res = &artistInfoUser.GetInvitedUserListResponse{
|
res = &artistInfoUser.GetInvitedUserListResponse{
|
||||||
Data: []*artistInfoUser.InvitedUser{},
|
Data: []*artistInfoUser.InvitedUser{},
|
||||||
@ -1039,7 +1039,7 @@ func GetInviterUserList(in *artistInfoUser.GetInviterUserListRequest) (res *arti
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
var inviteCodes []string
|
var inviteCodes []string
|
||||||
db.DB.Model(model.Invite{}).Where("invited_code = ?", in.InvitedCode).Pluck("invite_code", &inviteCodes)
|
db.DB.Model(model.UserInvited{}).Where("invited_code = ?", in.InvitedCode).Pluck("invite_code", &inviteCodes)
|
||||||
var invitedList []model.User
|
var invitedList []model.User
|
||||||
orm := db.DB.Model(model.User{}).Preload("RealNameInfo").Where("invited_code in ?", inviteCodes) //查询邀请人
|
orm := db.DB.Model(model.User{}).Preload("RealNameInfo").Where("invited_code in ?", inviteCodes) //查询邀请人
|
||||||
if err = orm.Count(&res.Page.Total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&invitedList).Error; err != nil {
|
if err = orm.Count(&res.Page.Total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&invitedList).Error; err != nil {
|
||||||
@ -1128,7 +1128,7 @@ func GetInviteStaticList(in *artistInfoUser.GetInviteStaticListRequest) (res *ar
|
|||||||
Where("su.deleted_at=0").
|
Where("su.deleted_at=0").
|
||||||
Group("ui.invite_code") //HAVING count(ui.invited_code) >0
|
Group("ui.invite_code") //HAVING count(ui.invited_code) >0
|
||||||
if in.Keyword != "" {
|
if in.Keyword != "" {
|
||||||
orm = orm.Where(fmt.Sprintf("rn.name LIKE '%%%v%%' OR su.tel_num LIKE '%%%v%%' OR su.invited_code LIKE '%%%v%%' ", in.Keyword, in.Keyword, in.Keyword))
|
orm = orm.Where(fmt.Sprintf("rn.name LIKE '%%%v%%' OR su.tel_num LIKE '%%%v%%' OR su.invited_code LIKE '%%%v%%'", in.Keyword, in.Keyword, in.Keyword))
|
||||||
}
|
}
|
||||||
var datas []inviteStatic
|
var datas []inviteStatic
|
||||||
err = orm.Count(&res.Page.Total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&datas).Error
|
err = orm.Count(&res.Page.Total).Scopes(db.Pagination(in.Page, in.PageSize)).Find(&datas).Error
|
||||||
|
Loading…
Reference in New Issue
Block a user