|
@@ -20,12 +20,14 @@ class LoginService extends CrudService {
|
|
|
const { phone, passwd, role } = data;
|
|
|
// 根据用户输入的手机号查询其他用户表中是否存在相应数据
|
|
|
let user = await this.model.findOne({ phone, role, isdel: '0' });
|
|
|
+ console.log(`user1=>${user}`);
|
|
|
// 增设使用code模式登陆的判断变量
|
|
|
let is_code = false;
|
|
|
- // 如果用户不存在抛出异常
|
|
|
if (!user) {
|
|
|
// 添加code作为登录的方式
|
|
|
user = await this.model.findOne({ code: phone, role, isdel: '0' });
|
|
|
+ console.log(`user2=>${user}`);
|
|
|
+ // 如果用户不存在抛出异常
|
|
|
if (!user) { throw new BusinessError(ErrorCode.USER_NOT_EXIST); } else is_code = true;
|
|
|
}
|
|
|
const pdata = {};
|