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,6 +1,9 @@
1
1
  const Item = require('mm_machine').Item;
2
2
  const Excel = require('mm_excel');
3
3
 
4
+ var save_dir = '/app/sys/static/doc/';
5
+ var url_path = "/sys/doc/";
6
+
4
7
  /**
5
8
  * Sql操作驱动类
6
9
  * @extends {Item}
@@ -19,8 +22,10 @@ class Drive extends Item {
19
22
  /* 通用项 */
20
23
  // 配置参数
21
24
  this.config = {
22
- // 名称
25
+ // 名称, 由中英文和下“_”组成, 用于修改或卸载 例如: demo
23
26
  "name": "",
27
+ // 状态 0未启用,1启用
28
+ "state": 1,
24
29
  // 表名 {0} 代表可前端传参自定义查询的表
25
30
  "table": "{0}",
26
31
  // 主键 用于水平连表查询时 例如:id
@@ -71,13 +76,15 @@ class Drive extends Item {
71
76
  // 分隔符 用于查询时的多条件处理
72
77
  "separator": "|",
73
78
  // 支持的方法 add增、del删、set改、get查, 只填get表示只支持查询 // import export del_repeat",
74
- "method": "add del set get get_obj import export del_repeat",
79
+ "method": "add del set get get_obj import export del_repeat avg sum count",
75
80
  // sql查询语句
76
81
  "query": {},
77
82
  // 默认查询, 当查询条件中不包含该项时,默认添加该项。 例如: { "age": "`age` < 20" } , 当查询参含有age,不调用该项,不存在时,sql会增加该项
78
83
  "query_default": {},
79
84
  // sql更改语句
80
85
  "update": {},
86
+ // 默认添加条件,当不包含该项时,默认添加该项。 例如: { "age": "`age` += 1" } , 当查询参含有age,不调用该项,不存在时,sql会增加该项
87
+ "body_default": {},
81
88
  // 文件路径, 当调用函数不存在时,会先从文件中加载
82
89
  "func_file": "",
83
90
  // 回调函数名 用于决定调用脚本的哪个函数
@@ -206,7 +213,7 @@ Drive.prototype.run = async function(query, body, db) {
206
213
  * @param {Object} body 修改项
207
214
  * @return {Object} 返回准备参数
208
215
  */
209
- Drive.prototype.ready = async function(db, query, body) {
216
+ Drive.prototype.ready = function(db, query, body) {
210
217
  var cg = this.config;
211
218
  var qy = Object.assign({}, query);
212
219
  $.push(db.config.filter, cg.filter, true);
@@ -218,18 +225,17 @@ Drive.prototype.ready = async function(db, query, body) {
218
225
  };
219
226
 
220
227
  /**
221
- * 查询(主要)
222
- * @param {Object} db 数据库操作类
223
- * @param {Object} query 查询条件
228
+ * 转为查询条件字符串
229
+ * @param {Object} db 数据库管理器
230
+ * @param {Object} query 查寻条件
224
231
  * @param {Object} method 方法
225
- * @return {Object} 返回查询结果
232
+ * @return {String} 返回查询条件
226
233
  */
227
- Drive.prototype.get_main = async function(db, query, method) {
228
- var ret;
234
+ Drive.prototype.to_where = function(db, query, method) {
229
235
  var {
230
236
  cg,
231
237
  qy
232
- } = await this.ready(db, query, {});
238
+ } = this.ready(db, query, {});
233
239
  db.config.separator = cg.separator;
234
240
  if (!query.size && cg.page_size) {
235
241
  db.size = cg.page_size + 0;
@@ -242,9 +248,6 @@ Drive.prototype.get_main = async function(db, query, method) {
242
248
  var field = query[f.field];
243
249
  if (cg.field.has("*{0}*")) {
244
250
  if (field) {
245
- if (cg.field_hide.getMatch(field)) {
246
- return $.ret.error(70003, '不合法的查询参数');
247
- }
248
251
  db.field = cg.field.replace("{0}", field);
249
252
  } else if (method === 'get_obj' && cg.field_obj) {
250
253
  db.field = cg.field_obj + '';
@@ -276,20 +279,40 @@ Drive.prototype.get_main = async function(db, query, method) {
276
279
  var qt = cg.query_default;
277
280
  if (Object.keys(qt).length > 0) {
278
281
  var id = $.dict.user_id;
279
- var word = "{" + id + "}";
282
+ var id_key = "{" + id + "}";
280
283
  var user_id = "0";
281
- if (db.user && db.user[id]) {
282
- user_id = db.user[id];
284
+ var user = db.user;
285
+ if (user && user[id]) {
286
+ user_id = user[id];
283
287
  }
284
288
  for (var k in qt) {
285
289
  if (!qy[k]) {
286
- query_str += " && " + qt[k].replace(word, user_id);
290
+ query_str += " && " + qt[k].replaceAll(id_key, user_id);
287
291
  }
288
292
  }
289
293
  if (query_str.startsWith(" && ")) {
290
294
  query_str = query_str.replace(" && ", "");
291
295
  }
292
296
  }
297
+ return query_str;
298
+ }
299
+
300
+ /**
301
+ * 查询(主要)
302
+ * @param {Object} db 数据库操作类
303
+ * @param {Object} query 查询条件
304
+ * @param {Object} method 方法
305
+ * @return {Object} 返回查询结果
306
+ */
307
+ Drive.prototype.get_main = async function(db, query, method) {
308
+ var ret;
309
+ if (this.config.field.has("*{0}*")) {
310
+ var field = query[db.config.filter.field];
311
+ if (field && this.config.field_hide.getMatch(field)) {
312
+ return $.ret.error(70003, '不合法的查询参数');
313
+ }
314
+ }
315
+ var query_str = this.to_where(db, query, method);
293
316
 
294
317
  // 查询
295
318
  if (db.count_ret === "true") {
@@ -297,9 +320,6 @@ Drive.prototype.get_main = async function(db, query, method) {
297
320
  } else {
298
321
  ret = $.ret.list(await db.getSql(query_str, db.orderby, db.field));
299
322
  }
300
- if (cg.log) {
301
- $.log.debug('查询SQL语句', db.sql)
302
- }
303
323
  if (db.error) {
304
324
  $.log.error('查询SQL', db.sql, db.error);
305
325
  }
@@ -351,14 +371,33 @@ Drive.prototype.set_main = async function(db, query, body) {
351
371
  var {
352
372
  cg,
353
373
  qy
354
- } = await this.ready(db, query, body);
374
+ } = this.ready(db, query, body);
355
375
  var key = cg.key;
356
376
  if (body[key]) {
357
377
  qy[key] = body[key];
358
378
  }
359
379
  var query_str = db.tpl_query(qy, cg.query);
360
- var set_str = db.tpl_body(body, cg.update);
361
380
 
381
+ var qt = cg.query_default;
382
+ if (Object.keys(qt).length > 0) {
383
+ var id = $.dict.user_id;
384
+ var id_key = "{" + id + "}";
385
+ var user_id = "0";
386
+ var user = db.user;
387
+ if (user && user[id]) {
388
+ user_id = user[id];
389
+ }
390
+ for (var k in qt) {
391
+ if (!qy[k]) {
392
+ query_str += " && " + qt[k].replace(id_key, user_id);
393
+ }
394
+ }
395
+ if (query_str.startsWith(" && ")) {
396
+ query_str = query_str.replace(" && ", "");
397
+ }
398
+ }
399
+
400
+ var set_str = db.tpl_body(body, cg.update);
362
401
  var n = await db.setSql(query_str, set_str);
363
402
 
364
403
  if (n < 1) {
@@ -390,10 +429,25 @@ Drive.prototype.set = async function(db, query, body) {
390
429
  */
391
430
  Drive.prototype.add_main = async function(db, body) {
392
431
  var ret;
393
- var {
394
- cg
395
- } = await this.ready(db, {}, body);
432
+ var cg = this.config;
396
433
  if (Object.keys(body).length > 0) {
434
+ var bt = cg.body_default;
435
+ if (Object.keys(bt).length > 0) {
436
+ var id = $.dict.user_id;
437
+ var id_key = "{" + id + "}";
438
+ var user_id = "0";
439
+ var user = db.user;
440
+ if (user && user[id]) {
441
+ user_id = user[id];
442
+ }
443
+ for (var k in bt) {
444
+ if (!body[k]) {
445
+ var str = bt[k].replace(id_key, user_id);
446
+ var key = str.left("=").trim("`");
447
+ body[key] = str.right("=").trim("'");
448
+ }
449
+ }
450
+ }
397
451
  var n = await db.add(body);
398
452
  if (n < 1) {
399
453
  ret = $.ret.error(500, '添加失败!\n' + db.error.message);
@@ -402,7 +456,7 @@ Drive.prototype.add_main = async function(db, body) {
402
456
  ret = $.ret.bl(true, '添加成功!');
403
457
  }
404
458
  } else {
405
- ret = $.ret.error(70000, '参数不能为空');
459
+ ret = $.ret.error(30001, '参数不能为空');
406
460
  }
407
461
  if (cg.log) {
408
462
  $.log.debug('添加SQL语句', db.sql)
@@ -432,7 +486,7 @@ Drive.prototype.del_main = async function(db, query) {
432
486
  var {
433
487
  cg,
434
488
  qy
435
- } = await this.ready(db, query, {});
489
+ } = this.ready(db, query, {});
436
490
  var query_str = db.tpl_query(qy, cg.query);
437
491
  var bl = await db.delSql(query_str);
438
492
  if (bl < 1) {
@@ -458,7 +512,6 @@ Drive.prototype.del = async function(db, query, body) {
458
512
  return await this.del_main(db, query);
459
513
  };
460
514
 
461
-
462
515
  /**
463
516
  * 添加或修改(主要)
464
517
  * @param {Object} db 数据库操作类
@@ -471,7 +524,7 @@ Drive.prototype.addOrSet_main = async function(db, query, body) {
471
524
  var {
472
525
  cg,
473
526
  qy
474
- } = await this.ready(db, query, body);
527
+ } = this.ready(db, query, body);
475
528
  if (Object.keys(body).length > 0 && Object.keys(qy).length > 0) {
476
529
  var n = await db.addOrSet(qy, body);
477
530
  if (n < 1) {
@@ -481,7 +534,7 @@ Drive.prototype.addOrSet_main = async function(db, query, body) {
481
534
  ret = $.ret.bl(true, '操作成功!');
482
535
  }
483
536
  } else {
484
- ret = $.ret.error(70000, '参数不能为空');
537
+ ret = $.ret.error(30001, '参数不能为空');
485
538
  }
486
539
  if (cg.log) {
487
540
  $.log.debug('添加或修改SQL语句', db.sql)
@@ -525,7 +578,7 @@ Drive.prototype.get_params = async function(fields) {
525
578
  arr.map((name) => {
526
579
  for (var i = 0; i < list.length; i++) {
527
580
  var o = list[i];
528
- if (name == o.name) {
581
+ if (name === o.name) {
529
582
  lt.push(o);
530
583
  }
531
584
  }
@@ -541,10 +594,11 @@ Drive.prototype.get_params = async function(fields) {
541
594
  var lt = [];
542
595
  var arr = field.split(',');
543
596
  for (var i = 0; i < arr.length; i++) {
544
- var name = arr[i].replace(/`/g, '');
545
- params.push({
597
+ var o = arr[i];
598
+ var name = o.replace(/`/g, '');
599
+ lt.push({
546
600
  name,
547
- title: name
601
+ title: name,
548
602
  });
549
603
  }
550
604
  params = lt;
@@ -566,7 +620,7 @@ Drive.prototype.get_format = async function(db) {
566
620
  if (o.table) {
567
621
  if (!o.list || o.list.length == 0) {
568
622
  dbs.table = o.table;
569
- o.list = await dbs.getSql(o.where, null, o.id + "," + o.name);
623
+ o.list = await dbs.getSql(o.where, null, o.key + "," + o.name);
570
624
  }
571
625
  }
572
626
  }
@@ -582,32 +636,65 @@ Drive.prototype.get_format = async function(db) {
582
636
  Drive.prototype.import_main = async function(db, file) {
583
637
  var params = await this.get_params();
584
638
  var format = await this.get_format(db);
639
+ file = file.replace(url_path, save_dir);
585
640
  file = file.fullname($.config.path.user || $.config.path.static);
586
641
  if (!file.hasFile()) {
587
- return $.ret.error(30000, file + "文件不存在!");
642
+ return $.ret.error(30001, file + "文件不存在!");
588
643
  }
589
644
  var excel = new Excel({
590
645
  file,
591
646
  params,
592
647
  format
593
648
  });
594
- var jarr = await excel.load();
649
+ var jarr = [];
650
+ try {
651
+ jarr = await excel.load();
652
+ } catch (e) {
653
+ $.log.error("导入文件", e);
654
+ } finally {
655
+ excel.clear();
656
+ excel = null;
657
+ }
658
+
595
659
  var list = [];
596
660
  var errors = [];
661
+ var list_error = [];
597
662
  db.table = db.table || this.config.table;
598
- for (var i = 0; i < jarr.length; i++) {
599
- var o = jarr[i];
600
- var n = await db.add(o);
601
- if (n < 1) {
602
- list.push(o);
603
- errors.push(db.error);
663
+ if (!jarr.length) {
664
+ return $.ret.error(10000, '要导入的数据不能为空!');
665
+ }
666
+ var key = this.config.key;
667
+ if (jarr[0][key]) {
668
+ for (var i = 0; i < jarr.length; i++) {
669
+ var o = jarr[i];
670
+ var qy = {};
671
+ qy[key] = o[key];
672
+ var n = await db.set(qy, o);
673
+ if (n < 1) {
674
+ errors.push(db.error);
675
+ list_error.push(o);
676
+ } else {
677
+ list.push(o);
678
+ }
679
+ }
680
+ } else {
681
+ for (var i = 0; i < jarr.length; i++) {
682
+ var o = jarr[i];
683
+ var n = await db.add(o);
684
+ if (n < 1) {
685
+ errors.push(db.error);
686
+ list_error.push(o);
687
+ } else {
688
+ list.push(o);
689
+ }
604
690
  }
605
691
  }
606
- var bl = list.length !== jarr.length;
692
+ var bl = list.length === jarr.length;
607
693
  var body = $.ret.bl(bl, bl ? '导入成功!' : '导入失败!');
608
694
  body.result.list = list;
609
695
  if (errors.length) {
610
- body.errors = errors;
696
+ body.result.list_error = list_error;
697
+ body.result.errors = errors;
611
698
  }
612
699
  return body;
613
700
  };
@@ -617,13 +704,13 @@ Drive.prototype.import_main = async function(db, file) {
617
704
  * 导入数据
618
705
  * @param {Object} db 数据库操作类
619
706
  * @param {Object} query 查询条件
620
- * @param {Object} body 导出设置
707
+ * @param {Object} body 导入设置
621
708
  * @return {Object} 返回执行结果
622
709
  */
623
710
  Drive.prototype.import = async function(db, query, body) {
624
711
  var params = Object.assign({}, query, body);
625
712
  if (!params.file) {
626
- return $.ret.error(70000, '文件名(file)参数不能为空');
713
+ return $.ret.error(60000, '文件名(file)参数不能为空');
627
714
  }
628
715
  return await this.import_main(db, params.file);
629
716
  };
@@ -651,12 +738,10 @@ Drive.prototype.export_main = async function(db, query, body) {
651
738
  fields
652
739
  } = body;
653
740
  var table = db.table || this.config.table;
741
+ var date = new Date();
742
+ var name = table + "_" + date.stamp() + '.xlsx';
654
743
  if (!file) {
655
- var uid = 0;
656
- if (db.user) {
657
- uid = db.user.user_id;
658
- }
659
- file = './user/' + uid + '/' + table + '.xlsx';
744
+ file = save_dir + name;
660
745
  file.addDir($.config.path.user || $.config.path.static);
661
746
  }
662
747
  if (!fields && query.field) {
@@ -675,9 +760,18 @@ Drive.prototype.export_main = async function(db, query, body) {
675
760
  format
676
761
  });
677
762
  var list = by.result.list;
678
- file = await excel.save(list);
679
- var body = $.ret.bl(file == true, file ? '导出成功!' : '导出失败!');
763
+ try {
764
+ file = await excel.save(list);
765
+ } catch (e) {
766
+ $.log.error("导出保存文件失败!", e);
767
+ } finally {
768
+ excel.clear();
769
+ excel = null;
770
+ }
771
+
772
+ var body = $.ret.bl(!!file, file ? '导出成功!' : '导出失败!');
680
773
  body.result.file = file;
774
+ body.result.url = url_path + name;
681
775
  if (message) {
682
776
  body.result.message = message;
683
777
  }
@@ -733,7 +827,7 @@ Drive.prototype.del_repeat_main = async function(db, params) {
733
827
  }
734
828
  }
735
829
  } else {
736
- msg = '没有重复号码。';
830
+ msg = '没有重复项。';
737
831
  }
738
832
  // console.log(list);
739
833
  return $.ret.bl(!msg, msg ? '去重失败!原因:' + msg : '去重成功!');
@@ -771,7 +865,8 @@ Drive.prototype.main = async function(params, db) {
771
865
  if (!cg.method.has("*" + method + "*")) {
772
866
  return $.ret.error(50001, '不支持的操作方式')
773
867
  }
774
- delete query.method;
868
+ var qy = Object.assign({}, query);
869
+ delete qy.method;
775
870
  if (this[method]) {
776
871
  db.method = method;
777
872
 
@@ -784,16 +879,144 @@ Drive.prototype.main = async function(params, db) {
784
879
  if (table) {
785
880
  db.table = cg.table.replace("{0}", table);
786
881
  } else {
787
- return $.ret.error(70000, '表名不能为空');
882
+ return $.ret.error(30001, '表名不能为空');
788
883
  }
789
884
  } else {
790
885
  db.table = cg.table + '';
791
886
  }
792
887
 
793
- return await this[method](db, query, body);
888
+ return await this[method](db, qy, Object.assign({}, body));
794
889
  } else {
795
890
  return $.ret.error(50001, '不支持的操作方式');
796
891
  }
797
892
  };
798
893
 
894
+
895
+ /**
896
+ * 总计
897
+ * @param {Object} db 数据库管理器
898
+ * @param {Object} pm 查询条件
899
+ * @return {Object} 返回执行结果
900
+ */
901
+ Drive.prototype.sum_main = async function(db, pm) {
902
+ var ret;
903
+ var orderby = pm.orderby || "";
904
+ delete pm.orderby;
905
+ var groupby = pm.groupby;
906
+ delete pm.groupby;
907
+ var f = db.config.filter;
908
+ var field = pm[f.field];
909
+ delete pm[f.field];
910
+ var query_str = this.to_where(db, pm, "get_list");
911
+
912
+ if (!groupby || !field) {
913
+ ret = $.ret.error(30000, "参数groupby、field是必须的,且值不能为空!");
914
+ } else {
915
+ var list = await db.groupSumSql(query_str, groupby, field, orderby);
916
+ if (!list.length && db.error) {
917
+ $.log.error('SUM查询SQL', db.sql, db.error);
918
+ ret = $.ret.body(db.error);
919
+ } else {
920
+ ret = $.ret.list(list);
921
+ }
922
+ }
923
+ return ret;
924
+ };
925
+
926
+ /**
927
+ * 总计
928
+ * @param {Object} db 数据库管理器
929
+ * @param {Object} query 查询条件
930
+ * @return {Object} 返回执行结果
931
+ */
932
+ Drive.prototype.sum = async function(db, query, body) {
933
+ var pm = Object.assign({}, query, body);
934
+ return await this.sum_main(db, pm);
935
+ };
936
+
937
+ /**
938
+ * 平均值
939
+ * @param {Object} db 数据库管理器
940
+ * @param {Object} pm 查询条件
941
+ * @return {Object} 返回执行结果
942
+ */
943
+ Drive.prototype.avg_main = async function(db, pm) {
944
+ var ret;
945
+ var orderby = pm.orderby || "";
946
+ delete pm.orderby;
947
+ var groupby = pm.groupby;
948
+ delete pm.groupby;
949
+ var f = db.config.filter;
950
+ var field = pm[f.field];
951
+ delete pm[f.field];
952
+ var query_str = this.to_where(db, pm, "get_list");
953
+
954
+ if (!groupby || !field) {
955
+ ret = $.ret.error(30000, "参数groupby、field是必须的,且值不能为空!");
956
+ } else {
957
+ var list = await db.groupAvgSql(query_str, groupby, field, orderby);
958
+ if (!list.length && db.error) {
959
+ $.log.error('AVG查询SQL', db.sql, db.error);
960
+ ret = $.ret.body(db.error);
961
+ } else {
962
+ ret = $.ret.list(list);
963
+ }
964
+ }
965
+ return ret;
966
+ };
967
+
968
+ /**
969
+ * 平均值
970
+ * @param {Object} db 数据库管理器
971
+ * @param {Object} query 查询条件
972
+ * @return {Object} 返回执行结果
973
+ */
974
+ Drive.prototype.avg = async function(db, query, body) {
975
+ var pm = Object.assign({}, query, body);
976
+ return await this.avg_main(db, pm);
977
+ };
978
+
979
+ /**
980
+ * 总计
981
+ * @param {Object} db 数据库管理器
982
+ * @param {Object} pm 查询条件
983
+ * @return {Object} 返回执行结果
984
+ */
985
+ Drive.prototype.count_main = async function(db, pm) {
986
+ var ret;
987
+ var orderby = pm.orderby || "";
988
+ delete pm.orderby;
989
+ var groupby = pm.groupby;
990
+ delete pm.groupby;
991
+ var f = db.config.filter;
992
+ var field = pm[f.field];
993
+ delete pm[f.field];
994
+ var query_str = this.to_where(db, pm, "get_list");
995
+
996
+ if (!groupby || !field) {
997
+ ret = $.ret.error(30000, "参数groupby、field是必须的,且值不能为空!");
998
+ } else {
999
+ var list = await db.groupCountSql(query_str, groupby, field, orderby);
1000
+ if (!list.length && db.error) {
1001
+ $.log.error('COUNT查询SQL', db.sql, db.error);
1002
+ ret = $.ret.body(db.error);
1003
+ } else {
1004
+ ret = $.ret.list(list);
1005
+ }
1006
+ }
1007
+ return ret;
1008
+ };
1009
+
1010
+ /**
1011
+ * 总计
1012
+ * @param {Object} db 数据库管理器
1013
+ * @param {Object} query 查询条件
1014
+ * @return {Object} 返回执行结果
1015
+ */
1016
+ Drive.prototype.count = async function(db, query, body) {
1017
+ var pm = Object.assign({}, query, body);
1018
+ return await this.count_main(db, pm);
1019
+ };
1020
+
1021
+
799
1022
  module.exports = Drive;
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "静态文件管理器",
3
+ "script": "./index.js"
4
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ // 路由路径,注意:这里是泛路径,相当于/*
3
+ "path": "/",
4
+ // 默认文件,当直接访问这个路径时,如果存在默认文件,这直接访问该文件
5
+ "index": "index.html",
6
+ // 资源缓存寿命,单位:秒
7
+ "maxAge": 0,
8
+ // 是否恒久不变,一般资源文件可能变化,所以这里一般是false
9
+ "immutable": false,
10
+ // 是否使用brotli压缩方式
11
+ "brotli": true,
12
+ // 是否启用gzip压缩方式
13
+ "gzip": true,
14
+ // 是否限制访问指定拓展名的文件,多个
15
+ "extensions": null,
16
+ // 是否转换JS、vue代码为amd标准,true的情况下会把es6和commonJS都转成amd格式
17
+ "convert_amd": false,
18
+ // 调用脚本文件,如果请求改路由情况会调用改脚本文件
19
+ "func_file": "./static.js"
20
+ }
@@ -22,10 +22,12 @@ class Drive extends Item {
22
22
  /* 通用项 */
23
23
  // 配置参数
24
24
  this.config = {
25
+ // 名称, 由中英文和下“_”组成, 用于修改或卸载 例如: demo
26
+ "name": "",
27
+ // 状态 0未启用,1启用
28
+ "state": 1,
25
29
  // 标题
26
30
  "title": "",
27
- // 名称
28
- "name": "",
29
31
  // 应用名
30
32
  "app": "",
31
33
  // 插件
@@ -53,7 +55,7 @@ class Drive extends Item {
53
55
  // 执行函数名
54
56
  "func_name": "",
55
57
  // 是否将ES6转换AMD
56
- "convert_amd": false,
58
+ "convert_amd": true
57
59
  };
58
60
 
59
61
  if (config) {
@@ -248,4 +250,4 @@ Drive.prototype.run = async function(ctx, path, next) {
248
250
  return done;
249
251
  };
250
252
 
251
- module.exports = Drive;
253
+ module.exports = Drive;
@@ -130,4 +130,8 @@ Static.prototype.sort = function() {
130
130
  });
131
131
  };
132
132
 
133
- exports.Static = Static;
133
+ if (!$.Static) {
134
+ $.Static = Static;
135
+ }
136
+
137
+ module.exports = Static;
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "定时任务管理器",
3
+ "script": "./index.js"
4
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ // 任务标题
3
+ "title": "示例任务",
4
+ // 任务描述
5
+ "description": "描述任务使用方法",
6
+ // 任务名称,用于动态增删改查
7
+ "name": "demo",
8
+ // 任务驱动的脚本文件
9
+ "func_file": "./index.js",
10
+ // 任务执行次数,执行次数达标后不再执行。0为不限次数,一直执行
11
+ "num": 2,
12
+ // 任务间隔时长,单位:毫秒
13
+ "interval": 1000,
14
+ // 任务启动等待时长,单位:毫秒
15
+ "wait": 0,
16
+ // 任务触发的时间,可设置的格式分别为: yyyy-MM-dd hh:mm:ss, MM-dd hh:mm:ss, dd hh:mm:ss, hh:mm:ss, hh:mm, mm 例如: 08:00, 则为每天8点触发
17
+ "time": "",
18
+ // 任务开始日期,例如:2020-10-01开始执行,为空则不限制
19
+ "date_start": "",
20
+ // 任务结束日期,例如:2020-10-07不再执行,为空则不限制
21
+ "date_end": "",
22
+ // 任务排序,决定多个任务的执行优先顺序
23
+ "sort": 100
24
+ }