fix(search): 修复跨租户重复手机号查询报错
This commit is contained in:
@@ -919,7 +919,7 @@ func (r *Repository) ListAdminInvitations(ctx context.Context, query AdminInvita
|
||||
if p := strings.TrimSpace(query.Phone); p != "" {
|
||||
if isPhoneKeyword(p) {
|
||||
db = db.Where(
|
||||
"(ui.inviter_id = (SELECT id FROM users WHERE phone = ?) OR ui.invitee_id = (SELECT id FROM users WHERE phone = ?))",
|
||||
"(ui.inviter_id IN (SELECT id FROM users WHERE phone = ?) OR ui.invitee_id IN (SELECT id FROM users WHERE phone = ?))",
|
||||
p,
|
||||
p,
|
||||
)
|
||||
@@ -930,14 +930,14 @@ func (r *Repository) ListAdminInvitations(ctx context.Context, query AdminInvita
|
||||
}
|
||||
if p := strings.TrimSpace(query.InviterPhone); p != "" {
|
||||
if isPhoneKeyword(p) {
|
||||
db = db.Where("ui.inviter_id = (SELECT id FROM users WHERE phone = ?)", p)
|
||||
db = db.Where("ui.inviter_id IN (SELECT id FROM users WHERE phone = ?)", p)
|
||||
} else {
|
||||
db = db.Where("inviter.phone LIKE ?", "%"+p+"%")
|
||||
}
|
||||
}
|
||||
if p := strings.TrimSpace(query.InviteePhone); p != "" {
|
||||
if isPhoneKeyword(p) {
|
||||
db = db.Where("ui.invitee_id = (SELECT id FROM users WHERE phone = ?)", p)
|
||||
db = db.Where("ui.invitee_id IN (SELECT id FROM users WHERE phone = ?)", p)
|
||||
} else {
|
||||
db = db.Where("invitee.phone LIKE ?", "%"+p+"%")
|
||||
}
|
||||
@@ -1069,14 +1069,14 @@ func (r *Repository) adminRebateLedgerBase(ctx context.Context, query AdminRebat
|
||||
}
|
||||
if p := strings.TrimSpace(query.InviterPhone); p != "" {
|
||||
if isPhoneKeyword(p) {
|
||||
db = db.Where("irl.inviter_id = (SELECT id FROM users WHERE phone = ?)", p)
|
||||
db = db.Where("irl.inviter_id IN (SELECT id FROM users WHERE phone = ?)", p)
|
||||
} else {
|
||||
db = db.Where("inviter.phone LIKE ?", "%"+p+"%")
|
||||
}
|
||||
}
|
||||
if p := strings.TrimSpace(query.InviteePhone); p != "" {
|
||||
if isPhoneKeyword(p) {
|
||||
db = db.Where("irl.invitee_id = (SELECT id FROM users WHERE phone = ?)", p)
|
||||
db = db.Where("irl.invitee_id IN (SELECT id FROM users WHERE phone = ?)", p)
|
||||
} else {
|
||||
db = db.Where("invitee.phone LIKE ?", "%"+p+"%")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user