feat: 完善员工门店软删除与密码管理

This commit is contained in:
湛兮
2026-05-26 18:01:52 +08:00
parent 6b31ea7bbf
commit e8f05513fd
19 changed files with 597 additions and 73 deletions
+23 -3
View File
@@ -83,7 +83,7 @@ export const authService = {
user: AuthUser;
payload: AuthJwtPayload;
}> {
const admin = await authRepository.findActiveByUsername(input.username);
const admin = await authRepository.findByUsername(input.username);
if (admin) {
const passwordMatched = await verifyPassword(
@@ -95,6 +95,10 @@ export const authService = {
throw unauthorized("用户名或密码错误");
}
if (admin.status === "INACTIVE") {
throw unauthorized("账号已被禁用");
}
await authRepository.updateLastLoginAt(admin.id);
const user = await toAuthUser(admin);
@@ -105,7 +109,7 @@ export const authService = {
};
}
const employee = await authRepository.findActiveEmployeeByPhone(
const employee = await authRepository.findEmployeeByPhoneForLogin(
input.username,
);
@@ -122,6 +126,14 @@ export const authService = {
throw unauthorized("用户名或密码错误");
}
if (employee.status === "INACTIVE") {
throw unauthorized("账号已被禁用");
}
if (employee.storeStatus === "INACTIVE") {
throw unauthorized("所属门店已被禁用");
}
await authRepository.updateEmployeeLastLoginAt(employee.id);
const user = await toEmployeeAuthUser(employee);
@@ -140,7 +152,7 @@ export const authService = {
user: AuthUser;
payload: AuthJwtPayload;
}> {
const employee = await authRepository.findActiveEmployeeByPhone(
const employee = await authRepository.findEmployeeByPhoneForLogin(
input.username,
);
@@ -157,6 +169,14 @@ export const authService = {
throw unauthorized("用户名或密码错误");
}
if (employee.status === "INACTIVE") {
throw unauthorized("账号已被禁用");
}
if (employee.storeStatus === "INACTIVE") {
throw unauthorized("所属门店已被禁用");
}
await authRepository.updateEmployeeLastLoginAt(employee.id);
const user = await toEmployeeAuthUser(employee);