chore(member): add debug info print

pull/662/head
roberChen 2021-03-25 11:36:06 +08:00
parent 2d05b5a80f
commit 4e243e2d70
2 changed files with 5 additions and 1 deletions

View File

@ -103,6 +103,8 @@ func initialization() {
member, err := models.NewMember().FindByFieldFirst("account", "admin") member, err := models.NewMember().FindByFieldFirst("account", "admin")
if err == orm.ErrNoRows { if err == orm.ErrNoRows {
// create admin user
logs.Info("creating admin user")
member.Account = "admin" member.Account = "admin"
member.Avatar = conf.URLForWithCdnImage("/static/images/headimgurl.jpg") member.Avatar = conf.URLForWithCdnImage("/static/images/headimgurl.jpg")
member.Password = "123456" member.Password = "123456"
@ -114,6 +116,8 @@ func initialization() {
panic("Member.Add => " + err.Error()) panic("Member.Add => " + err.Error())
} }
// create demo book
logs.Info("creating demo book")
book := models.NewBook() book := models.NewBook()
book.MemberId = member.MemberId book.MemberId = member.MemberId

View File

@ -81,7 +81,7 @@ func (m *Member) Login(account string, password string) (*Member, error) {
logs.Info("转入 HTTP 接口登陆 ->", account) logs.Info("转入 HTTP 接口登陆 ->", account)
return member.httpLogin(account, password) return member.httpLogin(account, password)
} else { } else {
logs.Error("用户登录 ->", err) logs.Error("user login for `%s`: %s",account, err)
return member, ErrMemberNoExist return member, ErrMemberNoExist
} }
} }