wip: oauth2登录和oauth2 otp登录验证

This commit is contained in:
王一之
2023-07-21 21:18:31 +08:00
parent 179b58e557
commit 513f8ea012
21 changed files with 507 additions and 123 deletions

View File

@@ -0,0 +1,24 @@
package persistence
import (
"mayfly-go/internal/sys/domain/entity"
"mayfly-go/internal/sys/domain/repository"
"mayfly-go/pkg/gormx"
)
type authAccountRepoImpl struct{}
func newAuthAccountRepo() repository.OAuthAccount {
return new(authAccountRepoImpl)
}
func (a *authAccountRepoImpl) GetOAuthAccount(condition *entity.OAuthAccount, cols ...string) error {
return gormx.GetBy(condition, cols...)
}
func (a *authAccountRepoImpl) SaveOAuthAccount(e *entity.OAuthAccount) error {
if e.Id == 0 {
return gormx.Insert(e)
}
return gormx.UpdateById(e)
}

View File

@@ -3,17 +3,22 @@ package persistence
import "mayfly-go/internal/sys/domain/repository"
var (
accountRepo = newAccountRepo()
configRepo = newConfigRepo()
resourceRepo = newResourceRepo()
roleRepo = newRoleRepo()
syslogRepo = newSyslogRepo()
accountRepo = newAccountRepo()
authAccountRepo = newAuthAccountRepo()
configRepo = newConfigRepo()
resourceRepo = newResourceRepo()
roleRepo = newRoleRepo()
syslogRepo = newSyslogRepo()
)
func GetAccountRepo() repository.Account {
return accountRepo
}
func GetOAuthAccountRepo() repository.OAuthAccount {
return authAccountRepo
}
func GetConfigRepo() repository.Config {
return configRepo
}