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.
25 lines
608 B
25 lines
608 B
5 years ago
|
const dbUtils = require('./../utils/db-util')
|
||
|
|
||
|
const user = {
|
||
|
/**
|
||
|
* 根据用户名和密码查找用户
|
||
|
* @param {object} options 用户名密码对象
|
||
|
* @return {object|null} 查找结果
|
||
|
*/
|
||
|
async getOneByUserNameAndPassword( options ) {
|
||
|
let _sql = `
|
||
|
SELECT * from user_info
|
||
|
where password="${options.password}" and name="${options.name}"
|
||
|
limit 1`
|
||
|
let result = await dbUtils.query( _sql )
|
||
|
if ( Array.isArray(result) && result.length > 0 ) {
|
||
|
result = result[0]
|
||
|
} else {
|
||
|
result = null
|
||
|
}
|
||
|
return result
|
||
|
},
|
||
|
}
|
||
|
|
||
|
module.exports = user
|