修改账号注册方法,以及邮箱协议对接
This commit is contained in:
27
services/proxy_service.go
Normal file
27
services/proxy_service.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"go-account-register/models"
|
||||
"go-account-register/utils"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ProxyService struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func InitProxyService() *ProxyService {
|
||||
db := utils.GetDB()
|
||||
|
||||
return &ProxyService{db: db}
|
||||
}
|
||||
|
||||
func (p *ProxyService) GetInfo() *models.Proxy {
|
||||
var proxy models.Proxy
|
||||
result := p.db.Model(&models.Proxy{}).Order("RAND()").Limit(1).Find(&proxy)
|
||||
if result.Error != nil {
|
||||
return nil
|
||||
}
|
||||
return &proxy
|
||||
}
|
||||
Reference in New Issue
Block a user