mm_os 1.3.4 → 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.
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
@@ -0,0 +1,296 @@
1
+ /**
2
+ * 视图模型
3
+ * @class
4
+ */
5
+ class ViewModel {
6
+ /**
7
+ * 配置参数
8
+ * @param {Object} config
9
+ */
10
+ constructor(config) {
11
+
12
+ }
13
+ }
14
+
15
+ /**
16
+ * 获取显示类型
17
+ * @param {String} key
18
+ * @param {Boolean} f 是否带格式
19
+ * @return {String} 返回显示类型
20
+ */
21
+ ViewModel.prototype.get_type = function(key, f) {
22
+ var show = '';
23
+ switch (key) {
24
+ case "search":
25
+ show = f ? "select" : "";
26
+ break;
27
+ case "view":
28
+ show = "text";
29
+ break;
30
+ case "table":
31
+ show = f ? "select" : "text";
32
+ break;
33
+ case "edit":
34
+ show = f ? "select" : "input";
35
+ break;
36
+ case "list":
37
+ show = "text";
38
+ break;
39
+ case "details":
40
+ show = "text";
41
+ break;
42
+ case "batch":
43
+ show = f ? "select" : "";
44
+ break;
45
+ case "filter":
46
+ show = f ? "select" : "";
47
+ break;
48
+ default:
49
+ show = f ? "select" : "";
50
+ break;
51
+ }
52
+ return show;
53
+ };
54
+
55
+ /**
56
+ * 查询显示方式
57
+ * @param {Array} arr
58
+ * @param {String} key
59
+ * @param {Boolean} f 是否带格式
60
+ * @return {String}
61
+ */
62
+ ViewModel.prototype.get_show = function(arr, key, f) {
63
+ var bl = false;
64
+ var show = '';
65
+ for (var i = 0; i < arr.length; i++) {
66
+ var str = arr[i];
67
+ if (str.indexOf(key + "_no") !== -1) {
68
+ bl = true;
69
+ break;
70
+ } else if (str.indexOf(key + "_input") !== -1) {
71
+ show = 'input';
72
+ break;
73
+ } else if (str.indexOf(key + "_select") !== -1) {
74
+ show = 'select';
75
+ break;
76
+ } else if (str.indexOf(key + "_text") !== -1) {
77
+ show = 'text';
78
+ break;
79
+ }
80
+ }
81
+ if (!show && !bl) {
82
+ show = this.get_type(key, f);
83
+ }
84
+ return show;
85
+ };
86
+
87
+ /**
88
+ * 获取表格所需键值对
89
+ * @param {Object} model 模型
90
+ * @return {Object} 返回视图所用模型
91
+ */
92
+ ViewModel.prototype.field = async function(model) {
93
+ var list = model.param.list;
94
+ if (!list) {
95
+ model.param.list = [];
96
+ return [];
97
+ }
98
+ var field;
99
+ if (model.file.indexOf('_form') !== -1 || model.file.indexOf('_view') !== -1) {
100
+ field = model.sql.field_obj || '';
101
+ } else {
102
+ field = model.sql.field_default || '';
103
+ }
104
+ var requireds = [];
105
+ var add = model.param.add;
106
+ if (add) {
107
+ requireds = add.body_required;
108
+ }
109
+ var arr = field.replace(/`/g, '').split(',');
110
+ var pm = [];
111
+ for (var i = 0; i < list.length; i++) {
112
+ var o = list[i];
113
+ var name = o.name;
114
+ if (arr.indexOf(name) !== -1) {
115
+ var obj = Object.assign({}, o);
116
+ var format = model.sql.format.getObj({
117
+ key: name
118
+ });
119
+ var f = false;
120
+ if (format) {
121
+ obj.title = format.title;
122
+ obj.format = format;
123
+ f = true;
124
+ }
125
+ if (requireds.indexOf(name) !== -1) {
126
+ obj.required = true;
127
+ }
128
+ var desc = obj.description;
129
+ var show = {};
130
+
131
+ if (desc.indexOf("##") === -1) {
132
+ show.form = f ? "select" : "input";
133
+ show.view = "text";
134
+ show.search = f ? "select" : "";
135
+ show.table = f ? "select" : "text";
136
+ show.list = "text";
137
+ show.edit = f ? "select" : "input";
138
+ show.details = "text";
139
+ show.batch = f ? "select" : "";
140
+ show.filter = f ? "select" : "";
141
+ } else {
142
+ desc = desc.between("##", "##");
143
+ obj.description = obj.description.replace("##" + desc + "##", "");
144
+ var ar = desc.trim().split(" ");
145
+ if (desc.indexOf("none") !== -1) {
146
+ show.form = '';
147
+ show.view = '';
148
+ show.search = '';
149
+ show.table = '';
150
+ show.list = '';
151
+ show.edit = '';
152
+ show.details = '';
153
+ show.batch = '';
154
+ show.filter = '';
155
+ } else {
156
+ // 后端 - 搜索栏
157
+ show.search = this.get_show(ar, "search", f);
158
+ // 后端 - 表格
159
+ show.table = this.get_show(ar, "table", f);
160
+ // 后端 - 表单页
161
+ show.form = this.get_show(ar, "form", f);
162
+ // 后端 - 详情页
163
+ show.view = this.get_show(ar, "view", f);
164
+ // 后端 - 批量操作
165
+ show.batch = this.get_show(ar, "batch", f);
166
+
167
+ // 前端 - 列表
168
+ show.list = this.get_show(ar, "list", f);
169
+ // 前端 - 详情页
170
+ show.details = this.get_show(ar, "details", f);
171
+ // 前端 - 筛选栏
172
+ show.filter = this.get_show(ar, "filter", f);
173
+ // 前端 - 编辑页
174
+ show.edit = this.get_show(ar, "edit", f);
175
+ }
176
+ }
177
+ obj.show = show;
178
+ pm.push(obj);
179
+ }
180
+ }
181
+ return pm;
182
+ };
183
+
184
+ /**
185
+ * 运算视图模型(css)
186
+ * @param {Object} model 模型
187
+ * @return {Object} 返回视图所用模型
188
+ */
189
+ ViewModel.prototype.css = async function(model) {
190
+ var css = {};
191
+ return css;
192
+ };
193
+
194
+ /**
195
+ * 运算视图模型(html)
196
+ * @param {Object} model 模型
197
+ * @return {Object} 返回视图所用模型
198
+ */
199
+ ViewModel.prototype.html = async function(model) {
200
+ var html = {};
201
+ if (!model.sql) {
202
+ return html;
203
+ }
204
+ return html;
205
+ };
206
+
207
+ /**
208
+ * 运算视图模型(js)
209
+ * @param {Object} model 模型
210
+ * @return {Object} 返回视图所用模型
211
+ */
212
+ ViewModel.prototype.js = async function(model) {
213
+ var js = {
214
+ data: [],
215
+ query: []
216
+ };
217
+ var field = model.field;
218
+ var path_start = model.file.indexOf('admin') !== -1 ? '/apis/' : '/api/';
219
+
220
+ for (var i = 0; i < field.length; i++) {
221
+ var o = field[i];
222
+ var format = o.format;
223
+ if (format) {
224
+ var obj;
225
+ if (format.table) {
226
+ var basename = format.table.split('_').splice(1).join('_');
227
+ var name = "list_" + basename;
228
+ var id = format.id || format.key;
229
+ o.label = name;
230
+ var path = path_start + format.table.replace('_', '/') + "?size=0";
231
+ obj = {
232
+ basename,
233
+ title: format.title,
234
+ id,
235
+ name,
236
+ field: format.name,
237
+ value: [],
238
+ path
239
+ };
240
+
241
+ // 存在BUG(start)
242
+ if (o.name === 'father_id' || o.name === 'fid') {
243
+ obj.father_id = o.name;
244
+ }
245
+ if (o.name === 'title') {
246
+ obj.title_name = 'title';
247
+ }
248
+ // 存在BUG(end)
249
+ } else {
250
+ var basename = format.key;
251
+ var name = "arr_" + basename;
252
+ o.label = name;
253
+ obj = {
254
+ title: format.title,
255
+ name,
256
+ value: format.list
257
+ }
258
+ }
259
+ js.data.push(obj);
260
+ }
261
+ }
262
+ var param = model.param;
263
+ if (param && param.get) {
264
+ var arr = param.get.query_required.concat(param.get.query);
265
+ var lt = param.list;
266
+ for (var i = 0; i < arr.length; i++) {
267
+ var o = lt.getObj({
268
+ name: arr[i]
269
+ });
270
+ if (o) {
271
+ js.query.push({
272
+ title: o.title,
273
+ name: o.name,
274
+ type: o.type,
275
+ select: o.description ? (o.description.indexOf('(') !== -1) : false
276
+ });
277
+ }
278
+ }
279
+ }
280
+ return js;
281
+ };
282
+
283
+ /**
284
+ * 运算视图模型
285
+ * @param {Object} model 模型
286
+ * @return {Object} 返回视图所用模型
287
+ */
288
+ ViewModel.prototype.run = async function(model) {
289
+ model.field = await this.field(model);
290
+ model.js = await this.js(model);
291
+ model.html = await this.html(model);
292
+ model.css = await this.css(model);
293
+ return model;
294
+ };
295
+
296
+ module.exports = ViewModel;
@@ -3,26 +3,48 @@
3
3
  "filter": true,
4
4
  // 校验脚本文件, 可以使用脚本的方式加一步进行校验, 让传参更加安全
5
5
  "func_file": "",
6
+ // get请求
7
+ "get": {
8
+ // 查询参数校验项
9
+ "query": ["uid", "name", "username", "phone", "email"],
10
+ // 查询必填参数
11
+ "query_required": []
12
+ },
13
+ // post请求
6
14
  "post": {
15
+ // 查询参数校验项
7
16
  "query": ["uid", "name", "username", "phone", "email"],
17
+ // 查询必填参数
8
18
  "query_required": [],
19
+ // 正文参数校验项
9
20
  "body": ["age", "headImg", "birthday", "password", "confirm_password", "pay_password"],
21
+ // 正文必填参数
10
22
  "body_required": []
11
23
  },
24
+ // 校验列表
12
25
  "list": [{
26
+ // 参数key名
13
27
  "name": "uid",
28
+ // 参数中文名
14
29
  "title": "用户ID",
30
+ // 数据类型
15
31
  "type": "number",
32
+ // 数字类型时设置
16
33
  "number": {
34
+ // 最小数值
17
35
  "min": 1
18
36
  },
37
+ // 分隔参数,允许传多个值,为空则限制1个值
19
38
  "splitter": "|"
20
39
  }, {
21
40
  "name": "name",
22
41
  "title": "姓名",
23
42
  "type": "string",
43
+ // 字符串类型时设置
24
44
  "string": {
45
+ // 格式
25
46
  "format": "ch",
47
+ // 传值范围,字符串时为限制字符长度
26
48
  "range": [2, 6]
27
49
  },
28
50
  "splitter": "|"
@@ -32,6 +54,7 @@
32
54
  "title": "年龄",
33
55
  "type": "number",
34
56
  "number": {
57
+ // 传值范围,数字时为最小值和最大值
35
58
  "range": [1, 150]
36
59
  }
37
60
  },
@@ -40,6 +63,7 @@
40
63
  "title": "头像",
41
64
  "type": "string",
42
65
  "string": {
66
+ // 拓展名,用于传媒体(图片、音频、视频)时
43
67
  "extension": "png|gif|jpg|jpeg|bmp"
44
68
  }
45
69
  },
@@ -17,12 +17,14 @@ class Drive extends Item {
17
17
  /* 通用项 */
18
18
  // 配置参数
19
19
  this.config = {
20
- // 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
20
+ // 名称, 由中英文和下“_”组成, 用于修改或卸载 例如: demo
21
21
  "name": "",
22
+ // 状态 0未启用,1启用
23
+ "state": 1,
22
24
  // 参数过滤
23
25
  "filter": true,
24
26
  // 默认监听方法, 当查询参数中出现监听的关键词时,选择以该键值作为请求方式,否则默认为get
25
- "method": "get",
27
+ "method": "method",
26
28
  // 增
27
29
  "add": {
28
30
  // body参数
@@ -57,19 +59,48 @@ class Drive extends Item {
57
59
  // query中的必填参数
58
60
  "query_required": []
59
61
  },
60
- // 提交
61
- "post": {
62
+ // 导入
63
+ "import": {
64
+ // body中的参数
65
+ "body": ["name"],
66
+ // body中的必填参数
67
+ "body_required": ["file"]
68
+ },
69
+ // 导出
70
+ "export": {
62
71
  // url中的query参数
63
72
  "query": [],
64
73
  // query中的必填参数
65
- "query_required": [],
66
- // body参数
67
- "body": [],
68
- // body中的必填参数
69
- "body_required": [],
70
- // 不包含参数
71
- "body_not": []
74
+ "query_required": []
75
+ },
76
+ // 去重
77
+ "del_req": {
78
+ // query中的必填参数
79
+ "query_required": ["groupby", "sort"]
80
+ },
81
+ // 合计
82
+ "sum": {
83
+ // query中的必填参数
84
+ "query_required": ["field", "groupby"]
72
85
  },
86
+ // 总数
87
+ "count": {
88
+ // query中的必填参数
89
+ "query_required": ["field", "groupby"]
90
+ },
91
+ // 提交
92
+ // "post": {
93
+ // // url中的query参数
94
+ // "query": [],
95
+ // // query中的必填参数
96
+ // "query_required": [],
97
+ // // body参数
98
+ // "body": [],
99
+ // // body中的必填参数
100
+ // "body_required": [],
101
+ // // 不包含参数
102
+ // "body_not": []
103
+ // },
73
104
  // 验证参数集
74
105
  "list": [],
75
106
  // 文件路径, 当调用函数不存在时,会先从文件中加载
@@ -149,7 +180,8 @@ Drive.prototype.model = function() {
149
180
  "max": 0,
150
181
  // 验证字符串范围
151
182
  "range": []
152
- }
183
+ },
184
+ "default": ""
153
185
  });
154
186
  };
155
187
 
@@ -162,7 +194,7 @@ Drive.prototype.model = function() {
162
194
  */
163
195
  Drive.prototype.check_item = function(model, value, method) {
164
196
  var msg;
165
- if (value === undefined || value === null) {
197
+ if (value === "" || value === undefined || value === null) {
166
198
  if (method.has(model.name)) {
167
199
  msg = model.msg_head(model) + model.msg('required');
168
200
  }
@@ -272,7 +304,7 @@ Drive.prototype.check = function(query, body, method) {
272
304
  if (!arr || arr.length === 0) {
273
305
  arr = [];
274
306
  for (var k in query) {
275
- if (arr.indexOf(k) == -1) {
307
+ if (arr.indexOf(k) === -1) {
276
308
  arr.push(k);
277
309
  }
278
310
  }
@@ -294,7 +326,7 @@ Drive.prototype.check = function(query, body, method) {
294
326
  if (!arr || arr.length === 0) {
295
327
  arr = [];
296
328
  for (var k in query) {
297
- if (arr.indexOf(k) == -1) {
329
+ if (arr.indexOf(k) === -1) {
298
330
  arr.push(k);
299
331
  }
300
332
  }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "插件管理器",
3
+ "script": "./index.js"
4
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ // 应用名称,表示该插件用在什么应用里的
3
+ "app": "{1}",
4
+ // 插件名称,插件的唯一标识
5
+ "name": "{0}",
6
+ // 插件标题,用于检索和识别
7
+ "title": "示例插件",
8
+ // 插件描述,介绍改插件是做什么用的
9
+ "description": "描述该插件是做什么用的",
10
+ // 插件版本号,用于升级迭代
11
+ "version": "1.0",
12
+ // 插件语言包文件路径
13
+ "lang_path": "./lang/",
14
+ // 插件图标
15
+ "icon": "/{1}/{0}/img/logo.png",
16
+ // 插件指令,通过指令方式调用插件
17
+ "cmd": "{2}",
18
+ // 排序,表示多个插件时在应用下执行的先后顺序
19
+ "sort": 10
20
+ }
@@ -14,11 +14,6 @@ class Drive extends Item {
14
14
  constructor(dir) {
15
15
  super(dir, __dirname);
16
16
  this.default_file = "./plugin.json";
17
-
18
- /**
19
- * 开关,开启可使用插件
20
- */
21
- this.onOff = true;
22
17
 
23
18
  /**
24
19
  * 当前语言
@@ -32,13 +27,15 @@ class Drive extends Item {
32
27
  /* 通用项 */
33
28
  // 配置参数
34
29
  this.config = {
30
+ // 名称, 由中英文和下“_”组成, 用于修改或卸载 例如: demo
31
+ // 同时也是版本唯一标识,当商城有两个插件名称相同时,可以通过版本号查询和下载
32
+ "name": "",
33
+ // 状态 0未启用,1启用
34
+ "state": 1,
35
35
  // 标题, 介绍事件作用
36
36
  "title": "",
37
37
  // 描述, 用于描述该事件有什么用的
38
38
  "description": "",
39
- // 名称, 由中英文和下“_”组成, 用于卸载事件
40
- // 同时也是版本唯一标识,当商城有两个插件名称相同时,可以通过版本号查询和下载
41
- "name": "",
42
39
  // 应用域
43
40
  "app": "",
44
41
  // 文件路径, 当调用函数不存在时,会先从文件中加载
@@ -31,7 +31,7 @@ Plugin.prototype.run = function(param1, param2) {
31
31
  var ret;
32
32
  var lt = this.list;
33
33
  for (var i = 0, o; o = lt[i++];) {
34
- if (o.onOff) {
34
+ if (o.config.state === 1) {
35
35
  ret = o.run(param1, param2);
36
36
  if (ret && o.end) {
37
37
  break;
@@ -56,7 +56,7 @@ Plugin.prototype.chat = async function(from_user, to_user, group, content, type,
56
56
  var ret = "";
57
57
  var lt = this.list;
58
58
  for (var i = 0, o; o = lt[i++];) {
59
- if (o.onOff) {
59
+ if (o.config.state === 1) {
60
60
  ret = await o.chat(from_user, to_user, group, content, type, msg_type, db);
61
61
  if (ret) {
62
62
  break;
@@ -66,29 +66,6 @@ Plugin.prototype.chat = async function(from_user, to_user, group, content, type,
66
66
  return ret;
67
67
  };
68
68
 
69
- /**
70
- * 指令(类似命令提示符)
71
- * @param {String} content 指令内容
72
- * @return {String} 执行结果
73
- */
74
- Plugin.prototype.cmd = async function(content) {
75
- var ret = "";
76
- var lt = this.list;
77
- for (var i = 0, o; o = lt[i++];) {
78
- if (o.onOff) {
79
- var cmd = o.config.cmd;
80
- if (cmd && content.startsWith(cmd)) {
81
- ret = await o.cmd(content.replace(cmd, ''));
82
- if (ret) {
83
- break;
84
- }
85
- }
86
- }
87
- }
88
- return ret;
89
- };
90
-
91
-
92
69
  /**
93
70
  * 执行插件方法
94
71
  * @param {String} name 插件名称
@@ -101,7 +78,7 @@ Plugin.prototype.exec = function(name, method, option) {
101
78
  var lt = this.list;
102
79
  for (var i = 0, o; o = lt[i++];) {
103
80
  var name = o.config.name;
104
- if (o.onOff && name === name) {
81
+ if (o.config.state === 1 && name === name) {
105
82
  var func = o[method];
106
83
  if (func) {
107
84
  ret = func(option);
@@ -137,16 +114,16 @@ Plugin.prototype.sort = function() {
137
114
  */
138
115
  Plugin.prototype.load = function(path) {
139
116
  if (!path) {
140
- path = '/app/' + this.scope + "/plugin/";
117
+ path = '/app/' + this.scope;
141
118
  }
142
- var list = this.list;
143
- if (path.endsWith('/app/')) {
144
- var list_scope = $.dir.get(path);
119
+ list = this.list;
120
+ var dir_plugin = path + "/plugin/";
121
+ if (dir_plugin.hasDir()) {
122
+ var list_scope = $.dir.get(dir_plugin);
145
123
 
146
124
  // 遍历目录路径
147
-
148
125
  list_scope.map(function(o) {
149
- var file = './app.json'.fullname(o);
126
+ var file = './plugin.json'.fullname(o);
150
127
  if (file.hasFile()) {
151
128
  var obj = new Drive(o);
152
129
  obj.load(file);
@@ -155,27 +132,10 @@ Plugin.prototype.load = function(path) {
155
132
  }
156
133
  }
157
134
  });
158
- } else {
159
- var dir_plugin = path + "/plugin/";
160
- if (dir_plugin.hasDir()) {
161
- var list_scope = $.dir.get(dir_plugin);
162
-
163
- // 遍历目录路径
164
- list_scope.map(function(o) {
165
- var file = './plugin.json'.fullname(o);
166
- if (file.hasFile()) {
167
- var obj = new Drive(o);
168
- obj.load(file);
169
- if (obj.config.name) {
170
- list.push(obj);
171
- }
172
- }
173
- });
174
- }
175
135
  }
176
136
  };
177
137
 
178
- exports.Plugin = Plugin;
138
+ module.exports = Plugin;
179
139
 
180
140
 
181
141
  /**
@@ -191,7 +151,7 @@ if (!$.pool.plugin) {
191
151
  * @param {string} title 标题
192
152
  * @return {Object} 返回一个缓存类
193
153
  */
194
- function plugin_admin(scope, title) {
154
+ $.plugin_admin = function (scope, title) {
195
155
  if (!scope) {
196
156
  scope = $.val.scope + '';
197
157
  }
@@ -202,8 +162,3 @@ function plugin_admin(scope, title) {
202
162
  }
203
163
  return obj;
204
164
  }
205
-
206
- /**
207
- * @module 导出plugin管理器
208
- */
209
- exports.plugin_admin = plugin_admin;
@@ -0,0 +1,47 @@
1
+ # websocket 开发说明
2
+
3
+ ## 简介
4
+ Websocket 是用于与浏览器客户端实现双向通讯的协议,可用来实现即时通讯、交易所、消息推送等。
5
+
6
+ ## 关于mm websocket的使用
7
+ 前端和服务端均已集成webstock功能,前端使用mm_sdk,后端使用com/websocket框架机制
8
+
9
+ ## websocket 使用规范
10
+ 为了让前后端通讯更加稳定、可控,前后端均采用json-rpc2.0的方式进行通讯,采用以下传参规范 ↓
11
+
12
+ 在客户端给服务端发送消息时,或在服务端给客户端发送消息时(响应格式):
13
+ `
14
+ {
15
+ // 消息ID (用于识别对应请求)
16
+ id: "",
17
+ // 调用方法 (例如聊天时为chat、请求获取联系人时为get_contact)
18
+ method: "",
19
+ // 请求参数
20
+ params: {}
21
+ }
22
+ `
23
+
24
+ 如果需要在某一端接收到消息后,告诉对方已收到消息或返回内容,可以给对方端推送一条消息(响应格式):
25
+ `
26
+ {
27
+ // 消息ID (用于响应对应请求)
28
+ id: "",
29
+ // 错误提示 (错误时必须返回)
30
+ error: {
31
+ // 错误码
32
+ code: -32602,
33
+ // 错误提示
34
+ message: ""
35
+ },
36
+ // 响应结果 (成功时必须返回)
37
+ result: {}
38
+ }
39
+ `
40
+
41
+ ## mm websocket 通讯json-rpc2.0协议原理
42
+ 1. 首先websocket给客户端和服务端提供了一个接收消息的接口,可以收到来自对方的消息
43
+ 2. 然后双方可以通过收到的json数据中是否含有method属性来判断对方端是请求查询,还是提交数据
44
+ 3. 如果是提交数据,则接收数据处理并存储
45
+ 4. 如果是请求查询,则给请求做处理,并回推送一条消息
46
+ 5. 为了能够识别消息是否成功推送,通过响应格式中的ID属性来判断
47
+ 6. 如果非请求或响应, 只是单向推送数据, 那么可以通过id属性值0或空进行识别
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "web socket管理器",
3
+ "script": "./index.js"
4
+ }