Explorar o código

🐛 fix(order): 修复订单查询和错误提示问题

- 在订单查询条件中增加userId过滤,增强数据访问安全性
- 修正错误提示断言字段,将error改为message以匹配实际返回格式
yourname hai 1 mes
pai
achega
7d6f587946

+ 1 - 1
packages/orders-module-mt/src/services/order.mt.service.ts

@@ -182,7 +182,7 @@ export class OrderMtService extends GenericCrudService<OrderMt> {
     try {
       // 查询订单信息
       const order = await this.repository.findOne({
-        where: { id: orderId, tenantId }
+        where: { id: orderId, tenantId, userId }
       });
 
       if (!order) {

+ 1 - 1
packages/orders-module-mt/tests/integration/user-orders-routes.integration.test.ts

@@ -384,7 +384,7 @@ describe('多租户用户订单管理API集成测试', () => {
       expect(response.status).toBe(404);
       const result = await response.json();
 
-      expect(result.error).toBe('订单不存在');
+      expect(result.message).toBe('订单不存在');
     });
   });
 });