mm_os 1.3.4 → 1.3.6

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.
Files changed (368) hide show
  1. package/README.en.md +36 -0
  2. package/README.md +25 -166
  3. package/conf.json +3 -0
  4. package/core/base/index.js +29 -0
  5. package/core/base/mqtt/index.js +268 -0
  6. package/core/base/mqtt/lib.js +40 -0
  7. package/core/base/web/index.js +110 -0
  8. package/core/com/api/com.json +4 -0
  9. package/{bin → core}/com/api/config.tpl.json +9 -7
  10. package/{bin → core}/com/api/drive.js +239 -64
  11. package/{bin → core}/com/api/index.js +8 -9
  12. package/{bin → core}/com/api/oauth.js +23 -14
  13. package/core/com/api/script.js +32 -0
  14. package/core/com/db/com.json +4 -0
  15. package/{bin → core}/com/db/drive.js +99 -65
  16. package/{bin → core}/com/db/index.js +2 -2
  17. package/core/com/event/com.json +4 -0
  18. package/{bin → core}/com/event/config.tpl.json +2 -2
  19. package/core/com/event/drive.js +125 -0
  20. package/{bin → core}/com/event/index.js +5 -10
  21. package/core/com/event/script.js +26 -0
  22. package/core/com/eventer/com.js +450 -0
  23. package/core/com/eventer/com.json +4 -0
  24. package/core/com/middleware/com.js +128 -0
  25. package/core/com/middleware/com.json +4 -0
  26. package/core/com/middleware/config.tpl.json +8 -0
  27. package/core/com/middleware/script.js +9 -0
  28. package/core/com/mqtt/com.json +4 -0
  29. package/core/com/mqtt/config.tpl.json +12 -0
  30. package/core/com/mqtt/drive.js +139 -0
  31. package/core/com/mqtt/index.js +138 -0
  32. package/core/com/mqtt/script.js +33 -0
  33. package/core/com/msg/com.js +296 -0
  34. package/core/com/msg/com.json +4 -0
  35. package/{bin → core}/com/nav/drive.js +42 -17
  36. package/{bin → core}/com/nav/index.js +4 -4
  37. package/core/com/nav/tpl/admin_pc/page_channel.vue +299 -0
  38. package/core/com/nav/tpl/admin_pc/page_config.vue +279 -0
  39. package/core/com/nav/tpl/admin_pc/page_config_form.vue +194 -0
  40. package/core/com/nav/tpl/admin_pc/page_default.vue +287 -0
  41. package/core/com/nav/tpl/admin_pc/page_form.vue +180 -0
  42. package/core/com/nav/tpl/admin_pc/page_lang.vue +265 -0
  43. package/core/com/nav/tpl/admin_pc/page_nav.vue +313 -0
  44. package/core/com/nav/tpl/admin_pc/page_table.vue +285 -0
  45. package/core/com/nav/tpl/admin_pc/page_type.vue +313 -0
  46. package/core/com/nav/tpl/dev_pc/page_channel.vue +253 -0
  47. package/core/com/nav/tpl/dev_pc/page_config.vue +253 -0
  48. package/core/com/nav/tpl/dev_pc/page_default.vue +247 -0
  49. package/core/com/nav/tpl/dev_pc/page_form.vue +162 -0
  50. package/core/com/nav/tpl/dev_pc/page_nav.vue +253 -0
  51. package/core/com/nav/tpl/dev_pc/page_table.vue +247 -0
  52. package/core/com/nav/tpl/dev_pc/page_type.vue +253 -0
  53. package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_channel.vue +231 -231
  54. package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_default.vue +231 -231
  55. package/{bin → core}/com/nav/tpl/home_pc/page_form.vue +9 -9
  56. package/{bin → core}/com/nav/tpl/home_pc/page_list.vue +231 -231
  57. package/{bin → core}/com/nav/tpl/home_pc/page_nav.vue +221 -221
  58. package/{bin/com/nav/tpl/home_phone → core/com/nav/tpl/home_pc}/page_type.vue +231 -231
  59. package/{bin → core}/com/nav/tpl/home_pc/page_view.vue +8 -8
  60. package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_channel.vue +231 -231
  61. package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_default.vue +231 -231
  62. package/{bin → core}/com/nav/tpl/home_phone/page_form.vue +9 -9
  63. package/{bin → core}/com/nav/tpl/home_phone/page_list.vue +231 -231
  64. package/{bin/com/nav/tpl/admin_pc → core/com/nav/tpl/home_phone}/page_nav.vue +236 -220
  65. package/{bin/com/nav/tpl/home_pc → core/com/nav/tpl/home_phone}/page_type.vue +231 -231
  66. package/{bin → core}/com/nav/tpl/home_phone/page_view.vue +8 -8
  67. package/core/com/nav/viewmodel.js +296 -0
  68. package/{bin → core}/com/param/config.tpl.json +24 -0
  69. package/{bin → core}/com/param/drive.js +47 -15
  70. package/core/com/plugin/com.json +4 -0
  71. package/core/com/plugin/config.tpl.json +20 -0
  72. package/{bin → core}/com/plugin/drive.js +5 -8
  73. package/{bin → core}/com/plugin/index.js +11 -56
  74. package/core/com/socket/README.md +47 -0
  75. package/core/com/socket/com.json +4 -0
  76. package/core/com/socket/config.tpl.json +14 -0
  77. package/{bin → core}/com/socket/drive.js +74 -51
  78. package/{bin → core}/com/socket/index.js +4 -2
  79. package/{bin → core}/com/socket/script.js +8 -6
  80. package/core/com/sql/config.tpl.json +70 -0
  81. package/{bin → core}/com/sql/drive.js +281 -58
  82. package/core/com/static/com.json +4 -0
  83. package/core/com/static/config.tpl.json +20 -0
  84. package/{bin → core}/com/static/drive.js +6 -4
  85. package/{bin → core}/com/static/index.js +5 -1
  86. package/core/com/task/com.json +4 -0
  87. package/core/com/task/config.tpl.json +24 -0
  88. package/core/com/task/drive.js +374 -0
  89. package/{bin → core}/com/task/index.js +14 -20
  90. package/core/com/task/script.js +37 -0
  91. package/core/com/timer/com.js +217 -0
  92. package/core/com/timer/com.json +4 -0
  93. package/core/com/tpl/com.js +19 -0
  94. package/core/com/tpl/com.json +4 -0
  95. package/index.js +161 -740
  96. package/lib/actions.js +50 -0
  97. package/lib/app.js +73 -0
  98. package/lib/base.js +355 -0
  99. package/lib/com.js +31 -0
  100. package/lib/game.js +31 -0
  101. package/lib/ref.js +121 -0
  102. package/middleware/cors/index.js +57 -0
  103. package/middleware/cors/middleware.json +7 -0
  104. package/middleware/mqtt_base/index.js +10 -0
  105. package/middleware/mqtt_base/middleware.json +8 -0
  106. package/{waf.js → middleware/waf/index.js} +12 -2
  107. package/middleware/waf/middleware.json +9 -0
  108. package/middleware/web_base/index.js +67 -0
  109. package/middleware/web_base/middleware.json +9 -0
  110. package/middleware/web_event/index.js +411 -0
  111. package/middleware/web_event/middleware.json +10 -0
  112. package/middleware/web_proxy/index.js +24 -0
  113. package/middleware/web_proxy/middleware.json +9 -0
  114. package/middleware/web_router/index.js +33 -0
  115. package/middleware/web_router/middleware.json +10 -0
  116. package/middleware/web_socket/index.js +21 -0
  117. package/middleware/web_socket/middleware.json +9 -0
  118. package/middleware/web_static/index.js +26 -0
  119. package/middleware/web_static/middleware.json +9 -0
  120. package/nodemon.json +12 -2
  121. package/package.json +56 -66
  122. package/.gitattributes +0 -5
  123. package/bin/com/README.md +0 -2
  124. package/bin/com/api/script.js +0 -14
  125. package/bin/com/cmd/README.md +0 -3
  126. package/bin/com/cmd/config.tpl.json +0 -41
  127. package/bin/com/cmd/drive.js +0 -512
  128. package/bin/com/cmd/index.js +0 -213
  129. package/bin/com/cmd/old/5w2h.js +0 -54
  130. package/bin/com/cmd/old/drive.js +0 -423
  131. package/bin/com/cmd/script.js +0 -11
  132. package/bin/com/event/drive.js +0 -69
  133. package/bin/com/event/script.js +0 -12
  134. package/bin/com/nav/tpl/admin_pc/page_channel.vue +0 -234
  135. package/bin/com/nav/tpl/admin_pc/page_default.vue +0 -236
  136. package/bin/com/nav/tpl/admin_pc/page_form.vue +0 -152
  137. package/bin/com/nav/tpl/admin_pc/page_table.vue +0 -236
  138. package/bin/com/nav/tpl/admin_pc/page_type.vue +0 -234
  139. package/bin/com/nav/tpl/home_phone/page_nav.vue +0 -221
  140. package/bin/com/nav/viewmodel.js +0 -161
  141. package/bin/com/plugin/config.tpl.json +0 -11
  142. package/bin/com/socket/config.tpl.json +0 -8
  143. package/bin/com/sql/config.tpl.json +0 -34
  144. package/bin/com/static/config.tpl.json +0 -11
  145. package/bin/com/task/config.tpl.json +0 -13
  146. package/bin/com/task/drive.js +0 -288
  147. package/bin/com/task/script.js +0 -38
  148. package/bin/com.js +0 -74
  149. package/bin/mm.conf +0 -48
  150. package/bin/static/404.html +0 -52
  151. package/bin/static/README.md +0 -1
  152. package/bin/static/css/font-awesome.min.css +0 -7
  153. package/bin/static/css/mm_base.css +0 -220
  154. package/bin/static/css/mm_common.css +0 -518
  155. package/bin/static/css/mm_component.css +0 -307
  156. package/bin/static/css/mm_expand.css +0 -634
  157. package/bin/static/css/mm_theme.css +0 -291
  158. package/bin/static/css/new_file.css +0 -79
  159. package/bin/static/css/swiper.min.css +0 -12
  160. package/bin/static/favicon.ico +0 -0
  161. package/bin/static/font/FontAwesome.otf +0 -0
  162. package/bin/static/font/HelveticaNeue.eot +0 -0
  163. package/bin/static/font/HelveticaNeue.otf +0 -0
  164. package/bin/static/font/HelveticaNeue.svg +0 -1273
  165. package/bin/static/font/HelveticaNeue.woff +0 -0
  166. package/bin/static/font/HelveticaNeue.woff2 +0 -0
  167. package/bin/static/font/fontawesome-webfont.eot +0 -0
  168. package/bin/static/font/fontawesome-webfont.svg +0 -2671
  169. package/bin/static/font/fontawesome-webfont.ttf +0 -0
  170. package/bin/static/font/fontawesome-webfont.woff +0 -0
  171. package/bin/static/font/fontawesome-webfont.woff2 +0 -0
  172. package/bin/static/h5.html +0 -325
  173. package/bin/static/highlight/highlight.pack.js +0 -2
  174. package/bin/static/highlight/styles/a11y-dark.css +0 -99
  175. package/bin/static/highlight/styles/a11y-light.css +0 -99
  176. package/bin/static/highlight/styles/agate.css +0 -108
  177. package/bin/static/highlight/styles/an-old-hope.css +0 -89
  178. package/bin/static/highlight/styles/androidstudio.css +0 -66
  179. package/bin/static/highlight/styles/arduino-light.css +0 -88
  180. package/bin/static/highlight/styles/arta.css +0 -73
  181. package/bin/static/highlight/styles/ascetic.css +0 -45
  182. package/bin/static/highlight/styles/atelier-cave-dark.css +0 -83
  183. package/bin/static/highlight/styles/atelier-cave-light.css +0 -85
  184. package/bin/static/highlight/styles/atelier-dune-dark.css +0 -69
  185. package/bin/static/highlight/styles/atelier-dune-light.css +0 -69
  186. package/bin/static/highlight/styles/atelier-estuary-dark.css +0 -84
  187. package/bin/static/highlight/styles/atelier-estuary-light.css +0 -84
  188. package/bin/static/highlight/styles/atelier-forest-dark.css +0 -69
  189. package/bin/static/highlight/styles/atelier-forest-light.css +0 -69
  190. package/bin/static/highlight/styles/atelier-heath-dark.css +0 -69
  191. package/bin/static/highlight/styles/atelier-heath-light.css +0 -69
  192. package/bin/static/highlight/styles/atelier-lakeside-dark.css +0 -69
  193. package/bin/static/highlight/styles/atelier-lakeside-light.css +0 -69
  194. package/bin/static/highlight/styles/atelier-plateau-dark.css +0 -84
  195. package/bin/static/highlight/styles/atelier-plateau-light.css +0 -84
  196. package/bin/static/highlight/styles/atelier-savanna-dark.css +0 -84
  197. package/bin/static/highlight/styles/atelier-savanna-light.css +0 -84
  198. package/bin/static/highlight/styles/atelier-seaside-dark.css +0 -69
  199. package/bin/static/highlight/styles/atelier-seaside-light.css +0 -69
  200. package/bin/static/highlight/styles/atelier-sulphurpool-dark.css +0 -69
  201. package/bin/static/highlight/styles/atelier-sulphurpool-light.css +0 -69
  202. package/bin/static/highlight/styles/atom-one-dark-reasonable.css +0 -77
  203. package/bin/static/highlight/styles/atom-one-dark.css +0 -96
  204. package/bin/static/highlight/styles/atom-one-light.css +0 -96
  205. package/bin/static/highlight/styles/brown-paper.css +0 -64
  206. package/bin/static/highlight/styles/brown-papersq.png +0 -0
  207. package/bin/static/highlight/styles/codepen-embed.css +0 -60
  208. package/bin/static/highlight/styles/color-brewer.css +0 -71
  209. package/bin/static/highlight/styles/darcula.css +0 -77
  210. package/bin/static/highlight/styles/dark.css +0 -63
  211. package/bin/static/highlight/styles/darkula.css +0 -6
  212. package/bin/static/highlight/styles/default.css +0 -99
  213. package/bin/static/highlight/styles/docco.css +0 -97
  214. package/bin/static/highlight/styles/dracula.css +0 -76
  215. package/bin/static/highlight/styles/far.css +0 -71
  216. package/bin/static/highlight/styles/foundation.css +0 -88
  217. package/bin/static/highlight/styles/github-gist.css +0 -79
  218. package/bin/static/highlight/styles/github.css +0 -99
  219. package/bin/static/highlight/styles/gml.css +0 -78
  220. package/bin/static/highlight/styles/googlecode.css +0 -89
  221. package/bin/static/highlight/styles/grayscale.css +0 -101
  222. package/bin/static/highlight/styles/gruvbox-dark.css +0 -108
  223. package/bin/static/highlight/styles/gruvbox-light.css +0 -108
  224. package/bin/static/highlight/styles/hopscotch.css +0 -83
  225. package/bin/static/highlight/styles/hybrid.css +0 -102
  226. package/bin/static/highlight/styles/idea.css +0 -97
  227. package/bin/static/highlight/styles/ir-black.css +0 -73
  228. package/bin/static/highlight/styles/isbl-editor-dark.css +0 -112
  229. package/bin/static/highlight/styles/isbl-editor-light.css +0 -112
  230. package/bin/static/highlight/styles/kimbie.dark.css +0 -74
  231. package/bin/static/highlight/styles/kimbie.light.css +0 -74
  232. package/bin/static/highlight/styles/lightfair.css +0 -87
  233. package/bin/static/highlight/styles/magula.css +0 -70
  234. package/bin/static/highlight/styles/mono-blue.css +0 -59
  235. package/bin/static/highlight/styles/monokai-sublime.css +0 -83
  236. package/bin/static/highlight/styles/monokai.css +0 -70
  237. package/bin/static/highlight/styles/nord.css +0 -309
  238. package/bin/static/highlight/styles/obsidian.css +0 -88
  239. package/bin/static/highlight/styles/ocean.css +0 -74
  240. package/bin/static/highlight/styles/paraiso-dark.css +0 -72
  241. package/bin/static/highlight/styles/paraiso-light.css +0 -72
  242. package/bin/static/highlight/styles/pojoaque.css +0 -83
  243. package/bin/static/highlight/styles/pojoaque.jpg +0 -0
  244. package/bin/static/highlight/styles/purebasic.css +0 -96
  245. package/bin/static/highlight/styles/qtcreator_dark.css +0 -83
  246. package/bin/static/highlight/styles/qtcreator_light.css +0 -83
  247. package/bin/static/highlight/styles/railscasts.css +0 -106
  248. package/bin/static/highlight/styles/rainbow.css +0 -85
  249. package/bin/static/highlight/styles/routeros.css +0 -108
  250. package/bin/static/highlight/styles/school-book.css +0 -69
  251. package/bin/static/highlight/styles/school-book.png +0 -0
  252. package/bin/static/highlight/styles/shades-of-purple.css +0 -97
  253. package/bin/static/highlight/styles/solarized-dark.css +0 -84
  254. package/bin/static/highlight/styles/solarized-light.css +0 -84
  255. package/bin/static/highlight/styles/sunburst.css +0 -102
  256. package/bin/static/highlight/styles/tomorrow-night-blue.css +0 -75
  257. package/bin/static/highlight/styles/tomorrow-night-bright.css +0 -74
  258. package/bin/static/highlight/styles/tomorrow-night-eighties.css +0 -74
  259. package/bin/static/highlight/styles/tomorrow-night.css +0 -75
  260. package/bin/static/highlight/styles/tomorrow.css +0 -72
  261. package/bin/static/highlight/styles/vs.css +0 -68
  262. package/bin/static/highlight/styles/vs2015.css +0 -115
  263. package/bin/static/highlight/styles/xcode.css +0 -104
  264. package/bin/static/highlight/styles/xt256.css +0 -92
  265. package/bin/static/highlight/styles/zenburn.css +0 -80
  266. package/bin/static/highlight/vue-highlight.js +0 -29
  267. package/bin/static/ifame.html +0 -24
  268. package/bin/static/img/add.png +0 -0
  269. package/bin/static/img/avatar.png +0 -0
  270. package/bin/static/img/banner_2.png +0 -0
  271. package/bin/static/img/default.png +0 -0
  272. package/bin/static/img/loading.svg +0 -1
  273. package/bin/static/img/logo.png +0 -0
  274. package/bin/static/img/logo1.png +0 -0
  275. package/bin/static/img/logo_gray.png +0 -0
  276. package/bin/static/img/logo_round.png +0 -0
  277. package/bin/static/img/mm.ico +0 -0
  278. package/bin/static/img/mm.jpg +0 -0
  279. package/bin/static/img/select.png +0 -0
  280. package/bin/static/img/web.png +0 -0
  281. package/bin/static/index.html +0 -12
  282. package/bin/static/js/clipboard.min.js +0 -257
  283. package/bin/static/js/css.min.js +0 -1
  284. package/bin/static/js/echarts.js +0 -22
  285. package/bin/static/js/html5.min.js +0 -1
  286. package/bin/static/js/jquery.lazyload.min.js +0 -2
  287. package/bin/static/js/jquery.min.js +0 -4189
  288. package/bin/static/js/jquery.scrollstop.min.js +0 -2
  289. package/bin/static/js/mm-requirejs-vue.js +0 -283
  290. package/bin/static/js/mm_check.js +0 -490
  291. package/bin/static/js/mm_flexble.js +0 -112
  292. package/bin/static/js/mm_picker.js +0 -1417
  293. package/bin/static/js/mm_pinyinlite.js +0 -873
  294. package/bin/static/js/mm_sdk.js +0 -2841
  295. package/bin/static/js/mm_ui_expand.js +0 -468
  296. package/bin/static/js/mm_vue.js +0 -376
  297. package/bin/static/js/mm_vue_ui.js +0 -2375
  298. package/bin/static/js/mm_websocket.js +0 -145
  299. package/bin/static/js/require.js +0 -5
  300. package/bin/static/js/sortable.min.js +0 -3
  301. package/bin/static/js/swiper.min.js +0 -13
  302. package/bin/static/js/text.min.js +0 -1
  303. package/bin/static/js/vue-router.min.js +0 -6
  304. package/bin/static/js/vue.js +0 -12338
  305. package/bin/static/js/vuedraggable.min.js +0 -2
  306. package/bin/static/js/vuex.min.js +0 -6
  307. package/bin/static/src/components/bar/mm_action.vue +0 -19
  308. package/bin/static/src/components/bar/mm_buy.vue +0 -19
  309. package/bin/static/src/components/bar/mm_chat.vue +0 -18
  310. package/bin/static/src/components/bar/mm_count.vue +0 -18
  311. package/bin/static/src/components/bar/mm_filter.vue +0 -18
  312. package/bin/static/src/components/bar/mm_search.vue +0 -18
  313. package/bin/static/src/components/bar/mm_sort.vue +0 -18
  314. package/bin/static/src/components/bar/mm_tag.vue +0 -18
  315. package/bin/static/src/components/bar/mm_title.vue +0 -19
  316. package/bin/static/src/components/content/mm_pre.vue +0 -70
  317. package/bin/static/src/components/expand/mm_drag.vue +0 -39
  318. package/bin/static/src/components/item/mm_article.vue +0 -115
  319. package/bin/static/src/components/item/mm_base.vue +0 -26
  320. package/bin/static/src/components/item/mm_contact.vue +0 -25
  321. package/bin/static/src/components/item/mm_goods.vue +0 -23
  322. package/bin/static/src/components/item/mm_img.vue +0 -21
  323. package/bin/static/src/components/item/mm_media.vue +0 -18
  324. package/bin/static/src/components/item/mm_message.vue +0 -18
  325. package/bin/static/src/components/item/mm_music.vue +0 -95
  326. package/bin/static/src/components/item/mm_news.vue +0 -22
  327. package/bin/static/src/components/item/mm_number.vue +0 -26
  328. package/bin/static/src/components/item/mm_question.vue +0 -35
  329. package/bin/static/src/components/item/mm_user.vue +0 -22
  330. package/bin/static/src/components/item/mm_video.vue +0 -95
  331. package/bin/static/src/components/slide/mm_slide_card.vue +0 -64
  332. package/bin/static/src/components/slide/mm_slide_img.vue +0 -47
  333. package/bin/static/src/components/slide/mm_slide_page.vue +0 -8
  334. package/bin/static/src/components/slide/mm_slide_text.vue +0 -54
  335. package/bin/static/src/main.js +0 -84
  336. package/bin/static/src/mixins/form.js +0 -223
  337. package/bin/static/src/mixins/item.js +0 -242
  338. package/bin/static/src/mixins/list.js +0 -244
  339. package/bin/static/src/mixins/page.js +0 -1011
  340. package/bin/static/src/mm_component.js +0 -74
  341. package/bin/static/src/router.js +0 -72
  342. package/bin/static/src/store/user.js +0 -75
  343. package/bin/static/src/store/web.js +0 -50
  344. package/bin/static/user/1/number_info.xlsx +0 -0
  345. package/bin/static/w3c.html +0 -94
  346. package/init.js +0 -55
  347. package/update.md +0 -1
  348. /package/{bin → core}/com/api/README.md +0 -0
  349. /package/{bin → core}/com/api/rpc.js +0 -0
  350. /package/{bin → core}/com/db/README.md +0 -0
  351. /package/{bin → core}/com/event/README.md +0 -0
  352. /package/{bin/com/socket → core/com/mqtt}/README.md +0 -0
  353. /package/{bin → core}/com/nav/README.md +0 -0
  354. /package/{bin → core}/com/nav/config.tpl.json +0 -0
  355. /package/{bin → core}/com/param/README.md +0 -0
  356. /package/{bin → core}/com/param/index.js +0 -0
  357. /package/{bin → core}/com/param/script.js +0 -0
  358. /package/{bin → core}/com/param/test.js +0 -0
  359. /package/{bin → core}/com/plugin/README.md +0 -0
  360. /package/{bin → core}/com/plugin/script.js +0 -0
  361. /package/{bin → core}/com/sql/README.md +0 -0
  362. /package/{bin → core}/com/sql/index.js +0 -0
  363. /package/{bin → core}/com/sql/script.js +0 -0
  364. /package/{bin → core}/com/static/README.md +0 -0
  365. /package/{bin → core}/com/static/script.js +0 -0
  366. /package/{bin → core}/com/task/README.md +0 -0
  367. /package/{bin/rps.bat → rps.bat} +0 -0
  368. /package/{bin/tps.bat → tps.bat} +0 -0
@@ -1,512 +0,0 @@
1
- const Item = require('mm_machine').Item;
2
- const Param = require('../param/drive.js');
3
-
4
- /**
5
- * 指令驱动类
6
- * @extends {Item}
7
- * @class
8
- */
9
- class Drive extends Item {
10
- /**
11
- * 构造函数
12
- * @param {String} dir 当前目录
13
- * @constructor
14
- */
15
- constructor(dir) {
16
- super(dir, __dirname);
17
- this.default_file = "./cmd.json";
18
-
19
- // 开关 true为开启, false为关闭
20
- this.onOff = true;
21
-
22
- /* 通用项 */
23
- // 配置参数
24
- this.config = {
25
- // 标识名
26
- "name": "demo",
27
- // 分组名
28
- "title": "指令标题",
29
- // 描述, 用于描述该接口有什么用的
30
- "description": "暂无描述",
31
- // 文件名
32
- "func_file": "./index.js",
33
- // 时态, 分before之前、main主要、after之后三个时态,
34
- "tense": "main",
35
- // 加载顺序,数字越大越后面加载
36
- "sort": 1000,
37
- // 分组
38
- "group": "default",
39
- // 类型: query便民查询,action执行,game游戏,orther其他,为空表示未分类
40
- "type": "",
41
- // 匹配关键词
42
- "match": [],
43
- // 不含关键词
44
- "not_match": [],
45
- // 去除关键词
46
- "remove": [],
47
- // 摘取
48
- "extract": [],
49
- // 第一阶段
50
- "stage1": {
51
- // 方式
52
- "mode": "fill",
53
- // 验证参数集
54
- "param": [
55
- // {
56
- // // 参数名
57
- // "name": "name",
58
- // // 参数介绍名
59
- // "title": "名称",
60
- // // 参数格式
61
- // "format": "",
62
- // // 缺少参数提示语,传键值对,例如:{ number: "快递单号多少?" }
63
- // "not_tip": "",
64
- // // 错误提示
65
- // "error_tip": "",
66
- // // 监听语法
67
- // "listen": "",
68
- // // 校验函数明
69
- // "func_name": ""
70
- // },
71
- ]
72
- },
73
- // 第二阶段
74
- "stage2": {
75
- // 方式
76
- "mode": "update",
77
- // 验证参数集
78
- "param": []
79
- },
80
- // 第三阶段
81
- "stage3": {
82
- // 方式
83
- "mode": "fill",
84
- // 验证参数集
85
- "param": []
86
- }
87
- }
88
- }
89
- };
90
-
91
-
92
- /**
93
- * 创建一个参数模型
94
- */
95
- Drive.prototype.model = function() {
96
- return {
97
- // 参数名
98
- "name": "name",
99
- // 参数介绍名
100
- "title": "名称",
101
- // 排序
102
- "sort": 10,
103
- // 监听语法
104
- "listen": "",
105
- // 参数格式
106
- "format": "",
107
- // 缺少参数提示语
108
- "not_tip": "",
109
- // 更新提示
110
- "update_tip": "",
111
- // 错误提示
112
- "error_tip": ""
113
- };
114
- };
115
-
116
-
117
- /**
118
- * 校验是否匹配指令
119
- * @param {Object} content 请求的正文
120
- * @param {Object} db 数据管理器
121
- * @return {Boolean} 匹配返回true,不匹配返回false
122
- */
123
- Drive.prototype.match = function(content, db) {
124
- var bl = false;
125
- var arr = this.config.match;
126
- for (var i = 0; i < arr.length; i++) {
127
- var format = arr[i];
128
- if (content.matchs(format)) {
129
- bl = true;
130
- break;
131
- }
132
- }
133
- return bl;
134
- };
135
-
136
-
137
- /**
138
- * 校验是否不含关键词
139
- * @param {Object} content 请求的正文
140
- * @param {Object} db 数据管理器
141
- * @return {Boolean} 不含返回true,含有返回false
142
- */
143
- Drive.prototype.not_match = function(content, db) {
144
- var bl = true;
145
- var arr = this.config.not_match;
146
- for (var i = 0; i < arr.length; i++) {
147
- var format = arr[i];
148
- if (content.matchs(format)) {
149
- bl = false;
150
- break;
151
- }
152
- }
153
- return bl;
154
- };
155
-
156
-
157
- /**
158
- * 抽取正文
159
- * @param {String} content 正文
160
- * @param {Object} db 数据管理器
161
- * @return {Object} 返回过滤后的参数
162
- */
163
- Drive.prototype.extract = async function(content, db) {
164
- var list = this.config.extract;
165
- var ret = content;
166
- var len = list.length;
167
- for (var i = 0; i < len; i++) {
168
- var format = list[i];
169
- var str = content.matchs(format);
170
- if (str) {
171
- ret += "\r\n" + str;
172
- }
173
- }
174
- return ret;
175
- };
176
-
177
-
178
- /**
179
- * 移除关键词
180
- * @param {String} content 正文
181
- * @param {Object} db 数据管理器
182
- * @return {Object} 返回过滤后的参数
183
- */
184
- Drive.prototype.remove = async function(content, db) {
185
- var list = this.config.remove;
186
- var len = list.length;
187
- for (var i = 0; i < len; i++) {
188
- var str = list[i];
189
- var value = content.matchs(str);
190
- if (value) {
191
- content = content.replace(value, '');
192
- }
193
- }
194
- return content;
195
- };
196
-
197
- /**
198
- * 修改提示
199
- * @param {Object} msg 消息上下文
200
- * @param {Object} db 数据管理器
201
- * @return {Object} 返回过滤后的参数
202
- */
203
- Drive.prototype.view_tip = async function(msg, db, tip) {
204
- var form = this.view(msg, db);
205
- tip = tip.replace("{form}", form);
206
- return tip;
207
- };
208
-
209
- /**
210
- * 1. 检验阶段, 判断条件是否满足
211
- * @param {Object} msg 消息上下文
212
- * @param {Object} db 数据管理器
213
- * @return {String} 验证失败返回错误提示
214
- */
215
- Drive.prototype.check = async function(msg, db) {
216
- // 校验是否匹配指令
217
- var bl = await this.match(msg.content, db);
218
- if (bl) {
219
- bl = await this.not_match(msg.content, db);
220
- }
221
- return bl;
222
- };
223
-
224
-
225
- /**
226
- * 2. 过滤阶段, 抽出主要的内容
227
- * @param {Object} msg 消息上下文
228
- * @param {Object} db 数据管理器
229
- * @return {Object} 返回过滤后的参数
230
- */
231
- Drive.prototype.filter = async function(msg, db) {
232
- var content = await this.extract(msg.content);
233
- return await this.remove(content);
234
- };
235
-
236
- /**
237
- * 3.1 信息补全阶段 用于通知用户补全执行的必要条件
238
- * @param {Object} msg 消息上下文
239
- * @param {Object} db 数据管理器
240
- * @param {Object} stage 阶段参数
241
- * @return {Object} 返回参数表单
242
- */
243
- Drive.prototype.fill = async function(msg, db, stage) {
244
- if (!stage) {
245
- return "";
246
- }
247
- var list = stage.param;
248
- if(!list || list.length === 0){
249
- return "";
250
- }
251
- var form = {};
252
- var keyword = "";
253
- // 是否有进行填充
254
- var has_fill = false;
255
-
256
- var ct = "";
257
- // 判断参数
258
- if (db.msg.form) {
259
- form = db.msg.form.toJson();
260
- } else {
261
- // 补全内容
262
- ct = db.msg.content;
263
- var len = list.length;
264
- for (var i = 0; i < len; i++) {
265
- var o = list[i];
266
- var k = o.name;
267
- if (!form[k]) {
268
- var value = ct.matchs(o.format);
269
- if (value) {
270
- form[k] = value;
271
- keyword = k;
272
- ct = ct.replace(value, '');
273
- has_fill = true;
274
- } else {
275
- form[k] = "";
276
- }
277
- }
278
- }
279
- }
280
- ct = msg.content;
281
- var tip = "";
282
- for (var k in form) {
283
- if (!form[k]) {
284
- keyword = k;
285
- var o = list.getObj({
286
- name: k
287
- });
288
- var value = ct.matchs(o.format);
289
- if (value) {
290
- form[k] = value;
291
- ct = ct.replace(value, '');
292
- has_fill = true;
293
- } else {
294
- msg.form = form;
295
- if (ct && o.error_tip && has_fill == false) {
296
- tip = await this.view_tip(msg, db, o.error_tip);
297
- } else if (o.not_tip) {
298
- tip = await this.view_tip(msg, db, o.not_tip);
299
- }
300
- break;
301
- }
302
- }
303
- }
304
-
305
- db.msg.keyword = keyword;
306
- db.msg.form = JSON.stringify(form);
307
- msg.form = form;
308
- return tip;
309
- };
310
-
311
- /**
312
- * 3.2 更新信息 用于用户更改完善
313
- * @param {Object} msg 消息上下文
314
- * @param {Object} db 数据管理器
315
- * @param {Object} stage 阶段参数
316
- * @return {Object} 返回参数表单
317
- */
318
- Drive.prototype.update = async function(msg, db, stage) {
319
- if (!stage || !db.msg.form) {
320
- return "";
321
- }
322
- var list = stage.param;
323
-
324
- var tip = "";
325
- var ct = msg.content;
326
- var keyword = db.msg.keyword + "";
327
- var form = db.msg.form.toJson();
328
- var len = list.length;
329
- for (var i = 0; i < len; i++) {
330
- var o = list[i];
331
- var k = o.name;
332
- if (form[k]) {
333
- var value = ct.matchs(o.listen);
334
- if (value) {
335
- if (o.update_tip) {
336
- tip = o.update_tip;
337
- } else {
338
- tip = "那" + value.replace(value.matchs("{不对}"), '是?');
339
- }
340
- keyword = k;
341
- break;
342
- } else if (keyword == k && o.format) {
343
- value = ct.matchs(o.format);
344
- if (value) {
345
- form[k] = value;
346
- ct = ct.replace(value, '');
347
- break;
348
- }
349
- }
350
- }
351
- }
352
- db.msg.keyword = keyword;
353
- db.msg.form = JSON.stringify(form);
354
- msg.form = form;
355
- return tip;
356
- };
357
-
358
- /**
359
- * 4. 执行阶段
360
- * @param {Object} msg 消息上下文
361
- * @param {Object} db 数据管理器
362
- * @return {Object} 返回执行结果
363
- */
364
- Drive.prototype.main = async function(msg, db) {
365
- return "你好";
366
- };
367
-
368
- /**
369
- * 5. 结束阶段 用来判断是否结束会话
370
- * @param {Object} msg 消息上下文
371
- * @param {Object} db 数据管理器
372
- * @param {Object} ret 执行结果
373
- * @return {Boolean} 返回会话结果
374
- */
375
- Drive.prototype.end = async function(msg, db, ret) {
376
- if (ret) {
377
- var txt = "";
378
- if (typeof(ret) == "object") {
379
- txt = JSON.stringify(ret);
380
- } else {
381
- txt = ret;
382
- }
383
- if (txt.indexOf('?') === -1) {
384
- db.msg.end = 1;
385
- }
386
- }
387
- return ret;
388
- };
389
-
390
- /**
391
- * 执行但不记录指令
392
- * @param {Object} msg 消息上下文
393
- * @param {Object} db 数据管理器
394
- * @return {Object} 返回执行结果
395
- */
396
- Drive.prototype.run_cmd = async function(msg, db) {
397
- var ret;
398
- // 第一步, 验证阶段
399
- var bl = await this.check(msg, db);
400
- if (bl) {
401
- ret = await this.run(msg, db);
402
- }
403
- return ret;
404
- };
405
-
406
-
407
- /**
408
- * 执行
409
- * @param {Object} msg 消息上下文
410
- * @param {Object} db 数据管理器
411
- * @return {Object} 返回执行结果
412
- */
413
- Drive.prototype.run_first = async function(msg, db) {
414
- var ret;
415
- // 第一步, 验证阶段
416
- var bl = await this.check(msg, db);
417
- if (bl) {
418
- ret = await this.run(msg, db);
419
- if(ret){
420
- // 如果匹配指令则将该消息定义为使用该指令
421
- db.msg.cmd = this.config.name;
422
- }
423
- }
424
- return ret;
425
- };
426
-
427
- /**
428
- * 执行前 用于有历史信息时,直接获取,不重复询问
429
- * @param {Object} msg 消息上下文
430
- * @param {Object} db 数据管理器
431
- * @return {Object} 执行结果, 如果有结果则直接跳过其他步骤,并返回
432
- */
433
- Drive.prototype.run_before = async function(msg, db) {
434
- return null;
435
- };
436
-
437
- /**
438
- * 执行后, 用于特殊情况下的不结束会话
439
- * @param {Object} msg 消息上下文
440
- * @param {Object} db 数据管理器
441
- * @param {Object} ret 执行结果
442
- * @return {Object}
443
- */
444
- Drive.prototype.run_after = async function(msg, db, ret) {
445
- return ret;
446
- };
447
-
448
- /**
449
- * 执行
450
- * @param {Object} param 状态参数
451
- * @param {Object} db 数据管理器
452
- * @return {Object} 返回执行结果
453
- */
454
- Drive.prototype.run = async function(msg, db) {
455
-
456
- // 第二步, 过滤阶段
457
- msg.content = await this.filter(msg, db);
458
-
459
- // 执行前
460
- var ret = await this.run_before(msg, db);
461
- if (!ret) {
462
- // 第三步, 信息补全或更新阶段
463
- var stage = this.config["stage" + db.msg.stage];
464
- if (stage) {
465
- var mode = stage.mode ? stage.mode : "fill";
466
- if (this[mode]) {
467
- ret = await this[mode](msg, db, stage);
468
- }
469
- }
470
-
471
- if (!ret) {
472
- // 第五步, 执行阶段
473
- ret = await this.main(msg, db);
474
-
475
- // 第六步, 结束会话阶段
476
- ret = this.end(msg, db, ret);
477
- }
478
- }
479
- // 执行后
480
- ret = await this.run_after(msg, db, ret);
481
- return ret;
482
- };
483
-
484
- /**
485
- * 查看参数
486
- * @param {Object} param 状态参数
487
- * @param {Object} db 数据管理器
488
- * @return {Object} 返回结构化参数
489
- */
490
- Drive.prototype.view = function(msg, db) {
491
- var ret = "";
492
- var json = msg.form;
493
- if (json) {
494
- var stage = this.config.stage1;
495
- if (stage) {
496
- var list = stage.param;
497
- if (list) {
498
- var len = list.length;
499
- for (var i = 0; i < len; i++) {
500
- var o = list[i];
501
- var value = json[o.name];
502
- if (value) {
503
- ret += o.title + ": " + value + "\r\n";
504
- }
505
- }
506
- }
507
- }
508
- }
509
- return ret.trim();
510
- };
511
-
512
- module.exports = Drive;
@@ -1,213 +0,0 @@
1
- const Index = require('mm_machine').Index;
2
- const Drive = require('./drive');
3
-
4
- /**
5
- * Cmd导航类
6
- * @extends {Index}
7
- * @class
8
- */
9
- class Cmd extends Index {
10
- /**
11
- * 构造函数
12
- * @param {Object} scope 作用域
13
- * @param {String} title 标题
14
- * @constructor
15
- */
16
- constructor(scope, title) {
17
- super(scope, __dirname);
18
- this.Drive = Drive;
19
- this.type = "cmd";
20
- this.title = title;
21
- this.list_before = [];
22
- this.list_main = [];
23
- this.list_after = [];
24
- }
25
- }
26
-
27
- /**
28
- * 执行导航
29
- * @param {Object} msg 消息
30
- * @param {Object} db 数据管理器
31
- * @param {String} table 表名
32
- * @return {Object|String}
33
- */
34
- Cmd.prototype.run = async function(msg, db, table) {
35
- var ret;
36
- // 判断是否含有消息和消息正文
37
- if (msg && msg.content) {
38
- db.msg = {
39
- content: "",
40
- content_last: msg.content,
41
- form: "",
42
- stage: 1
43
- };
44
-
45
- // 判断是否启用数据库存储消息,如果表名为空则不存储消息
46
- if (table) {
47
- db.table = table;
48
- db.key = "message_id";
49
- var query = {
50
- from_user: msg.from_user,
51
- to_user: msg.to_user,
52
- group: msg.group,
53
- type: msg.type,
54
- end: 0
55
- };
56
- // 获取当前未结束的会话记录
57
- var msg_log = await db.getObj(query);
58
- // 如果不存在未结束会话,则创建新会话记录
59
- if (!msg_log) {
60
- var bl = await db.add(msg);
61
- if (bl) {
62
- msg_log = await db.getObj(query);
63
- if (msg_log) {
64
- msg_log.create_time = new Date().toStr('yyyy-MM-dd hh:mm:ss');
65
- }
66
- } else {
67
- console.log('添加微信消息到wechat_message表失败!');
68
- return null;
69
- }
70
- } else if (msg_log.content_last !== msg.content) {
71
- // 判断是否重复会话内容,如果未重复则添加新内容
72
- msg_log.content += '\r\n' + msg.content;
73
- }
74
- msg_log.content_last = msg.content;
75
- db.msg = msg_log;
76
-
77
- var lt = this.list_before;
78
- for (var i = 0, o; o = lt[i++];) {
79
- if (o.onOff) {
80
- ret = await o.run_cmd(msg, db);
81
- if (ret) {
82
- break;
83
- }
84
- }
85
- }
86
- if (!ret) {
87
- // 判断会话记录是否锁定了指令, 如果存在则继续执行该指令程序
88
- if (msg_log.cmd) {
89
- // 检索指令驱动是否存在
90
- var drive = this.list.getObj({
91
- config: {
92
- name: msg_log.cmd
93
- }
94
- });
95
-
96
- if (drive) {
97
- // 如果存在则执行指令
98
- ret = await drive.run(msg, db);
99
- } else {
100
- // 如果不存在则结束会话, 并创建新会话
101
- db.msg.end = 1;
102
- var bl = await db.add(msg);
103
- if (bl) {
104
- msg_log = await db.getObj(query);
105
- if (msg_log) {
106
- msg_log.create_time = new Date().toStr('yyyy-MM-dd hh:mm:ss');
107
- }
108
- db.msg = msg_log;
109
- }
110
- }
111
- }
112
-
113
- if (db.msg.keyword) {
114
- // 添加消息
115
- msg.content = db.msg.keyword + "\r\n" + msg.content;
116
- }
117
- }
118
- }
119
- if (!ret) {
120
- var lt = this.list_main;
121
- for (var i = 0, o; o = lt[i++];) {
122
- if (o.onOff) {
123
- ret = await o.run_first(msg, db);
124
- if (ret) {
125
- break;
126
- }
127
- }
128
- }
129
- }
130
- if (!ret) {
131
- var lt = this.list_after;
132
- for (var i = 0, o; o = lt[i++];) {
133
- if (o.onOff) {
134
- ret = await o.run_first(msg, db);
135
- if (ret) {
136
- break;
137
- }
138
- }
139
- }
140
- }
141
- }
142
- return ret;
143
- };
144
-
145
- /**
146
- * 执行排序
147
- */
148
- Cmd.prototype.sort = async function() {
149
- this.list.sort(function(o1, o2) {
150
- var p1 = o1.sort;
151
- var p2 = o2.sort;
152
- return p2 - p1;
153
- });
154
- this.sort_tense();
155
- };
156
-
157
- /**
158
- * 排序时态
159
- */
160
- Cmd.prototype.sort_tense = async function() {
161
- this.list_before.clear();
162
- this.list_after.clear();
163
- this.list_main.clear();
164
-
165
- var lt = this.list;
166
- for (var i = 0; i < lt.length; i++) {
167
- var o = lt[i];
168
- switch (o.config.tense) {
169
- case "before":
170
- this.list_before.push(o);
171
- break;
172
- case "after":
173
- this.list_after.push(o);
174
- break;
175
- default:
176
- this.list_main.push(o);
177
- break;
178
- }
179
- }
180
- };
181
-
182
- /* 导出指令 */
183
- exports.Cmd = Cmd;
184
-
185
- /**
186
- * Cmd事件池
187
- */
188
- if (!$.pool.cmd) {
189
- $.pool.cmd = {};
190
- }
191
-
192
- /**
193
- * Cmd管理器,用于创建缓存
194
- * @param {String} scope 作用域
195
- * @param {string} title 标题
196
- * @return {Object} 返回一个缓存类
197
- */
198
- function cmd_admin(scope, title) {
199
- if (!scope) {
200
- scope = $.val.scope + '';
201
- }
202
- var obj = $.pool.cmd[scope];
203
- if (!obj) {
204
- $.pool.cmd[scope] = new Cmd(scope, title);
205
- obj = $.pool.cmd[scope];
206
- }
207
- return obj;
208
- }
209
-
210
- /**
211
- * @module 导出Cmd管理器
212
- */
213
- exports.cmd_admin = cmd_admin;