付智勇

用户列表查询

... ... @@ -73,7 +73,7 @@ userController.prototype.login = async(ctx, next) =>{
}
if(!userData.code){
return userBack;
}else{
return userData;
}
... ... @@ -84,12 +84,13 @@ userController.prototype.login = async(ctx, next) =>{
}
userController.prototype.getStu = async(ctx, next) =>{
try {
const stuType = ctx.params.type;
if(!stuType){
return status.paramError('type');
}
try {
let stu = await userService.getStu(stuType);
return stu
} catch (error) {
... ... @@ -133,7 +134,7 @@ userController.prototype.delUserByUserId = async(ctx,next) => {
userController.prototype.resetPasswordByUserId = async(ctx,next) =>{
const userId = ctx.params.userId;
const pw = saitMd5.md5AddSalt('123056')
const pw = saitMd5.md5AddSalt('123456')
if(!userId){
return status.paramError('userId');
... ...
... ... @@ -45,10 +45,15 @@ userService.prototype.login = async(name,pw) => {
userService.prototype.getStu = async(type)=>{
try {
let User = await userModel.findAll({where:{userType:type}});
let sql = `SELECT
u.*, ug.name
FROM
3m_user u
LEFT JOIN 3m_user_group ug ON ug.id = u.group_id`
let User = await sequelize.query(sql);
return User
} catch (error) {
throw new Error(err);
throw new Error(error);
}
}
... ...