Finish db update sync.

This commit is contained in:
Yang Luo
2021-05-09 15:44:12 +08:00
parent e2f6efd1ab
commit 6e5aa2bc40
4 changed files with 88 additions and 9 deletions

View File

@ -54,6 +54,15 @@ func getUserMapOriginal() ([]*User, map[string]*User) {
return users, m
}
func updateUser(user *User) bool {
affected, err := adapter.Engine.ID(user.Id).Cols("name", "password", "cellphone", "avatar", "deleted").Update(user)
if err != nil {
panic(err)
}
return affected != 0
}
func calculateHash(user *User) string {
s := strings.Join([]string{strconv.Itoa(user.Id), user.Password, user.Name, getFullAvatarUrl(user.Avatar), user.Cellphone}, "|")
return util.GetMd5Hash(s)