npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

book-meeting-room

v1.1.6

Published

## 项目简介

Readme

meeting 会议室预约系统

项目简介

本项目是一个基于 Node.js 的命令行会议室预约系统,支持会议室查询、预约、冲突检测等功能,适用于企业内部会议室管理自动化。

主要功能

  • 查询可用会议室
  • 预约会议室(支持时间冲突检测)
  • 会议室详情查看
  • 预约信息填写与确认

技术栈

meeting 会议室预约系统

项目简介

这是一个基于 Node.js 的命令行会议室预约工具。主要目标是自动化公司内部会议室查询与预约,支持交互式选择、定时重试(定时任务)以及调试日志记录,便于排查和自动化使用。

主要功能(现状)

  • 交互式选择城市(通过接口获取城市列表,默认北京)
  • 基于所选城市获取楼宇/楼层并可多选优先楼层(按优先顺序)
  • 为每个选中楼层单独请求会议室列表并聚合展示(保证后端接收单个 floorId 的兼容性)
  • 支持为定时任务指定优先会议室(定时任务将优先抢该房间)
  • 预约请求字段与后端 cURL 格式对齐(roomId 转为字符串、participants 为数组、remindMinute 默认为 15)
  • 记录并保存请求日志(booking_request.log)和 mock 日志(mock_booking.log),以及错误日志(booking_error.log

技术栈

  • Node.js (>=18)
  • ECMAScript Modules (ESM)
  • axios, inquirer, dayjs, chalk, node-schedule

目录结构(简要)

./
   ├─ src/
   │   ├─ index.js           # CLI 与流程控制(交互、定时任务、日志)
   │   └─ meetingRoom.js     # 与后端接口交互的封装(list/book/search 等)
   ├─ package.json
   ├─ README.md
   ├─ mock_booking.log       # mock 预定记录(若启用 mock)
   ├─ booking_request.log    # 记录真实发向 booking 接口的请求体
   └─ booking_error.log      # 记录错误栈

环境变量

请在项目根目录创建 .env(或在 shell 中导出环境变量)并配置必要项:

(注意:代码中使用的基础地址变量名为 METTING_BASE_URL

METTING_BASE_URL=https://meetingroom.lkcoffee.com/api  # 必需,API 基础地址
CSRF_TOKEN=你的_x-csrf-token                              # 必需
COOKIES=你的_cookie串                                     # 必需
REFERER=https://meetingroom.lkcoffee.com/...            # 建议提供

# 预约人信息(必需)
BOOKING_USER=xxx
BOOKING_USER_NAME=xxx
BOOKING_USER_MAIL=xxx
BOOKING_USER_DEPT=xxx
BOOKING_USER_MOBILE=xxx

# 可选:指定默认城市 / 楼层(命令行交互会优先提示)
CITY_ID=12
FLOOR_ID_LIST=82,83   # 可选,逗号分隔;代码会取第一个值发送给后端,但会把完整数组保存在 bookingInfo 供本地匹配使用

# 其它可选项
REMIND_MINUTE=15

说明要点:

  • FLOOR_ID_LIST 虽然可设置为逗号分隔的多值,但客户端会在发送给后端时仅取第一个值并以单元素数组的形式传输(后端要求)。客户端仍保留完整列表以做本地优先级匹配与聚合请求。

使用方法

安装依赖:

npm install

交互式运行(默认会询问是否启用 mock 预定):

node src/index.js

通过命令行参数非完全交互(提供日期/时间),示例:

node src/index.js -p 2025-10-16 -s 12:10 -e 12:20

行为说明:

  • 启动时会提示是否启用 mock(默认启用)。mock 模式下不会调用真实 booking 接口,而是将预约信息写入 mock_booking.log
  • 若选择开启定时任务(定时模式),程序会先强制让你选择城市,然后可选择优先楼层并可选择优先房间,随后以周期性任务尝试预约。

调试与日志

  • booking_request.log:在调用真实 booking 接口前,程序会将请求体以 JSON 行追加到该文件(包含时间戳),便于复现与审计。
  • mock_booking.log:若启用 mock,会将 mock 预约写入该日志(包含用户选择与实际发送的 floorIdSent)。
  • booking_error.log:记录运行时抛出的错误栈与信息。

示例查看最新日志:

tail -n 20 booking_request.log
tail -n 20 mock_booking.log
tail -n 50 booking_error.log

CLI / 全局命令(bin)

本项目在 package.json 中声明了两个可执行命令:

  • book-meeting-room -> ./dist/index.js
  • bmr -> ./dist/index.js

说明与使用方法:

  1. 开发时直接运行源码(不需要构建)

    node src/index.js
  2. 构建 dist(项目中使用 gulp 进行构建)

    npm run build
    # 构建后会产出 dist/index.js,可被 bin 指向的命令使用
  3. 使用 npx(无需全局安装)

    • 本地 dist(如果已构建):

      npx ./dist/index.js -- -p 2025-10-16 -s 12:10 -e 12:20

      注意:-- 用来把后续参数传递给被执行的脚本。

    • 直接从 GitHub 仓库运行(无需先克隆或构建):

      npx github:houchaowei/book-meeting-room -- -p 2025-10-16 -s 12:10 -e 12:20

      该方式会临时下载并执行仓库中的包(取决于远端 package.json 的配置)。

  4. 本地开发时把包链接到全局(便于测试 bin 命令)

    npm link
    # 之后你可以直接运行:
    book-meeting-room
    # 或
    bmr
  5. 直接全局安装(不推荐开发中使用)

    npm i -g .
    book-meeting-room

注意:bin 命令依赖 dist/index.js,因此在使用 bin 命令前请确保已运行 npm run build 生成 dist,或在开发阶段使用 node src/index.js 直接运行源码。

特别说明与实现细节

  • 城市选择:通过 https://meetingroom.lkcoffee.com/api/cityList 获取,交互式默认北京。
  • 楼层与房间:系统会先通过 searchBuilding 获取楼宇和楼层信息,用户可多选优先楼层;为兼容后端只接受单个 floorId 的限制,客户端为每个选中楼层单独请求 listMeetingRoom 并聚合 roomInfoList,然后供用户选择优先房间或在定时任务中随机选择。
  • 发送给后端的 floorIdList:已在客户端统一规范为单元素数组(例如 `[