You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

package curd
import (
"goskeleton/app/model"
"goskeleton/app/utils/md5_encrypt"
)
func CreateUserCurdFactory() *UsersCurd {
return &UsersCurd{model.CreateUserFactory("")}
}
type UsersCurd struct {
userModel *model.UsersModel
}
// func (u *UsersCurd) Register(userName, pass, userIp string) bool {
func (u *UsersCurd) Register(userName, pass string) bool {
pass = md5_encrypt.Base64Md5(pass) // 预先处理密码加密,然后存储在数据库
return u.userModel.Register(userName, pass)
}
func (u *UsersCurd) Store(name string, pass string, realName string, phone string, remark string) bool {
pass = md5_encrypt.Base64Md5(pass) // 预先处理密码加密,然后存储在数据库
return u.userModel.Store(name, pass, realName, phone, remark)
}
func (u *UsersCurd) NameUpdate(id int, name string) bool {
//预先处理密码加密等操作,然后进行更新
// pass = md5_encrypt.Base64Md5(pass) // 预先处理密码加密,然后存储在数据库
return u.userModel.NameUpdate(id, name)
}
func (u *UsersCurd) UpdatePassword(id int,userName,oldpass,newpass string) bool {
//预先处理密码加密等操作,然后进行更新
oldpass = md5_encrypt.Base64Md5(oldpass)
newpass = md5_encrypt.Base64Md5(newpass) // 预先处理密码加密,然后存储在数据库
// return u.userModel.UpdatePassword(id,oldpass,newpass)
return u.userModel.UpdatePassword(id,userName,oldpass,newpass)!=nil
}