框架慢慢修改

This commit is contained in:
zhangchao
2024-07-04 19:15:44 +08:00
parent d79e6bdaba
commit 82eadb8921
13 changed files with 152 additions and 96 deletions

View File

@@ -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 {