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

koishi-plugin-student-query

v1.5.1

Published

学生信息查询插件 - 支持多数据库、学号/姓名查询、模糊搜索、分页显示、自动通过好友请求、加群验证审核

Readme

koishi-plugin-student-query

npm

学生信息查询插件 - 支持多数据库、学号/姓名查询、模糊搜索、分页显示

功能特性

🆕 多数据库支持 (v1.3.0)

  • 同时查询多个数据库(如本科生库和研究生库)
  • 字段映射机制(自动处理不同数据库的字段差异)
  • 结果自动合并(显示所有数据库的查询结果)
  • 数据来源标识(每条结果显示来自哪个数据库)

查询功能

  • ✅ 学号精确查询和模糊查询
  • ✅ 姓名精确查询和模糊查询
  • ✅ 姓名学号一致性校验(支持任意顺序和分隔符)
  • ✅ 分页支持(模糊查询结果过多时自动分页)

权限与安全

  • ✅ 权限控制(支持用户白名单和群组白名单)
  • ✅ 敏感信息脱敏(手机号等)
  • ✅ 管理员可查看完整敏感信息

自动化功能

  • ✅ 自动通过白名单用户的好友请求
  • ✅ 加群验证审核(智能识别学号姓名并校验)
  • ✅ 自动发送审核结果到管理群

其他

  • ✅ 完整的帮助系统
  • ✅ 智能解析(支持多种分隔符和格式)

安装

npm install koishi-plugin-student-query
# 或
yarn add koishi-plugin-student-query

配置

在 Koishi 配置文件中添加插件配置:

多数据库配置(推荐)

plugins:
  student-query:
    databases:
      - name: bks # 本科生数据库
        path: ./bks.db
        tableName: bks
        fieldMapping:
          XH: student_id
          XM: full_name
          XBDM: gender_code
          BJDM: class_code
          ZYDM: major_code
          YXDM: college_code
          SJH: mobile_phone
        enabled: true

      - name: yjs # 研究生数据库
        path: ./yjs.db
        tableName: yjs
        fieldMapping:
          XH: XH
          XM: XM
          XBDM: XBDM
          BJDM: BJWID
          ZYDM: ZYDM
          YXDM: YXDM
          SJH: SJHM
        enabled: true

    whitelistUsers: [] # 用户白名单(为空则允许所有用户)
    whitelistGroups: [] # 群组白名单(为空则允许所有群组)
    enablePrivateChat: true # 是否启用私聊查询
    enableGroupChat: true # 是否启用群聊查询
    pageSize: 50 # 分页大小
    fuzzySearchMinLength: 2 # 模糊查询最小字符长度
    enableSensitiveInfo: false # 是否显示敏感信息
    adminUsers: [] # 管理员用户列表
    autoAcceptFriend: true # 是否自动通过白名单用户的好友请求
    friendWelcomeMessage: "你好!我已通过你的好友请求。" # 欢迎消息
    enableGroupVerify: false # 是否启用加群验证审核
    verifyGroups: [] # 需要审核的群组列表
    adminGroup: "" # 管理群群号(接收审核通知)

配置说明

数据库配置 (databases)

每个数据库配置包含以下字段:

  • name: 数据库名称(用于标识,如 "bks"、"yjs")
  • path: 数据库文件路径,支持相对路径和绝对路径
  • tableName: 学生信息表的表名
  • fieldMapping: 字段映射配置,将数据库字段映射到统一格式
    • XH: 学号字段名
    • XM: 姓名字段名
    • XBDM: 性别代码字段名
    • BJDM: 班级代码字段名
    • ZYDM: 专业代码字段名
    • YXDM: 院系代码字段名
    • SJH: 手机号字段名
  • enabled: 是否启用此数据库

💡 提示: 字段映射机制允许您使用不同结构的数据库。插件会自动将不同数据库的字段映射到统一格式进行查询。

基础配置

  • whitelistUsers: 用户白名单,填入用户 ID(如 QQ 号),为空则允许所有用户
  • whitelistGroups: 群组白名单,填入群组 ID,为空则允许所有群组
  • enablePrivateChat: 是否启用私聊查询功能
  • enableGroupChat: 是否启用群聊查询功能
  • pageSize: 模糊查询时每页显示的结果数量(1-50)
  • fuzzySearchMinLength: 模糊查询最小字符长度
  • enableSensitiveInfo: 是否默认显示敏感信息(手机号等)
  • adminUsers: 管理员用户列表,管理员可以查看完整敏感信息

好友请求配置

  • autoAcceptFriend: 是否自动通过白名单用户的好友请求(默认开启)
  • friendWelcomeMessage: 通过好友请求后发送的欢迎消息,留空则不发送

加群审核配置

  • enableGroupVerify: 是否启用加群验证审核功能(默认关闭)
  • verifyGroups: 需要审核的群组列表(群号),只有这些群的加群请求会被处理
  • adminGroup: 管理群群号,用于接收加群审核通知

使用方法

查询指令

1. 学号查询

学号查询 <学号>        # 精确查询
学号查询 -f <学号>     # 模糊查询
学号查询 -f <学号> -p 2 # 模糊查询第2页

别名: xhcx

2. 姓名查询

姓名查询 <姓名>        # 精确查询
姓名查询 -f <姓名>     # 模糊查询
姓名查询 -f <姓名> -p 2 # 模糊查询第2页

别名: xmcx

3. 信息校验

信息校验 <姓名> <学号>  # 校验姓名和学号是否匹配

别名: xxjy

4. 帮助信息

学生查询帮助           # 显示帮助信息

别名: xscxbz

使用示例

学号查询 23101054
姓名查询 张三
姓名查询 -f 张
学号查询 -f 2310
信息校验 张三 23101054

数据库要求

插件需要 SQLite 数据库文件,包含学生基本信息。通过字段映射配置,您可以使用任何字段名,只需在配置中正确映射即可。

标准字段(映射后)

  • XH: 学号
  • XM: 姓名
  • XBDM: 性别代码(1-男,2-女)
  • BJDM: 班级代码
  • ZYDM: 专业代码
  • YXDM: 院系代码
  • SJH: 手机号

多数据库示例

您可以同时使用多个数据库,即使它们的字段名不同:

本科生数据库 (bks.db)

  • 表名: bks
  • 字段: student_id, full_name, gender_code, class_code, major_code, college_code, mobile_phone

研究生数据库 (yjs.db)

  • 表名: yjs
  • 字段: XH, XM, XBDM, BJWID, ZYDM, YXDM, SJHM

插件会通过字段映射自动处理这些差异。详细配置请参考 MULTI_DB_CONFIG.md

隐私保护

  • 手机号等敏感信息默认会进行脱敏处理(显示为 138****5678 格式)
  • 仅白名单用户可使用查询功能
  • 管理员可查看完整敏感信息
  • 支持群组和用户双重权限控制

License

MIT