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.
46 lines
793 B
46 lines
793 B
/**
|
|
* @Title:
|
|
* @Description:
|
|
* @Author: Yuki Wong(iyuki0430@msn.com)
|
|
* @Update:
|
|
* @Date: 2020/7/20 11:49
|
|
* @File: AccountDAO.go
|
|
* @Software: GoLand
|
|
**/
|
|
package AccountDAO
|
|
|
|
import (
|
|
"dsSupport/Utils/ConfigUtil"
|
|
"dsSupport/Utils/DbUtil"
|
|
"strings"
|
|
)
|
|
|
|
//数据库
|
|
var db = DbUtil.Engine
|
|
|
|
func Login(username string, password string) (bool, string) {
|
|
var flag bool
|
|
var msg string
|
|
|
|
if username != "" && password != ""{
|
|
flag = false
|
|
msg = "账号或密码不能为空"
|
|
}
|
|
|
|
if len(ConfigUtil.AccountUsers) > 0 {
|
|
for _, v := range ConfigUtil.AccountUsers {
|
|
UserPwd := strings.Split(v, ":")
|
|
if UserPwd[0] == username && UserPwd[1] == password {
|
|
flag = true
|
|
msg = "登陆成功"
|
|
}
|
|
}
|
|
} else {
|
|
flag = false
|
|
msg = "配置文件错误"
|
|
}
|
|
|
|
return flag, msg
|
|
}
|
|
|