whistle.mock-plugins 1.1.2-beta.1 → 1.1.2-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -395,6 +395,15 @@ module.exports = function(req, res) {
395
395
  const { active } = req.query;
396
396
  const patchData = req.body;
397
397
 
398
+ // 记录请求信息
399
+ console.log('PATCH请求:', {
400
+ path: req.path,
401
+ pathMatch: pathMatch ? pathMatch[1] : null,
402
+ id,
403
+ active,
404
+ body: patchData
405
+ });
406
+
398
407
  // 读取接口数据
399
408
  let interfacesData;
400
409
  try {
@@ -411,8 +420,8 @@ module.exports = function(req, res) {
411
420
  });
412
421
  }
413
422
 
414
- // 批量更新接口状态
415
- if (active !== undefined) {
423
+ // 批量更新接口状态 - 按分组和功能模块
424
+ if (active !== undefined && !id && (patchData.featureId || patchData.group)) {
416
425
  const { featureId, group } = patchData;
417
426
 
418
427
  if (!featureId) {
@@ -423,6 +432,12 @@ module.exports = function(req, res) {
423
432
  });
424
433
  }
425
434
 
435
+ console.log('批量更新接口状态:', {
436
+ active,
437
+ featureId,
438
+ group
439
+ });
440
+
426
441
  // 根据分组筛选要更新的接口
427
442
  let updatedCount = 0;
428
443
  interfacesData.interfaces = interfacesData.interfaces.map(item => {
@@ -466,8 +481,9 @@ module.exports = function(req, res) {
466
481
  });
467
482
  }
468
483
 
469
- // 单个接口更新
484
+ // 处理单个接口状态更新或其他字段更新
470
485
  if (!id) {
486
+ console.error('单个接口更新错误: 缺少接口ID');
471
487
  return res.status(400).json({
472
488
  code: 400,
473
489
  message: '接口ID不能为空',
@@ -482,6 +498,9 @@ module.exports = function(req, res) {
482
498
 
483
499
  if (index === -1) {
484
500
  console.error(`接口不存在,ID: ${id},当前共有 ${interfacesData.interfaces.length} 个接口`);
501
+ if (interfacesData.interfaces.length > 0) {
502
+ console.log('所有接口ID:', interfacesData.interfaces.map(i => i.id));
503
+ }
485
504
  return res.status(404).json({
486
505
  code: 404,
487
506
  message: `接口不存在 (ID: ${id})`,