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 🙏

© 2026 – Pkg Stats / Ryan Hefner

skybase-tree

v1.0.2

Published

main tree CURD

Readme

skybase-tree main tree CURD

安装依赖

$ npm i

当前工具

1、id服务
2、短信模块

本地配置设置 - ./config/config.local.js

module.exports = {
  mysql: {
    host: '127.0.0.1',
    port: 3306,
    user: 'root',
    password: '123456',
    database: 'test',
    pool: 1000,
    timeout: 60000,
    charset: 'utf8mb4',
    multipleStatements: true,
    connectionLimit: 1000
  }
}

启动项目

$ node index.js

访问相应api

http://localhost:13000/skyapi/tree
http://localhost:13000/skyapi/tree/getSon
http://localhost:13000/skyapi/tree/getSons
http://localhost:13000/skyapi/tree/addChild
http://localhost:13000/skyapi/tree/addChilds
http://localhost:13000/skyapi/tree/addBrother
http://localhost:13000/skyapi/tree/del
http://localhost:13000/skyapi/tree/delMult
http://localhost:13000/skyapi/tree/modify
http://localhost:13000/skyapi/tree/move
http://localhost:13000/skyapi/tree/copy

根据id获取某节点详情

根据id获取某节点详情

地址/skyapi/tree

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | id | 是 | number | 默认:无 | 节点id节点id |

200返回说明

{
  "data": {
    "id": 2,
    "projectId": 0,
    "companyId": 0,
    "pid": 1,
    "depth": 2,
    "name": "菜单1",
    "jsonExtend": {}
  },
  "code": 200,
  "msg": "成功",
  "t": 1562580707790
}

获取某id的第一层儿子

获取某id的第一层儿子

地址/skyapi/tree/getSon

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | id | 是 | number | 默认:无 | 节点id节点id |

200返回说明

{
  "data": {
    "list": [
      {
        "id": 5,
        "projectId": 0,
        "companyId": 0,
        "pid": 4,
        "depth": 2,
        "name": "表单1",
        "jsonExtend": {}
      }
    ]
  },
  "code": 200,
  "msg": "成功",
  "t": 1562639605988
}

获取某id的所有儿子

获取某id的所有儿子

地址/skyapi/tree/getSons

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | id | 是 | number | 默认:无 | 节点id节点id |

200返回说明

{
  "data": {
    "list": [
      {
        "id": 12,
        "projectId": 0,
        "companyId": 0,
        "pid": 2,
        "depth": 3,
        "name": "表单2",
        "jsonExtend": {},
        "child": [
          {
            "id": 13,
            "projectId": 0,
            "companyId": 0,
            "pid": 12,
            "depth": 4,
            "name": "表单2",
            "jsonExtend": {},
            "child": []
          }
        ]
      }
    ]
  },
  "code": 200,
  "msg": "成功",
  "t": 1562639910027
}

为某节点增加一个儿子

为某节点增加一个儿子

地址/skyapi/tree/addChild

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | id | 否 | number | 默认:无 | 父节点id父节点id | | name | 是 | string | 默认:无 | 当前节点名称当前节点名称 | | jsonExtend | 否 | string | 默认:{} | 扩展字段扩展字段 |

200返回说明

{
  "data": {
    "project_id": 0,
    "company_id": 0,
    "pid": 0,
    "depth": 1,
    "name": "节点",
    "json_extend": "{}",
    "id": 10
  },
  "code": 200,
  "msg": "成功",
  "t": 1562578762596
}

为某节点增加一批儿子

为某节点增加一批儿子

地址/skyapi/tree/addChilds

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | projectId | 否 | number | 默认:无 | 项目id项目id | | companyId | 否 | number | 默认:无 | 公司id公司id | | pid | 否 | number | 默认:无 | 父节点id父节点id | | names | 是 | string | 默认:无 | 名称列表数组 jsonStr名称列表数组 jsonStr ["test", "asdf" , "fdas", "asdf"] | | jsonExtends | 否 | string | 默认:无 | 扩展字段数组扩展字段数组 |

200返回说明

{
  "data": {},
  "code": 200,
  "msg": "成功",
  "t": 1562578762596
}

为某节点增加一个兄弟

为某节点增加一个兄弟

地址/skyapi/tree/addBrother

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | id | 是 | number | 默认:无 | 节点id节点id | | name | 是 | string | 默认:无 | 当前节点名称当前节点名称 | | jsonExtend | 否 | string | 默认:{} | 扩展字段扩展字段 |

200返回说明

{
  "data": {
    "project_id": 0,
    "company_id": 0,
    "pid": 0,
    "depth": 1,
    "name": "节点",
    "json_extend": "{}",
    "id": 10
  },
  "code": 200,
  "msg": "成功",
  "t": 1562578762596
}

删除某节点,同时下面的节点也被删除

删除某节点,同时下面的节点也被删除

地址/skyapi/tree/del

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | id | 是 | number | 默认:无 | 节点id节点id |

200返回说明

{
  "data": {},
  "code": 200,
  "msg": "成功",
  "t": 1562578762596
}

删除多个节点

删除多个节点

地址/skyapi/tree/delMult

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | ids | 是 | string | 默认:无 | 节点id 列表节点id 列表 [1,2,3,4,5] |

200返回说明

{
  "data": {},
  "code": 200,
  "msg": "成功",
  "t": 1562578762596
}

修改某节点信息

修改某节点信息

地址/skyapi/tree/modify

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | id | 否 | number | 默认:无 | 父节点id父节点id | | name | 否 | string | 默认:无 | 当前节点名称当前节点名称 | | jsonExtend | 否 | string | 默认:无 | 扩展字段扩展字段 |

200返回说明

{
  "data": {
    "project_id": 0,
    "company_id": 0,
    "pid": 0,
    "depth": 1,
    "name": "节点",
    "json_extend": "{}",
    "id": 10
  },
  "code": 200,
  "msg": "成功",
  "t": 1562578762596
}

移动整个节点到,另一节点下成为儿子

移动整个节点到,另一节点下成为儿子

地址/skyapi/tree/move

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | idSrc | 是 | number | 默认:无 | 原节点id原节点id | | idDest | 是 | number | 默认:无 | 目标节点id目标节点id |

200返回说明

{
  "data": {},
  "code": 200,
  "msg": "成功",
  "t": 1562578762596
}

复制节点到,另一节点下成为儿子

复制节点到,另一节点下成为儿子

地址/skyapi/tree/copy

方法GET

query参数

| 参数名 | 必须 | 类型 | 默认值 | 说明 | | ---: | :---: | :---: | :--- | :--- | | idSrc | 是 | number | 默认:无 | 原节点id原节点id | | idDest | 是 | number | 默认:无 | 目标节点id目标节点id |

200返回说明

{
  "data": {},
  "code": 200,
  "msg": "成功",
  "t": 1562578762596
}