Browse Source

3211

master
lichong 8 months ago
commit
c9b25b1965
  1. 24
      basedemo/vitebase/.gitignore
  2. 7
      basedemo/vitebase/README.md
  3. 13
      basedemo/vitebase/index.html
  4. 18
      basedemo/vitebase/package.json
  5. 1
      basedemo/vitebase/public/vite.svg
  6. 30
      basedemo/vitebase/src/App.vue
  7. 1
      basedemo/vitebase/src/assets/vue.svg
  8. 40
      basedemo/vitebase/src/components/HelloWorld.vue
  9. 5
      basedemo/vitebase/src/main.js
  10. 89
      basedemo/vitebase/src/style.css
  11. 7
      basedemo/vitebase/vite.config.js
  12. 23
      basedemo/vuebase/.gitignore
  13. 24
      basedemo/vuebase/README.md
  14. 5
      basedemo/vuebase/babel.config.js
  15. 19
      basedemo/vuebase/jsconfig.json
  16. 52
      basedemo/vuebase/package.json
  17. BIN
      basedemo/vuebase/public/favicon.ico
  18. 17
      basedemo/vuebase/public/index.html
  19. 30
      basedemo/vuebase/src/App.vue
  20. BIN
      basedemo/vuebase/src/assets/logo.png
  21. 60
      basedemo/vuebase/src/components/HelloWorld.vue
  22. 6
      basedemo/vuebase/src/main.js
  23. 25
      basedemo/vuebase/src/router/index.js
  24. 14
      basedemo/vuebase/src/store/index.js
  25. 5
      basedemo/vuebase/src/views/AboutView.vue
  26. 18
      basedemo/vuebase/src/views/HomeView.vue
  27. 5
      basedemo/vuebase/vue.config.js
  28. 33
      demo/README.md
  29. 74
      demo/app.js
  30. 11
      demo/app/controller/home.js
  31. 9
      demo/app/router.js
  32. 36
      demo/config/config.default.js
  33. 10
      demo/config/plugin.js
  34. 5
      demo/jsconfig.json
  35. 49
      demo/package.json
  36. 549
      demo/run/agent_config.json
  37. 310
      demo/run/agent_config_meta.json
  38. 362
      demo/run/agent_timing_7200.json
  39. 584
      demo/run/application_config.json
  40. 310
      demo/run/application_config_meta.json
  41. 530
      demo/run/application_timing_15252.json
  42. 530
      demo/run/application_timing_17632.json
  43. 530
      demo/run/application_timing_9772.json
  44. 14
      demo/run/router.json
  45. 12
      demo/typings/app/controller/index.d.ts
  46. 7
      demo/typings/app/index.d.ts
  47. 12
      demo/typings/config/index.d.ts
  48. 34
      demo/typings/config/plugin.d.ts
  49. 1
      developedcode/cegongji/back/.eslintignore
  50. 4
      developedcode/cegongji/back/.eslintrc
  51. 15
      developedcode/cegongji/back/.gitignore
  52. 33
      developedcode/cegongji/back/README.md
  53. 3
      developedcode/cegongji/back/agent.js
  54. 128
      developedcode/cegongji/back/app.js
  55. 30
      developedcode/cegongji/back/app/controller/dualFlowMotor.js
  56. 32
      developedcode/cegongji/back/app/controller/home.js
  57. 22
      developedcode/cegongji/back/app/controller/hubMotor.js
  58. 33
      developedcode/cegongji/back/app/controller/message.js
  59. 48
      developedcode/cegongji/back/app/controller/users.js
  60. 9
      developedcode/cegongji/back/app/io/controller/gelixing.js
  61. 24
      developedcode/cegongji/back/app/middleware/error_handler.js
  62. 23
      developedcode/cegongji/back/app/middleware/jwtErr.js
  63. 47
      developedcode/cegongji/back/app/model/dualFlowMotor.js
  64. 47
      developedcode/cegongji/back/app/model/hubMotor.js
  65. 43
      developedcode/cegongji/back/app/model/user.js
  66. 37
      developedcode/cegongji/back/app/model/userLoginRecord.js
  67. 14
      developedcode/cegongji/back/app/router.js
  68. 11
      developedcode/cegongji/back/app/router/message.js
  69. 15
      developedcode/cegongji/back/app/router/selfInit.js
  70. 17
      developedcode/cegongji/back/app/router/user.js
  71. 88
      developedcode/cegongji/back/app/service/dealSerialport.js
  72. 46
      developedcode/cegongji/back/app/service/dualFlowMotor.js
  73. 121
      developedcode/cegongji/back/app/service/home.js
  74. 24
      developedcode/cegongji/back/app/service/hubMotor.js
  75. 37
      developedcode/cegongji/back/app/service/message.js
  76. 156
      developedcode/cegongji/back/app/service/users.js
  77. 241
      developedcode/cegongji/back/app/service/utils.js
  78. 24
      developedcode/cegongji/back/app/udp/controller/index.js
  79. 73
      developedcode/cegongji/back/config/config.default.js
  80. 29
      developedcode/cegongji/back/config/plugin.js
  81. 5
      developedcode/cegongji/back/jsconfig.json
  82. 56
      developedcode/cegongji/back/package.json
  83. 20
      developedcode/cegongji/back/test/app/controller/home.test.js
  84. 4
      developedcode/cegongji/front/.browserslistrc
  85. 5
      developedcode/cegongji/front/.editorconfig
  86. 23
      developedcode/cegongji/front/.gitignore
  87. 44
      developedcode/cegongji/front/README.md
  88. 16
      developedcode/cegongji/front/index.html
  89. 19
      developedcode/cegongji/front/jsconfig.json
  90. 34
      developedcode/cegongji/front/package.json
  91. BIN
      developedcode/cegongji/front/public/favicon.png
  92. 43
      developedcode/cegongji/front/src/App.vue
  93. 31
      developedcode/cegongji/front/src/api/dualFlowMotor.js
  94. 26
      developedcode/cegongji/front/src/api/home.js
  95. 23
      developedcode/cegongji/front/src/api/hubMotor.js
  96. 30
      developedcode/cegongji/front/src/api/message.js
  97. 36
      developedcode/cegongji/front/src/api/user.js
  98. 16
      developedcode/cegongji/front/src/assets/css/base.css
  99. BIN
      developedcode/cegongji/front/src/assets/img/login-bg.jpg
  100. BIN
      developedcode/cegongji/front/src/assets/img/login-logo.png

24
basedemo/vitebase/.gitignore

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

7
basedemo/vitebase/README.md

@ -0,0 +1,7 @@
# Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).

13
basedemo/vitebase/index.html

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

18
basedemo/vitebase/package.json

@ -0,0 +1,18 @@
{
"name": "vitebase",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.3.4"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.2.3",
"vite": "^4.4.5"
}
}

1
basedemo/vitebase/public/vite.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

30
basedemo/vitebase/src/App.vue

@ -0,0 +1,30 @@
<script setup>
import HelloWorld from './components/HelloWorld.vue'
</script>
<template>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
</div>
<HelloWorld msg="Vite + Vue" />
</template>
<style scoped>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
}
</style>

1
basedemo/vitebase/src/assets/vue.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

After

Width:  |  Height:  |  Size: 496 B

40
basedemo/vitebase/src/components/HelloWorld.vue

@ -0,0 +1,40 @@
<script setup>
import { ref } from 'vue'
defineProps({
msg: String,
})
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Install
<a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
in your IDE for a better DX
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>

5
basedemo/vitebase/src/main.js

@ -0,0 +1,5 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
createApp(App).mount('#app')

89
basedemo/vitebase/src/style.css

@ -0,0 +1,89 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.card {
padding: 2em;
}
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

7
basedemo/vitebase/vite.config.js

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
})

23
basedemo/vuebase/.gitignore

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
basedemo/vuebase/README.md

@ -0,0 +1,24 @@
# vuebase
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

5
basedemo/vuebase/babel.config.js

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

19
basedemo/vuebase/jsconfig.json

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

52
basedemo/vuebase/package.json

@ -0,0 +1,52 @@
{
"name": "vuebase",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^1.5.0",
"core-js": "^3.8.3",
"dayjs": "^1.11.9",
"element-plus": "^2.3.12",
"lodash": "^4.17.21",
"nprogress": "^0.2.0",
"vue": "^3.2.13",
"vue-router": "^4.0.3",
"vuex": "^4.0.0"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "@babel/eslint-parser"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
}

BIN
basedemo/vuebase/public/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

17
basedemo/vuebase/public/index.html

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

30
basedemo/vuebase/src/App.vue

@ -0,0 +1,30 @@
<template>
<nav>
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</nav>
<router-view/>
</template>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
nav {
padding: 30px;
}
nav a {
font-weight: bold;
color: #2c3e50;
}
nav a.router-link-exact-active {
color: #42b983;
}
</style>

BIN
basedemo/vuebase/src/assets/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

60
basedemo/vuebase/src/components/HelloWorld.vue

@ -0,0 +1,60 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

6
basedemo/vuebase/src/main.js

@ -0,0 +1,6 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
createApp(App).use(store).use(router).mount('#app')

25
basedemo/vuebase/src/router/index.js

@ -0,0 +1,25 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
const routes = [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
}
]
const router = createRouter({
history: createWebHashHistory(),
routes
})
export default router

14
basedemo/vuebase/src/store/index.js

@ -0,0 +1,14 @@
import { createStore } from 'vuex'
export default createStore({
state: {
},
getters: {
},
mutations: {
},
actions: {
},
modules: {
}
})

5
basedemo/vuebase/src/views/AboutView.vue

@ -0,0 +1,5 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>

18
basedemo/vuebase/src/views/HomeView.vue

@ -0,0 +1,18 @@
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>
<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
export default {
name: 'HomeView',
components: {
HelloWorld
}
}
</script>

5
basedemo/vuebase/vue.config.js

@ -0,0 +1,5 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
lintOnSave: false
})

33
demo/README.md

@ -0,0 +1,33 @@
# mqtttohttp
## QuickStart
<!-- add docs here for user -->
see [egg docs][egg] for more detail.
### Development
```bash
$ npm i
$ npm run dev
$ open http://localhost:7001/
```
### Deploy
```bash
$ npm start
$ npm stop
```
### npm scripts
- Use `npm run lint` to check code style.
- Use `npm test` to run unit test.
- Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail.
[egg]: https://eggjs.org

74
demo/app.js

@ -0,0 +1,74 @@
// app.js
const mqtt = require("mqtt");//mqtt api包
const _ = require("lodash")//工具包
class AppBootHook {
constructor(app) {
this.app = app;
}
async didReady() {
//连接到小车上的mqtt服务器
// const client = mqtt.connect("mqtt://192.168.1.102:1883", {
const client = mqtt.connect("mqtt://127.0.0.1:1883", {
clean: true,//持续链接
connectTimeout: 4000,//超时
clientId: 'map-editor-' + Math.random().toString(16).substr(2),//连接用户id唯一
username: 'map-editor',//连接用户名(如果没有则可以不写)
password: 'leador',//连接用户密码(如果没有则可以不写)
});
//连接服务器
client.on("connect", function () {
console.log("appmqtt服务器连接成功");
// 订阅电池信息
client.subscribe(`/robot4inspection/fa49e558574df1ec/sensor/battery`, { qos: 0 }, (a, b, c) => {
});
// 订阅位置信息
client.subscribe(`/robot4inspection/fa49e558574df1ec/sensor/gps`, { qos: 0 }, (a, b, c) => {
});
// 订阅位姿信息
client.subscribe(`/robot4inspection/fa49e558574df1ec/localization/pose`, { qos: 0 }, (a, b, c) => {
});
// 订阅错误消息
client.subscribe(`/robot4inspection/fa49e558574df1ec/message/error`, { qos: 0 }, (a, b, c) => {
});
// 订阅警告消息
client.subscribe(`/robot4inspection/fa49e558574df1ec/message/warn`, { qos: 0 }, (a, b, c) => {
});
// 订阅日志消息
client.subscribe(`/robot4inspection/fa49e558574df1ec/message/info`, { qos: 0 }, (a, b, c) => {
});
});
//监听消息
client.on("message", async function (topic, message) {
if (_.endsWith(topic, "/sensor/battery")) {
//得到电池信息
let resObj = JSON.parse(message.toString())
console.log(resObj)
} else if (_.endsWith(topic, "/sensor/gps")) {
//得到位置信息
let resObj = JSON.parse(message.toString())
console.log(resObj)
} else if (_.endsWith(topic, "/localization/pose")) {
//得到位姿信息
let resObj = JSON.parse(message.toString())
console.log(resObj)
} else if (_.endsWith(topic, "/message/error")) {
//得到错误信息
let resObj = JSON.parse(message.toString())
console.log(resObj)
//得到错误信息后需要发布消息(自定义话题即可)
client.publish("/errorMessage", JSON.stringify(resObj), { qos: 1, })
} else if (_.endsWith(topic, "/message/warn")) {
//得到警告信息
let resObj = JSON.parse(message.toString())
console.log(resObj)
} else if (_.endsWith(topic, "/message/info")) {
//得到日志信息
let resObj = JSON.parse(message.toString())
console.log(resObj)
}
});
}
}
module.exports = AppBootHook;

11
demo/app/controller/home.js

@ -0,0 +1,11 @@
'use strict';
const { Controller } = require('egg');
const _ = require("lodash")
class HomeController extends Controller {
async index() {
}
}
module.exports = HomeController;

9
demo/app/router.js

@ -0,0 +1,9 @@
'use strict';
/**
* @param {Egg.Application} app - egg application
*/
module.exports = app => {
const { router, controller } = app;
router.post('/', controller.home.index);
};

36
demo/config/config.default.js

@ -0,0 +1,36 @@
/* eslint valid-jsdoc: "off" */
"use strict";
/**
* @param {Egg.EggAppInfo} appInfo app info
*/
module.exports = (appInfo) => {
/**
* built-in config
* @type {Egg.EggAppConfig}
**/
const config = (exports = {});
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + "_1687851227647_4638";
// add your middleware config here
config.middleware = [];
config.cluster = {
listen: {
port: 7020
}
}
// add your user config here
const userConfig = {
// myAppName: 'egg',
};
return {
...config,
...userConfig,
};
};

10
demo/config/plugin.js

@ -0,0 +1,10 @@
"use strict";
/** @type Egg.EggPlugin */
module.exports = {
// had enabled by egg
// static: {
// enable: true,
// }
};

5
demo/jsconfig.json

@ -0,0 +1,5 @@
{
"include": [
"**/*"
]
}

49
demo/package.json

@ -0,0 +1,49 @@
{
"name": "mqtttohttp",
"version": "1.0.0",
"description": "",
"private": true,
"egg": {
"declarations": true
},
"dependencies": {
"aedes": "^0.49.0",
"egg": "^3",
"egg-scripts": "^2",
"lodash": "^4.17.21",
"mqtt": "^4.3.7"
},
"devDependencies": {
"egg-bin": "^5",
"egg-ci": "^2",
"egg-mock": "^5",
"eslint": "^8",
"eslint-config-egg": "^12"
},
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-mqtttohttp",
"stop": "egg-scripts stop --title=egg-server-mqtttohttp",
"dev": "egg-bin dev",
"npmPro": "npm install --production",
"build": "tar -zcvf ../release.tgz .",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
},
"ci": {
"version": "16, 18",
"type": "github"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "MIT"
}

549
demo/run/agent_config.json

@ -0,0 +1,549 @@
{
"config": {
"session": {
"maxAge": 86400000,
"key": "EGG_SESS",
"httpOnly": true,
"encrypt": true,
"logValue": true
},
"security": {
"domainWhiteList": [],
"protocolWhiteList": [],
"defaultMiddleware": "csrf,hsts,methodnoallow,noopen,nosniff,csp,xssProtection,xframe,dta",
"csrf": {
"enable": true,
"type": "ctoken",
"ignoreJSON": false,
"useSession": false,
"cookieName": "csrfToken",
"sessionName": "csrfToken",
"headerName": "x-csrf-token",
"bodyName": "_csrf",
"queryName": "_csrf",
"supportedRequests": [
{
"path": {},
"methods": [
"POST",
"PATCH",
"DELETE",
"PUT",
"CONNECT"
]
}
],
"refererWhiteList": []
},
"xframe": {
"enable": true,
"value": "SAMEORIGIN"
},
"hsts": {
"enable": false,
"maxAge": 31536000,
"includeSubdomains": false
},
"dta": {
"enable": true
},
"methodnoallow": {
"enable": true
},
"noopen": {
"enable": true
},
"nosniff": {
"enable": true
},
"referrerPolicy": {
"enable": false,
"value": "no-referrer-when-downgrade"
},
"xssProtection": {
"enable": true,
"value": "1; mode=block"
},
"csp": {
"enable": false,
"policy": {}
},
"ssrf": {
"ipBlackList": null,
"ipExceptionList": null,
"checkAddress": null
},
"_protocolWhiteListSet": "<Set>"
},
"helper": {
"shtml": {}
},
"jsonp": {
"limit": 50,
"callback": [
"_callback",
"callback"
],
"csrf": false
},
"onerror": {
"errorPageUrl": "",
"appErrorFilter": null,
"templatePath": "F:\\code\\demo\\node_modules\\egg-onerror\\lib\\onerror_page.mustache"
},
"i18n": {
"defaultLocale": "en_US",
"dirs": [],
"queryField": "locale",
"cookieField": "locale",
"cookieDomain": "",
"cookieMaxAge": "1y"
},
"watcher": {
"type": "development",
"eventSources": {
"default": "F:\\code\\demo\\node_modules\\egg-watcher\\lib\\event-sources\\default",
"development": "F:\\code\\demo\\node_modules\\egg-watcher\\lib\\event-sources\\development"
}
},
"customLogger": {
"scheduleLogger": {
"consoleLevel": "NONE",
"file": "egg-schedule.log"
}
},
"schedule": {
"directory": []
},
"multipart": {
"mode": "stream",
"autoFields": false,
"defaultCharset": "utf8",
"defaultParamCharset": "utf8",
"fieldNameSize": 100,
"fieldSize": "100kb",
"fields": 10,
"fileSize": "10mb",
"files": 10,
"fileExtensions": [],
"whitelist": null,
"allowArrayField": false,
"tmpdir": "C:\\Users\\lichong\\AppData\\Local\\Temp\\egg-multipart-tmp\\mqtttohttp",
"cleanSchedule": {
"cron": "0 30 4 * * *",
"disable": false
}
},
"development": {
"watchDirs": [],
"ignoreDirs": [],
"fastReady": false,
"reloadOnDebug": true,
"overrideDefault": false,
"overrideIgnore": false
},
"logrotator": {
"filesRotateByHour": null,
"hourDelimiter": "-",
"filesRotateBySize": null,
"maxFileSize": 52428800,
"maxFiles": 10,
"rotateDuration": 60000,
"maxDays": 31
},
"static": {
"prefix": "/public/",
"dir": "F:\\code\\demo\\app\\public",
"dynamic": true,
"preload": false,
"buffer": false,
"maxFiles": 1000
},
"view": {
"root": "F:\\code\\demo\\app\\view",
"cache": false,
"defaultExtension": ".html",
"defaultViewEngine": "",
"mapping": {}
},
"env": "local",
"name": "mqtttohttp",
"keys": "<String len: 29>",
"cookies": {},
"proxy": false,
"maxIpsCount": 0,
"maxProxyCount": 0,
"protocolHeaders": "x-forwarded-proto",
"ipHeaders": "x-forwarded-for",
"hostHeaders": "",
"pkg": {
"name": "mqtttohttp",
"version": "1.0.0",
"description": "",
"private": true,
"egg": {
"declarations": true
},
"dependencies": {
"aedes": "^0.49.0",
"egg": "^3",
"egg-scripts": "^2",
"lodash": "^4.17.21",
"mqtt": "^4.3.7"
},
"devDependencies": {
"egg-bin": "^5",
"egg-ci": "^2",
"egg-mock": "^5",
"eslint": "^8",
"eslint-config-egg": "^12"
},
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-mqtttohttp",
"stop": "egg-scripts stop --title=egg-server-mqtttohttp",
"dev": "egg-bin dev",
"npmPro": "npm install --production",
"build": "tar -zcvf ../release.tgz .",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
},
"ci": {
"version": "16, 18",
"type": "github"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "MIT"
},
"baseDir": "F:\\code\\demo",
"HOME": "C:\\Users\\lichong",
"rundir": "F:\\code\\demo\\run",
"dump": {
"ignore": "<Set>",
"timing": {
"slowBootActionMinDuration": 5000
}
},
"confusedConfigurations": {
"bodyparser": "bodyParser",
"notFound": "notfound",
"sitefile": "siteFile",
"middlewares": "middleware",
"httpClient": "httpclient"
},
"notfound": {
"pageUrl": ""
},
"siteFile": {
"/favicon.ico": "<Buffer len: 6463>",
"cacheControl": "public, max-age=2592000"
},
"bodyParser": {
"enable": true,
"encoding": "utf8",
"formLimit": "1mb",
"jsonLimit": "1mb",
"textLimit": "1mb",
"strict": true,
"queryString": {
"arrayLimit": 100,
"depth": 5,
"parameterLimit": 1000
},
"onerror": "<Function onerror>"
},
"logger": {
"dir": "F:\\code\\demo\\logs\\mqtttohttp",
"encoding": "utf8",
"env": "local",
"level": "INFO",
"consoleLevel": "INFO",
"disableConsoleAfterReady": false,
"outputJSON": false,
"buffer": true,
"appLogName": "mqtttohttp-web.log",
"coreLogName": "egg-web.log",
"agentLogName": "egg-agent.log",
"errorLogName": "common-error.log",
"coreLogger": {
"consoleLevel": "WARN"
},
"allowDebugAtProd": false,
"enablePerformanceTimer": false,
"enableFastContextLogger": false,
"type": "agent",
"localStorage": "<AsyncLocalStorage>"
},
"httpclient": {
"enableDNSCache": false,
"dnsCacheLookupInterval": 10000,
"dnsCacheMaxLength": 1000,
"request": {
"timeout": 5000
},
"httpAgent": {
"keepAlive": true,
"freeSocketTimeout": 4000,
"maxSockets": 9007199254740991,
"maxFreeSockets": 256
},
"httpsAgent": {
"keepAlive": true,
"freeSocketTimeout": 4000,
"maxSockets": 9007199254740991,
"maxFreeSockets": 256
},
"useHttpClientNext": false
},
"meta": {
"enable": true,
"logging": false
},
"coreMiddleware": [
"meta",
"siteFile",
"notfound",
"bodyParser",
"overrideMethod"
],
"workerStartTimeout": 600000,
"serverTimeout": null,
"cluster": {
"listen": {
"path": "",
"port": 7020,
"hostname": ""
}
},
"clusterClient": {
"maxWaitTime": 60000,
"responseTimeout": 60000
},
"onClientError": null,
"middleware": [],
"coreMiddlewares": "~config~coreMiddleware",
"appMiddlewares": "~config~middleware",
"appMiddleware": "~config~middleware"
},
"plugins": {
"onerror": {
"enable": true,
"package": "egg-onerror",
"name": "onerror",
"dependencies": [],
"optionalDependencies": [
"jsonp"
],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-onerror",
"version": "2.2.0"
},
"session": {
"enable": true,
"package": "egg-session",
"name": "session",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-session",
"version": "3.3.0"
},
"i18n": {
"enable": true,
"package": "egg-i18n",
"name": "i18n",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-i18n",
"version": "2.1.1"
},
"watcher": {
"enable": true,
"package": "egg-watcher",
"name": "watcher",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-watcher",
"version": "3.1.1",
"dependents": [
"development"
]
},
"multipart": {
"enable": true,
"package": "egg-multipart",
"name": "multipart",
"dependencies": [],
"optionalDependencies": [
"schedule"
],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-multipart",
"version": "3.3.0"
},
"security": {
"enable": true,
"package": "egg-security",
"name": "security",
"dependencies": [],
"optionalDependencies": [
"session"
],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-security",
"version": "3.1.0"
},
"development": {
"enable": true,
"package": "egg-development",
"name": "development",
"dependencies": [
"watcher"
],
"optionalDependencies": [],
"env": [
"local"
],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-development",
"version": "2.7.0"
},
"logrotator": {
"enable": true,
"package": "egg-logrotator",
"name": "logrotator",
"dependencies": [
"schedule"
],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-logrotator",
"version": "3.1.0"
},
"schedule": {
"enable": true,
"package": "egg-schedule",
"name": "schedule",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-schedule",
"version": "4.0.0",
"dependents": [
"logrotator"
]
},
"static": {
"enable": true,
"package": "egg-static",
"name": "static",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-static",
"version": "2.3.1"
},
"jsonp": {
"enable": true,
"package": "egg-jsonp",
"name": "jsonp",
"dependencies": [],
"optionalDependencies": [
"security"
],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-jsonp",
"version": "2.0.0"
},
"view": {
"enable": true,
"package": "egg-view",
"name": "view",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-view",
"version": "2.1.4"
}
},
"appInfo": {
"name": "mqtttohttp",
"baseDir": "F:\\code\\demo",
"env": "local",
"scope": "",
"HOME": "C:\\Users\\lichong",
"pkg": {
"name": "mqtttohttp",
"version": "1.0.0",
"description": "",
"private": true,
"egg": {
"declarations": true
},
"dependencies": {
"aedes": "^0.49.0",
"egg": "^3",
"egg-scripts": "^2",
"lodash": "^4.17.21",
"mqtt": "^4.3.7"
},
"devDependencies": {
"egg-bin": "^5",
"egg-ci": "^2",
"egg-mock": "^5",
"eslint": "^8",
"eslint-config-egg": "^12"
},
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-mqtttohttp",
"stop": "egg-scripts stop --title=egg-server-mqtttohttp",
"dev": "egg-bin dev",
"npmPro": "npm install --production",
"build": "tar -zcvf ../release.tgz .",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
},
"ci": {
"version": "16, 18",
"type": "github"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "MIT"
},
"root": "F:\\code\\demo"
}
}

310
demo/run/agent_config_meta.json

@ -0,0 +1,310 @@
{
"keys": "F:\\code\\demo\\config\\config.default.js",
"middleware": "F:\\code\\demo\\config\\config.default.js",
"cluster": {
"listen": {
"port": "F:\\code\\demo\\config\\config.default.js",
"path": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"hostname": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
}
},
"session": {
"maxAge": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js",
"key": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js",
"httpOnly": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js",
"encrypt": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js",
"logValue": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js"
},
"security": {
"domainWhiteList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"protocolWhiteList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"defaultMiddleware": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"csrf": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"type": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"ignoreJSON": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"useSession": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"cookieName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"sessionName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"headerName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"bodyName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"queryName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"supportedRequests": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"refererWhiteList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"xframe": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"value": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"hsts": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.local.js",
"maxAge": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"includeSubdomains": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"dta": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"methodnoallow": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"noopen": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"nosniff": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"referrerPolicy": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"value": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"xssProtection": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"value": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"csp": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"policy": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"ssrf": {
"ipBlackList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"ipExceptionList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"checkAddress": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
}
},
"helper": {
"shtml": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"jsonp": {
"limit": "F:\\code\\demo\\node_modules\\egg-jsonp\\config\\config.default.js",
"callback": "F:\\code\\demo\\node_modules\\egg-jsonp\\config\\config.default.js",
"csrf": "F:\\code\\demo\\node_modules\\egg-jsonp\\config\\config.default.js"
},
"onerror": {
"errorPageUrl": "F:\\code\\demo\\node_modules\\egg-onerror\\config\\config.default.js",
"appErrorFilter": "F:\\code\\demo\\node_modules\\egg-onerror\\config\\config.default.js",
"templatePath": "F:\\code\\demo\\node_modules\\egg-onerror\\config\\config.default.js"
},
"i18n": {
"defaultLocale": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"dirs": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"queryField": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"cookieField": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"cookieDomain": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"cookieMaxAge": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js"
},
"watcher": {
"type": "F:\\code\\demo\\node_modules\\egg-watcher\\config\\config.local.js",
"eventSources": {
"default": "F:\\code\\demo\\node_modules\\egg-watcher\\config\\config.default.js",
"development": "F:\\code\\demo\\node_modules\\egg-watcher\\config\\config.default.js"
}
},
"customLogger": {
"scheduleLogger": {
"consoleLevel": "F:\\code\\demo\\node_modules\\egg-schedule\\config\\config.default.js",
"file": "F:\\code\\demo\\node_modules\\egg-schedule\\config\\config.default.js"
}
},
"schedule": {
"directory": "F:\\code\\demo\\node_modules\\egg-schedule\\config\\config.default.js"
},
"multipart": {
"mode": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"autoFields": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"defaultCharset": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"defaultParamCharset": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fieldNameSize": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fieldSize": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fields": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fileSize": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"files": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fileExtensions": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"whitelist": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"allowArrayField": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"tmpdir": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"cleanSchedule": {
"cron": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"disable": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js"
}
},
"development": {
"watchDirs": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"ignoreDirs": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"fastReady": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"reloadOnDebug": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"overrideDefault": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"overrideIgnore": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js"
},
"logrotator": {
"filesRotateByHour": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"hourDelimiter": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"filesRotateBySize": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"maxFileSize": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"maxFiles": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"rotateDuration": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"maxDays": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js"
},
"static": {
"prefix": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"dir": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"dynamic": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"preload": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"buffer": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"maxFiles": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js"
},
"view": {
"root": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.default.js",
"cache": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.local.js",
"defaultExtension": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.default.js",
"defaultViewEngine": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.default.js",
"mapping": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.default.js"
},
"env": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"name": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"cookies": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"proxy": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxIpsCount": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxProxyCount": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"protocolHeaders": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"ipHeaders": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"hostHeaders": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"pkg": {
"name": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"version": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"description": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"private": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg": {
"declarations": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"dependencies": {
"aedes": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg-scripts": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"lodash": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"mqtt": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"devDependencies": {
"egg-bin": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg-ci": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg-mock": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"eslint": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"eslint-config-egg": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"engines": {
"node": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"scripts": {
"start": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"stop": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"dev": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"npmPro": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"build": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"debug": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"test": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"test-local": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"cov": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"lint": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"ci": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"ci": {
"version": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"type": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"repository": {
"type": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"url": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"author": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"license": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"baseDir": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"HOME": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"rundir": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"dump": {
"ignore": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"timing": {
"slowBootActionMinDuration": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
}
},
"confusedConfigurations": {
"bodyparser": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"notFound": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"sitefile": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"middlewares": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"httpClient": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"notfound": {
"pageUrl": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"siteFile": {
"/favicon.ico": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"cacheControl": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"bodyParser": {
"enable": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"encoding": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"formLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"jsonLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"textLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"strict": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"queryString": {
"arrayLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"depth": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"parameterLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"onerror": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"logger": {
"dir": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"encoding": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"env": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"level": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"consoleLevel": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"disableConsoleAfterReady": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"outputJSON": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"buffer": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"appLogName": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"coreLogName": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"agentLogName": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"errorLogName": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"coreLogger": {
"consoleLevel": "F:\\code\\demo\\node_modules\\egg\\config\\config.local.js"
},
"allowDebugAtProd": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"enablePerformanceTimer": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"enableFastContextLogger": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"httpclient": {
"enableDNSCache": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"dnsCacheLookupInterval": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"dnsCacheMaxLength": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"request": {
"timeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"httpAgent": {
"keepAlive": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"freeSocketTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxSockets": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxFreeSockets": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"httpsAgent": {
"keepAlive": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"freeSocketTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxSockets": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxFreeSockets": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"useHttpClientNext": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"meta": {
"enable": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"logging": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"coreMiddleware": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"workerStartTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"serverTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"clusterClient": {
"maxWaitTime": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"responseTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"onClientError": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
}

362
demo/run/agent_timing_7200.json

@ -0,0 +1,362 @@
[
{
"name": "Process Start",
"start": 1700526702429,
"end": 1700526703916,
"duration": 1487,
"pid": 7200,
"index": 0
},
{
"name": "Application Start",
"start": 1700526703917,
"end": 1700526705396,
"duration": 1479,
"pid": 7200,
"index": 1
},
{
"name": "Load Plugin",
"start": 1700526703927,
"end": 1700526703936,
"duration": 9,
"pid": 7200,
"index": 2
},
{
"name": "Load Config",
"start": 1700526703936,
"end": 1700526703965,
"duration": 29,
"pid": 7200,
"index": 3
},
{
"name": "Require(0) config/config.default.js",
"start": 1700526703937,
"end": 1700526703937,
"duration": 0,
"pid": 7200,
"index": 4
},
{
"name": "Require(1) node_modules/egg-session/config/config.default.js",
"start": 1700526703938,
"end": 1700526703938,
"duration": 0,
"pid": 7200,
"index": 5
},
{
"name": "Require(2) node_modules/egg-security/config/config.default.js",
"start": 1700526703938,
"end": 1700526703939,
"duration": 1,
"pid": 7200,
"index": 6
},
{
"name": "Require(3) node_modules/egg-jsonp/config/config.default.js",
"start": 1700526703939,
"end": 1700526703940,
"duration": 1,
"pid": 7200,
"index": 7
},
{
"name": "Require(4) node_modules/egg-onerror/config/config.default.js",
"start": 1700526703940,
"end": 1700526703940,
"duration": 0,
"pid": 7200,
"index": 8
},
{
"name": "Require(5) node_modules/egg-i18n/config/config.default.js",
"start": 1700526703941,
"end": 1700526703941,
"duration": 0,
"pid": 7200,
"index": 9
},
{
"name": "Require(6) node_modules/egg-watcher/config/config.default.js",
"start": 1700526703941,
"end": 1700526703942,
"duration": 1,
"pid": 7200,
"index": 10
},
{
"name": "Require(7) node_modules/egg-schedule/config/config.default.js",
"start": 1700526703942,
"end": 1700526703942,
"duration": 0,
"pid": 7200,
"index": 11
},
{
"name": "Require(8) node_modules/egg-multipart/config/config.default.js",
"start": 1700526703943,
"end": 1700526703943,
"duration": 0,
"pid": 7200,
"index": 12
},
{
"name": "Require(9) node_modules/egg-development/config/config.default.js",
"start": 1700526703944,
"end": 1700526703944,
"duration": 0,
"pid": 7200,
"index": 13
},
{
"name": "Require(10) node_modules/egg-logrotator/config/config.default.js",
"start": 1700526703944,
"end": 1700526703945,
"duration": 1,
"pid": 7200,
"index": 14
},
{
"name": "Require(11) node_modules/egg-static/config/config.default.js",
"start": 1700526703945,
"end": 1700526703945,
"duration": 0,
"pid": 7200,
"index": 15
},
{
"name": "Require(12) node_modules/egg-view/config/config.default.js",
"start": 1700526703946,
"end": 1700526703946,
"duration": 0,
"pid": 7200,
"index": 16
},
{
"name": "Require(13) node_modules/egg/config/config.default.js",
"start": 1700526703946,
"end": 1700526703947,
"duration": 1,
"pid": 7200,
"index": 17
},
{
"name": "Require(14) config/config.default.js",
"start": 1700526703960,
"end": 1700526703960,
"duration": 0,
"pid": 7200,
"index": 18
},
{
"name": "Require(15) node_modules/egg-security/config/config.local.js",
"start": 1700526703962,
"end": 1700526703962,
"duration": 0,
"pid": 7200,
"index": 19
},
{
"name": "Require(16) node_modules/egg-watcher/config/config.local.js",
"start": 1700526703963,
"end": 1700526703963,
"duration": 0,
"pid": 7200,
"index": 20
},
{
"name": "Require(17) node_modules/egg-view/config/config.local.js",
"start": 1700526703964,
"end": 1700526703964,
"duration": 0,
"pid": 7200,
"index": 21
},
{
"name": "Require(18) node_modules/egg/config/config.local.js",
"start": 1700526703964,
"end": 1700526703965,
"duration": 1,
"pid": 7200,
"index": 22
},
{
"name": "Load extend/agent.js",
"start": 1700526703966,
"end": 1700526704402,
"duration": 436,
"pid": 7200,
"index": 23
},
{
"name": "Require(19) node_modules/egg-security/app/extend/agent.js",
"start": 1700526703977,
"end": 1700526703989,
"duration": 12,
"pid": 7200,
"index": 24
},
{
"name": "Require(20) node_modules/egg-schedule/app/extend/agent.js",
"start": 1700526703990,
"end": 1700526704333,
"duration": 343,
"pid": 7200,
"index": 25
},
{
"name": "Require(21) node_modules/egg-logrotator/app/extend/agent.js",
"start": 1700526704342,
"end": 1700526704391,
"duration": 49,
"pid": 7200,
"index": 26
},
{
"name": "Load extend/context.js",
"start": 1700526704402,
"end": 1700526704860,
"duration": 458,
"pid": 7200,
"index": 27
},
{
"name": "Require(22) node_modules/egg-security/app/extend/context.js",
"start": 1700526704402,
"end": 1700526704610,
"duration": 208,
"pid": 7200,
"index": 28
},
{
"name": "Require(23) node_modules/egg-jsonp/app/extend/context.js",
"start": 1700526704618,
"end": 1700526704631,
"duration": 13,
"pid": 7200,
"index": 29
},
{
"name": "Require(24) node_modules/egg-i18n/app/extend/context.js",
"start": 1700526704631,
"end": 1700526704632,
"duration": 1,
"pid": 7200,
"index": 30
},
{
"name": "Require(25) node_modules/egg-multipart/app/extend/context.js",
"start": 1700526704632,
"end": 1700526704848,
"duration": 216,
"pid": 7200,
"index": 31
},
{
"name": "Require(26) node_modules/egg-view/app/extend/context.js",
"start": 1700526704849,
"end": 1700526704855,
"duration": 6,
"pid": 7200,
"index": 32
},
{
"name": "Require(27) node_modules/egg/app/extend/context.js",
"start": 1700526704856,
"end": 1700526704858,
"duration": 2,
"pid": 7200,
"index": 33
},
{
"name": "Load agent.js",
"start": 1700526704860,
"end": 1700526705184,
"duration": 324,
"pid": 7200,
"index": 34
},
{
"name": "Require(28) node_modules/egg-security/agent.js",
"start": 1700526704861,
"end": 1700526704861,
"duration": 0,
"pid": 7200,
"index": 35
},
{
"name": "Require(29) node_modules/egg-onerror/agent.js",
"start": 1700526704862,
"end": 1700526704862,
"duration": 0,
"pid": 7200,
"index": 36
},
{
"name": "Require(30) node_modules/egg-watcher/agent.js",
"start": 1700526704862,
"end": 1700526704874,
"duration": 12,
"pid": 7200,
"index": 37
},
{
"name": "Require(31) node_modules/egg-schedule/agent.js",
"start": 1700526704874,
"end": 1700526704887,
"duration": 13,
"pid": 7200,
"index": 38
},
{
"name": "Require(32) node_modules/egg-development/agent.js",
"start": 1700526704888,
"end": 1700526705171,
"duration": 283,
"pid": 7200,
"index": 39
},
{
"name": "Require(33) node_modules/egg-logrotator/agent.js",
"start": 1700526705171,
"end": 1700526705172,
"duration": 1,
"pid": 7200,
"index": 40
},
{
"name": "Require(34) node_modules/egg/agent.js",
"start": 1700526705183,
"end": 1700526705183,
"duration": 0,
"pid": 7200,
"index": 41
},
{
"name": "Before Start in node_modules/egg-watcher/lib/init.js:15:14",
"start": 1700526705188,
"end": 1700526705377,
"duration": 189,
"pid": 7200,
"index": 42
},
{
"name": "Before Start in node_modules/egg-schedule/agent.js:12:9",
"start": 1700526705189,
"end": 1700526705253,
"duration": 64,
"pid": 7200,
"index": 43
},
{
"name": "Before Start in node_modules/egg-development/agent.js:12:9",
"start": 1700526705189,
"end": 1700526705395,
"duration": 206,
"pid": 7200,
"index": 44
}
]

584
demo/run/application_config.json

@ -0,0 +1,584 @@
{
"config": {
"session": {
"maxAge": 86400000,
"key": "EGG_SESS",
"httpOnly": true,
"encrypt": true,
"logValue": true,
"overwrite": true,
"signed": true,
"autoCommit": true,
"encode": "<Function encode>",
"decode": "<Function decode>",
"genid": "<Function v4>"
},
"security": {
"domainWhiteList": [],
"protocolWhiteList": [],
"defaultMiddleware": "csrf,hsts,methodnoallow,noopen,nosniff,csp,xssProtection,xframe,dta",
"csrf": {
"enable": true,
"type": "ctoken",
"ignoreJSON": false,
"useSession": false,
"cookieName": "csrfToken",
"sessionName": "csrfToken",
"headerName": "x-csrf-token",
"bodyName": "_csrf",
"queryName": "_csrf",
"supportedRequests": [
{
"path": {},
"methods": [
"POST",
"PATCH",
"DELETE",
"PUT",
"CONNECT"
]
}
],
"refererWhiteList": [],
"matching": "<Function anonymous>"
},
"xframe": {
"enable": true,
"value": "SAMEORIGIN",
"matching": "<Function anonymous>"
},
"hsts": {
"enable": false,
"maxAge": 31536000,
"includeSubdomains": false
},
"dta": {
"enable": true,
"matching": "<Function anonymous>"
},
"methodnoallow": {
"enable": true,
"matching": "<Function anonymous>"
},
"noopen": {
"enable": true,
"matching": "<Function anonymous>"
},
"nosniff": {
"enable": true,
"matching": "<Function anonymous>"
},
"referrerPolicy": {
"enable": false,
"value": "no-referrer-when-downgrade"
},
"xssProtection": {
"enable": true,
"value": "1; mode=block",
"matching": "<Function anonymous>"
},
"csp": {
"enable": false,
"policy": {}
},
"ssrf": {
"ipBlackList": null,
"ipExceptionList": null,
"checkAddress": null
},
"_protocolWhiteListSet": "<Set>"
},
"helper": {
"shtml": {}
},
"jsonp": {
"limit": 50,
"callback": [
"_callback",
"callback"
],
"csrf": false
},
"onerror": {
"errorPageUrl": "",
"appErrorFilter": null,
"templatePath": "F:\\code\\demo\\node_modules\\egg-onerror\\lib\\onerror_page.mustache"
},
"i18n": {
"defaultLocale": "en_US",
"dirs": [
"F:\\code\\demo\\node_modules\\egg-session\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-security\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-jsonp\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-onerror\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-i18n\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-watcher\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-schedule\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-multipart\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-development\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-logrotator\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-static\\config\\locales",
"F:\\code\\demo\\node_modules\\egg-view\\config\\locales",
"F:\\code\\demo\\node_modules\\egg\\config\\locales",
"F:\\code\\demo\\config\\locales"
],
"queryField": "locale",
"cookieField": "locale",
"cookieDomain": "",
"cookieMaxAge": "1y",
"functionName": "__"
},
"watcher": {
"type": "development",
"eventSources": {
"default": "F:\\code\\demo\\node_modules\\egg-watcher\\lib\\event-sources\\default",
"development": "F:\\code\\demo\\node_modules\\egg-watcher\\lib\\event-sources\\development"
}
},
"customLogger": {
"scheduleLogger": {
"consoleLevel": "NONE",
"file": "egg-schedule.log"
}
},
"schedule": {
"directory": []
},
"multipart": {
"mode": "stream",
"autoFields": false,
"defaultCharset": "utf8",
"defaultParamCharset": "utf8",
"fieldNameSize": 100,
"fieldSize": 102400,
"fields": 10,
"fileSize": 10485760,
"files": 10,
"fileExtensions": [],
"whitelist": null,
"allowArrayField": false,
"tmpdir": "C:\\Users\\lichong\\AppData\\Local\\Temp\\egg-multipart-tmp\\mqtttohttp",
"cleanSchedule": {
"cron": "0 30 4 * * *",
"disable": false
},
"checkFile": "<Function anonymous>"
},
"development": {
"watchDirs": [],
"ignoreDirs": [],
"fastReady": false,
"reloadOnDebug": true,
"overrideDefault": false,
"overrideIgnore": false
},
"logrotator": {
"filesRotateByHour": null,
"hourDelimiter": "-",
"filesRotateBySize": null,
"maxFileSize": 52428800,
"maxFiles": 10,
"rotateDuration": 60000,
"maxDays": 31
},
"static": {
"prefix": "/public/",
"dir": "F:\\code\\demo\\app\\public",
"dynamic": true,
"preload": false,
"buffer": false,
"maxFiles": 1000
},
"view": {
"root": "F:\\code\\demo\\app\\view",
"cache": false,
"defaultExtension": ".html",
"defaultViewEngine": "",
"mapping": {}
},
"env": "local",
"name": "mqtttohttp",
"keys": "<String len: 29>",
"cookies": {},
"proxy": false,
"maxIpsCount": 0,
"maxProxyCount": 0,
"protocolHeaders": "x-forwarded-proto",
"ipHeaders": "x-forwarded-for",
"hostHeaders": "",
"pkg": {
"name": "mqtttohttp",
"version": "1.0.0",
"description": "",
"private": true,
"egg": {
"declarations": true
},
"dependencies": {
"aedes": "^0.49.0",
"egg": "^3",
"egg-scripts": "^2",
"lodash": "^4.17.21",
"mqtt": "^4.3.7"
},
"devDependencies": {
"egg-bin": "^5",
"egg-ci": "^2",
"egg-mock": "^5",
"eslint": "^8",
"eslint-config-egg": "^12"
},
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-mqtttohttp",
"stop": "egg-scripts stop --title=egg-server-mqtttohttp",
"dev": "egg-bin dev",
"npmPro": "npm install --production",
"build": "tar -zcvf ../release.tgz .",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
},
"ci": {
"version": "16, 18",
"type": "github"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "MIT"
},
"baseDir": "F:\\code\\demo",
"HOME": "C:\\Users\\lichong",
"rundir": "F:\\code\\demo\\run",
"dump": {
"ignore": "<Set>",
"timing": {
"slowBootActionMinDuration": 5000
}
},
"confusedConfigurations": {
"bodyparser": "bodyParser",
"notFound": "notfound",
"sitefile": "siteFile",
"middlewares": "middleware",
"httpClient": "httpclient"
},
"notfound": {
"pageUrl": ""
},
"siteFile": {
"/favicon.ico": "<Buffer len: 6463>",
"cacheControl": "public, max-age=2592000"
},
"bodyParser": {
"enable": true,
"encoding": "utf8",
"formLimit": "1mb",
"jsonLimit": "1mb",
"textLimit": "1mb",
"strict": true,
"queryString": {
"arrayLimit": 100,
"depth": 5,
"parameterLimit": 1000
},
"returnRawBody": true
},
"logger": {
"dir": "F:\\code\\demo\\logs\\mqtttohttp",
"encoding": "utf8",
"env": "local",
"level": "INFO",
"consoleLevel": "INFO",
"disableConsoleAfterReady": false,
"outputJSON": false,
"buffer": true,
"appLogName": "mqtttohttp-web.log",
"coreLogName": "egg-web.log",
"agentLogName": "egg-agent.log",
"errorLogName": "common-error.log",
"coreLogger": {
"consoleLevel": "WARN"
},
"allowDebugAtProd": false,
"enablePerformanceTimer": false,
"enableFastContextLogger": false,
"type": "application",
"localStorage": "<AsyncLocalStorage>"
},
"httpclient": {
"enableDNSCache": false,
"dnsCacheLookupInterval": 10000,
"dnsCacheMaxLength": 1000,
"request": {
"timeout": 5000
},
"httpAgent": {
"keepAlive": true,
"freeSocketTimeout": 4000,
"maxSockets": 9007199254740991,
"maxFreeSockets": 256
},
"httpsAgent": {
"keepAlive": true,
"freeSocketTimeout": 4000,
"maxSockets": 9007199254740991,
"maxFreeSockets": 256
},
"useHttpClientNext": false
},
"meta": {
"enable": true,
"logging": false
},
"coreMiddleware": [
"meta",
"siteFile",
"notfound",
"static",
"bodyParser",
"overrideMethod",
"session",
"securities",
"i18n",
"eggLoaderTrace"
],
"workerStartTimeout": 600000,
"serverTimeout": null,
"cluster": {
"listen": {
"path": "",
"port": 7020,
"hostname": ""
}
},
"clusterClient": {
"maxWaitTime": 60000,
"responseTimeout": 60000
},
"onClientError": null,
"middleware": [],
"coreMiddlewares": "~config~coreMiddleware",
"appMiddlewares": "~config~middleware",
"appMiddleware": "~config~middleware"
},
"plugins": {
"onerror": {
"enable": true,
"package": "egg-onerror",
"name": "onerror",
"dependencies": [],
"optionalDependencies": [
"jsonp"
],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-onerror",
"version": "2.2.0"
},
"session": {
"enable": true,
"package": "egg-session",
"name": "session",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-session",
"version": "3.3.0"
},
"i18n": {
"enable": true,
"package": "egg-i18n",
"name": "i18n",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-i18n",
"version": "2.1.1"
},
"watcher": {
"enable": true,
"package": "egg-watcher",
"name": "watcher",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-watcher",
"version": "3.1.1",
"dependents": [
"development"
]
},
"multipart": {
"enable": true,
"package": "egg-multipart",
"name": "multipart",
"dependencies": [],
"optionalDependencies": [
"schedule"
],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-multipart",
"version": "3.3.0"
},
"security": {
"enable": true,
"package": "egg-security",
"name": "security",
"dependencies": [],
"optionalDependencies": [
"session"
],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-security",
"version": "3.1.0"
},
"development": {
"enable": true,
"package": "egg-development",
"name": "development",
"dependencies": [
"watcher"
],
"optionalDependencies": [],
"env": [
"local"
],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-development",
"version": "2.7.0"
},
"logrotator": {
"enable": true,
"package": "egg-logrotator",
"name": "logrotator",
"dependencies": [
"schedule"
],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-logrotator",
"version": "3.1.0"
},
"schedule": {
"enable": true,
"package": "egg-schedule",
"name": "schedule",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-schedule",
"version": "4.0.0",
"dependents": [
"logrotator"
]
},
"static": {
"enable": true,
"package": "egg-static",
"name": "static",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-static",
"version": "2.3.1"
},
"jsonp": {
"enable": true,
"package": "egg-jsonp",
"name": "jsonp",
"dependencies": [],
"optionalDependencies": [
"security"
],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-jsonp",
"version": "2.0.0"
},
"view": {
"enable": true,
"package": "egg-view",
"name": "view",
"dependencies": [],
"optionalDependencies": [],
"env": [],
"from": "F:\\code\\demo\\node_modules\\egg\\config\\plugin.js",
"path": "F:\\code\\demo\\node_modules\\egg-view",
"version": "2.1.4"
}
},
"appInfo": {
"name": "mqtttohttp",
"baseDir": "F:\\code\\demo",
"env": "local",
"scope": "",
"HOME": "C:\\Users\\lichong",
"pkg": {
"name": "mqtttohttp",
"version": "1.0.0",
"description": "",
"private": true,
"egg": {
"declarations": true
},
"dependencies": {
"aedes": "^0.49.0",
"egg": "^3",
"egg-scripts": "^2",
"lodash": "^4.17.21",
"mqtt": "^4.3.7"
},
"devDependencies": {
"egg-bin": "^5",
"egg-ci": "^2",
"egg-mock": "^5",
"eslint": "^8",
"eslint-config-egg": "^12"
},
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-mqtttohttp",
"stop": "egg-scripts stop --title=egg-server-mqtttohttp",
"dev": "egg-bin dev",
"npmPro": "npm install --production",
"build": "tar -zcvf ../release.tgz .",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
},
"ci": {
"version": "16, 18",
"type": "github"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "MIT"
},
"root": "F:\\code\\demo"
}
}

310
demo/run/application_config_meta.json

@ -0,0 +1,310 @@
{
"keys": "F:\\code\\demo\\config\\config.default.js",
"middleware": "F:\\code\\demo\\config\\config.default.js",
"cluster": {
"listen": {
"port": "F:\\code\\demo\\config\\config.default.js",
"path": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"hostname": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
}
},
"session": {
"maxAge": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js",
"key": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js",
"httpOnly": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js",
"encrypt": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js",
"logValue": "F:\\code\\demo\\node_modules\\egg-session\\config\\config.default.js"
},
"security": {
"domainWhiteList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"protocolWhiteList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"defaultMiddleware": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"csrf": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"type": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"ignoreJSON": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"useSession": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"cookieName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"sessionName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"headerName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"bodyName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"queryName": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"supportedRequests": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"refererWhiteList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"xframe": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"value": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"hsts": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.local.js",
"maxAge": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"includeSubdomains": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"dta": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"methodnoallow": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"noopen": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"nosniff": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"referrerPolicy": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"value": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"xssProtection": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"value": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"csp": {
"enable": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"policy": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"ssrf": {
"ipBlackList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"ipExceptionList": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js",
"checkAddress": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
}
},
"helper": {
"shtml": "F:\\code\\demo\\node_modules\\egg-security\\config\\config.default.js"
},
"jsonp": {
"limit": "F:\\code\\demo\\node_modules\\egg-jsonp\\config\\config.default.js",
"callback": "F:\\code\\demo\\node_modules\\egg-jsonp\\config\\config.default.js",
"csrf": "F:\\code\\demo\\node_modules\\egg-jsonp\\config\\config.default.js"
},
"onerror": {
"errorPageUrl": "F:\\code\\demo\\node_modules\\egg-onerror\\config\\config.default.js",
"appErrorFilter": "F:\\code\\demo\\node_modules\\egg-onerror\\config\\config.default.js",
"templatePath": "F:\\code\\demo\\node_modules\\egg-onerror\\config\\config.default.js"
},
"i18n": {
"defaultLocale": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"dirs": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"queryField": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"cookieField": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"cookieDomain": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js",
"cookieMaxAge": "F:\\code\\demo\\node_modules\\egg-i18n\\config\\config.default.js"
},
"watcher": {
"type": "F:\\code\\demo\\node_modules\\egg-watcher\\config\\config.local.js",
"eventSources": {
"default": "F:\\code\\demo\\node_modules\\egg-watcher\\config\\config.default.js",
"development": "F:\\code\\demo\\node_modules\\egg-watcher\\config\\config.default.js"
}
},
"customLogger": {
"scheduleLogger": {
"consoleLevel": "F:\\code\\demo\\node_modules\\egg-schedule\\config\\config.default.js",
"file": "F:\\code\\demo\\node_modules\\egg-schedule\\config\\config.default.js"
}
},
"schedule": {
"directory": "F:\\code\\demo\\node_modules\\egg-schedule\\config\\config.default.js"
},
"multipart": {
"mode": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"autoFields": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"defaultCharset": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"defaultParamCharset": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fieldNameSize": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fieldSize": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fields": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fileSize": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"files": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"fileExtensions": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"whitelist": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"allowArrayField": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"tmpdir": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"cleanSchedule": {
"cron": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js",
"disable": "F:\\code\\demo\\node_modules\\egg-multipart\\config\\config.default.js"
}
},
"development": {
"watchDirs": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"ignoreDirs": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"fastReady": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"reloadOnDebug": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"overrideDefault": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js",
"overrideIgnore": "F:\\code\\demo\\node_modules\\egg-development\\config\\config.default.js"
},
"logrotator": {
"filesRotateByHour": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"hourDelimiter": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"filesRotateBySize": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"maxFileSize": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"maxFiles": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"rotateDuration": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js",
"maxDays": "F:\\code\\demo\\node_modules\\egg-logrotator\\config\\config.default.js"
},
"static": {
"prefix": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"dir": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"dynamic": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"preload": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"buffer": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js",
"maxFiles": "F:\\code\\demo\\node_modules\\egg-static\\config\\config.default.js"
},
"view": {
"root": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.default.js",
"cache": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.local.js",
"defaultExtension": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.default.js",
"defaultViewEngine": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.default.js",
"mapping": "F:\\code\\demo\\node_modules\\egg-view\\config\\config.default.js"
},
"env": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"name": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"cookies": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"proxy": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxIpsCount": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxProxyCount": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"protocolHeaders": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"ipHeaders": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"hostHeaders": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"pkg": {
"name": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"version": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"description": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"private": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg": {
"declarations": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"dependencies": {
"aedes": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg-scripts": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"lodash": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"mqtt": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"devDependencies": {
"egg-bin": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg-ci": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"egg-mock": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"eslint": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"eslint-config-egg": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"engines": {
"node": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"scripts": {
"start": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"stop": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"dev": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"npmPro": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"build": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"debug": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"test": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"test-local": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"cov": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"lint": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"ci": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"ci": {
"version": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"type": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"repository": {
"type": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"url": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"author": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"license": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"baseDir": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"HOME": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"rundir": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"dump": {
"ignore": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"timing": {
"slowBootActionMinDuration": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
}
},
"confusedConfigurations": {
"bodyparser": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"notFound": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"sitefile": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"middlewares": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"httpClient": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"notfound": {
"pageUrl": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"siteFile": {
"/favicon.ico": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"cacheControl": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"bodyParser": {
"enable": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"encoding": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"formLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"jsonLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"textLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"strict": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"queryString": {
"arrayLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"depth": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"parameterLimit": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"onerror": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"logger": {
"dir": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"encoding": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"env": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"level": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"consoleLevel": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"disableConsoleAfterReady": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"outputJSON": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"buffer": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"appLogName": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"coreLogName": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"agentLogName": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"errorLogName": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"coreLogger": {
"consoleLevel": "F:\\code\\demo\\node_modules\\egg\\config\\config.local.js"
},
"allowDebugAtProd": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"enablePerformanceTimer": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"enableFastContextLogger": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"httpclient": {
"enableDNSCache": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"dnsCacheLookupInterval": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"dnsCacheMaxLength": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"request": {
"timeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"httpAgent": {
"keepAlive": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"freeSocketTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxSockets": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxFreeSockets": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"httpsAgent": {
"keepAlive": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"freeSocketTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxSockets": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"maxFreeSockets": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"useHttpClientNext": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"meta": {
"enable": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"logging": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"coreMiddleware": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"workerStartTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"serverTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"clusterClient": {
"maxWaitTime": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js",
"responseTimeout": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
},
"onClientError": "F:\\code\\demo\\node_modules\\egg\\config\\config.default.js"
}

530
demo/run/application_timing_15252.json

@ -0,0 +1,530 @@
[
{
"name": "Process Start",
"start": 1700526705421,
"end": 1700526706058,
"duration": 637,
"pid": 15252,
"index": 0
},
{
"name": "Application Start",
"start": 1700526706059,
"end": 1700526708946,
"duration": 2887,
"pid": 15252,
"index": 1
},
{
"name": "Load Plugin",
"start": 1700526706067,
"end": 1700526706075,
"duration": 8,
"pid": 15252,
"index": 2
},
{
"name": "Load Config",
"start": 1700526706075,
"end": 1700526706090,
"duration": 15,
"pid": 15252,
"index": 3
},
{
"name": "Require(0) config/config.default.js",
"start": 1700526706076,
"end": 1700526706076,
"duration": 0,
"pid": 15252,
"index": 4
},
{
"name": "Require(1) node_modules/egg-session/config/config.default.js",
"start": 1700526706077,
"end": 1700526706077,
"duration": 0,
"pid": 15252,
"index": 5
},
{
"name": "Require(2) node_modules/egg-security/config/config.default.js",
"start": 1700526706077,
"end": 1700526706078,
"duration": 1,
"pid": 15252,
"index": 6
},
{
"name": "Require(3) node_modules/egg-jsonp/config/config.default.js",
"start": 1700526706078,
"end": 1700526706078,
"duration": 0,
"pid": 15252,
"index": 7
},
{
"name": "Require(4) node_modules/egg-onerror/config/config.default.js",
"start": 1700526706079,
"end": 1700526706079,
"duration": 0,
"pid": 15252,
"index": 8
},
{
"name": "Require(5) node_modules/egg-i18n/config/config.default.js",
"start": 1700526706079,
"end": 1700526706079,
"duration": 0,
"pid": 15252,
"index": 9
},
{
"name": "Require(6) node_modules/egg-watcher/config/config.default.js",
"start": 1700526706080,
"end": 1700526706080,
"duration": 0,
"pid": 15252,
"index": 10
},
{
"name": "Require(7) node_modules/egg-schedule/config/config.default.js",
"start": 1700526706080,
"end": 1700526706081,
"duration": 1,
"pid": 15252,
"index": 11
},
{
"name": "Require(8) node_modules/egg-multipart/config/config.default.js",
"start": 1700526706081,
"end": 1700526706082,
"duration": 1,
"pid": 15252,
"index": 12
},
{
"name": "Require(9) node_modules/egg-development/config/config.default.js",
"start": 1700526706083,
"end": 1700526706083,
"duration": 0,
"pid": 15252,
"index": 13
},
{
"name": "Require(10) node_modules/egg-logrotator/config/config.default.js",
"start": 1700526706083,
"end": 1700526706084,
"duration": 1,
"pid": 15252,
"index": 14
},
{
"name": "Require(11) node_modules/egg-static/config/config.default.js",
"start": 1700526706084,
"end": 1700526706084,
"duration": 0,
"pid": 15252,
"index": 15
},
{
"name": "Require(12) node_modules/egg-view/config/config.default.js",
"start": 1700526706084,
"end": 1700526706084,
"duration": 0,
"pid": 15252,
"index": 16
},
{
"name": "Require(13) node_modules/egg/config/config.default.js",
"start": 1700526706085,
"end": 1700526706085,
"duration": 0,
"pid": 15252,
"index": 17
},
{
"name": "Require(14) config/config.default.js",
"start": 1700526706086,
"end": 1700526706086,
"duration": 0,
"pid": 15252,
"index": 18
},
{
"name": "Require(15) node_modules/egg-security/config/config.local.js",
"start": 1700526706087,
"end": 1700526706087,
"duration": 0,
"pid": 15252,
"index": 19
},
{
"name": "Require(16) node_modules/egg-watcher/config/config.local.js",
"start": 1700526706088,
"end": 1700526706088,
"duration": 0,
"pid": 15252,
"index": 20
},
{
"name": "Require(17) node_modules/egg-view/config/config.local.js",
"start": 1700526706089,
"end": 1700526706089,
"duration": 0,
"pid": 15252,
"index": 21
},
{
"name": "Require(18) node_modules/egg/config/config.local.js",
"start": 1700526706090,
"end": 1700526706090,
"duration": 0,
"pid": 15252,
"index": 22
},
{
"name": "Load extend/application.js",
"start": 1700526706091,
"end": 1700526706127,
"duration": 36,
"pid": 15252,
"index": 23
},
{
"name": "Require(19) node_modules/egg-session/app/extend/application.js",
"start": 1700526706091,
"end": 1700526706092,
"duration": 1,
"pid": 15252,
"index": 24
},
{
"name": "Require(20) node_modules/egg-security/app/extend/application.js",
"start": 1700526706092,
"end": 1700526706096,
"duration": 4,
"pid": 15252,
"index": 25
},
{
"name": "Require(21) node_modules/egg-jsonp/app/extend/application.js",
"start": 1700526706096,
"end": 1700526706097,
"duration": 1,
"pid": 15252,
"index": 26
},
{
"name": "Require(22) node_modules/egg-schedule/app/extend/application.js",
"start": 1700526706097,
"end": 1700526706110,
"duration": 13,
"pid": 15252,
"index": 27
},
{
"name": "Require(23) node_modules/egg-logrotator/app/extend/application.js",
"start": 1700526706111,
"end": 1700526706115,
"duration": 4,
"pid": 15252,
"index": 28
},
{
"name": "Require(24) node_modules/egg-view/app/extend/application.js",
"start": 1700526706115,
"end": 1700526706126,
"duration": 11,
"pid": 15252,
"index": 29
},
{
"name": "Load extend/request.js",
"start": 1700526706127,
"end": 1700526706158,
"duration": 31,
"pid": 15252,
"index": 30
},
{
"name": "Require(25) node_modules/egg/app/extend/request.js",
"start": 1700526706142,
"end": 1700526706155,
"duration": 13,
"pid": 15252,
"index": 31
},
{
"name": "Load extend/response.js",
"start": 1700526706158,
"end": 1700526706170,
"duration": 12,
"pid": 15252,
"index": 32
},
{
"name": "Require(26) node_modules/egg/app/extend/response.js",
"start": 1700526706160,
"end": 1700526706168,
"duration": 8,
"pid": 15252,
"index": 33
},
{
"name": "Load extend/context.js",
"start": 1700526706170,
"end": 1700526706191,
"duration": 21,
"pid": 15252,
"index": 34
},
{
"name": "Require(27) node_modules/egg-security/app/extend/context.js",
"start": 1700526706170,
"end": 1700526706176,
"duration": 6,
"pid": 15252,
"index": 35
},
{
"name": "Require(28) node_modules/egg-jsonp/app/extend/context.js",
"start": 1700526706176,
"end": 1700526706177,
"duration": 1,
"pid": 15252,
"index": 36
},
{
"name": "Require(29) node_modules/egg-i18n/app/extend/context.js",
"start": 1700526706177,
"end": 1700526706178,
"duration": 1,
"pid": 15252,
"index": 37
},
{
"name": "Require(30) node_modules/egg-multipart/app/extend/context.js",
"start": 1700526706178,
"end": 1700526706188,
"duration": 10,
"pid": 15252,
"index": 38
},
{
"name": "Require(31) node_modules/egg-view/app/extend/context.js",
"start": 1700526706188,
"end": 1700526706189,
"duration": 1,
"pid": 15252,
"index": 39
},
{
"name": "Require(32) node_modules/egg/app/extend/context.js",
"start": 1700526706189,
"end": 1700526706190,
"duration": 1,
"pid": 15252,
"index": 40
},
{
"name": "Load extend/helper.js",
"start": 1700526706192,
"end": 1700526706388,
"duration": 196,
"pid": 15252,
"index": 41
},
{
"name": "Require(33) node_modules/egg-security/app/extend/helper.js",
"start": 1700526706192,
"end": 1700526706370,
"duration": 178,
"pid": 15252,
"index": 42
},
{
"name": "Require(34) node_modules/egg/app/extend/helper.js",
"start": 1700526706372,
"end": 1700526706384,
"duration": 12,
"pid": 15252,
"index": 43
},
{
"name": "Load app.js",
"start": 1700526706389,
"end": 1700526707920,
"duration": 1531,
"pid": 15252,
"index": 44
},
{
"name": "Require(35) node_modules/egg-session/app.js",
"start": 1700526706389,
"end": 1700526706401,
"duration": 12,
"pid": 15252,
"index": 45
},
{
"name": "Require(36) node_modules/egg-security/app.js",
"start": 1700526706403,
"end": 1700526706413,
"duration": 10,
"pid": 15252,
"index": 46
},
{
"name": "Require(37) node_modules/egg-onerror/app.js",
"start": 1700526706414,
"end": 1700526706501,
"duration": 87,
"pid": 15252,
"index": 47
},
{
"name": "Require(38) node_modules/egg-i18n/app.js",
"start": 1700526706502,
"end": 1700526706591,
"duration": 89,
"pid": 15252,
"index": 48
},
{
"name": "Require(39) node_modules/egg-watcher/app.js",
"start": 1700526706591,
"end": 1700526706594,
"duration": 3,
"pid": 15252,
"index": 49
},
{
"name": "Require(40) node_modules/egg-schedule/app.js",
"start": 1700526706594,
"end": 1700526706595,
"duration": 1,
"pid": 15252,
"index": 50
},
{
"name": "Require(41) node_modules/egg-multipart/app.js",
"start": 1700526706595,
"end": 1700526706606,
"duration": 11,
"pid": 15252,
"index": 51
},
{
"name": "Require(42) node_modules/egg-development/app.js",
"start": 1700526706606,
"end": 1700526706607,
"duration": 1,
"pid": 15252,
"index": 52
},
{
"name": "Require(43) node_modules/egg-logrotator/app.js",
"start": 1700526706607,
"end": 1700526706607,
"duration": 0,
"pid": 15252,
"index": 53
},
{
"name": "Require(44) node_modules/egg-static/app.js",
"start": 1700526706608,
"end": 1700526706608,
"duration": 0,
"pid": 15252,
"index": 54
},
{
"name": "Require(45) app.js",
"start": 1700526706608,
"end": 1700526707920,
"duration": 1312,
"pid": 15252,
"index": 55
},
{
"name": "Before Start in node_modules/egg-watcher/lib/init.js:15:14",
"start": 1700526707940,
"end": 1700526708932,
"duration": 992,
"pid": 15252,
"index": 56
},
{
"name": "Load Service",
"start": 1700526707965,
"end": 1700526707969,
"duration": 4,
"pid": 15252,
"index": 57
},
{
"name": "Load \"service\" to Context",
"start": 1700526707965,
"end": 1700526707969,
"duration": 4,
"pid": 15252,
"index": 58
},
{
"name": "Load Middleware",
"start": 1700526707970,
"end": 1700526708898,
"duration": 928,
"pid": 15252,
"index": 59
},
{
"name": "Load \"middlewares\" to Application",
"start": 1700526707970,
"end": 1700526708891,
"duration": 921,
"pid": 15252,
"index": 60
},
{
"name": "Load Controller",
"start": 1700526708898,
"end": 1700526708900,
"duration": 2,
"pid": 15252,
"index": 61
},
{
"name": "Load \"controller\" to Application",
"start": 1700526708898,
"end": 1700526708900,
"duration": 2,
"pid": 15252,
"index": 62
},
{
"name": "Load Router",
"start": 1700526708900,
"end": 1700526708901,
"duration": 1,
"pid": 15252,
"index": 63
},
{
"name": "Require(46) app/router.js",
"start": 1700526708900,
"end": 1700526708900,
"duration": 0,
"pid": 15252,
"index": 64
},
{
"name": "Before Start in node_modules/egg-core/lib/egg.js:304:10",
"start": 1700526708900,
"end": 1700526708918,
"duration": 18,
"pid": 15252,
"index": 65
}
]

530
demo/run/application_timing_17632.json

@ -0,0 +1,530 @@
[
{
"name": "Process Start",
"start": 1700535304054,
"end": 1700535304755,
"duration": 701,
"pid": 17632,
"index": 0
},
{
"name": "Application Start",
"start": 1700535304756,
"end": 1700535305081,
"duration": 325,
"pid": 17632,
"index": 1
},
{
"name": "Load Plugin",
"start": 1700535304764,
"end": 1700535304774,
"duration": 10,
"pid": 17632,
"index": 2
},
{
"name": "Load Config",
"start": 1700535304774,
"end": 1700535304792,
"duration": 18,
"pid": 17632,
"index": 3
},
{
"name": "Require(0) config/config.default.js",
"start": 1700535304774,
"end": 1700535304775,
"duration": 1,
"pid": 17632,
"index": 4
},
{
"name": "Require(1) node_modules/egg-session/config/config.default.js",
"start": 1700535304776,
"end": 1700535304779,
"duration": 3,
"pid": 17632,
"index": 5
},
{
"name": "Require(2) node_modules/egg-security/config/config.default.js",
"start": 1700535304779,
"end": 1700535304780,
"duration": 1,
"pid": 17632,
"index": 6
},
{
"name": "Require(3) node_modules/egg-jsonp/config/config.default.js",
"start": 1700535304780,
"end": 1700535304780,
"duration": 0,
"pid": 17632,
"index": 7
},
{
"name": "Require(4) node_modules/egg-onerror/config/config.default.js",
"start": 1700535304781,
"end": 1700535304781,
"duration": 0,
"pid": 17632,
"index": 8
},
{
"name": "Require(5) node_modules/egg-i18n/config/config.default.js",
"start": 1700535304781,
"end": 1700535304782,
"duration": 1,
"pid": 17632,
"index": 9
},
{
"name": "Require(6) node_modules/egg-watcher/config/config.default.js",
"start": 1700535304782,
"end": 1700535304782,
"duration": 0,
"pid": 17632,
"index": 10
},
{
"name": "Require(7) node_modules/egg-schedule/config/config.default.js",
"start": 1700535304783,
"end": 1700535304783,
"duration": 0,
"pid": 17632,
"index": 11
},
{
"name": "Require(8) node_modules/egg-multipart/config/config.default.js",
"start": 1700535304783,
"end": 1700535304784,
"duration": 1,
"pid": 17632,
"index": 12
},
{
"name": "Require(9) node_modules/egg-development/config/config.default.js",
"start": 1700535304784,
"end": 1700535304784,
"duration": 0,
"pid": 17632,
"index": 13
},
{
"name": "Require(10) node_modules/egg-logrotator/config/config.default.js",
"start": 1700535304785,
"end": 1700535304785,
"duration": 0,
"pid": 17632,
"index": 14
},
{
"name": "Require(11) node_modules/egg-static/config/config.default.js",
"start": 1700535304785,
"end": 1700535304786,
"duration": 1,
"pid": 17632,
"index": 15
},
{
"name": "Require(12) node_modules/egg-view/config/config.default.js",
"start": 1700535304786,
"end": 1700535304786,
"duration": 0,
"pid": 17632,
"index": 16
},
{
"name": "Require(13) node_modules/egg/config/config.default.js",
"start": 1700535304787,
"end": 1700535304787,
"duration": 0,
"pid": 17632,
"index": 17
},
{
"name": "Require(14) config/config.default.js",
"start": 1700535304788,
"end": 1700535304788,
"duration": 0,
"pid": 17632,
"index": 18
},
{
"name": "Require(15) node_modules/egg-security/config/config.local.js",
"start": 1700535304789,
"end": 1700535304790,
"duration": 1,
"pid": 17632,
"index": 19
},
{
"name": "Require(16) node_modules/egg-watcher/config/config.local.js",
"start": 1700535304790,
"end": 1700535304790,
"duration": 0,
"pid": 17632,
"index": 20
},
{
"name": "Require(17) node_modules/egg-view/config/config.local.js",
"start": 1700535304791,
"end": 1700535304791,
"duration": 0,
"pid": 17632,
"index": 21
},
{
"name": "Require(18) node_modules/egg/config/config.local.js",
"start": 1700535304792,
"end": 1700535304792,
"duration": 0,
"pid": 17632,
"index": 22
},
{
"name": "Load extend/application.js",
"start": 1700535304793,
"end": 1700535304806,
"duration": 13,
"pid": 17632,
"index": 23
},
{
"name": "Require(19) node_modules/egg-session/app/extend/application.js",
"start": 1700535304793,
"end": 1700535304793,
"duration": 0,
"pid": 17632,
"index": 24
},
{
"name": "Require(20) node_modules/egg-security/app/extend/application.js",
"start": 1700535304794,
"end": 1700535304794,
"duration": 0,
"pid": 17632,
"index": 25
},
{
"name": "Require(21) node_modules/egg-jsonp/app/extend/application.js",
"start": 1700535304795,
"end": 1700535304796,
"duration": 1,
"pid": 17632,
"index": 26
},
{
"name": "Require(22) node_modules/egg-schedule/app/extend/application.js",
"start": 1700535304796,
"end": 1700535304797,
"duration": 1,
"pid": 17632,
"index": 27
},
{
"name": "Require(23) node_modules/egg-logrotator/app/extend/application.js",
"start": 1700535304798,
"end": 1700535304803,
"duration": 5,
"pid": 17632,
"index": 28
},
{
"name": "Require(24) node_modules/egg-view/app/extend/application.js",
"start": 1700535304803,
"end": 1700535304805,
"duration": 2,
"pid": 17632,
"index": 29
},
{
"name": "Load extend/request.js",
"start": 1700535304806,
"end": 1700535304809,
"duration": 3,
"pid": 17632,
"index": 30
},
{
"name": "Require(25) node_modules/egg/app/extend/request.js",
"start": 1700535304807,
"end": 1700535304808,
"duration": 1,
"pid": 17632,
"index": 31
},
{
"name": "Load extend/response.js",
"start": 1700535304809,
"end": 1700535304813,
"duration": 4,
"pid": 17632,
"index": 32
},
{
"name": "Require(26) node_modules/egg/app/extend/response.js",
"start": 1700535304811,
"end": 1700535304812,
"duration": 1,
"pid": 17632,
"index": 33
},
{
"name": "Load extend/context.js",
"start": 1700535304813,
"end": 1700535304839,
"duration": 26,
"pid": 17632,
"index": 34
},
{
"name": "Require(27) node_modules/egg-security/app/extend/context.js",
"start": 1700535304814,
"end": 1700535304821,
"duration": 7,
"pid": 17632,
"index": 35
},
{
"name": "Require(28) node_modules/egg-jsonp/app/extend/context.js",
"start": 1700535304821,
"end": 1700535304822,
"duration": 1,
"pid": 17632,
"index": 36
},
{
"name": "Require(29) node_modules/egg-i18n/app/extend/context.js",
"start": 1700535304822,
"end": 1700535304823,
"duration": 1,
"pid": 17632,
"index": 37
},
{
"name": "Require(30) node_modules/egg-multipart/app/extend/context.js",
"start": 1700535304823,
"end": 1700535304834,
"duration": 11,
"pid": 17632,
"index": 38
},
{
"name": "Require(31) node_modules/egg-view/app/extend/context.js",
"start": 1700535304835,
"end": 1700535304836,
"duration": 1,
"pid": 17632,
"index": 39
},
{
"name": "Require(32) node_modules/egg/app/extend/context.js",
"start": 1700535304836,
"end": 1700535304837,
"duration": 1,
"pid": 17632,
"index": 40
},
{
"name": "Load extend/helper.js",
"start": 1700535304839,
"end": 1700535304853,
"duration": 14,
"pid": 17632,
"index": 41
},
{
"name": "Require(33) node_modules/egg-security/app/extend/helper.js",
"start": 1700535304839,
"end": 1700535304850,
"duration": 11,
"pid": 17632,
"index": 42
},
{
"name": "Require(34) node_modules/egg/app/extend/helper.js",
"start": 1700535304851,
"end": 1700535304851,
"duration": 0,
"pid": 17632,
"index": 43
},
{
"name": "Load app.js",
"start": 1700535304853,
"end": 1700535304948,
"duration": 95,
"pid": 17632,
"index": 44
},
{
"name": "Require(35) node_modules/egg-session/app.js",
"start": 1700535304854,
"end": 1700535304854,
"duration": 0,
"pid": 17632,
"index": 45
},
{
"name": "Require(36) node_modules/egg-security/app.js",
"start": 1700535304855,
"end": 1700535304856,
"duration": 1,
"pid": 17632,
"index": 46
},
{
"name": "Require(37) node_modules/egg-onerror/app.js",
"start": 1700535304856,
"end": 1700535304862,
"duration": 6,
"pid": 17632,
"index": 47
},
{
"name": "Require(38) node_modules/egg-i18n/app.js",
"start": 1700535304862,
"end": 1700535304869,
"duration": 7,
"pid": 17632,
"index": 48
},
{
"name": "Require(39) node_modules/egg-watcher/app.js",
"start": 1700535304870,
"end": 1700535304872,
"duration": 2,
"pid": 17632,
"index": 49
},
{
"name": "Require(40) node_modules/egg-schedule/app.js",
"start": 1700535304872,
"end": 1700535304873,
"duration": 1,
"pid": 17632,
"index": 50
},
{
"name": "Require(41) node_modules/egg-multipart/app.js",
"start": 1700535304873,
"end": 1700535304874,
"duration": 1,
"pid": 17632,
"index": 51
},
{
"name": "Require(42) node_modules/egg-development/app.js",
"start": 1700535304874,
"end": 1700535304874,
"duration": 0,
"pid": 17632,
"index": 52
},
{
"name": "Require(43) node_modules/egg-logrotator/app.js",
"start": 1700535304875,
"end": 1700535304875,
"duration": 0,
"pid": 17632,
"index": 53
},
{
"name": "Require(44) node_modules/egg-static/app.js",
"start": 1700535304875,
"end": 1700535304875,
"duration": 0,
"pid": 17632,
"index": 54
},
{
"name": "Require(45) app.js",
"start": 1700535304876,
"end": 1700535304948,
"duration": 72,
"pid": 17632,
"index": 55
},
{
"name": "Before Start in node_modules/egg-watcher/lib/init.js:15:14",
"start": 1700535304953,
"end": 1700535305067,
"duration": 114,
"pid": 17632,
"index": 56
},
{
"name": "Load Service",
"start": 1700535304979,
"end": 1700535304982,
"duration": 3,
"pid": 17632,
"index": 57
},
{
"name": "Load \"service\" to Context",
"start": 1700535304979,
"end": 1700535304982,
"duration": 3,
"pid": 17632,
"index": 58
},
{
"name": "Load Middleware",
"start": 1700535304982,
"end": 1700535305050,
"duration": 68,
"pid": 17632,
"index": 59
},
{
"name": "Load \"middlewares\" to Application",
"start": 1700535304982,
"end": 1700535305043,
"duration": 61,
"pid": 17632,
"index": 60
},
{
"name": "Load Controller",
"start": 1700535305050,
"end": 1700535305052,
"duration": 2,
"pid": 17632,
"index": 61
},
{
"name": "Load \"controller\" to Application",
"start": 1700535305050,
"end": 1700535305052,
"duration": 2,
"pid": 17632,
"index": 62
},
{
"name": "Load Router",
"start": 1700535305052,
"end": 1700535305053,
"duration": 1,
"pid": 17632,
"index": 63
},
{
"name": "Require(46) app/router.js",
"start": 1700535305052,
"end": 1700535305052,
"duration": 0,
"pid": 17632,
"index": 64
},
{
"name": "Before Start in node_modules/egg-core/lib/egg.js:304:10",
"start": 1700535305052,
"end": 1700535305059,
"duration": 7,
"pid": 17632,
"index": 65
}
]

530
demo/run/application_timing_9772.json

@ -0,0 +1,530 @@
[
{
"name": "Process Start",
"start": 1700535301978,
"end": 1700535302668,
"duration": 690,
"pid": 9772,
"index": 0
},
{
"name": "Application Start",
"start": 1700535302669,
"end": 1700535302992,
"duration": 323,
"pid": 9772,
"index": 1
},
{
"name": "Load Plugin",
"start": 1700535302677,
"end": 1700535302687,
"duration": 10,
"pid": 9772,
"index": 2
},
{
"name": "Load Config",
"start": 1700535302687,
"end": 1700535302703,
"duration": 16,
"pid": 9772,
"index": 3
},
{
"name": "Require(0) config/config.default.js",
"start": 1700535302688,
"end": 1700535302688,
"duration": 0,
"pid": 9772,
"index": 4
},
{
"name": "Require(1) node_modules/egg-session/config/config.default.js",
"start": 1700535302689,
"end": 1700535302689,
"duration": 0,
"pid": 9772,
"index": 5
},
{
"name": "Require(2) node_modules/egg-security/config/config.default.js",
"start": 1700535302689,
"end": 1700535302690,
"duration": 1,
"pid": 9772,
"index": 6
},
{
"name": "Require(3) node_modules/egg-jsonp/config/config.default.js",
"start": 1700535302690,
"end": 1700535302692,
"duration": 2,
"pid": 9772,
"index": 7
},
{
"name": "Require(4) node_modules/egg-onerror/config/config.default.js",
"start": 1700535302692,
"end": 1700535302693,
"duration": 1,
"pid": 9772,
"index": 8
},
{
"name": "Require(5) node_modules/egg-i18n/config/config.default.js",
"start": 1700535302693,
"end": 1700535302693,
"duration": 0,
"pid": 9772,
"index": 9
},
{
"name": "Require(6) node_modules/egg-watcher/config/config.default.js",
"start": 1700535302694,
"end": 1700535302694,
"duration": 0,
"pid": 9772,
"index": 10
},
{
"name": "Require(7) node_modules/egg-schedule/config/config.default.js",
"start": 1700535302694,
"end": 1700535302695,
"duration": 1,
"pid": 9772,
"index": 11
},
{
"name": "Require(8) node_modules/egg-multipart/config/config.default.js",
"start": 1700535302695,
"end": 1700535302695,
"duration": 0,
"pid": 9772,
"index": 12
},
{
"name": "Require(9) node_modules/egg-development/config/config.default.js",
"start": 1700535302696,
"end": 1700535302696,
"duration": 0,
"pid": 9772,
"index": 13
},
{
"name": "Require(10) node_modules/egg-logrotator/config/config.default.js",
"start": 1700535302696,
"end": 1700535302696,
"duration": 0,
"pid": 9772,
"index": 14
},
{
"name": "Require(11) node_modules/egg-static/config/config.default.js",
"start": 1700535302697,
"end": 1700535302697,
"duration": 0,
"pid": 9772,
"index": 15
},
{
"name": "Require(12) node_modules/egg-view/config/config.default.js",
"start": 1700535302697,
"end": 1700535302698,
"duration": 1,
"pid": 9772,
"index": 16
},
{
"name": "Require(13) node_modules/egg/config/config.default.js",
"start": 1700535302698,
"end": 1700535302698,
"duration": 0,
"pid": 9772,
"index": 17
},
{
"name": "Require(14) config/config.default.js",
"start": 1700535302699,
"end": 1700535302699,
"duration": 0,
"pid": 9772,
"index": 18
},
{
"name": "Require(15) node_modules/egg-security/config/config.local.js",
"start": 1700535302700,
"end": 1700535302700,
"duration": 0,
"pid": 9772,
"index": 19
},
{
"name": "Require(16) node_modules/egg-watcher/config/config.local.js",
"start": 1700535302701,
"end": 1700535302701,
"duration": 0,
"pid": 9772,
"index": 20
},
{
"name": "Require(17) node_modules/egg-view/config/config.local.js",
"start": 1700535302702,
"end": 1700535302702,
"duration": 0,
"pid": 9772,
"index": 21
},
{
"name": "Require(18) node_modules/egg/config/config.local.js",
"start": 1700535302702,
"end": 1700535302703,
"duration": 1,
"pid": 9772,
"index": 22
},
{
"name": "Load extend/application.js",
"start": 1700535302703,
"end": 1700535302719,
"duration": 16,
"pid": 9772,
"index": 23
},
{
"name": "Require(19) node_modules/egg-session/app/extend/application.js",
"start": 1700535302704,
"end": 1700535302704,
"duration": 0,
"pid": 9772,
"index": 24
},
{
"name": "Require(20) node_modules/egg-security/app/extend/application.js",
"start": 1700535302705,
"end": 1700535302707,
"duration": 2,
"pid": 9772,
"index": 25
},
{
"name": "Require(21) node_modules/egg-jsonp/app/extend/application.js",
"start": 1700535302707,
"end": 1700535302708,
"duration": 1,
"pid": 9772,
"index": 26
},
{
"name": "Require(22) node_modules/egg-schedule/app/extend/application.js",
"start": 1700535302709,
"end": 1700535302710,
"duration": 1,
"pid": 9772,
"index": 27
},
{
"name": "Require(23) node_modules/egg-logrotator/app/extend/application.js",
"start": 1700535302711,
"end": 1700535302716,
"duration": 5,
"pid": 9772,
"index": 28
},
{
"name": "Require(24) node_modules/egg-view/app/extend/application.js",
"start": 1700535302716,
"end": 1700535302717,
"duration": 1,
"pid": 9772,
"index": 29
},
{
"name": "Load extend/request.js",
"start": 1700535302719,
"end": 1700535302722,
"duration": 3,
"pid": 9772,
"index": 30
},
{
"name": "Require(25) node_modules/egg/app/extend/request.js",
"start": 1700535302720,
"end": 1700535302721,
"duration": 1,
"pid": 9772,
"index": 31
},
{
"name": "Load extend/response.js",
"start": 1700535302722,
"end": 1700535302726,
"duration": 4,
"pid": 9772,
"index": 32
},
{
"name": "Require(26) node_modules/egg/app/extend/response.js",
"start": 1700535302723,
"end": 1700535302725,
"duration": 2,
"pid": 9772,
"index": 33
},
{
"name": "Load extend/context.js",
"start": 1700535302726,
"end": 1700535302752,
"duration": 26,
"pid": 9772,
"index": 34
},
{
"name": "Require(27) node_modules/egg-security/app/extend/context.js",
"start": 1700535302726,
"end": 1700535302734,
"duration": 8,
"pid": 9772,
"index": 35
},
{
"name": "Require(28) node_modules/egg-jsonp/app/extend/context.js",
"start": 1700535302734,
"end": 1700535302735,
"duration": 1,
"pid": 9772,
"index": 36
},
{
"name": "Require(29) node_modules/egg-i18n/app/extend/context.js",
"start": 1700535302736,
"end": 1700535302736,
"duration": 0,
"pid": 9772,
"index": 37
},
{
"name": "Require(30) node_modules/egg-multipart/app/extend/context.js",
"start": 1700535302736,
"end": 1700535302749,
"duration": 13,
"pid": 9772,
"index": 38
},
{
"name": "Require(31) node_modules/egg-view/app/extend/context.js",
"start": 1700535302749,
"end": 1700535302750,
"duration": 1,
"pid": 9772,
"index": 39
},
{
"name": "Require(32) node_modules/egg/app/extend/context.js",
"start": 1700535302750,
"end": 1700535302751,
"duration": 1,
"pid": 9772,
"index": 40
},
{
"name": "Load extend/helper.js",
"start": 1700535302752,
"end": 1700535302767,
"duration": 15,
"pid": 9772,
"index": 41
},
{
"name": "Require(33) node_modules/egg-security/app/extend/helper.js",
"start": 1700535302753,
"end": 1700535302764,
"duration": 11,
"pid": 9772,
"index": 42
},
{
"name": "Require(34) node_modules/egg/app/extend/helper.js",
"start": 1700535302765,
"end": 1700535302766,
"duration": 1,
"pid": 9772,
"index": 43
},
{
"name": "Load app.js",
"start": 1700535302767,
"end": 1700535302861,
"duration": 94,
"pid": 9772,
"index": 44
},
{
"name": "Require(35) node_modules/egg-session/app.js",
"start": 1700535302767,
"end": 1700535302768,
"duration": 1,
"pid": 9772,
"index": 45
},
{
"name": "Require(36) node_modules/egg-security/app.js",
"start": 1700535302768,
"end": 1700535302769,
"duration": 1,
"pid": 9772,
"index": 46
},
{
"name": "Require(37) node_modules/egg-onerror/app.js",
"start": 1700535302770,
"end": 1700535302776,
"duration": 6,
"pid": 9772,
"index": 47
},
{
"name": "Require(38) node_modules/egg-i18n/app.js",
"start": 1700535302776,
"end": 1700535302783,
"duration": 7,
"pid": 9772,
"index": 48
},
{
"name": "Require(39) node_modules/egg-watcher/app.js",
"start": 1700535302783,
"end": 1700535302786,
"duration": 3,
"pid": 9772,
"index": 49
},
{
"name": "Require(40) node_modules/egg-schedule/app.js",
"start": 1700535302786,
"end": 1700535302787,
"duration": 1,
"pid": 9772,
"index": 50
},
{
"name": "Require(41) node_modules/egg-multipart/app.js",
"start": 1700535302787,
"end": 1700535302788,
"duration": 1,
"pid": 9772,
"index": 51
},
{
"name": "Require(42) node_modules/egg-development/app.js",
"start": 1700535302788,
"end": 1700535302788,
"duration": 0,
"pid": 9772,
"index": 52
},
{
"name": "Require(43) node_modules/egg-logrotator/app.js",
"start": 1700535302788,
"end": 1700535302789,
"duration": 1,
"pid": 9772,
"index": 53
},
{
"name": "Require(44) node_modules/egg-static/app.js",
"start": 1700535302789,
"end": 1700535302789,
"duration": 0,
"pid": 9772,
"index": 54
},
{
"name": "Require(45) app.js",
"start": 1700535302790,
"end": 1700535302861,
"duration": 71,
"pid": 9772,
"index": 55
},
{
"name": "Before Start in node_modules/egg-watcher/lib/init.js:15:14",
"start": 1700535302866,
"end": 1700535302979,
"duration": 113,
"pid": 9772,
"index": 56
},
{
"name": "Load Service",
"start": 1700535302890,
"end": 1700535302893,
"duration": 3,
"pid": 9772,
"index": 57
},
{
"name": "Load \"service\" to Context",
"start": 1700535302890,
"end": 1700535302893,
"duration": 3,
"pid": 9772,
"index": 58
},
{
"name": "Load Middleware",
"start": 1700535302893,
"end": 1700535302964,
"duration": 71,
"pid": 9772,
"index": 59
},
{
"name": "Load \"middlewares\" to Application",
"start": 1700535302893,
"end": 1700535302958,
"duration": 65,
"pid": 9772,
"index": 60
},
{
"name": "Load Controller",
"start": 1700535302964,
"end": 1700535302966,
"duration": 2,
"pid": 9772,
"index": 61
},
{
"name": "Load \"controller\" to Application",
"start": 1700535302964,
"end": 1700535302966,
"duration": 2,
"pid": 9772,
"index": 62
},
{
"name": "Load Router",
"start": 1700535302966,
"end": 1700535302967,
"duration": 1,
"pid": 9772,
"index": 63
},
{
"name": "Require(46) app/router.js",
"start": 1700535302966,
"end": 1700535302966,
"duration": 0,
"pid": 9772,
"index": 64
},
{
"name": "Before Start in node_modules/egg-core/lib/egg.js:304:10",
"start": 1700535302966,
"end": 1700535302972,
"duration": 6,
"pid": 9772,
"index": 65
}
]

14
demo/run/router.json

@ -0,0 +1,14 @@
[
{
"name": null,
"methods": [
"POST"
],
"paramNames": [],
"path": "/",
"regexp": "/^(?:\\/(?=$))?$/",
"stack": [
"wrappedController"
]
}
]

12
demo/typings/app/controller/index.d.ts

@ -0,0 +1,12 @@
// This file is created by egg-ts-helper@1.35.1
// Do not modify this file!!!!!!!!!
/* eslint-disable */
import 'egg';
import ExportHome = require('../../../app/controller/home');
declare module 'egg' {
interface IController {
home: ExportHome;
}
}

7
demo/typings/app/index.d.ts

@ -0,0 +1,7 @@
// This file is created by egg-ts-helper@1.35.1
// Do not modify this file!!!!!!!!!
/* eslint-disable */
import 'egg';
export * from 'egg';
export as namespace Egg;

12
demo/typings/config/index.d.ts

@ -0,0 +1,12 @@
// This file is created by egg-ts-helper@1.35.1
// Do not modify this file!!!!!!!!!
/* eslint-disable */
import 'egg';
import { EggAppConfig } from 'egg';
import ExportConfigDefault = require('../../config/config.default');
type ConfigDefault = ReturnType<typeof ExportConfigDefault>;
type NewEggAppConfig = ConfigDefault;
declare module 'egg' {
interface EggAppConfig extends NewEggAppConfig { }
}

34
demo/typings/config/plugin.d.ts

@ -0,0 +1,34 @@
// This file is created by egg-ts-helper@1.35.1
// Do not modify this file!!!!!!!!!
/* eslint-disable */
import 'egg';
import 'egg-onerror';
import 'egg-session';
import 'egg-i18n';
import 'egg-watcher';
import 'egg-multipart';
import 'egg-security';
import 'egg-development';
import 'egg-logrotator';
import 'egg-schedule';
import 'egg-static';
import 'egg-jsonp';
import 'egg-view';
import { EggPluginItem } from 'egg';
declare module 'egg' {
interface EggPlugin {
onerror?: EggPluginItem;
session?: EggPluginItem;
i18n?: EggPluginItem;
watcher?: EggPluginItem;
multipart?: EggPluginItem;
security?: EggPluginItem;
development?: EggPluginItem;
logrotator?: EggPluginItem;
schedule?: EggPluginItem;
static?: EggPluginItem;
jsonp?: EggPluginItem;
view?: EggPluginItem;
}
}

1
developedcode/cegongji/back/.eslintignore

@ -0,0 +1 @@
coverage

4
developedcode/cegongji/back/.eslintrc

@ -0,0 +1,4 @@
{
"extends": "eslint-config-egg",
"root": true
}

15
developedcode/cegongji/back/.gitignore

@ -0,0 +1,15 @@
logs/
npm-debug.log
yarn-error.log
node_modules/
*-lock.json
*-lock.yaml
yarn.lock
coverage/
.idea/
run/
.DS_Store
*.sw*
*.un~
typings/
.nyc_output/

33
developedcode/cegongji/back/README.md

@ -0,0 +1,33 @@
# cegongji
cegongji back
## QuickStart
<!-- add docs here for user -->
see [egg docs][egg] for more detail.
### Development
```bash
$ npm i
$ npm run dev
$ open http://localhost:7001/
```
### Deploy
```bash
$ npm start
$ npm stop
```
### npm scripts
- Use `npm run lint` to check code style.
- Use `npm test` to run unit test.
- Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail.
[egg]: https://eggjs.org

3
developedcode/cegongji/back/agent.js

@ -0,0 +1,3 @@
module.exports = async app => {
}

128
developedcode/cegongji/back/app.js

@ -0,0 +1,128 @@
const { SerialPort } = require('serialport')
const mqtt = require("mqtt");
require('events').EventEmitter.defaultMaxListeners = 0; // 解除限制
const serialPortParams = {
path: "COM5",
baudRate: 9600, //波特率
dataBits: 8, //数据位
parity: 'none', //奇偶校验
stopBits: 1, //停止位
flowControl: false,
autoOpen: false, //不自动打开
// highWaterMark: 64 * 1024,
highWaterMark: 32,
}
class AppBootHook {
constructor(app) {
this.app = app;
}
configWillLoad() {
// 此时 config 文件已经被读取并合并,但是还并未生效
// 这是应用层修改配置的最后时机
// 注意:此函数只支持同步调用
}
async didLoad() {
// 所有的配置已经加载完毕
// 可以用来加载应用自定义的文件,启动自定义的服务
}
async willReady() {
// 所有的插件都已启动完毕,但是应用整体还未 ready
// 可以做一些数据初始化等操作,这些操作成功才会启动应用
}
async didReady() {
// 应用已经启动完毕
}
async serverDidReady() {
// http / https server 已启动,开始接受外部请求
// 此时可以从 app.server 拿到 server 的实例
//生成串口连接
function genSerialport(options) {
return new SerialPort({ ...serialPortParams, ...options })
}
//转矩转速功率测量仪下"COM1"
//转矩转速功率测量仪中"COM2"
//转矩转速功率测量仪上"COM3"
//wlk-10A控制器(下上一体)"COM4"
//XSD5-2隔离型 "COM5"
//初始化串口
this.app.comKey = [
{
key: "XSD5",
ripCom: "COM5",
sendRipId: "01 03 00 00 00 06",
ripBackStart: "01 03",
recieveRipLength: 17,
ripComInstence: genSerialport({ path: "COM5" }),
},
{
key: "TR4DU",
ripCom: "COM3",
sendRipId: "05 03 00 00 00 09",
ripBackStart: "05 03",
recieveRipLength: 23,
ripComInstence: genSerialport({ path: "COM3" }),
},
{
key: "WLK10A",
ripCom: "COM4",
execFun: ["WLK10AU", "WLK10AD"],
sendRipId: "01 03 00 00 00 02",
ripBackStart: "01 03",
recieveRipLength: 9,
ripComInstence: genSerialport({ path: "COM4" }),
},
{
key: "TR4DM",
ripCom: "COM2",
sendRipId: "05 03 00 00 00 09",
ripBackStart: "05 03",
recieveRipLength: 23,
ripComInstence: genSerialport({ path: "COM2" }),
},
{
key: "TR4DD",
ripCom: "COM1",
sendRipId: "05 03 00 00 00 09",
ripBackStart: "05 03",
recieveRipLength: 23,
ripComInstence: genSerialport({ path: "COM1" }),
},
{
key: "relay",
ripCom: "COM7",
// sendRipId: ["08 01 00 41 00 08", "02 01 00 41 00 08"],
sendRipId: ["08 01 00 41 00 08"],
// ripBackStart: ["01 01 01", "02 01 01"],
ripBackStart: ["08 01 01"],
recieveRipLength: 6,
ripComInstence: genSerialport({ path: "COM7" }),
},
// {
// key: "COM6",
// ripCom: "COM6",
// sendRipId: ["01 01 00 41 00 08", "02 01 00 41 00 08"],
// ripBackStart: ["01 01 01", "02 01 01"],
// recieveRipLength: 6,
// ripComInstence: genSerialport({ path: "COM6" }),
// },
]
this.app.mqttServe = mqtt.connect("mqtt://127.0.0.1:1883", {
clean: true,
connectTimeout: 4000,
clientId: 'COM-' + Math.random().toString(16).substring(2),
});
this.app.mqttServe.on("connect", function () {
console.log("appmqtt服务器连接成功");
});
}
}
module.exports = AppBootHook;

30
developedcode/cegongji/back/app/controller/dualFlowMotor.js

@ -0,0 +1,30 @@
'use strict';
const _ = require("lodash");
const Controller = require('egg').Controller;
class DualFlowMotorController extends Controller {
//初始化双流电机
async init() {
let { ctx } = this;
let params = ctx.request.body
let res = await ctx.service.dualFlowMotor.init(params);
ctx.body = res
ctx.status = 200
}
//保存双流电机数据
async send() {
let { ctx } = this;
let params = ctx.request.body
let res = await ctx.service.dualFlowMotor.send(params);
ctx.body = res
ctx.status = 200
}
//保存双流电机数据
async save() {
let { ctx } = this;
let params = ctx.request.body
let res = await ctx.service.dualFlowMotor.save(params);
ctx.body = res
ctx.status = 200
}
}
module.exports = DualFlowMotorController;

32
developedcode/cegongji/back/app/controller/home.js

@ -0,0 +1,32 @@
'use strict';
const Controller = require('egg').Controller;
const _ = require("lodash");
class HomeController extends Controller {
//启动定时任务
async startSend() {
let { ctx } = this;
ctx.service.home.startSend(ctx.request.body);
ctx.body = {
haserror: false,
msg: `(${_.join(_.map(ctx.request.body, "key"), "、")})定时任务开始`,
}
ctx.status = 200
}
//初始化发送一次查询命令
async startSendOnce() {
let { ctx } = this;
let res = await ctx.service.home.startSendOnce(ctx.request.body);
ctx.body = res
ctx.status = 200
}
//关闭定时任务
async endSend() {
let { ctx } = this;
let res = await ctx.service.home.endSend();
ctx.body = res
ctx.status = 200
}
}
module.exports = HomeController;

22
developedcode/cegongji/back/app/controller/hubMotor.js

@ -0,0 +1,22 @@
'use strict';
const _ = require("lodash");
const Controller = require('egg').Controller;
class HubMotorController extends Controller {
//初始化轮毂电机
async init() {
let { ctx } = this;
let params = ctx.request.body
let res = await ctx.service.hubMotor.init(params);
ctx.body = res
ctx.status = 200
}
//保存轮毂电机数据
async save() {
let { ctx } = this;
let params = ctx.request.body
let res = await ctx.service.hubMotor.save(params);
ctx.body = res
ctx.status = 200
}
}
module.exports = HubMotorController;

33
developedcode/cegongji/back/app/controller/message.js

@ -0,0 +1,33 @@
'use strict';
const _ = require("lodash");
const Controller = require('egg').Controller;
class MessageController extends Controller {
//打开端口
async openCom() {
let { ctx } = this;
let params = ctx.request.body
let SerialPortItem = _.find(ctx.app.comKey, { key: params.key })
let res = await ctx.service.message.openCom(SerialPortItem);
ctx.body = res
ctx.status = 200
}
//关闭端口
async closeCom() {
let { ctx } = this;
let params = ctx.request.body
let SerialPortItem = _.find(ctx.app.comKey, { key: params.key })
let res = await ctx.service.message.closeCom(SerialPortItem);
ctx.body = res
ctx.status = 200
}
//发送指令
async index() {
let { ctx } = this;
let params = ctx.request.body
let SerialPortItem = _.find(ctx.app.comKey, { ripCom: params.ripCom })
let res = await ctx.service.message.index({ ...SerialPortItem, ...params });
ctx.body = res
ctx.status = 200
}
}
module.exports = MessageController;

48
developedcode/cegongji/back/app/controller/users.js

@ -0,0 +1,48 @@
'use strict';
const Controller = require('egg').Controller;
class UserController extends Controller {
//用户登陆
async login() {
let { ctx } = this;
let res = await ctx.service.users.login(ctx.request.body);
ctx.body = res
ctx.status = 200
}
//新增用户
async addUser() {
let { ctx } = this;
let res = await ctx.service.users.addUser(ctx.request.body);
ctx.body = res
}
// //修改用户
// async updateUser() {
// let { ctx } = this;
// let id = await ctx.service.users.updateUser(ctx.request.body);
// ctx.body = {
// topic_id: id,
// };
// }
// //删除用户
// async delUser() {
// let { ctx } = this;
// let id = await ctx.service.users.delUser(ctx.request.body);
// ctx.body = {
// topic_id: id,
// };
// }
//获取用户列表
async getUserList() {
let { ctx } = this;
let res = await ctx.service.users.getUserList(ctx.request.body);
ctx.body = res
}
//获取用户登录列表
async getUserLoginList() {
let { ctx } = this;
let res = await ctx.service.users.getUserLoginList(ctx.request.body);
ctx.body = res
}
}
module.exports = UserController;

9
developedcode/cegongji/back/app/io/controller/gelixing.js

@ -0,0 +1,9 @@
'use strict';
const Controller = require('egg').Controller;
class GelixingController extends Controller {
//message
async index1() {
}
}
module.exports = GelixingController;

24
developedcode/cegongji/back/app/middleware/error_handler.js

@ -0,0 +1,24 @@
// app/middleware/error_handler.js
module.exports = () => {
return async function errorHandler(ctx, next) {
try {
await next();
} catch (err) {
// 所有的异常都在 app 上触发一个 error 事件,框架会记录一条错误日志
ctx.app.emit('error', err, ctx);
const status = err.status || 500;
// 生产环境时 500 错误的详细错误内容不返回给客户端,因为可能包含敏感信息
const error =
status === 500 && ctx.app.config.env === 'prod'
? 'Internal Server Error'
: err.message;
// 从 error 对象上读出各个属性,设置到响应中
ctx.body = { error };
if (status === 422) {
ctx.body.detail = err.errors;
}
ctx.status = status;
}
};
};

23
developedcode/cegongji/back/app/middleware/jwtErr.js

@ -0,0 +1,23 @@
'use strict';
// middleware/jwtErr.js
module.exports = options => {
return async function jwtErr(ctx, next) {
try {
let tokenTemp = ctx.headers.authorization.split(' ')
let token = tokenTemp[tokenTemp.length - 1];
let decode = await ctx.app.jwt.verify(token, options.secret)
let params = {
_id: decode.userID
}
let permission = await ctx.service.utils.checkPerssion("User", params)
if (permission) {
await next()
} else {
ctx.body = { "statusCode": 403, "errMsg": "没有权限" };
}
} catch (err) {
ctx.body = { "statusCode": 403, "errMsg": `错误信息:${err}` };
}
};
};

47
developedcode/cegongji/back/app/model/dualFlowMotor.js

@ -0,0 +1,47 @@
'use strict';
module.exports = app => {
const mongoose = app.mongoose;
const Schema = mongoose.Schema;
const DualFlowMotorSchema = new Schema({
username: {//数据所属人
type: String,
index: true
},
canName: {//can名称
type: String,
index: true
},
canId: { //canId
type: String,
index: true
},
sendRip: { //can发送的数据
type: String,
index: true
},
recieveRipArr: { //can接收的数据
type: Array,
index: true
},
delete: {
type: Number,
default: 0, //0代表未删除,1代表删除
index: true
},
create_at: {
type: Date,
default: Date.now,
index: true
},
update_at: {
type: Date,
default: Date.now,
index: true
},
}, {
strict: false
});
return mongoose.model('dualFlowMotor', DualFlowMotorSchema, "dualFlowMotor");
};

47
developedcode/cegongji/back/app/model/hubMotor.js

@ -0,0 +1,47 @@
'use strict';
module.exports = app => {
const mongoose = app.mongoose;
const Schema = mongoose.Schema;
const HubMotorSchema = new Schema({
username: {//数据所属人
type: String,
index: true
},
canName: {//can名称
type: String,
index: true
},
canId: { //canId
type: String,
index: true
},
sendRip: { //can发送的数据
type: String,
index: true
},
recieveRipArr: { //can接收的数据
type: Array,
index: true
},
delete: {
type: Number,
default: 0, //0代表未删除,1代表删除
index: true
},
create_at: {
type: Date,
default: Date.now,
index: true
},
update_at: {
type: Date,
default: Date.now,
index: true
},
}, {
strict: false
});
return mongoose.model('hubMotor', HubMotorSchema, "hubMotor");
};

43
developedcode/cegongji/back/app/model/user.js

@ -0,0 +1,43 @@
'use strict';
module.exports = app => {
const mongoose = app.mongoose;
const Schema = mongoose.Schema;
const UserSchema = new Schema({
submission: {
username: {
type: String,
unique: true,
index: true
},
password: {
type: String,
index: true
},
},
role: { //角色信息,默认操作员
type: String,
default: 'operator',
index: true
},
delete: {
type: Number,
default: 0, //0代表未删除,1代表删除
index: true
},
create_at: {
type: Date,
default: Date.now,
index: true
},
update_at: {
type: Date,
default: Date.now,
index: true
},
}, {
strict: false
});
return mongoose.model('user', UserSchema, "user");
};

37
developedcode/cegongji/back/app/model/userLoginRecord.js

@ -0,0 +1,37 @@
'use strict';
module.exports = app => {
const mongoose = app.mongoose;
const Schema = mongoose.Schema;
const UserLoginRecordSchema = new Schema({
username: {
type: String,
ref: 'User',
index: true
},
role: { //角色信息,默认操作员
type: String,
default: 'operator',
index: true
},
delete: {
type: Number,
default: 0, //0代表未删除,1代表删除
index: true
},
create_at: {
type: Date,
default: Date.now,
index: true
},
update_at: {
type: Date,
default: Date.now,
index: true
},
}, {
strict: false
});
return mongoose.model('userLoginRecord', UserLoginRecordSchema, "userLoginRecord");
};

14
developedcode/cegongji/back/app/router.js

@ -0,0 +1,14 @@
"use strict";
/**
* @param {Egg.Application} app - egg application
*/
module.exports = (app) => {
require('./router/user')(app)
//udp
app.udp.handle("index.handle")
// mqttio
require('./router/message')(app)
//自定义初始化页面
require('./router/selfInit')(app)
};

11
developedcode/cegongji/back/app/router/message.js

@ -0,0 +1,11 @@
'use strict';
/**
* @param {Egg.Application} app - egg application
*/
module.exports = app => {
const { router, controller } = app;
//串口接口
router.post('/api/v1/openCom', controller.message.openCom)
router.post('/api/v1/closeCom', controller.message.closeCom)
router.post('/api/v1/message', controller.message.index)
};

15
developedcode/cegongji/back/app/router/selfInit.js

@ -0,0 +1,15 @@
'use strict';
/**
* @param {Egg.Application} app - egg application
*/
module.exports = app => {
const { router, controller } = app;
//hubMotor轮毂电机
router.post('/api/v1/initDualFlowMotor', controller.dualFlowMotor.init)
router.post('/api/v1/saveDualFlowMotor', controller.dualFlowMotor.save)
router.post('/api/v1/sendDualFlowMotor', controller.dualFlowMotor.send)
//hubMotor轮毂电机
router.post('/api/v1/initHubMotor', controller.hubMotor.init)
router.post('/api/v1/saveHubMotor', controller.hubMotor.save)
};

17
developedcode/cegongji/back/app/router/user.js

@ -0,0 +1,17 @@
'use strict';
/**
* @param {Egg.Application} app - egg application
*/
module.exports = app => {
const { router, controller, middleware } = app;
// const jwtErr = middleware.jwtErr(app.config.jwt);
router.post('/api/v1/auth', controller.users.login)//用户登录
router.post('/api/v1/adduser', controller.users.addUser)//增加用户、查用户列表
// router.post('/api/v1/updateuser', jwtErr , controller.users.updateUser)//修改用户
// router.post('/api/v1/deluser', jwtErr , controller.users.delUser)//删除用户
router.post('/api/v1/getUserList', controller.users.getUserList)
router.post('/api/v1/getUserLoginList', controller.users.getUserLoginList)//查找用户登陆列表
router.post('/api/v1/startSend', controller.home.startSend)//启动定时任务
router.post('/api/v1/startSendOnce', controller.home.startSendOnce)//初始化发送一次查询命令
router.get('/api/v1/endSend', controller.home.endSend)//关闭定时任务
};

88
developedcode/cegongji/back/app/service/dealSerialport.js

@ -0,0 +1,88 @@
'use strict';
const Service = require('egg').Service;
const _ = require("lodash");
class DealSerialportService extends Service {
//打开串口
async openSerialport(SerialPortItem, port) {
if (SerialPortItem.isOpen) {
await this.closeSerialport(SerialPortItem, port)
}
let returnData = {
haserror: true,
msg: `${port}串口打开出错`,
};
await SerialPortItem.open(function (error) {
if (error) {
returnData.haserror = true
returnData.msg = `${port}端口打开出错:${error}`
} else {
returnData.haserror = false
returnData.msg = `${port}端口打开成功`
}
return returnData
});
return returnData
}
//关闭串口
async closeSerialport(SerialPortItem, port) {
if (SerialPortItem.isOpen) {
await SerialPortItem.close()
}
let returnData = {
haserror: false,
msg: `${port}串口关闭成功`,
};
return returnData
}
//向串口发送指令
async writeSerialport(SerialPortItem, params) {
let { ctx } = this
//每次发送数据停留50ms
await ctx.service.utils.sleep(50);
let returnData = {
haserror: false,
msg: `${params.ripCom}的指令(${JSON.stringify(params.sendRipId)})发送成功`,
};
if (SerialPortItem.isOpen) {
await this.writeData(SerialPortItem, params)
} else {
await this.openSerialport(SerialPortItem, params.ripCom)
await this.writeData(SerialPortItem, params)
}
return returnData
}
//写数据后读取
async writeData(SerialPortItem, params) {
let { ctx } = this
let dealData1 = ""
let dealData2 = ""
if (typeof (params.sendRipId) === "string") {
dealData1 = await ctx.service.utils.MODBUS_CRC(params.sendRipId, true, "hex");
} else if (typeof (params.sendRipId) === "object") {
dealData1 = await ctx.service.utils.MODBUS_CRC(params.sendRipId[0], true, "hex");
// dealData2 = await ctx.service.utils.MODBUS_CRC(params.sendRipId[1], true, "hex");
}
await SerialPortItem.write(Buffer.from(dealData1)); // 发送字符串
await ctx.service.utils.sleep(50);
let readResult1 = await SerialPortItem.read(); // 发送字符串
if (dealData1 && readResult1) {
if (dealData1.toString("hex").substring(0, 4) === readResult1.toString("hex").substring(0, 4) && dealData1.toString("hex") !== readResult1.toString("hex")) {
await ctx.service.home.sendData(params, readResult1, params.isDirct);
}
}
if (dealData2) {
await ctx.service.utils.sleep(50);
await SerialPortItem.write(Buffer.from(dealData2)); // 发送字符串
await ctx.service.utils.sleep(50);
let readResult2 = await SerialPortItem.read(); // 发送字符串
if (dealData2 && readResult2) {
if (dealData2.toString("hex").substring(0, 4) === readResult2.toString("hex").substring(0, 4) && dealData2.toString("hex") !== readResult2.toString("hex")) {
await ctx.service.home.sendData(params, readResult2, params.isDirct);
}
}
}
}
}
module.exports = DealSerialportService;

46
developedcode/cegongji/back/app/service/dualFlowMotor.js

@ -0,0 +1,46 @@
'use strict';
const Service = require('egg').Service;
const _ = require("lodash");
class DualFlowMotorService extends Service {
//初始化双流电机
async init(params) {
let { ctx, app } = this;
app.cantest1 = params.start
return {
hasError: false,
msg: `${params.start ? '开启' : '关闭'}成功`
}
}
//保存双流电机数据
async send(params) {
let { ctx, app } = this;
let returnData = {
hasError: false,
msg: "发送成功"
}
await app.udp.udp.send(params.key, 8096, "localhost", (err, bytes) => {
if (err) {
returnData.msg = err
} else {
returnData.msg = `已成功发送${bytes}字节`
// app.udp.udp.close();
// app.udp.udp.on("close", () => {
// console.log("close");
// });
}
});
return returnData
}
//保存双流电机数据
async save(params) {
let { ctx, app } = this;
// let res = await ctx.model.DualFlowMotor.create(params)
// console.log(66688, res, params)
return {
a444: 52
}
}
}
module.exports = DualFlowMotorService;

121
developedcode/cegongji/back/app/service/home.js

@ -0,0 +1,121 @@
'use strict';
const Service = require('egg').Service;
const _ = require("lodash");
class HomeService extends Service {
// 开始定时任务
async startSend(params) {
let { app, ctx } = this;
await ctx.service.utils.sleep(500);
if (!_.isEmpty(params)) {
let newArr = []
for (let i = 0; i < app.comKey.length; i++) {
let element = app.comKey[i];
let item = _.find(params, o => o.key === element.key)
if (item) {
newArr.push({ ...element })
}
}
app.timerTemp = true
while (app.timerTemp) {
await this.exec(newArr)
}
}
}
//初始化发送一次查询命令
async startSendOnce(params) {
let { app } = this;
let newArr = []
for (let i = 0; i < app.comKey.length; i++) {
let element = app.comKey[i];
let item = _.find(params, o => o.key === element.key)
if (item) {
newArr.push({ ...element })
}
}
await this.exec(newArr)
return {
haserror: false,
msg: '查询完成',
}
}
//结束定时任务
async endSend() {
let { app } = this;
app.timerTemp = false
return {
haserror: false,
msg: `成功关闭该页面定时任务`,
}
}
//执行任务
async exec(newArr) {
let { ctx } = this;
for (let i = 0; i < newArr.length; i++) {
let element = newArr[i];
await ctx.service.message.index(element);
}
}
// ArrayBuffer转16进制字符串
arrayBuffer2Hex(buffer) {
let hexArr = Array.prototype.map.call(
new Uint8Array(buffer),
function (bit) {
return ('00' + bit.toString(16)).slice(-2)
}
)
return hexArr.join(" ")
}
//收到数据后发送数据
async sendData(params, data, isDirct = false) {
if (data) {
let { app } = this;
let resData = this.arrayBuffer2Hex(Buffer.from(data))
//像端口发布信息
if (isDirct) {
app.mqttServe.publish(`/${params.ripCom}`, resData, {
qos: 2,
retain: false,
})
} else {
let keyList = ["relay", "WLK10A"]
if (keyList.indexOf(params.key) === -1) {
if (!resData.indexOf(params.ripBackStart)) {
app.mqttServe.publish(`/${params.key}`, resData, {
qos: 2,
retain: false,
})
}
} else {
if (params.key === "WLK10A") {
if (!resData.indexOf(params.ripBackStart)) {
for (let j = 0; j < params.execFun.length; j++) {
let execItem = params.execFun[j];
app.mqttServe.publish(`/${execItem}`, resData, {
qos: 2,
retain: false,
})
}
}
} else {
if (params.key === "relay") {
if (!resData.indexOf(params.ripBackStart[0])) {
app.mqttServe.publish(`/${params.key}1`, resData, {
qos: 2,
retain: false,
})
} else if (!resData.indexOf(params.ripBackStart[1])) {
app.mqttServe.publish(`/${params.key}2`, resData, {
qos: 2,
retain: false,
})
}
}
}
}
}
}
}
}
module.exports = HomeService;

24
developedcode/cegongji/back/app/service/hubMotor.js

@ -0,0 +1,24 @@
'use strict';
const Service = require('egg').Service;
const _ = require("lodash");
class HubMotorService extends Service {
//初始化轮毂电机
async init(params) {
let { ctx, app } = this;
return {
a444: 55
}
}
//保存轮毂电机数据
async save(params) {
let { ctx, app } = this;
return {
a444: 53
}
}
}
module.exports = HubMotorService;

37
developedcode/cegongji/back/app/service/message.js

@ -0,0 +1,37 @@
'use strict';
const Service = require('egg').Service;
const _ = require("lodash");
class MessageService extends Service {
//打开端口
async openCom(params) {
let { ctx, app } = this;
let SerialPortItem = _.find(app.comKey, { key: params.key })
let res = await ctx.service.dealSerialport.openSerialport(SerialPortItem.ripComInstence, params.ripCom);
return res
}
//关闭端口
async closeCom(params) {
let { ctx, app } = this;
let SerialPortItem = _.find(app.comKey, { key: params.key })
let res = await ctx.service.dealSerialport.closeSerialport(SerialPortItem.ripComInstence, params.ripCom);
return res
}
//发送指令
async send(SerialPortItem, params) {
let { ctx } = this;
let sendResult = await ctx.service.dealSerialport.writeSerialport(SerialPortItem, params);
if (sendResult) {
return sendResult
} else {
return "端口已被占用,请关闭已占用的端口后刷新页面。"
}
}
//发送指令
async index(params) {
let sendResult = await this.send(params.ripComInstence, params);
return sendResult
}
}
module.exports = MessageService;

156
developedcode/cegongji/back/app/service/users.js

@ -0,0 +1,156 @@
'use strict';
const Service = require('egg').Service;
const _ = require("lodash");
class UserService extends Service {
//用户登录
async login(uesrData) {
let { ctx } = this;
let filterOption = {
"filters": {
"submission.username": uesrData.username,
"submission.password": uesrData.password
},
"sort": {
"create_at": -1
},
"skip": 0,
"limit": 1,
}
let res = await ctx.service.utils.getDataList("User", filterOption);
let returnData =
{
haserror: true,
msg: `账号或密码出错请重新登录`,
username: _.get(uesrData, ["username"], ""),
};
if (res.total) {
//登录成功后新增一条登录信息
await this.addLoginInfo(_.get(uesrData, ["username"], ""), _.get(res, ["results", 0, "role"], "operator"))
returnData =
{
haserror: false,
msg: `${_.get(uesrData, ["username"], "")}用户登录成功`,
username: _.get(uesrData, ["username"], ""),
_id: _.get(res, ["results", 0, "_id"], ""),
role: _.get(res, ["results", 0, "role"], "operator"),
token: this.genToken(_.get(res, ["results", 0, "_id"], "")),
}
}
return returnData
}
//新增用户
async addUser(uesrData) {
let { ctx } = this;
let params = {
submission: {
username: _.get(uesrData, ["username"], ""),
password: _.get(uesrData, ["password"], "")
}
}
let returnData =
{
haserror: true,
msg: `${_.get(uesrData, ["username"], "")}用户重复,请输入不同用户`,
username: _.get(uesrData, ["username"]),
};
try {
let result = await ctx.model.User.create(params)
//注册成功后新增一条登录信息
await this.addLoginInfo(_.get(uesrData, ["username"], ""), result.role)
returnData = {
haserror: false,
msg: `${_.get(result, ["submission", "username"], "")}用户新建成功`,
username: _.get(result, ["submission", "username"]),
_id: result._id,
role: result.role,
token: this.genToken(result._id),
};
} catch (error) {
}
return returnData
}
// //修改用户
// async updateUser(filter) {
// let { ctx } = this;
// let res = await ctx.model.User.findOneAndUpdate({ username: filter.username }, { password: filter.password }, function (err, data) {
// if (err) {
// return "修改失败"
// } else {
// return "修改成功"
// }
// }
// );
// return res
// }
// //删除用户
// async delUser(uesrData) {
// let { ctx } = this;
// let res = await ctx.model.User.findOneAndUpdate({ username: filter.username }, { delete: true }, function (err, data) {
// if (err) {
// return "删除失败"
// } else {
// return "删除成功"
// }
// }
// );
// return res
// }
//获取用户列表
async getUserList(uesrData) {
let { ctx } = this;
let filterOption = {
"project": {
"submission.username": "$submission.username",
"role": "$role",
"create_at": "$create_at"
},
"sort": {
"create_at": -1
},
"skip": 0,
"limit": 10,
...uesrData
}
filterOption = _.merge(filterOption, uesrData)
let res = await ctx.service.utils.getDataList("User", filterOption);
return res
}
//获取用户登录列表
async getUserLoginList(uesrData) {
let { ctx } = this;
let filterOption = {
"project": {
"username": "$username",
"role": "$role",
"create_at": "$create_at"
},
"sort": {
"create_at": -1
},
"skip": 0,
"limit": 10,
...uesrData
}
filterOption = _.merge(filterOption, uesrData)
let res = await ctx.service.utils.getDataList("UserLoginRecord", filterOption);
return res
}
//登陆后或者注册后新增一条登录信息数据
async addLoginInfo(username = "", role = "operator") {
let { ctx, app } = this
let res = await ctx.model.UserLoginRecord.create({ username: username, role: role })
return res
}
//根据用户id生成token
genToken(id) {
// //生成Token
let { app } = this
let token = app.jwt.sign({
userID: id, //需要存储的Token数据
}, app.config.jwt.secret, { expiresIn: 24 * 60 * 60 + 's' });
return token
}
}
module.exports = UserService;

241
developedcode/cegongji/back/app/service/utils.js

@ -0,0 +1,241 @@
'use strict';
const Service = require('egg').Service;
const _ = require("lodash")
const mongoose = require('mongoose');
const crc16 = require('crc/crc16');
// const dayjs = require('dayjs');
const ObjectId = mongoose.Types.ObjectId;
class UtilsService extends Service {
//基础表
baseModel() {
let WorkflowlaunchSchema = new mongoose.Schema({
create_at: {
type: Date,
default: Date.now,
index: true
},
update_at: {
type: Date,
default: Date.now,
index: true
},
title: {
type: String,
index: true
},
user: {
type: String,
ref: 'XbyUser',
index: true
},
delete: {
type: Number,
default: 0, //0代表未删除,1代表删除
index: true
},
}, {
strict: false
});
return WorkflowlaunchSchema;
}
//数据库查找表
async findModelByName(name) {
if (!this.ctx.model.hasOwnProperty(name)) {
let baseModel = this.baseModel();
let lowerFirstName = _.lowerFirst(name)
this.ctx.model[name] = mongoose.model(lowerFirstName, baseModel, lowerFirstName);
}
return this.ctx.model[name];
}
/**
* 通用数据获取接口
* @param modelObj
* @param filterOption 过滤条件排序分页条件
* {
"filters": {
"submission.name": {
"$regex": ".*66",
"$options": "i"
}
},
"sort": {
"create_at": -1
},
"skip": 0,
"limit": 20,
}
* @returns {Promise<*>}
*/
async getDataList(name, filterOption = {}) {
// let { ctx } = this;
//facet 查询结果的同时显示总数
let modelObj = await this.findModelByName(name)
let facet = {
$facet: {
total: [{
$count: "total"
}],
results: []
}
};
//sort 排序用
if (!_.isEmpty(filterOption.sort)) {
facet.$facet.results.push({
$sort: filterOption.sort
});
}
//skip 排序用
facet.$facet.results.push({
$skip: _.get(filterOption, ["skip"], 0) || 0
});
//limit 排序用
if (_.get(filterOption, ["limit"], 1)) {
facet.$facet.results.push({
$limit: filterOption.limit
});
}
let agg = [];
//转换字符串_id为objectid,目前只能转第一层和第二层的id,要改为迭代查找
for (let key in (_.get(filterOption, ["filters"], {}) || {})) {
if (key === '_id' && _.isString(filterOption.filters[key]) && ObjectId.isValid(filterOption.filters[key])) {
//值是一个 mongodb id字符串
filterOption.filters[key] = ObjectId(filterOption.filters[key]);
}
else if (key === 'create_at' || key === 'update_at') {
filterOption.filters[key]["$gte"] = new Date(filterOption.filters[key]["$gte"]);
filterOption.filters[key]["$lt"] = new Date(filterOption.filters[key]["$lt"]);
}
}
agg.push({
$match: { delete: 0, ...(_.get(filterOption, ["filters"], {}) || {}) }
});
if (filterOption.hasOwnProperty('project') && !_.isEmpty(filterOption.project)) {
facet.$facet.results.push({
$project: filterOption.project
});
}
//当results ===0 时, 只保留统计
let aggTotal = []
let aggResults = []
aggTotal = [...agg, ...facet["$facet"]["total"]]
aggResults = [...agg, ...facet["$facet"]["results"]]
// ctx.logger.debug(modelObj.modelName, JSON.stringify(aggResults));
let resultRecords = [];
//allowDiskUse:解决管道内数据量超过100M时报错问题
let resultTotal = await modelObj.collection.aggregate(aggTotal, { allowDiskUse: true }).toArray();
if (filterOption.results !== 0) {
resultRecords = await modelObj.collection.aggregate(aggResults, { allowDiskUse: true }).toArray();
}
let r = resultTotal[0] ? resultTotal[0] : { total: 0 }
r["results"] = resultRecords
return r;
}
//修改数据
async update(name, updateData, filter = {}) {
let modelObj = await this.findModelByName(name)
updateData['update_at'] = Date.now();
//转换子路径是因为更新子路径要用.点的形式,不能用字典形式
if ("submission" in updateData) {
_.forEach(updateData.submission, function (value, key) {
updateData["submission." + key] = value;
})
updateData = _.omit(updateData, "submission")
}
updateData = {
$set: updateData
};
filter = _.isEmpty(filter) ? { "_id": updateData["$set"]._id } : filter
delete updateData["$set"]['_id']
return await modelObj.findOneAndUpdate(
filter
, updateData, {
lean: true
}).exec();
}
//新增数据
async save(name, addOption) {
let modelObj = await this.findModelByName(name)
if (!_.isArray(addOption)) {
addOption = [addOption]
}
let saveData = await modelObj.create(addOption)
return saveData
}
//modbus生成crc校验
/**
* MODBUS-RTU CRC校验
* @param data 命令(不带crc16循环冗余码的命令)
* @returns {any[]} 十六进制高低位
* @constructor
*/
MODBUS_CRC(data, isAll = false, type = "string") {
let trimStr = _.replace(data, /[\s]/g, '')
let res = crc16(trimStr, 'hex')
let dataBuffer = Buffer.from(trimStr, "HEX")
let crcValue = 0xFFFF;
for (let i = 0; i < dataBuffer.length; i++) {
crcValue ^= dataBuffer[i]
for (let j = 0; j < 8; j++) {
if (crcValue & 0x0001) {
crcValue >>= 1
crcValue ^= 0xA001
} else {
crcValue >>= 1
}
}
}
crcValue = crcValue.toString(16)
crcValue = _.padStart(crcValue, 4, "0")
//处理进来的字符串
if (type === "string") {
let result = "";
for (let i = 0; i < trimStr.length; i++) {
result += trimStr[i];
if (i % 2 === 1) result += ' ';
}
let returnData = `${crcValue.substring(2, 4)} ${crcValue.substring(0, 2)}`
if (isAll) {
returnData = `${result}${crcValue.substring(2, 4)} ${crcValue.substring(0, 2)}`
}
return returnData
} else {
let result = [];
for (let i = 0; i < trimStr.length; i++) {
if (i % 2 === 1) {
let item = trimStr.substr(i - 1, 2)
result.push(parseInt(`0x${item}`, 16))
};
}
let returnDataArr = [parseInt(`0x${crcValue.substring(2, 4)}`, 16), parseInt(`0x${crcValue.substring(0, 2)}`, 16)]
result.push(returnDataArr[0])
result.push(returnDataArr[1])
if (isAll) {
return Buffer.from(result)
} else {
return Buffer.from(returnDataArr)
}
}
}
sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
async checkPerssion(model, filter) {
let { ctx } = this
try {
let res = await ctx.model[model].find(filter)
if (res && res.length) {
return true
} else {
return false
}
} catch (err) {
return false
}
}
}
module.exports = UtilsService;

24
developedcode/cegongji/back/app/udp/controller/index.js

@ -0,0 +1,24 @@
module.exports = app => {
return {
async handle(udp) {
udp.on('error', (err) => {
console.log(`udp error:\n${err.stack}`);
});
udp.on('message', (msg, rinfo) => {
//cantest接口
if (app.cantest1) {
app.mqttServe.publish(`/cantest1`, msg.toString(), {
qos: 2,
retain: false,
})
}
});
udp.on('listening', () => {
let address = udp.address();
console.log(`udp listening ${address.address}:${address.port}`);
});
},
};
};

73
developedcode/cegongji/back/config/config.default.js

@ -0,0 +1,73 @@
/* eslint valid-jsdoc: "off" */
'use strict';
/**
* @param {Egg.EggAppInfo} appInfo app info
*/
module.exports = appInfo => {
/**
* built-in config
* @type {Egg.EggAppConfig}
**/
const config = exports = {};
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1690006251624_276';
// add your middleware config here
config.middleware = [];
// add your user config here
const userConfig = {
// myAppName: 'egg',
};
config.mongoose = {
url: "mongodb://127.0.0.1:27020/cegongji",
options: {
useUnifiedTopology: true,
useNewUrlParser: true,
}
};
// 加载 errorHandler 中间件
config.middleware = ['errorHandler'];
// 只对 /api 前缀的 url 路径生效
config.errorHandler = {
match: '/api',
};
//udp
config.udp = {
port: 5000
};
//跨域
config.security = {
csrf: {
enable: false,
ignoreJSON: true
},
domainWhiteList: ['http://localhost:80']
};
config.cors = {
origin: '*',
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
};
config.io = {
init: {},
namespace: {
// 命名空间
'/message/': {
connectionMiddleware: [],
packetMiddleware: []
}
}
}
config.jwt = {
secret: 'xby123456', //自定义token的加密条件字符串,可按各自的需求填写
};
return {
...config,
...userConfig,
};
};

29
developedcode/cegongji/back/config/plugin.js

@ -0,0 +1,29 @@
"use strict";
/** @type Egg.EggPlugin */
module.exports = {
// had enabled by egg
// static: {
// enable: true,
// }
jwt: {
enable: true,
package: 'egg-jwt',
},
mongoose: {
enable: true,
package: "egg-mongoose",
},
validate: {
enable: true,
package: 'egg-validate',
},
udp: {
enable: true,
package: 'egg-udp',
},
cors: {
enable: true,
package: 'egg-cors',
},
};

5
developedcode/cegongji/back/jsconfig.json

@ -0,0 +1,5 @@
{
"include": [
"**/*"
]
}

56
developedcode/cegongji/back/package.json

@ -0,0 +1,56 @@
{
"name": "cegongji",
"version": "1.0.0",
"description": "cegongji back",
"private": true,
"egg": {
"declarations": true
},
"dependencies": {
"crc": "^4.3.2",
"dayjs": "^1.11.9",
"egg": "^3",
"egg-cors": "^2.2.3",
"egg-jwt": "^3.1.7",
"egg-mongoose": "^3.3.1",
"egg-scripts": "^2",
"egg-udp": "^1.1.0",
"egg-validate": "^2.0.2",
"js-md5": "^0.7.3",
"lodash": "^4.17.21",
"mongoose": "^7.4.2",
"mqtt": "4.1.0",
"serialport": "^10.5.0"
},
"devDependencies": {
"egg-bin": "^5",
"egg-ci": "^2",
"egg-mock": "^5",
"eslint": "^8",
"eslint-config-egg": "^12"
},
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-cegongji",
"stop": "egg-scripts stop --title=egg-server-cegongji",
"dev": "egg-bin dev",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
},
"ci": {
"version": "16, 18",
"type": "github"
},
"repository": {
"type": "git",
"url": ""
},
"author": "lichong",
"license": "MIT"
}

20
developedcode/cegongji/back/test/app/controller/home.test.js

@ -0,0 +1,20 @@
'use strict';
const { app, assert } = require('egg-mock/bootstrap');
describe('test/app/controller/home.test.js', () => {
it('should assert', async () => {
const pkg = require('../../../package.json');
assert(app.config.keys.startsWith(pkg.name));
// const ctx = app.mockContext({});
// yield ctx.service.xx();
});
it('should GET /', async () => {
return app.httpRequest()
.get('/')
.expect('hi, egg')
.expect(200);
});
});

4
developedcode/cegongji/front/.browserslistrc

@ -0,0 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11

5
developedcode/cegongji/front/.editorconfig

@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

23
developedcode/cegongji/front/.gitignore

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

44
developedcode/cegongji/front/README.md

@ -0,0 +1,44 @@
# default
## Project setup
```
# yarn
yarn
# npm
npm install
# pnpm
pnpm install
```
### Compiles and hot-reloads for development
```
# yarn
yarn dev
# npm
npm run dev
# pnpm
pnpm dev
```
### Compiles and minifies for production
```
# yarn
yarn build
# npm
npm run build
# pnpm
pnpm build
```
### Customize configuration
See [Configuration Reference](https://vitejs.dev/config/).

16
developedcode/cegongji/front/index.html

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en" class="overflow-y-auto">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>测功机</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

19
developedcode/cegongji/front/jsconfig.json

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

34
developedcode/cegongji/front/package.json

@ -0,0 +1,34 @@
{
"name": "cegongji",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@mdi/font": "7.0.96",
"@soerenmartius/vue3-clipboard": "^0.1.2",
"axios": "^1.4.0",
"dayjs": "^1.11.7",
"element-plus": "^2.3.9",
"js-md5": "^0.7.3",
"lodash": "^4.17.21",
"mqtt": "4.1.0",
"nprogress": "^0.2.0",
"pinia": "^2.0.35",
"pinia-plugin-persist": "^1.0.0",
"qs": "^6.11.1",
"screenfull": "^6.0.2",
"ulid": "^2.3.0",
"vue": "^3.2.47",
"vue-router": "^4.1.6",
"vuetify": "^3.3.13"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.2.1",
"sass": "^1.62.1",
"vite": "^4.3.4",
"vite-plugin-vuetify": "^1.0.0"
}
}

BIN
developedcode/cegongji/front/public/favicon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

43
developedcode/cegongji/front/src/App.vue

@ -0,0 +1,43 @@
<template>
<div>
<v-snackbar v-if="snackbars.length" v-for="(snackItem, index) in snackbars" v-model="snackItem.snackbar"
:location="snackItem.location" :color="snackItem.snackbar_color" :timeout="snackItem.timeout"
:style="`top:${(index + 1) * 8 + index * 48}px !important;padding-top:0px;`" @input="cleanSnackbar"
:key="snackItem.id">
<v-tooltip v-if="snackItem.snackbar_message.length > 39" location="top" :key="`${snackItem.id}_tooltip`">
<template v-slot:activator="{ props }">
<div v-bind="props">
{{ snackItem.snackbar_message.slice(0, 39) + "..." }}
</div>
</template>
<span>{{ snackItem.snackbar_message }}</span>
</v-tooltip>
<template v-else>{{ snackItem.snackbar_message }}</template>
<template v-slot:actions v-if="snackItem.timeout === -1">
<v-btn flat @click="closeSnackbar(index)" tag="div"> 关闭 </v-btn>
</template>
</v-snackbar>
<router-view>
</router-view>
</div>
</template>
<script>
import mixin from "@/mixin/totalmixin";
export default {
name: "app",
mixins: [mixin],
data() {
return {};
},
async mounted() {
},
methods: {},
watch: {},
computed: {},
};
</script>
<style scoped lang="scss"></style>

31
developedcode/cegongji/front/src/api/dualFlowMotor.js

@ -0,0 +1,31 @@
import _axios from "@/plugins/axios";
//初始化轮毂电机页面
export function initDualFlowMotor(data) {
return _axios({
url: `v1/initDualFlowMotor`,
method: "POST",
data,
});
}
//轮毂电机发送数据
export function sendDualFlowMotor(data) {
return _axios({
url: `v1/sendDualFlowMotor`,
method: "POST",
data,
});
}
//todo 保存轮毂电机数据
export function saveDualFlowMotor(data) {
return _axios({
url: `v1/saveDualFlowMotor`,
method: "POST",
data,
});
}

26
developedcode/cegongji/front/src/api/home.js

@ -0,0 +1,26 @@
import _axios from "@/plugins/axios";
//初始化发送一次命令
export function startSendOnce(data) {
return _axios({
url: `v1/startSendOnce`,
method: "POST",
data
});
}
//启动定时发送命令
export function startSend(data) {
return _axios({
url: `v1/startSend`,
method: "POST",
data
});
}
//清除定时发送命令
export function endSend() {
return _axios({
url: `v1/endSend`,
method: "get"
});
}

23
developedcode/cegongji/front/src/api/hubMotor.js

@ -0,0 +1,23 @@
import _axios from "@/plugins/axios";
//初始化轮毂电机页面
export function initHubMotor(data) {
return _axios({
url: `v1/initHubMotor`,
method: "POST",
data,
});
}
//初始化轮毂电机页面
export function saveHubMotor(data) {
return _axios({
url: `v1/saveHubMotor`,
method: "POST",
data,
});
}

30
developedcode/cegongji/front/src/api/message.js

@ -0,0 +1,30 @@
import _axios from "@/plugins/axios";
//打开端口
export function openCom(data) {
return _axios({
url: `v1/openCom`,
method: "POST",
data,
});
}
//打开端口
export function closeCom(data) {
return _axios({
url: `v1/closeCom`,
method: "POST",
data,
});
}
//发送指令
export function tranRip(data) {
return _axios({
url: `v1/message`,
method: "POST",
data,
});
}

36
developedcode/cegongji/front/src/api/user.js

@ -0,0 +1,36 @@
import _axios from "@/plugins/axios";
//登录
export function login(data) {
return _axios({
url: `v1/auth`,
method: "POST",
data,
});
}
//注册
export function registe(data) {
return _axios({
url: `v1/adduser`,
method: "POST",
data,
});
}
//注册列表
export function registeList(data) {
return _axios({
url: `v1/getUserList`,
method: "POST",
data,
});
}
//登陆历史列表
export function loginHistoryList(data) {
return _axios({
url: `v1/getUserLoginList`,
method: "POST",
data,
});
}

16
developedcode/cegongji/front/src/assets/css/base.css

@ -0,0 +1,16 @@
html::-webkit-scrollbar {
width: 10px;
}
html::-webkit-scrollbar-thumb {
background: #ccc;
border-radius: 5px;
}
html {
scrollbar-width: 10px;
}
.v-container {
max-width: 1490px !important;
}

BIN
developedcode/cegongji/front/src/assets/img/login-bg.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

BIN
developedcode/cegongji/front/src/assets/img/login-logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save