Просмотр исходного кода

fix(salary-module): 修复列表路由缺少parseWithAwait的问题

- 在薪资列表路由中添加parseWithAwait验证
- 确保返回的薪资数据中数字字段正确转换为Number类型
- 修复前端toFixed()函数调用错误

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 1 месяц назад
Родитель
Сommit
b19e8d6bc1
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      allin-packages/salary-module/src/routes/salary-custom.routes.ts

+ 6 - 1
allin-packages/salary-module/src/routes/salary-custom.routes.ts

@@ -383,7 +383,12 @@ const app = new OpenAPIHono<AuthContext>()
         districtId
       );
 
-      return c.json(result, 200);
+      // 使用parseWithAwait验证每个薪资记录
+      const validatedData = await Promise.all(
+        result.data.map(item => parseWithAwait(SalaryLevelSchema, item))
+      );
+
+      return c.json({ data: validatedData, total: result.total }, 200);
     } catch (error) {
       return c.json({
         code: 500,