|
@@ -152,7 +152,26 @@ class EmployeeService:
|
|
|
out_data = await crud.get(employee_id=employee_id, employee_email=employee_email, employee_mobile=employee_mobile, enterprise_id=enterprise_id)
|
|
out_data = await crud.get(employee_id=employee_id, employee_email=employee_email, employee_mobile=employee_mobile, enterprise_id=enterprise_id)
|
|
|
if not out_data:
|
|
if not out_data:
|
|
|
raise CustomException(msg="员工不存在")
|
|
raise CustomException(msg="员工不存在")
|
|
|
- return EmployeeOutSchema.model_validate(out_data)
|
|
|
|
|
|
|
+ result = EmployeeOutSchema.model_validate(out_data)
|
|
|
|
|
+
|
|
|
|
|
+ # 补充 account_id
|
|
|
|
|
+ if enterprise_id:
|
|
|
|
|
+ from app.plugin.module_payment.enterprise.model import EnterpriseModel
|
|
|
|
|
+ from sqlalchemy import select
|
|
|
|
|
+ ent_stmt = select(EnterpriseModel).where(EnterpriseModel.enterprise_id == enterprise_id).limit(1)
|
|
|
|
|
+ ent_result = await auth.db.execute(ent_stmt)
|
|
|
|
|
+ ent = ent_result.scalar_one_or_none()
|
|
|
|
|
+ if ent and ent.account_id:
|
|
|
|
|
+ result.account_id = ent.account_id
|
|
|
|
|
+
|
|
|
|
|
+ # 补充 user_name / avatar
|
|
|
|
|
+ user = getattr(out_data, 'user', None)
|
|
|
|
|
+ if user:
|
|
|
|
|
+ result.user_id = user.id
|
|
|
|
|
+ result.user_name = user.name or user.username
|
|
|
|
|
+ result.avatar = getattr(user, 'avatar', None)
|
|
|
|
|
+
|
|
|
|
|
+ return result
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
async def detail_service(
|
|
async def detail_service(
|