From ab677eb5d9c5dc9827b8b0b0c251e9212c3b54a6 Mon Sep 17 00:00:00 2001 From: selfrelease Date: Mon, 27 Jul 2026 19:34:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20extraInsurances=20TS=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=96=AD=E8=A8=80=20+=20trust=20proxy=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E9=83=A8=E7=BD=B2=E5=88=B0on.hr8ai.top?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/app.ts | 2 ++ backend/src/routes/social.routes.ts | 4 ++-- backend/src/services/payroll.service.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/app.ts b/backend/src/app.ts index ca4e0d8..712fb76 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -8,6 +8,8 @@ import { apiLimiter } from './middleware/rateLimit' const app = express() +app.set('trust proxy', 1) + app.use(helmet()) app.use(compression({ filter: (req, res) => { diff --git a/backend/src/routes/social.routes.ts b/backend/src/routes/social.routes.ts index 8cff103..b37a456 100644 --- a/backend/src/routes/social.routes.ts +++ b/backend/src/routes/social.routes.ts @@ -429,7 +429,7 @@ router.post('/calculate', async (req: AuthRequest, res: Response, next: NextFunc // 附加险种 const extraItems: any[] = [] if (config.extraInsurances && Array.isArray(config.extraInsurances)) { - for (const ins of config.extraInsurances) { + for (const ins of config.extraInsurances as any[]) { const insBase = ins.baseType === 'medical' ? medicalBase : ins.baseType === 'fixed' ? 1 : actualBase if (ins.baseType === 'fixed' && ins.fixedAmount) { const orgAmt = ins.fixedAmount @@ -832,7 +832,7 @@ function calcSocialDetail(base: number, config: any) { ] // 附加险种 if (config.extraInsurances && Array.isArray(config.extraInsurances)) { - for (const ins of config.extraInsurances) { + for (const ins of config.extraInsurances as any[]) { const insBase = ins.baseType === 'medical' ? medicalBase : ins.baseType === 'fixed' ? 1 : actualBase if (ins.baseType === 'fixed' && ins.fixedAmount) { items.push({ name: ins.name, orgRate: 0, empRate: 0, orgAmount: ins.fixedAmount, empAmount: ins.empFixedAmount || 0 }) diff --git a/backend/src/services/payroll.service.ts b/backend/src/services/payroll.service.ts index 673d4cc..afc9fc3 100644 --- a/backend/src/services/payroll.service.ts +++ b/backend/src/services/payroll.service.ts @@ -46,7 +46,7 @@ export function calcSocialInsurance(base: number, config: any) { // 附加险种(大病险/长护险等) const extraItems: any[] = [] if (config.extraInsurances && Array.isArray(config.extraInsurances)) { - for (const ins of config.extraInsurances) { + for (const ins of config.extraInsurances as any[]) { const insBase = ins.baseType === 'medical' ? medicalBase : ins.baseType === 'fixed' ? 1 : actualBase if (ins.baseType === 'fixed' && ins.fixedAmount) { const orgAmt = ins.fixedAmount