{
  "module": "会员管理",
  "moduleKey": "member",
  "apiCount": 7,
  "apis": [
    {
      "title": "获取有效会员列表",
      "method": "GET",
      "path": "/api/members/valid-list",
      "description": "获取所有状态为有效（status=1）的会员套餐列表，用于下拉选择。无需分页，返回简化的字段信息。",
      "requestParams": {},
      "responseExample": {
        "success": {
          "code": "0000",
          "message": "操作成功",
          "data": [
            {
              "id": "xxx",
              "_id": "xxx",
              "code": "MEM0001",
              "name": "会员套餐1",
              "description": "套餐描述"
            },
            {
              "id": "yyy",
              "_id": "yyy",
              "code": "MEM0002",
              "name": "会员套餐2",
              "description": "套餐描述"
            }
          ],
          "timestamp": "2025-01-21T10:00:00.000Z"
        },
        "failure": {
          "code": "4000",
          "message": "获取失败",
          "data": null
        }
      },
      "notes": [
        "该接口仅返回状态为有效（status=1）的会员套餐",
        "返回结果按创建时间升序排序",
        "需要 members 的 read 权限",
        "适用于下拉选择等场景，无需分页"
      ]
    },
    {
      "title": "获取会员列表",
      "method": "GET",
      "path": "/api/members",
      "description": "分页获取会员套餐列表",
      "requestParams": {
        "query": [
          {
            "name": "pageNum",
            "type": "number",
            "required": false,
            "description": "页码，默认1"
          },
          {
            "name": "pageSize",
            "type": "number",
            "required": false,
            "description": "每页数量，默认10"
          },
          {
            "name": "name",
            "type": "string",
            "required": false,
            "description": "套餐名称关键词"
          },
          {
            "name": "memberTypeId",
            "type": "string",
            "required": false,
            "description": "会员类型ID（会员类型管理记录的_id）"
          }
        ]
      },
      "responseExample": {
        "success": {
          "code": "0000",
          "message": "获取成功",
          "data": {
            "list": [
              {
                "id": 1,
                "code": "MEM0001",
                "name": "会员套餐名称",
                "memberTypeId": "xxx",
                "price": "99.99",
                "validityDays": 30,
                "description": "套餐描述",
                "status": 1
              }
            ],
            "total": 100,
            "pageNum": 1,
            "pageSize": 10
          }
        }
      }
    },
    {
      "title": "获取会员详情",
      "method": "GET",
      "path": "/api/members/{id}",
      "description": "根据会员套餐ID获取会员套餐详细信息",
      "requestParams": {
        "path": [
          {
            "name": "id",
            "type": "string",
            "required": true,
            "description": "会员套餐ID"
          }
        ]
      },
      "responseExample": {
        "success": {
          "code": "0000",
          "message": "获取成功",
          "data": {
            "id": 1,
            "code": "MEM0001",
            "name": "会员套餐名称",
            "memberTypeId": "xxx",
            "price": "99.99",
            "validityDays": 30,
            "description": "套餐描述",
            "status": 1
          }
        },
        "failure": {
          "code": "4040",
          "message": "会员套餐不存在",
          "data": null
        }
      }
    },
    {
      "title": "创建会员",
      "method": "POST",
      "path": "/api/members",
      "description": "创建新的会员套餐",
      "requestParams": {
        "body": {
          "name": "string｜必填，套餐名称",
          "memberTypeId": "string｜可选，会员类型ID（会员类型管理记录的_id），如果提供会校验会员类型是否存在",
          "price": "string｜可选，价格（两位小数，如：99.99）",
          "validityDays": "number｜可选，有效期天数（最小值为1）",
          "description": "string｜可选，套餐描述",
          "status": "number｜可选，状态：1-有效，0-无效，默认0"
        }
      },
      "responseExample": {
        "success": {
          "code": "0000",
          "message": "创建会员成功",
          "data": {
            "id": 1,
            "code": "MEM0001",
            "name": "会员套餐名称",
            "memberTypeId": "xxx",
            "price": "99.99",
            "validityDays": 30,
            "description": "套餐描述",
            "status": 0
          }
        },
        "failure": {
          "code": "4000",
          "message": "关联的会员类型不存在",
          "data": null
        }
      },
      "notes": [
        "如果提供了memberTypeId，会校验会员类型是否存在，不存在返回错误：关联的会员类型不存在"
      ]
    },
    {
      "title": "更新会员",
      "method": "PUT",
      "path": "/api/members/{id}",
      "description": "更新指定会员套餐的信息",
      "requestParams": {
        "body": {
          "name": "string｜必填，套餐名称",
          "memberTypeId": "string｜可选，会员类型ID（会员类型管理记录的_id），如果提供会校验会员类型是否存在",
          "price": "string｜可选，价格（两位小数，如：99.99）",
          "validityDays": "number｜可选，有效期天数（最小值为1）",
          "description": "string｜可选，套餐描述",
          "status": "number｜可选，状态：1-有效，0-无效，默认0"
        },
        "path": [
          {
            "name": "id",
            "type": "string",
            "required": true,
            "description": "会员套餐ID"
          }
        ]
      },
      "responseExample": {
        "success": {
          "code": "0000",
          "message": "更新会员成功",
          "data": {
            "id": 1,
            "code": "MEM0001",
            "name": "会员套餐名称",
            "memberTypeId": "xxx",
            "price": "99.99",
            "validityDays": 30,
            "description": "套餐描述",
            "status": 1
          }
        },
        "failure": {
          "code": "4000",
          "message": "关联的会员类型不存在",
          "data": null
        }
      },
      "notes": [
        "如果提供了memberTypeId，会校验会员类型是否存在，不存在返回错误：关联的会员类型不存在",
        "有效状态（status=1）的会员套餐不允许修改，会返回错误：有效状态的会员套餐不允许修改"
      ]
    },
    {
      "title": "删除会员",
      "method": "DELETE",
      "path": "/api/members/{id}",
      "description": "删除指定的会员套餐",
      "requestParams": {
        "path": [
          {
            "name": "id",
            "type": "string",
            "required": true,
            "description": "会员套餐ID"
          }
        ]
      },
      "responseExample": {
        "success": {
          "code": "0000",
          "message": "删除会员成功",
          "data": {
            "result": true
          }
        },
        "failure": {
          "code": "4000",
          "message": "删除会员失败",
          "data": null
        }
      },
      "notes": [
        "有效状态（status=1）的会员套餐不允许删除，会返回错误：有效状态的会员套餐不允许删除"
      ]
    },
    {
      "title": "切换会员套餐状态",
      "method": "PUT",
      "path": "/api/members/{id}/status",
      "description": "切换会员套餐的启用/禁用状态",
      "requestParams": {
        "body": {
          "status": "number｜必填，状态：1-有效，0-无效"
        },
        "path": [
          {
            "name": "id",
            "type": "string",
            "required": true,
            "description": "会员套餐ID"
          }
        ]
      },
      "responseExample": {
        "success": {
          "code": "0000",
          "message": "状态更新成功",
          "data": {
            "id": 1,
            "code": "MEM0001",
            "name": "会员套餐名称",
            "memberTypeId": "xxx",
            "price": "99.99",
            "validityDays": 30,
            "description": "套餐描述",
            "status": 1,
            "updateTime": "2025-01-01T10:00:00.000Z"
          }
        },
        "failure": {
          "code": "4040",
          "message": "会员套餐不存在",
          "data": null
        }
      },
      "notes": [
        "该接口用于切换会员套餐的启用/禁用状态",
        "只有通过状态切换接口才能修改有效状态的会员套餐"
      ]
    }
  ]
}