mm_os 1.3.3 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +36 -0
- package/README.md +25 -166
- package/conf.json +3 -0
- package/core/base/index.js +29 -0
- package/core/base/mqtt/index.js +268 -0
- package/core/base/mqtt/lib.js +40 -0
- package/core/base/web/index.js +110 -0
- package/core/com/api/com.json +4 -0
- package/{bin → core}/com/api/config.tpl.json +9 -7
- package/{bin → core}/com/api/drive.js +239 -64
- package/{bin → core}/com/api/index.js +8 -9
- package/{bin → core}/com/api/oauth.js +23 -14
- package/core/com/api/script.js +32 -0
- package/core/com/db/com.json +4 -0
- package/{bin → core}/com/db/drive.js +99 -65
- package/{bin → core}/com/db/index.js +2 -2
- package/core/com/event/com.json +4 -0
- package/{bin → core}/com/event/config.tpl.json +2 -2
- package/core/com/event/drive.js +125 -0
- package/{bin → core}/com/event/index.js +5 -10
- package/core/com/event/script.js +26 -0
- package/core/com/eventer/com.js +450 -0
- package/core/com/eventer/com.json +4 -0
- package/core/com/middleware/com.js +128 -0
- package/core/com/middleware/com.json +4 -0
- package/core/com/middleware/config.tpl.json +8 -0
- package/core/com/middleware/script.js +9 -0
- package/core/com/mqtt/com.json +4 -0
- package/core/com/mqtt/config.tpl.json +12 -0
- package/core/com/mqtt/drive.js +139 -0
- package/core/com/mqtt/index.js +138 -0
- package/core/com/mqtt/script.js +33 -0
- package/core/com/msg/com.js +296 -0
- package/core/com/msg/com.json +4 -0
- package/{bin → core}/com/nav/drive.js +42 -17
- package/{bin → core}/com/nav/index.js +4 -4
- package/core/com/nav/tpl/admin_pc/page_channel.vue +299 -0
- package/core/com/nav/tpl/admin_pc/page_config.vue +279 -0
- package/core/com/nav/tpl/admin_pc/page_config_form.vue +194 -0
- package/core/com/nav/tpl/admin_pc/page_default.vue +287 -0
- package/core/com/nav/tpl/admin_pc/page_form.vue +180 -0
- package/core/com/nav/tpl/admin_pc/page_lang.vue +265 -0
- package/core/com/nav/tpl/admin_pc/page_nav.vue +313 -0
- package/core/com/nav/tpl/admin_pc/page_table.vue +285 -0
- package/core/com/nav/tpl/admin_pc/page_type.vue +313 -0
- package/core/com/nav/tpl/dev_pc/page_channel.vue +253 -0
- package/core/com/nav/tpl/dev_pc/page_config.vue +253 -0
- package/core/com/nav/tpl/dev_pc/page_default.vue +247 -0
- package/core/com/nav/tpl/dev_pc/page_form.vue +162 -0
- package/core/com/nav/tpl/dev_pc/page_nav.vue +253 -0
- package/core/com/nav/tpl/dev_pc/page_table.vue +247 -0
- package/core/com/nav/tpl/dev_pc/page_type.vue +253 -0
- package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_channel.vue +231 -231
- package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_default.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_pc/page_form.vue +9 -9
- package/{bin → core}/com/nav/tpl/home_pc/page_list.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_pc/page_nav.vue +221 -221
- package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_type.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_pc/page_view.vue +8 -8
- package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_channel.vue +231 -231
- package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_default.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_phone/page_form.vue +9 -9
- package/{bin → core}/com/nav/tpl/home_phone/page_list.vue +231 -231
- package/{bin/com/nav/tpl/admin_pc → core/com/nav/tpl/home_phone}/page_nav.vue +236 -220
- package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_type.vue +231 -231
- package/{bin → core}/com/nav/tpl/home_phone/page_view.vue +8 -8
- package/core/com/nav/viewmodel.js +296 -0
- package/{bin → core}/com/param/config.tpl.json +24 -0
- package/{bin → core}/com/param/drive.js +47 -15
- package/core/com/plugin/com.json +4 -0
- package/core/com/plugin/config.tpl.json +20 -0
- package/{bin → core}/com/plugin/drive.js +5 -8
- package/{bin → core}/com/plugin/index.js +11 -56
- package/core/com/socket/README.md +47 -0
- package/core/com/socket/com.json +4 -0
- package/core/com/socket/config.tpl.json +14 -0
- package/{bin → core}/com/socket/drive.js +74 -51
- package/{bin → core}/com/socket/index.js +4 -2
- package/{bin → core}/com/socket/script.js +8 -6
- package/core/com/sql/config.tpl.json +70 -0
- package/{bin → core}/com/sql/drive.js +281 -58
- package/core/com/static/com.json +4 -0
- package/core/com/static/config.tpl.json +20 -0
- package/{bin → core}/com/static/drive.js +6 -4
- package/{bin → core}/com/static/index.js +5 -1
- package/core/com/task/com.json +4 -0
- package/core/com/task/config.tpl.json +24 -0
- package/core/com/task/drive.js +374 -0
- package/{bin → core}/com/task/index.js +14 -20
- package/core/com/task/script.js +37 -0
- package/core/com/timer/com.js +217 -0
- package/core/com/timer/com.json +4 -0
- package/core/com/tpl/com.js +19 -0
- package/core/com/tpl/com.json +4 -0
- package/index.js +161 -740
- package/lib/actions.js +50 -0
- package/lib/app.js +73 -0
- package/lib/base.js +355 -0
- package/lib/com.js +31 -0
- package/lib/game.js +31 -0
- package/lib/ref.js +121 -0
- package/middleware/cors/index.js +57 -0
- package/middleware/cors/middleware.json +7 -0
- package/middleware/mqtt_base/index.js +10 -0
- package/middleware/mqtt_base/middleware.json +8 -0
- package/{waf.js → middleware/waf/index.js} +12 -2
- package/middleware/waf/middleware.json +9 -0
- package/middleware/web_base/index.js +67 -0
- package/middleware/web_base/middleware.json +9 -0
- package/middleware/web_event/index.js +411 -0
- package/middleware/web_event/middleware.json +10 -0
- package/middleware/web_proxy/index.js +24 -0
- package/middleware/web_proxy/middleware.json +9 -0
- package/middleware/web_router/index.js +33 -0
- package/middleware/web_router/middleware.json +10 -0
- package/middleware/web_socket/index.js +21 -0
- package/middleware/web_socket/middleware.json +9 -0
- package/middleware/web_static/index.js +26 -0
- package/middleware/web_static/middleware.json +9 -0
- package/nodemon.json +12 -2
- package/package.json +56 -66
- package/.gitattributes +0 -5
- package/bin/com/README.md +0 -2
- package/bin/com/api/script.js +0 -14
- package/bin/com/cmd/README.md +0 -3
- package/bin/com/cmd/config.tpl.json +0 -41
- package/bin/com/cmd/drive.js +0 -512
- package/bin/com/cmd/index.js +0 -213
- package/bin/com/cmd/old/5w2h.js +0 -54
- package/bin/com/cmd/old/drive.js +0 -423
- package/bin/com/cmd/script.js +0 -11
- package/bin/com/event/drive.js +0 -69
- package/bin/com/event/script.js +0 -12
- package/bin/com/nav/tpl/admin_pc/page_channel.vue +0 -234
- package/bin/com/nav/tpl/admin_pc/page_default.vue +0 -236
- package/bin/com/nav/tpl/admin_pc/page_form.vue +0 -152
- package/bin/com/nav/tpl/admin_pc/page_table.vue +0 -236
- package/bin/com/nav/tpl/admin_pc/page_type.vue +0 -234
- package/bin/com/nav/tpl/home_phone/page_nav.vue +0 -221
- package/bin/com/nav/viewmodel.js +0 -161
- package/bin/com/plugin/config.tpl.json +0 -11
- package/bin/com/socket/config.tpl.json +0 -8
- package/bin/com/sql/config.tpl.json +0 -34
- package/bin/com/static/config.tpl.json +0 -11
- package/bin/com/task/config.tpl.json +0 -13
- package/bin/com/task/drive.js +0 -288
- package/bin/com/task/script.js +0 -38
- package/bin/com.js +0 -74
- package/bin/mm.conf +0 -48
- package/bin/static/404.html +0 -52
- package/bin/static/README.md +0 -1
- package/bin/static/css/font-awesome.min.css +0 -7
- package/bin/static/css/mm_base.css +0 -220
- package/bin/static/css/mm_common.css +0 -518
- package/bin/static/css/mm_component.css +0 -307
- package/bin/static/css/mm_expand.css +0 -634
- package/bin/static/css/mm_theme.css +0 -291
- package/bin/static/css/new_file.css +0 -79
- package/bin/static/css/swiper.min.css +0 -12
- package/bin/static/favicon.ico +0 -0
- package/bin/static/font/FontAwesome.otf +0 -0
- package/bin/static/font/HelveticaNeue.eot +0 -0
- package/bin/static/font/HelveticaNeue.otf +0 -0
- package/bin/static/font/HelveticaNeue.svg +0 -1273
- package/bin/static/font/HelveticaNeue.woff +0 -0
- package/bin/static/font/HelveticaNeue.woff2 +0 -0
- package/bin/static/font/fontawesome-webfont.eot +0 -0
- package/bin/static/font/fontawesome-webfont.svg +0 -2671
- package/bin/static/font/fontawesome-webfont.ttf +0 -0
- package/bin/static/font/fontawesome-webfont.woff +0 -0
- package/bin/static/font/fontawesome-webfont.woff2 +0 -0
- package/bin/static/h5.html +0 -325
- package/bin/static/highlight/highlight.pack.js +0 -2
- package/bin/static/highlight/styles/a11y-dark.css +0 -99
- package/bin/static/highlight/styles/a11y-light.css +0 -99
- package/bin/static/highlight/styles/agate.css +0 -108
- package/bin/static/highlight/styles/an-old-hope.css +0 -89
- package/bin/static/highlight/styles/androidstudio.css +0 -66
- package/bin/static/highlight/styles/arduino-light.css +0 -88
- package/bin/static/highlight/styles/arta.css +0 -73
- package/bin/static/highlight/styles/ascetic.css +0 -45
- package/bin/static/highlight/styles/atelier-cave-dark.css +0 -83
- package/bin/static/highlight/styles/atelier-cave-light.css +0 -85
- package/bin/static/highlight/styles/atelier-dune-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-dune-light.css +0 -69
- package/bin/static/highlight/styles/atelier-estuary-dark.css +0 -84
- package/bin/static/highlight/styles/atelier-estuary-light.css +0 -84
- package/bin/static/highlight/styles/atelier-forest-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-forest-light.css +0 -69
- package/bin/static/highlight/styles/atelier-heath-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-heath-light.css +0 -69
- package/bin/static/highlight/styles/atelier-lakeside-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-lakeside-light.css +0 -69
- package/bin/static/highlight/styles/atelier-plateau-dark.css +0 -84
- package/bin/static/highlight/styles/atelier-plateau-light.css +0 -84
- package/bin/static/highlight/styles/atelier-savanna-dark.css +0 -84
- package/bin/static/highlight/styles/atelier-savanna-light.css +0 -84
- package/bin/static/highlight/styles/atelier-seaside-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-seaside-light.css +0 -69
- package/bin/static/highlight/styles/atelier-sulphurpool-dark.css +0 -69
- package/bin/static/highlight/styles/atelier-sulphurpool-light.css +0 -69
- package/bin/static/highlight/styles/atom-one-dark-reasonable.css +0 -77
- package/bin/static/highlight/styles/atom-one-dark.css +0 -96
- package/bin/static/highlight/styles/atom-one-light.css +0 -96
- package/bin/static/highlight/styles/brown-paper.css +0 -64
- package/bin/static/highlight/styles/brown-papersq.png +0 -0
- package/bin/static/highlight/styles/codepen-embed.css +0 -60
- package/bin/static/highlight/styles/color-brewer.css +0 -71
- package/bin/static/highlight/styles/darcula.css +0 -77
- package/bin/static/highlight/styles/dark.css +0 -63
- package/bin/static/highlight/styles/darkula.css +0 -6
- package/bin/static/highlight/styles/default.css +0 -99
- package/bin/static/highlight/styles/docco.css +0 -97
- package/bin/static/highlight/styles/dracula.css +0 -76
- package/bin/static/highlight/styles/far.css +0 -71
- package/bin/static/highlight/styles/foundation.css +0 -88
- package/bin/static/highlight/styles/github-gist.css +0 -79
- package/bin/static/highlight/styles/github.css +0 -99
- package/bin/static/highlight/styles/gml.css +0 -78
- package/bin/static/highlight/styles/googlecode.css +0 -89
- package/bin/static/highlight/styles/grayscale.css +0 -101
- package/bin/static/highlight/styles/gruvbox-dark.css +0 -108
- package/bin/static/highlight/styles/gruvbox-light.css +0 -108
- package/bin/static/highlight/styles/hopscotch.css +0 -83
- package/bin/static/highlight/styles/hybrid.css +0 -102
- package/bin/static/highlight/styles/idea.css +0 -97
- package/bin/static/highlight/styles/ir-black.css +0 -73
- package/bin/static/highlight/styles/isbl-editor-dark.css +0 -112
- package/bin/static/highlight/styles/isbl-editor-light.css +0 -112
- package/bin/static/highlight/styles/kimbie.dark.css +0 -74
- package/bin/static/highlight/styles/kimbie.light.css +0 -74
- package/bin/static/highlight/styles/lightfair.css +0 -87
- package/bin/static/highlight/styles/magula.css +0 -70
- package/bin/static/highlight/styles/mono-blue.css +0 -59
- package/bin/static/highlight/styles/monokai-sublime.css +0 -83
- package/bin/static/highlight/styles/monokai.css +0 -70
- package/bin/static/highlight/styles/nord.css +0 -309
- package/bin/static/highlight/styles/obsidian.css +0 -88
- package/bin/static/highlight/styles/ocean.css +0 -74
- package/bin/static/highlight/styles/paraiso-dark.css +0 -72
- package/bin/static/highlight/styles/paraiso-light.css +0 -72
- package/bin/static/highlight/styles/pojoaque.css +0 -83
- package/bin/static/highlight/styles/pojoaque.jpg +0 -0
- package/bin/static/highlight/styles/purebasic.css +0 -96
- package/bin/static/highlight/styles/qtcreator_dark.css +0 -83
- package/bin/static/highlight/styles/qtcreator_light.css +0 -83
- package/bin/static/highlight/styles/railscasts.css +0 -106
- package/bin/static/highlight/styles/rainbow.css +0 -85
- package/bin/static/highlight/styles/routeros.css +0 -108
- package/bin/static/highlight/styles/school-book.css +0 -69
- package/bin/static/highlight/styles/school-book.png +0 -0
- package/bin/static/highlight/styles/shades-of-purple.css +0 -97
- package/bin/static/highlight/styles/solarized-dark.css +0 -84
- package/bin/static/highlight/styles/solarized-light.css +0 -84
- package/bin/static/highlight/styles/sunburst.css +0 -102
- package/bin/static/highlight/styles/tomorrow-night-blue.css +0 -75
- package/bin/static/highlight/styles/tomorrow-night-bright.css +0 -74
- package/bin/static/highlight/styles/tomorrow-night-eighties.css +0 -74
- package/bin/static/highlight/styles/tomorrow-night.css +0 -75
- package/bin/static/highlight/styles/tomorrow.css +0 -72
- package/bin/static/highlight/styles/vs.css +0 -68
- package/bin/static/highlight/styles/vs2015.css +0 -115
- package/bin/static/highlight/styles/xcode.css +0 -104
- package/bin/static/highlight/styles/xt256.css +0 -92
- package/bin/static/highlight/styles/zenburn.css +0 -80
- package/bin/static/highlight/vue-highlight.js +0 -29
- package/bin/static/ifame.html +0 -24
- package/bin/static/img/add.png +0 -0
- package/bin/static/img/avatar.png +0 -0
- package/bin/static/img/banner_2.png +0 -0
- package/bin/static/img/default.png +0 -0
- package/bin/static/img/loading.svg +0 -1
- package/bin/static/img/logo.png +0 -0
- package/bin/static/img/logo1.png +0 -0
- package/bin/static/img/logo_gray.png +0 -0
- package/bin/static/img/logo_round.png +0 -0
- package/bin/static/img/mm.ico +0 -0
- package/bin/static/img/mm.jpg +0 -0
- package/bin/static/img/select.png +0 -0
- package/bin/static/img/web.png +0 -0
- package/bin/static/index.html +0 -12
- package/bin/static/js/clipboard.min.js +0 -257
- package/bin/static/js/css.min.js +0 -1
- package/bin/static/js/echarts.js +0 -22
- package/bin/static/js/html5.min.js +0 -1
- package/bin/static/js/jquery.lazyload.min.js +0 -2
- package/bin/static/js/jquery.min.js +0 -4189
- package/bin/static/js/jquery.scrollstop.min.js +0 -2
- package/bin/static/js/mm-requirejs-vue.js +0 -283
- package/bin/static/js/mm_check.js +0 -490
- package/bin/static/js/mm_flexble.js +0 -112
- package/bin/static/js/mm_picker.js +0 -1417
- package/bin/static/js/mm_pinyinlite.js +0 -873
- package/bin/static/js/mm_sdk.js +0 -2841
- package/bin/static/js/mm_ui_expand.js +0 -468
- package/bin/static/js/mm_vue.js +0 -376
- package/bin/static/js/mm_vue_ui.js +0 -2375
- package/bin/static/js/mm_websocket.js +0 -145
- package/bin/static/js/require.js +0 -5
- package/bin/static/js/sortable.min.js +0 -3
- package/bin/static/js/swiper.min.js +0 -13
- package/bin/static/js/text.min.js +0 -1
- package/bin/static/js/vue-router.min.js +0 -6
- package/bin/static/js/vue.js +0 -12338
- package/bin/static/js/vuedraggable.min.js +0 -2
- package/bin/static/js/vuex.min.js +0 -6
- package/bin/static/src/components/bar/mm_action.vue +0 -19
- package/bin/static/src/components/bar/mm_buy.vue +0 -19
- package/bin/static/src/components/bar/mm_chat.vue +0 -18
- package/bin/static/src/components/bar/mm_count.vue +0 -18
- package/bin/static/src/components/bar/mm_filter.vue +0 -18
- package/bin/static/src/components/bar/mm_search.vue +0 -18
- package/bin/static/src/components/bar/mm_sort.vue +0 -18
- package/bin/static/src/components/bar/mm_tag.vue +0 -18
- package/bin/static/src/components/bar/mm_title.vue +0 -19
- package/bin/static/src/components/content/mm_pre.vue +0 -70
- package/bin/static/src/components/expand/mm_drag.vue +0 -39
- package/bin/static/src/components/item/mm_article.vue +0 -115
- package/bin/static/src/components/item/mm_base.vue +0 -26
- package/bin/static/src/components/item/mm_contact.vue +0 -25
- package/bin/static/src/components/item/mm_goods.vue +0 -23
- package/bin/static/src/components/item/mm_img.vue +0 -21
- package/bin/static/src/components/item/mm_media.vue +0 -18
- package/bin/static/src/components/item/mm_message.vue +0 -18
- package/bin/static/src/components/item/mm_music.vue +0 -95
- package/bin/static/src/components/item/mm_news.vue +0 -22
- package/bin/static/src/components/item/mm_number.vue +0 -26
- package/bin/static/src/components/item/mm_question.vue +0 -35
- package/bin/static/src/components/item/mm_user.vue +0 -22
- package/bin/static/src/components/item/mm_video.vue +0 -95
- package/bin/static/src/components/slide/mm_slide_card.vue +0 -64
- package/bin/static/src/components/slide/mm_slide_img.vue +0 -47
- package/bin/static/src/components/slide/mm_slide_page.vue +0 -8
- package/bin/static/src/components/slide/mm_slide_text.vue +0 -54
- package/bin/static/src/main.js +0 -84
- package/bin/static/src/mixins/form.js +0 -223
- package/bin/static/src/mixins/item.js +0 -242
- package/bin/static/src/mixins/list.js +0 -244
- package/bin/static/src/mixins/page.js +0 -1011
- package/bin/static/src/mm_component.js +0 -74
- package/bin/static/src/router.js +0 -72
- package/bin/static/src/store/user.js +0 -75
- package/bin/static/src/store/web.js +0 -50
- package/bin/static/user/1/number_info.xlsx +0 -0
- package/bin/static/w3c.html +0 -94
- package/init.js +0 -55
- package/update.md +0 -1
- /package/{bin → core}/com/api/README.md +0 -0
- /package/{bin → core}/com/api/rpc.js +0 -0
- /package/{bin → core}/com/db/README.md +0 -0
- /package/{bin → core}/com/event/README.md +0 -0
- /package/{bin/com/socket → core/com/mqtt}/README.md +0 -0
- /package/{bin → core}/com/nav/README.md +0 -0
- /package/{bin → core}/com/nav/config.tpl.json +0 -0
- /package/{bin → core}/com/param/README.md +0 -0
- /package/{bin → core}/com/param/index.js +0 -0
- /package/{bin → core}/com/param/script.js +0 -0
- /package/{bin → core}/com/param/test.js +0 -0
- /package/{bin → core}/com/plugin/README.md +0 -0
- /package/{bin → core}/com/plugin/script.js +0 -0
- /package/{bin → core}/com/sql/README.md +0 -0
- /package/{bin → core}/com/sql/index.js +0 -0
- /package/{bin → core}/com/sql/script.js +0 -0
- /package/{bin → core}/com/static/README.md +0 -0
- /package/{bin → core}/com/static/script.js +0 -0
- /package/{bin → core}/com/task/README.md +0 -0
- /package/{bin/rps.bat → rps.bat} +0 -0
- /package/{bin/tps.bat → tps.bat} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
// webscoket请求路由地址
|
|
3
|
+
"path": "/ws/{0}",
|
|
4
|
+
// 名称
|
|
5
|
+
"name": "{0}",
|
|
6
|
+
// websocket标题
|
|
7
|
+
"title": "示例websocket",
|
|
8
|
+
// 描述,用来介绍该websocket程序是做什么用的
|
|
9
|
+
"description": "用来测试",
|
|
10
|
+
// webscoket调用的脚本文件
|
|
11
|
+
"func_file": "./index.js",
|
|
12
|
+
// 同步消息循环发送的时间间隔
|
|
13
|
+
"interval": 1000
|
|
14
|
+
}
|
|
@@ -25,8 +25,10 @@ class Drive extends Item {
|
|
|
25
25
|
* 配置参数
|
|
26
26
|
*/
|
|
27
27
|
this.config = {
|
|
28
|
-
//
|
|
29
|
-
"
|
|
28
|
+
// 名称, 由中英文和下“_”组成, 用于修改或卸载 例如: demo
|
|
29
|
+
"name": "",
|
|
30
|
+
// 状态 0未启用,1启用
|
|
31
|
+
"state": 1,
|
|
30
32
|
// socket 服务名称
|
|
31
33
|
"name": "",
|
|
32
34
|
// socket 服务标题
|
|
@@ -115,7 +117,7 @@ Drive.prototype.onmessage = async function(bodyStr, ctx, token) {
|
|
|
115
117
|
var ret = await this.run(bodyStr, ctx, token);
|
|
116
118
|
if (ret) {
|
|
117
119
|
var ws = ctx.websocket;
|
|
118
|
-
if (typeof(ret)
|
|
120
|
+
if (typeof(ret) === "object") {
|
|
119
121
|
ws.send(JSON.stringify(ret));
|
|
120
122
|
} else {
|
|
121
123
|
ws.send(ret);
|
|
@@ -132,7 +134,7 @@ Drive.prototype.onmessage = async function(bodyStr, ctx, token) {
|
|
|
132
134
|
* @return {Boolean} 返回true表示做状态修改, 例如关闭时为true, 会删除该客户端
|
|
133
135
|
*/
|
|
134
136
|
Drive.prototype.noticy = async function(type, bodyStr, ctx, token) {
|
|
135
|
-
$.log.debug('通知:', '关闭了');
|
|
137
|
+
// $.log.debug('通知:', '关闭了');
|
|
136
138
|
return true;
|
|
137
139
|
};
|
|
138
140
|
|
|
@@ -201,7 +203,7 @@ Drive.prototype.set_socket = function(ctx, token) {
|
|
|
201
203
|
* @param {String} token 临时访问牌
|
|
202
204
|
*/
|
|
203
205
|
Drive.prototype.success = function(ctx, token) {
|
|
204
|
-
var ret = $.ret.bl(true, '
|
|
206
|
+
var ret = $.ret.bl(true, 'connection succeeded');
|
|
205
207
|
// 首次响应加上身份牌
|
|
206
208
|
ret.result.token = token;
|
|
207
209
|
// ID为0表示连接成功
|
|
@@ -233,7 +235,7 @@ Drive.prototype.send = async function(body, token) {
|
|
|
233
235
|
if (token) {
|
|
234
236
|
var list = this.clients[token];
|
|
235
237
|
if (list) {
|
|
236
|
-
list.
|
|
238
|
+
list.map(async (ctx) => {
|
|
237
239
|
ctx.websocket.send(body);
|
|
238
240
|
})
|
|
239
241
|
}
|
|
@@ -241,7 +243,7 @@ Drive.prototype.send = async function(body, token) {
|
|
|
241
243
|
var dt = this.clients;
|
|
242
244
|
for (let k in dt) {
|
|
243
245
|
var list = dt[k];
|
|
244
|
-
list.
|
|
246
|
+
list.map(async (ctx) => {
|
|
245
247
|
ctx.websocket.send(body);
|
|
246
248
|
});
|
|
247
249
|
}
|
|
@@ -277,59 +279,77 @@ Drive.prototype.req = async function(method, params, func, token) {
|
|
|
277
279
|
* @return {Object} 返回执行结果
|
|
278
280
|
*/
|
|
279
281
|
Drive.prototype.run = async function(bodyStr, ctx, token) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
282
|
+
try {
|
|
283
|
+
if(Object.prototype.toString.call(bodyStr) == "[object Uint8Array]"){
|
|
284
|
+
bodyStr = bodyStr.toString();
|
|
285
|
+
}
|
|
286
|
+
var ws = ctx.websocket;
|
|
287
|
+
var json = bodyStr.toJson();
|
|
288
|
+
var req = ctx.request;
|
|
289
|
+
var request = Object.assign({}, {
|
|
290
|
+
headers: req.headers,
|
|
291
|
+
query: req.query,
|
|
292
|
+
token: token
|
|
293
|
+
});
|
|
294
|
+
if (json) {
|
|
295
|
+
var {
|
|
296
|
+
id,
|
|
297
|
+
method
|
|
298
|
+
} = json;
|
|
299
|
+
if (json.result && id) {
|
|
300
|
+
var lt = ws.list_msg;
|
|
301
|
+
var len = lt.length;
|
|
302
|
+
var has = false;
|
|
303
|
+
for (var i = 0; i < len; i++) {
|
|
304
|
+
var o = lt[i];
|
|
305
|
+
if (id === o.id) {
|
|
306
|
+
o.func(json.result);
|
|
307
|
+
lt.splice(i, 1);
|
|
308
|
+
has = true;
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
295
311
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
ret.
|
|
312
|
+
if (has) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
} else if (method) {
|
|
316
|
+
if (this.methods[method]) {
|
|
317
|
+
var ret;
|
|
318
|
+
var result = await this.methods[method](json.params, ws, request);
|
|
319
|
+
if (result) {
|
|
320
|
+
if (typeof(result) == "object" && !Array.isArray(result)) {
|
|
321
|
+
ret = Object.assign({
|
|
322
|
+
id
|
|
323
|
+
}, result);
|
|
324
|
+
} else {
|
|
325
|
+
ret = {};
|
|
326
|
+
if (id) {
|
|
327
|
+
ret.id = id
|
|
328
|
+
}
|
|
329
|
+
ret.result = result;
|
|
314
330
|
}
|
|
315
|
-
ret.result = result;
|
|
316
331
|
}
|
|
332
|
+
return ret;
|
|
317
333
|
}
|
|
318
|
-
return ret;
|
|
319
334
|
}
|
|
335
|
+
return await this.main(json, ws, request);
|
|
320
336
|
}
|
|
321
|
-
return this.main(
|
|
337
|
+
return await this.main(bodyStr, ws, request);
|
|
338
|
+
} catch (err) {
|
|
339
|
+
$.log.error("webscoket 错误", err);
|
|
340
|
+
return $.log.error(10000, "代码错误!原因:" + err.toString());
|
|
322
341
|
}
|
|
323
|
-
return this.main(bodyStr, ws);
|
|
324
342
|
};
|
|
325
343
|
|
|
326
344
|
/**
|
|
327
345
|
* 非定义函数时执行
|
|
328
346
|
* @param {Object} body 请求正文
|
|
329
|
-
* @param {Object}
|
|
330
|
-
* @
|
|
347
|
+
* @param {Object} params 参数
|
|
348
|
+
* @param {Object} ws Websocket服务
|
|
349
|
+
* @param {Object} request 请求协议头
|
|
350
|
+
* @return {Object} 返回执行结果
|
|
331
351
|
*/
|
|
332
|
-
Drive.prototype.main = async function(body, websocket) {
|
|
352
|
+
Drive.prototype.main = async function(body, websocket, request) {
|
|
333
353
|
return null;
|
|
334
354
|
};
|
|
335
355
|
|
|
@@ -337,7 +357,7 @@ Drive.prototype.main = async function(body, websocket) {
|
|
|
337
357
|
* 初始化函数, 用于定义开放给前端的函数
|
|
338
358
|
*/
|
|
339
359
|
Drive.prototype.init = async function init() {
|
|
340
|
-
|
|
360
|
+
|
|
341
361
|
};
|
|
342
362
|
|
|
343
363
|
/**
|
|
@@ -346,14 +366,17 @@ Drive.prototype.init = async function init() {
|
|
|
346
366
|
Drive.prototype.load_after = function() {
|
|
347
367
|
this.init();
|
|
348
368
|
var m = this.methods;
|
|
369
|
+
|
|
349
370
|
/**
|
|
350
371
|
* 获取所有方法
|
|
351
372
|
* @param {Object} params 参数
|
|
352
373
|
* @param {Object} ws Websocket服务
|
|
374
|
+
* @param {Object} request 请求协议头
|
|
375
|
+
* @return {Object} 返回执行结果
|
|
353
376
|
*/
|
|
354
|
-
m.get_method = function(params, ws) {
|
|
355
|
-
return
|
|
377
|
+
m.get_method = async function(params, ws, request) {
|
|
378
|
+
return Object.keys(m);
|
|
356
379
|
};
|
|
357
380
|
};
|
|
358
381
|
|
|
359
|
-
module.exports = Drive;
|
|
382
|
+
module.exports = Drive;
|
|
@@ -30,8 +30,9 @@ class Socket extends Index {
|
|
|
30
30
|
Socket.prototype.run = async function(ctx, next) {
|
|
31
31
|
await next();
|
|
32
32
|
var list = this.list;
|
|
33
|
-
const path = ctx.path;
|
|
33
|
+
const path = ctx.path.toLocaleLowerCase();
|
|
34
34
|
for (var i = 0, o; o = list[i++];) {
|
|
35
|
+
// console.log("监听webscoket路径是否正确", path === o.config.path);
|
|
35
36
|
if (path === o.config.path) {
|
|
36
37
|
o.add(ctx);
|
|
37
38
|
break;
|
|
@@ -67,4 +68,5 @@ Socket.prototype.load = function(path) {
|
|
|
67
68
|
});
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
+
|
|
72
|
+
module.exports = Socket;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 主函数, 用于处理未定义函数的消息
|
|
3
|
-
* @param {Object}
|
|
4
|
-
* @param {Object} ws
|
|
3
|
+
* @param {Object} params 参数
|
|
4
|
+
* @param {Object} ws Websocket服务
|
|
5
|
+
* @param {Object} request 请求协议头
|
|
6
|
+
* @return {Object} 返回执行结果
|
|
5
7
|
*/
|
|
6
|
-
exports.main = async function(body, ws) {
|
|
8
|
+
exports.main = async function(body, ws, request) {
|
|
7
9
|
$.log.debug('收到客户端推送数据', body);
|
|
8
10
|
};
|
|
9
11
|
|
|
@@ -20,7 +22,7 @@ exports.sync = async function(ws) {
|
|
|
20
22
|
*/
|
|
21
23
|
exports.init = async function() {
|
|
22
24
|
var m = this.methods;
|
|
23
|
-
|
|
25
|
+
|
|
24
26
|
/**
|
|
25
27
|
* 获取所有方法
|
|
26
28
|
* @param {Object} params 参数
|
|
@@ -29,7 +31,7 @@ exports.init = async function() {
|
|
|
29
31
|
m.get_method = function(params, ws) {
|
|
30
32
|
return Object.keys(m);
|
|
31
33
|
};
|
|
32
|
-
|
|
34
|
+
|
|
33
35
|
/**
|
|
34
36
|
* @param {Object} params 参数
|
|
35
37
|
* @param {Object} ws Websocket服务
|
|
@@ -37,4 +39,4 @@ exports.init = async function() {
|
|
|
37
39
|
m.test = function(params, ws) {
|
|
38
40
|
return "你好"
|
|
39
41
|
};
|
|
40
|
-
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
// SQL模板标题
|
|
3
|
+
"title": "示例sql模板",
|
|
4
|
+
// 调用的数据表
|
|
5
|
+
"table": "user_account",
|
|
6
|
+
// 表主键,用于getObj查询时
|
|
7
|
+
"key": "user_id",
|
|
8
|
+
// 排序方式,{0}表示支持前端传值来排序,传值方式例如:orderby=user_id
|
|
9
|
+
"orderby": "{0}",
|
|
10
|
+
// 默认排序方式,当前端没有传值的情况下,采用默认传值方式
|
|
11
|
+
"orderby_default": "`user_id` desc",
|
|
12
|
+
// 查询列表时返回的字段,{0}表示支持前端传值
|
|
13
|
+
"field": "{0}",
|
|
14
|
+
// 查询对象时返回的字段
|
|
15
|
+
"field_obj": "{0}",
|
|
16
|
+
// 默认返回字段
|
|
17
|
+
"field_default": "`username`, `phone`",
|
|
18
|
+
// 需要过滤的字段,*代表泛匹配 前面*表示以xxx结尾,后面*表示以xxx开头,前后*表示包含xxx的过滤
|
|
19
|
+
"field_hide": ["*password*", "*token*"],
|
|
20
|
+
// 传值分隔符,如果允许多个值,可以通过这个来分割,如果不允许传多个值则设置为空
|
|
21
|
+
"separator": "|",
|
|
22
|
+
// 关键词,用于过滤掉这些值不会写到查询条件中,同时用来识别传的参数
|
|
23
|
+
"keyword": {
|
|
24
|
+
// 数据表名,当"table":"{0}", 允许识别表明
|
|
25
|
+
"table": "table",
|
|
26
|
+
// 排序方式
|
|
27
|
+
"orderby": "orderby",
|
|
28
|
+
// 查询的字段
|
|
29
|
+
"field": "field",
|
|
30
|
+
// 页码
|
|
31
|
+
"page": "page",
|
|
32
|
+
// 页面大小
|
|
33
|
+
"size": "size",
|
|
34
|
+
// 总计,返回查询结果总数
|
|
35
|
+
"count": "count",
|
|
36
|
+
// 调用方式
|
|
37
|
+
"method": "method"
|
|
38
|
+
},
|
|
39
|
+
// 调用方式 add增 del删 set改 get查 get_obj查一条 import导入 export导出, 支持什么方式就传什么值,支持多个用空格分隔
|
|
40
|
+
"method": "add del set get get_obj import export del_repeat sum count",
|
|
41
|
+
// 查询条件转换
|
|
42
|
+
"query": {
|
|
43
|
+
// 当username=xx时,转为`username` like '%xxx%'的SQL语法
|
|
44
|
+
"username": "`username` like '%{0}%'"
|
|
45
|
+
},
|
|
46
|
+
// 修改时的查询条件
|
|
47
|
+
"where": {
|
|
48
|
+
// 当修改查询条件出现user_id=xx时,转为`user_id` = 'xxx'的SQL语法
|
|
49
|
+
"user_id": "`user_id` = '{0}'"
|
|
50
|
+
},
|
|
51
|
+
// 修改时值转换
|
|
52
|
+
"update": {
|
|
53
|
+
// 当修改的正文中出现username是转换为指定格式
|
|
54
|
+
"username": "`username` = '{0}'"
|
|
55
|
+
},
|
|
56
|
+
// 默认查询条件
|
|
57
|
+
"query_dedefault": {
|
|
58
|
+
|
|
59
|
+
},
|
|
60
|
+
// 默认添加项
|
|
61
|
+
"body_default": {
|
|
62
|
+
|
|
63
|
+
},
|
|
64
|
+
// SQL执行脚本,当设置js文件名后, 执行该SQL还将调用这个脚本
|
|
65
|
+
"func_file": "",
|
|
66
|
+
// 导入导出格式,转换导入、导出Eexcel时字段名和字段值
|
|
67
|
+
"format": [],
|
|
68
|
+
// 去重条件,需要查重、并去重的字段在这里写
|
|
69
|
+
"del_repeat": {}
|
|
70
|
+
}
|