单例导出权限
This commit is contained in:
+4
-4
@@ -5,16 +5,16 @@ import (
|
||||
"work_cation/models"
|
||||
)
|
||||
|
||||
type ErlangCard struct{}
|
||||
type erlangCard struct{}
|
||||
|
||||
var ErlangCardRepo *ErlangCard
|
||||
var ErlangCardRepo *erlangCard
|
||||
|
||||
func (*ErlangCard) FindAll(db *gorm.DB) []models.ErlangCards {
|
||||
func (*erlangCard) FindAll(db *gorm.DB) []models.ErlangCards {
|
||||
var cards []models.ErlangCards
|
||||
db.Find(&cards)
|
||||
return cards
|
||||
}
|
||||
|
||||
func (*ErlangCard) Create(db *gorm.DB, erlangCard *models.ErlangCards) error {
|
||||
func (*erlangCard) Create(db *gorm.DB, erlangCard *models.ErlangCards) error {
|
||||
return db.Create(erlangCard).Error
|
||||
}
|
||||
|
||||
+3
-3
@@ -7,11 +7,11 @@ import (
|
||||
"work_cation/pkg/utils"
|
||||
)
|
||||
|
||||
type User struct{}
|
||||
type userRepo struct{}
|
||||
|
||||
var UserRepo *User
|
||||
var User *userRepo
|
||||
|
||||
func (*User) GetUserInfo(db *gorm.DB) *models.Users {
|
||||
func (*userRepo) GetUserInfo(db *gorm.DB) *models.Users {
|
||||
var users models.Users
|
||||
db.Find(&users)
|
||||
ip := utils.IP.Get192Ip()
|
||||
|
||||
Reference in New Issue
Block a user