同步代码

This commit is contained in:
TsMask
2023-08-21 11:00:22 +08:00
parent 2735cc3009
commit 788f01674a
37 changed files with 2211 additions and 1 deletions

23
service/login.go Normal file
View File

@@ -0,0 +1,23 @@
package service
import (
"errors"
"github.com/aceld/zinx/zlog"
"omc/db"
"omc/lib"
"omc/model"
)
func UserLogin(name, pw string) error {
// 用户名密码校验
var user model.User
if err := db.Client.Model(&model.User{}).Where("account_id=?", name).First(&user).Error; err != nil {
return err
}
if err := lib.Compare(user.Password, pw); err != nil {
zlog.Ins().ErrorF("Password Login[%s]:%s", name, err)
return errors.New("incorrect username and password")
}
return nil
}