|
@@ -24,9 +24,18 @@ class LoginService extends CrudService {
|
|
|
let is_code = false;
|
|
|
// 如果用户不存在抛出异常
|
|
|
if (!user) {
|
|
|
- // 添加code作为登录的方式
|
|
|
- user = await this.model.findOne({ code: phone, role, institution_code });
|
|
|
- if (!user) { throw new BusinessError(ErrorCode.USER_NOT_EXIST); } else is_code = true;
|
|
|
+ // role为5的时候需要组织机构代码登陆
|
|
|
+ if (role === '5') {
|
|
|
+ user = await this.model.findOne({ code: phone, role, institution_code });
|
|
|
+ } else {
|
|
|
+ // 添加code作为登录的方式
|
|
|
+ user = await this.model.findOne({ code: phone, role });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (!user) {
|
|
|
+ throw new BusinessError(ErrorCode.USER_NOT_EXIST);
|
|
|
+ } else is_code = true;
|
|
|
}
|
|
|
const pdata = {};
|
|
|
if (is_code) pdata.code = phone;
|