新增账号凭证邮箱查询接口
This commit is contained in:
@@ -473,6 +473,37 @@ func (r *accountRepository) ListByPlatform(ctx context.Context, platform string)
|
||||
return r.accountsToService(ctx, accounts)
|
||||
}
|
||||
|
||||
func (r *accountRepository) ListByPlatformAndCredentialEmails(
|
||||
ctx context.Context,
|
||||
platform string,
|
||||
emails []string,
|
||||
) ([]service.Account, error) {
|
||||
if len(emails) == 0 {
|
||||
return []service.Account{}, nil
|
||||
}
|
||||
args := make([]any, 0, len(emails))
|
||||
for _, email := range emails {
|
||||
if email == "" {
|
||||
continue
|
||||
}
|
||||
args = append(args, email)
|
||||
}
|
||||
if len(args) == 0 {
|
||||
return []service.Account{}, nil
|
||||
}
|
||||
|
||||
accounts, err := r.client.Account.Query().
|
||||
Where(dbaccount.PlatformEQ(platform)).
|
||||
Where(func(s *entsql.Selector) {
|
||||
s.Where(sqljson.ValueIn(dbaccount.FieldCredentials, args, sqljson.Path("email")))
|
||||
}).
|
||||
All(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r.accountsToService(ctx, accounts)
|
||||
}
|
||||
|
||||
func (r *accountRepository) UpdateLastUsed(ctx context.Context, id int64) error {
|
||||
now := time.Now()
|
||||
_, err := r.client.Account.Update().
|
||||
|
||||
Reference in New Issue
Block a user