框架慢慢修改
This commit is contained in:
@@ -16,8 +16,8 @@ type Account struct {
|
||||
BaseModel
|
||||
Username string `gorm:"column:username;not null;unique_index;comment:'用户名'" json:"username" form:"username"`
|
||||
Password string `gorm:"column:password;comment:'密码'" form:"password" json:"-"`
|
||||
Name string `form:"name" json:"name"`
|
||||
IsActive bool `json:"-"`
|
||||
Name string `form:"name" json:"name"`
|
||||
IsActive bool `json:"-"`
|
||||
}
|
||||
|
||||
func (a *Account) TableName() string {
|
||||
@@ -59,7 +59,7 @@ func (a *Account) IsPasswordEqual(password string) bool {
|
||||
|
||||
// 验证用户民重复
|
||||
func (a *Account) CheckDuplicateUsername() bool {
|
||||
var count int
|
||||
var count int64
|
||||
if DB.Model(&Account{}).Where("username=?", a.Username).Count(&count); count > 0 {
|
||||
return false
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user