Selaa lähdekoodia

项目初始化

linwu 1 vuosi sitten
commit
7f423ceaa7
100 muutettua tiedostoa jossa 5153 lisäystä ja 0 poistoa
  1. 0 0
      admin/index.html
  2. 0 0
      admin/static/css/app.587d9b01.css
  3. 1 0
      admin/static/css/chunk-2c76396e.2fec2dcd.css
  4. 1 0
      admin/static/css/chunk-30ca8599.b1dd7a76.css
  5. 4 0
      admin/static/css/chunk-397774be.399b340b.css
  6. 0 0
      admin/static/css/chunk-477ee07a.e0e6984c.css
  7. 0 0
      admin/static/css/chunk-47e04da7.5937a2ca.css
  8. 0 0
      admin/static/css/chunk-5390c43f.892019d8.css
  9. 0 0
      admin/static/css/chunk-6313471f.e13ac41f.css
  10. 1 0
      admin/static/css/chunk-67a92bb6.51087aae.css
  11. 0 0
      admin/static/css/chunk-7b9b704b.1c9de7ac.css
  12. 1 0
      admin/static/css/chunk-9dca547a.90e92f12.css
  13. 0 0
      admin/static/css/chunk-libs.bf952545.css
  14. BIN
      admin/static/fonts/element-icons.535877f5.woff
  15. BIN
      admin/static/fonts/element-icons.732389de.ttf
  16. BIN
      admin/static/img/401.089007e7.gif
  17. BIN
      admin/static/img/404.a57b6f31.png
  18. BIN
      admin/static/img/404_cloud.0f4bc32b.png
  19. BIN
      admin/static/img/banner.e564212c.png
  20. BIN
      admin/static/img/coupon.88fb0bb7.png
  21. BIN
      admin/static/img/data.3c12545e.png
  22. BIN
      admin/static/img/duo.ca491c49.png
  23. BIN
      admin/static/img/goods.8036b3dc.png
  24. 47 0
      admin/static/img/iconfont.79732a8d.svg
  25. BIN
      admin/static/img/imageSingle.57b35e86.png
  26. BIN
      admin/static/img/img.99f275da.jpg
  27. BIN
      admin/static/img/img400x200.ddda3573.jpg
  28. BIN
      admin/static/img/membergoods.2f166174.png
  29. BIN
      admin/static/img/miaosha.4a48dd4a.png
  30. BIN
      admin/static/img/navBar.5a3d020d.png
  31. BIN
      admin/static/img/no_admintouxiang.bcdd3ac7.png
  32. BIN
      admin/static/img/no_touxiang.4c23a748.png
  33. BIN
      admin/static/img/nodata.eb82f0d3.png
  34. BIN
      admin/static/img/notice.da5db20f.png
  35. BIN
      admin/static/img/search.0669ec06.png
  36. BIN
      admin/static/img/technical.27b88aa2.png
  37. BIN
      admin/static/img/tuan.daa5cb3c.png
  38. BIN
      admin/static/img/tuwen.5f3fe075.png
  39. BIN
      admin/static/img/video.9e7cea9e.png
  40. BIN
      admin/static/img/window.4716fe04.png
  41. 0 0
      admin/static/js/app.e0632c6b.js
  42. 0 0
      admin/static/js/chunk-1553fa4a.f113ea6a.js
  43. 0 0
      admin/static/js/chunk-2c76396e.58dc81c3.js
  44. 1 0
      admin/static/js/chunk-2d2105d3.404da312.js
  45. 1 0
      admin/static/js/chunk-2d230fe7.3bd3f709.js
  46. 1 0
      admin/static/js/chunk-30ca8599.574eb1e6.js
  47. 0 0
      admin/static/js/chunk-397774be.92cd8d13.js
  48. 0 0
      admin/static/js/chunk-477ee07a.22702c06.js
  49. 0 0
      admin/static/js/chunk-47e04da7.e6feaa2a.js
  50. 1 0
      admin/static/js/chunk-5390c43f.44a3b7df.js
  51. 0 0
      admin/static/js/chunk-6313471f.4eba85fc.js
  52. 0 0
      admin/static/js/chunk-67a92bb6.d2f00136.js
  53. 0 0
      admin/static/js/chunk-7b9b704b.a3af0b8b.js
  54. 0 0
      admin/static/js/chunk-9dca547a.062d8117.js
  55. 0 0
      admin/static/js/chunk-elementUI.37aa17a8.js
  56. 7 0
      admin/static/js/chunk-libs.adf39fa2.js
  57. BIN
      admin/static/media/new_order.6d8d8f22.mp3
  58. 22 0
      app/AppService.php
  59. 208 0
      app/BaseController.php
  60. 100 0
      app/ExceptionHandle.php
  61. 8 0
      app/Request.php
  62. 13 0
      app/admin/common.php
  63. 91 0
      app/admin/controller/AccountController.php
  64. 87 0
      app/admin/controller/AdController.php
  65. 97 0
      app/admin/controller/AdminmenuController.php
  66. 133 0
      app/admin/controller/AgentController.php
  67. 84 0
      app/admin/controller/AgentcodeController.php
  68. 91 0
      app/admin/controller/AgentlevelController.php
  69. 78 0
      app/admin/controller/AgentteamawardController.php
  70. 77 0
      app/admin/controller/AgreementController.php
  71. 138 0
      app/admin/controller/AreaController.php
  72. 86 0
      app/admin/controller/ArticleController.php
  73. 83 0
      app/admin/controller/ArticlecategoryController.php
  74. 28 0
      app/admin/controller/AuthorizationController.php
  75. 139 0
      app/admin/controller/BargaingoodsController.php
  76. 331 0
      app/admin/controller/Base.php
  77. 136 0
      app/admin/controller/BottommenuController.php
  78. 64 0
      app/admin/controller/BottommenutypeController.php
  79. 76 0
      app/admin/controller/BroadcastController.php
  80. 128 0
      app/admin/controller/CategoryController.php
  81. 16 0
      app/admin/controller/ClearcacheController.php
  82. 45 0
      app/admin/controller/CommentController.php
  83. 181 0
      app/admin/controller/ConfigController.php
  84. 153 0
      app/admin/controller/CouponController.php
  85. 296 0
      app/admin/controller/DashboardController.php
  86. 77 0
      app/admin/controller/DepartmentController.php
  87. 112 0
      app/admin/controller/DictdataController.php
  88. 364 0
      app/admin/controller/DiyfieldsController.php
  89. 244 0
      app/admin/controller/DiypageController.php
  90. 139 0
      app/admin/controller/DiypagelinkController.php
  91. 82 0
      app/admin/controller/DomainreplaceController.php
  92. 49 0
      app/admin/controller/FilesController.php
  93. 75 0
      app/admin/controller/FilescateController.php
  94. 59 0
      app/admin/controller/ForhelpController.php
  95. 428 0
      app/admin/controller/GoodsController.php
  96. 92 0
      app/admin/controller/GoodsquantityunitlController.php
  97. 114 0
      app/admin/controller/HospitalController.php
  98. 76 0
      app/admin/controller/HospitalcateController.php
  99. 104 0
      app/admin/controller/HospitaldepartmentsController.php
  100. 83 0
      app/admin/controller/HospitallevelController.php

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/index.html


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/css/app.587d9b01.css


+ 1 - 0
admin/static/css/chunk-2c76396e.2fec2dcd.css

@@ -0,0 +1 @@
+@supports(-webkit-mask:none) and (not (cater-color:#fff)){.login-container .el-input input{color:#fff}}.login-container .el-input{display:inline-block;height:47px;width:85%}.login-container .el-input input{background:transparent;border:0;-webkit-appearance:none;border-radius:0;padding:12px 5px 12px 15px;color:#fff;height:47px;caret-color:#fff}.login-container .el-input input:-webkit-autofill{box-shadow:inset 0 0 0 1000px #283443!important;-webkit-text-fill-color:#fff!important}.login-container .el-form-item{border:1px solid hsla(0,0%,100%,.1);background:rgba(0,0,0,.1);border-radius:5px;color:#454545}.login-container[data-v-ab650a52]{min-height:100%;width:100%;background-color:#2d3a4b;overflow:hidden}.login-container .login-form[data-v-ab650a52]{position:relative;width:520px;max-width:100%;padding:160px 35px 0;margin:0 auto;overflow:hidden}.login-container .tips[data-v-ab650a52]{font-size:14px;color:#fff;margin-bottom:10px}.login-container .tips span[data-v-ab650a52]:first-of-type{margin-right:16px}.login-container .svg-container[data-v-ab650a52]{padding:6px 5px 6px 15px;color:#889aa4;vertical-align:middle;width:30px;display:inline-block}.login-container .title-container[data-v-ab650a52]{position:relative}.login-container .title-container .title[data-v-ab650a52]{font-size:26px;color:#eee;margin:0 auto 40px auto;text-align:center;font-weight:700}.login-container .show-pwd[data-v-ab650a52]{position:absolute;right:10px;top:7px;font-size:16px;color:#889aa4;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.login-container .thirdparty-button[data-v-ab650a52]{position:absolute;right:0;bottom:6px}@media only screen and (max-width:470px){.login-container .thirdparty-button[data-v-ab650a52]{display:none}}.store[data-v-ab650a52]{height:100%;width:100%}.copyright[data-v-ab650a52]{color:#3e4856}

+ 1 - 0
admin/static/css/chunk-30ca8599.b1dd7a76.css

@@ -0,0 +1 @@
+.errPage-container[data-v-35ca77fc]{width:800px;max-width:100%;margin:100px auto}.errPage-container .pan-back-btn[data-v-35ca77fc]{background:#008489;color:#fff;border:none!important}.errPage-container .pan-gif[data-v-35ca77fc]{margin:0 auto;display:block}.errPage-container .pan-img[data-v-35ca77fc]{display:block;margin:0 auto;width:100%}.errPage-container .text-jumbo[data-v-35ca77fc]{font-size:60px;font-weight:700;color:#484848}.errPage-container .list-unstyled[data-v-35ca77fc]{font-size:14px}.errPage-container .list-unstyled li[data-v-35ca77fc]{padding-bottom:5px}.errPage-container .list-unstyled a[data-v-35ca77fc]{color:#008489;text-decoration:none}.errPage-container .list-unstyled a[data-v-35ca77fc]:hover{text-decoration:underline}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 4 - 0
admin/static/css/chunk-397774be.399b340b.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/css/chunk-477ee07a.e0e6984c.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/css/chunk-47e04da7.5937a2ca.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/css/chunk-5390c43f.892019d8.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/css/chunk-6313471f.e13ac41f.css


+ 1 - 0
admin/static/css/chunk-67a92bb6.51087aae.css

@@ -0,0 +1 @@
+.el-form-item--mini.el-form-item[data-v-1207ad43],.el-form-item--small.el-form-item[data-v-1207ad43]{margin-bottom:5px}.searchForm .el-form-item__label[data-v-1207ad43],.searchForm label[data-v-1207ad43]{font-weight:400}.icon-dialog .el-dialog{margin-bottom:0;margin-top:4vh!important;display:flex;flex-direction:column;max-height:92vh;overflow:hidden;box-sizing:border-box}.icon-dialog .el-dialog .el-dialog__header{padding-top:14px}.icon-dialog .el-dialog .el-dialog__body{margin:20px;padding:0;overflow:auto}.icon-ul{margin:0;padding:0;font-size:0}.icon-ul li{list-style-type:none;text-align:center;font-size:14px;display:inline-block;width:16.66%;box-sizing:border-box;height:108px;padding:15px 6px 6px 6px;cursor:pointer;overflow:hidden}.icon-ul li:hover{background:#f2f2f2}.icon-ul li.active-item{background:#e1f3fb;color:#7a6df0}.icon-ul li>i{font-size:30px;line-height:50px}.waves-ripple{position:absolute;border-radius:100%;background-color:rgba(0,0,0,.15);background-clip:padding-box;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transform:scale(0);opacity:1}.waves-ripple.z-active{opacity:0;transform:scale(2);transition:opacity 1.2s ease-out,transform .6s ease-out}.edit-input[data-v-c8d577ac]{padding-right:100px}.cancel-btn[data-v-c8d577ac]{position:absolute;right:15px;top:10px}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/css/chunk-7b9b704b.1c9de7ac.css


+ 1 - 0
admin/static/css/chunk-9dca547a.90e92f12.css

@@ -0,0 +1 @@
+.el-form-item--mini.el-form-item[data-v-1207ad43],.el-form-item--small.el-form-item[data-v-1207ad43]{margin-bottom:5px}.searchForm .el-form-item__label[data-v-1207ad43],.searchForm label[data-v-1207ad43]{font-weight:400}.pagination-container[data-v-f2098c9e]{background:#fff;padding-top:20px;padding-bottom:20px;padding-left:16px;padding-right:16px}.pagination-container.hidden[data-v-f2098c9e]{display:none}.table_list_pic[data-v-79186324]{width:80px;height:80px;vertical-align:middle}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/css/chunk-libs.bf952545.css


BIN
admin/static/fonts/element-icons.535877f5.woff


BIN
admin/static/fonts/element-icons.732389de.ttf


BIN
admin/static/img/401.089007e7.gif


BIN
admin/static/img/404.a57b6f31.png


BIN
admin/static/img/404_cloud.0f4bc32b.png


BIN
admin/static/img/banner.e564212c.png


BIN
admin/static/img/coupon.88fb0bb7.png


BIN
admin/static/img/data.3c12545e.png


BIN
admin/static/img/duo.ca491c49.png


BIN
admin/static/img/goods.8036b3dc.png


+ 47 - 0
admin/static/img/iconfont.79732a8d.svg

@@ -0,0 +1,47 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<!--
+2013-9-30: Created.
+-->
+<svg>
+<metadata>
+Created by iconfont
+</metadata>
+<defs>
+
+<font id="iconfont" horiz-adv-x="1024" >
+  <font-face
+    font-family="iconfont"
+    font-weight="500"
+    font-stretch="normal"
+    units-per-em="1024"
+    ascent="896"
+    descent="-128"
+  />
+    <missing-glyph />
+    
+    <glyph glyph-name="erweima1" unicode="&#58906;" d="M877.714286-128 877.714286 115.809524 1024 115.809524 1024-128 877.714286-128ZM975.433143 67.730286 926.232381 67.730286 926.232381-79.872 975.433143-79.872 975.433143 67.730286ZM536.380952-128 536.380952 359.619048 730.989714 359.619048 730.989714 213.089524 975.676952 213.089524 975.676952 359.619048 1024 359.619048 1024 165.10781 682.812952 165.10781 682.812952 310.125714 584.94781 310.125714 584.94781-127.268571M536.380952 896 1024 896 1024 408.380952 536.380952 408.380952 536.380952 896ZM584.46019 456.46019 975.920762 456.46019 975.920762 847.969524 584.46019 847.969524 584.46019 456.46019ZM682.666667 749.714286 877.714286 749.714286 877.714286 554.666667 682.666667 554.666667 682.666667 749.714286ZM730.989714 602.989714 829.391238 602.989714 829.391238 701.391238 730.989714 701.391238 730.989714 602.989714ZM0 359.619048 487.619048 359.619048 487.619048-128 0-128 0 359.619048ZM48.030476-79.920762 439.53981-79.920762 439.53981 311.588571 48.030476 311.588571 48.030476-79.920762ZM146.285714 213.333333 341.333333 213.333333 341.333333 18.285714 146.285714 18.285714 146.285714 213.333333ZM194.608762 66.608762 293.010286 66.608762 293.010286 165.010286 194.608762 165.010286 194.608762 66.608762ZM0 896 487.619048 896 487.619048 408.380952 0 408.380952 0 896ZM48.030476 456.46019 439.53981 456.46019 439.53981 847.969524 48.030476 847.969524 48.030476 456.46019ZM146.285714 749.714286 341.333333 749.714286 341.333333 554.666667 146.285714 554.666667 146.285714 749.714286ZM194.608762 602.989714 293.010286 602.989714 293.010286 701.391238 194.608762 701.391238 194.608762 602.989714ZM828.952381-128 682.666667-128 682.666667 115.809524 828.952381 115.809524 828.952381-128ZM780.385524 67.730286 731.184762 67.730286 731.184762-79.872 780.385524-79.872 780.385524 67.730286Z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="xiahuaxian1" unicode="&#59360;" d="M802.909091-46.545455h-558.545455a34.909091 34.909091 0 0 0 0 69.818182h558.545455a34.909091 34.909091 0 0 0 0-69.818182z m-279.272727 104.727273C350.394182 58.181818 209.454545 199.121455 209.454545 372.363636v395.636364a34.909091 34.909091 0 0 0 69.818182 0v-395.636364C279.272727 237.614545 388.887273 128 523.636364 128S768 237.614545 768 372.363636v395.636364a34.909091 34.909091 0 0 0 69.818182 0v-395.636364C837.818182 199.121455 696.878545 58.181818 523.636364 58.181818z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="xieti" unicode="&#59119;" d="M512 678.89573a33.048659 33.048659 0 0 1-7.118173 33.048659 92.027805 92.027805 0 0 1-47.285005 15.253228 17.286991 17.286991 0 0 0-15.761668 16.270109 26.438928 26.438928 0 0 0 0 7.118173v9.660377q33.5571-3.559086 66.097319-5.084409t60.504468 0h56.945383q33.5571 0 63.555114 5.084409a94.061569 94.061569 0 0 0 0-16.77855 14.744786 14.744786 0 0 0-15.761668-16.77855 107.789474 107.789474 0 0 1-50.844092-15.761669 53.894737 53.894737 0 0 1-18.812314-33.5571L498.780536 104.357498a31.014896 31.014896 0 0 1 7.626614-32.540219 112.365442 112.365442 0 0 1 50.844091-15.761668 16.270109 16.270109 0 0 0 14.744787-16.77855 96.095333 96.095333 0 0 0 0-17.795432q-33.5571 3.559086-68.131083 5.084409H384.889772q-33.048659 0-63.046674-5.084409a96.095333 96.095333 0 0 0 0 17.795432 14.236346 14.236346 0 0 0 13.219464 15.761668 131.686197 131.686197 0 0 1 50.844091 16.270109 50.844091 50.844091 0 0 1 20.337637 33.04866z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="B" unicode="&#58935;" d="M270.528 1.536V766.464h224.704c67.136 0 120.768-16.064 160.896-48.128 40.256-32.064 60.224-74.624 60.224-127.616 0-42.176-11.904-79.36-35.776-111.616-23.872-32.256-56.768-55.168-98.496-68.672v-1.984c52.032-5.888 93.504-25.6 124.608-59.008s46.72-75.84 46.72-127.104c0-65.856-23.616-119.104-70.848-159.744-47.232-40.704-107.776-60.992-181.504-60.992H270.528zM369.28 680v-239.488h89.856c47.744 0 85.184 11.648 112.32 34.816 27.2 23.232 40.768 55.424 40.768 96.576 0 72.064-48.064 108.16-144.192 108.16H369.28z m0-325.376v-266.624h118.528c51.648 0 91.584 11.968 119.68 35.776 28.096 23.872 42.24 57.088 42.24 99.52 0 87.552-59.392 131.392-178.24 131.392H369.28z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="shanchu" unicode="&#58999;" d="M460.8 379.345c-146.618 148.945-288.582 288.582-428.218 428.218-34.909 34.909-41.891 55.855-18.618 76.8 20.945 18.618 39.564 13.964 74.473-20.945 132.655-132.655 262.982-265.309 395.636-395.636 9.309-9.309 16.291-20.945 30.255-39.564 18.618 25.6 32.582 41.891 46.545 58.182 125.673 125.673 251.345 253.673 379.345 379.345 9.309 9.309 16.291 20.945 25.6 23.273 16.291 4.655 39.564 6.982 46.545-2.327 9.309-11.636 6.982-32.582 4.655-48.873 0-9.309-13.964-16.291-20.945-23.273-144.291-144.291-283.927-286.255-428.218-430.545 20.945-23.273 41.891-44.218 62.836-65.164 121.018-121.018 242.036-242.036 365.382-363.055l9.309-9.309c18.618-18.618 30.255-39.564 6.982-60.509-23.273-23.273-44.218-11.636-65.164 6.982l-400.291 400.291c-11.636 11.636-18.618 23.273-30.255 37.236-16.291-16.291-27.927-25.6-37.236-34.909-132.655-132.655-265.309-265.309-400.291-397.964-6.982-6.982-13.964-16.291-20.945-18.618-16.291-2.327-37.236-2.327-46.545 4.655-9.309 9.309-6.982 32.582-4.655 46.545 2.327 9.309 13.964 18.618 23.273 25.6l395.636 395.636c11.636 11.636 23.273 18.618 34.909 27.927z"  horiz-adv-x="1025" />
+
+    
+    <glyph glyph-name="shangjiantou" unicode="&#58893;" d="M481.856-96V741.568L76.608 337.856l-44.48 44.608L513.664 864l478.144-478.144-44.544-46.08-401.792 401.792V-96h-63.616z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="xiajiantou" unicode="&#58896;" d="M545.472 864v-837.504L947.2 428.288l44.544-46.144-478.08-478.144L32.128 385.6l44.48 44.544 405.248-403.712V864h63.616z"  horiz-adv-x="1024" />
+
+    
+
+
+  </font>
+</defs></svg>

BIN
admin/static/img/imageSingle.57b35e86.png


BIN
admin/static/img/img.99f275da.jpg


BIN
admin/static/img/img400x200.ddda3573.jpg


BIN
admin/static/img/membergoods.2f166174.png


BIN
admin/static/img/miaosha.4a48dd4a.png


BIN
admin/static/img/navBar.5a3d020d.png


BIN
admin/static/img/no_admintouxiang.bcdd3ac7.png


BIN
admin/static/img/no_touxiang.4c23a748.png


BIN
admin/static/img/nodata.eb82f0d3.png


BIN
admin/static/img/notice.da5db20f.png


BIN
admin/static/img/search.0669ec06.png


BIN
admin/static/img/technical.27b88aa2.png


BIN
admin/static/img/tuan.daa5cb3c.png


BIN
admin/static/img/tuwen.5f3fe075.png


BIN
admin/static/img/video.9e7cea9e.png


BIN
admin/static/img/window.4716fe04.png


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/app.e0632c6b.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-1553fa4a.f113ea6a.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-2c76396e.58dc81c3.js


+ 1 - 0
admin/static/js/chunk-2d2105d3.404da312.js

@@ -0,0 +1 @@
+(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d2105d3"],{b829:function(n,e,o){"use strict";o.r(e);o("fb6a"),o("ac1f"),o("841c");var c,a,t={name:"AuthRedirect",created:function(){var n=window.location.search.slice(1);window.localStorage&&(window.localStorage.setItem("x-admin-oauth-code",n),window.close())},render:function(n){return n()}},d=t,i=o("2877"),l=Object(i["a"])(d,c,a,!1,null,null,null);e["default"]=l.exports}}]);

+ 1 - 0
admin/static/js/chunk-2d230fe7.3bd3f709.js

@@ -0,0 +1 @@
+(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d230fe7"],{ef3c:function(e,r,n){"use strict";n.r(r);n("ac1f"),n("5319");var t,u,a={created:function(){var e=this.$route,r=e.params,n=e.query,t=r.path;this.$router.replace({path:"/"+t,query:n})},render:function(e){return e()}},c=a,o=n("2877"),p=Object(o["a"])(c,t,u,!1,null,null,null);r["default"]=p.exports}}]);

+ 1 - 0
admin/static/js/chunk-30ca8599.574eb1e6.js

@@ -0,0 +1 @@
+(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-30ca8599"],{"1a27":function(t,a,i){"use strict";i("a5e5")},"24e2":function(t,a,i){"use strict";i.r(a);var e=function(){var t=this,a=t.$createElement,i=t._self._c||a;return i("div",{staticClass:"errPage-container"},[i("el-button",{staticClass:"pan-back-btn",attrs:{icon:"el-icon-arrow-left"},on:{click:t.back}},[t._v(" 返回 ")]),i("el-row",[i("el-col",{attrs:{span:12}},[i("h1",{staticClass:"text-jumbo text-ginormous"},[t._v(" Oops! ")]),t._v(" gif来源"),i("a",{attrs:{href:"https://zh.airbnb.com/",target:"_blank"}},[t._v("airbnb")]),t._v(" 页面 "),i("h2",[t._v("你没有权限去该页面")]),i("h6",[t._v("如有不满请联系你领导")]),i("ul",{staticClass:"list-unstyled"},[i("li",[t._v("或者你可以去:")]),i("li",{staticClass:"link-type"},[i("router-link",{attrs:{to:"/dashboard"}},[t._v(" 回首页 ")])],1),i("li",{staticClass:"link-type"},[i("a",{attrs:{href:"https://www.taobao.com/"}},[t._v("随便看看")])]),i("li",[i("a",{attrs:{href:"#"},on:{click:function(a){a.preventDefault(),t.dialogVisible=!0}}},[t._v("点我看图")])])])]),i("el-col",{attrs:{span:12}},[i("img",{attrs:{src:t.errGif,width:"313",height:"428",alt:"Girl has dropped her ice cream."}})])],1),i("el-dialog",{attrs:{visible:t.dialogVisible,title:"随便看"},on:{"update:visible":function(a){t.dialogVisible=a}}},[i("img",{staticClass:"pan-img",attrs:{src:t.ewizardClap}})])],1)},s=[],r=i("cc6c"),c=i.n(r),l={name:"Page401",data:function(){return{errGif:c.a+"?"+ +new Date,ewizardClap:"https://wpimg.wallstcn.com/007ef517-bafd-4066-aae4-6883632d9646",dialogVisible:!1}},methods:{back:function(){this.$route.query.noGoBack?this.$router.push({path:"/dashboard"}):this.$router.go(-1)}}},n=l,o=(i("1a27"),i("2877")),u=Object(o["a"])(n,e,s,!1,null,"35ca77fc",null);a["default"]=u.exports},a5e5:function(t,a,i){},cc6c:function(t,a,i){t.exports=i.p+"static/img/401.089007e7.gif"}}]);

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-397774be.92cd8d13.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-477ee07a.22702c06.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-47e04da7.e6feaa2a.js


+ 1 - 0
admin/static/js/chunk-5390c43f.44a3b7df.js

@@ -0,0 +1 @@
+(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5390c43f"],{"122a":function(t,s,a){},"1db4":function(t,s,a){"use strict";a.r(s);var e=function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",{staticClass:"wscn-http404-container"},[a("div",{staticClass:"wscn-http404"},[t._m(0),a("div",{staticClass:"bullshit"},[a("div",{staticClass:"bullshit__oops"},[t._v("OOPS!")]),t._m(1),a("div",{staticClass:"bullshit__headline"},[t._v(t._s(t.message))]),a("div",{staticClass:"bullshit__info"},[t._v("Please check that the URL you entered is correct, or click the button below to return to the homepage.")]),a("a",{staticClass:"bullshit__return-home",attrs:{href:""}},[t._v("Back to home")])])])])},c=[function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"pic-404"},[e("img",{staticClass:"pic-404__parent",attrs:{src:a("a36b"),alt:"404"}}),e("img",{staticClass:"pic-404__child left",attrs:{src:a("26fc"),alt:"404"}}),e("img",{staticClass:"pic-404__child mid",attrs:{src:a("26fc"),alt:"404"}}),e("img",{staticClass:"pic-404__child right",attrs:{src:a("26fc"),alt:"404"}})])},function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",{staticClass:"bullshit__info"},[t._v("All rights reserved "),a("a",{staticStyle:{color:"#20a0ff"},attrs:{href:"https://wallstreetcn.com",target:"_blank"}},[t._v("wallstreetcn")])])}],i={name:"Page404",computed:{message:function(){return"The webmaster said that you can not enter this page..."}}},l=i,n=(a("35e7"),a("2877")),r=Object(n["a"])(l,e,c,!1,null,"26fcd89f",null);s["default"]=r.exports},"26fc":function(t,s,a){t.exports=a.p+"static/img/404_cloud.0f4bc32b.png"},"35e7":function(t,s,a){"use strict";a("122a")},a36b:function(t,s,a){t.exports=a.p+"static/img/404.a57b6f31.png"}}]);

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-6313471f.4eba85fc.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-67a92bb6.d2f00136.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-7b9b704b.a3af0b8b.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-9dca547a.062d8117.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
admin/static/js/chunk-elementUI.37aa17a8.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 7 - 0
admin/static/js/chunk-libs.adf39fa2.js


BIN
admin/static/media/new_order.6d8d8f22.mp3


+ 22 - 0
app/AppService.php

@@ -0,0 +1,22 @@
+<?php
+declare (strict_types = 1);
+
+namespace app;
+
+use think\Service;
+
+/**
+ * 应用服务类
+ */
+class AppService extends Service
+{
+    public function register()
+    {
+        // 服务注册
+    }
+
+    public function boot()
+    {
+        // 服务启动
+    }
+}

+ 208 - 0
app/BaseController.php

@@ -0,0 +1,208 @@
+<?php
+
+declare(strict_types=1);
+
+namespace app;
+
+use think\App;
+use think\View;
+use think\exception\HttpException;
+use think\exception\HttpResponseException;
+use think\exception\ValidateException;
+use think\Response;
+use think\facade\Validate;
+use think\facade\Filesystem;
+use think\File;
+use app\model\Files;
+
+/**
+ * 控制器基础类
+ */
+abstract class BaseController
+{
+
+	/**
+	 * Request实例
+	 * @var \think\Request
+	 */
+	protected $request;
+
+	/**
+	 * 应用实例
+	 * @var \think\App
+	 */
+	protected $app;
+
+
+	/**
+	 * 是否批量验证
+	 * @var bool
+	 */
+	protected $batchValidate = false;
+
+	/**
+	 * 控制器中间件
+	 * @var array
+	 */
+	protected $middleware = [];
+
+	public function __construct(App $app, View $view)
+	{
+		$this->app     = $app;
+		$this->request = $this->app->request;
+		$this->view = $view;
+
+		// 控制器初始化
+		$this->initialize();
+	}
+
+	// 初始化
+	protected function initialize()
+	{
+	}
+
+	protected function success($msg = '', string $url = null, $data = '', int $wait = 3, array $header = [])
+	{
+		if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) {
+			$url = $_SERVER["HTTP_REFERER"];
+		} elseif ($url) {
+			$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : app('route')->buildUrl($url);
+		}
+
+		$result = [
+			'code' => 1,
+			'msg'  => $msg,
+			'data' => $data,
+			'url'  => $url,
+			'wait' => $wait,
+		];
+
+		$type = $this->getResponseType();
+		if ($type == 'html') {
+			$response = view(config('app.dispatch_success_tmpl'), $result);
+		} else if ($type == 'json') {
+			$response = json($result);
+		}
+
+		throw new HttpResponseException($response);
+	}
+
+	protected function error($msg = '', string $url = null, $data = '', int $wait = 3, array $header = [])
+	{
+		if (is_null($url)) {
+			$url = $this->request->isAjax() ? '' : 'javascript:history.back(-1);';
+		} elseif ($url) {
+			$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url);
+		}
+
+		$result = [
+			'code' => 0,
+			'msg'  => $msg,
+			'data' => $data,
+			'url'  => $url,
+			'wait' => $wait,
+		];
+
+		$type = $this->getResponseType();
+		if ($type == 'html') {
+			$response = view(config('app.dispatch_success_tmpl'), $result);
+		} else if ($type == 'json') {
+			$response = json($result);
+		}
+
+		throw new HttpResponseException($response);
+	}
+
+	protected function getResponseType()
+	{
+		return $this->request->isJson() || $this->request->isAjax() ? 'json' : 'html';
+	}
+
+	//上传前先检测上传模式 如果是oss客户端直传则直接返回 token 、key等信息
+	public function upload()
+	{
+
+		$file = $this->request->file('file');
+
+		$file_type = upload_replace(config('my.filetype')); //上传黑名单过滤
+
+		if (!Validate::fileExt($file, $file_type)) {
+			throw new ValidateException('文件类型验证失败');
+		}
+
+		if (!Validate::fileSize($file, config('my.filesize') * 1024 * 1024)) {
+			throw new ValidateException('文件大小验证失败');
+		}
+
+		if ($url = $this->up($file)) {
+			return $this->json(['data' => $url, 'url' => $url, 'weid' => weid()]);
+		}
+	}
+
+	//开始上传
+	protected function up($file)
+	{
+		$oss_settings = \app\model\OssUpload::getSettings();
+
+		$is_local = $this->request->post('is_local');
+		$cid = $this->request->post('cid');
+
+		if (!empty($oss_settings['oss_accessKey']) && !empty($oss_settings['oss_secretKey']) && !empty($oss_settings['oss_bucket']) && !empty($oss_settings['oss_domain']) && $is_local != 1) {
+			$url = \utils\oss\OssService::OssUpload($oss_settings, ['tmp_name' => $file->getPathname(), 'extension' => $file->extension()]);
+		} else {
+			$filename = Filesystem::disk('public')->putFile($this->getFileName(), $file, 'uniqid');
+			$upload_type = $this->request->post('upload_type');
+			if ($upload_type == 'file') {
+				$url = config('filesystem.disks.public.url') . '/' . $filename;
+			} else {
+				$url = toimg(config('filesystem.disks.public.url') . '/' . $filename);
+			}
+		}
+
+		$source_id = $this->userInfo['id'] ?? UID();
+		if (Validate::fileExt($file, 'jpg,jpeg,png,gif')) {
+			Files::create([
+				'weid' => weid(),
+				'cid' => (int) $cid,
+				'type' => $upload_type,
+				'name' => $filename,
+				'uri' => $url,
+				'source_id'   => (int) $source_id
+			]);
+		}
+
+		return $url;
+	}
+
+	//获取上传的文件完整路径
+	private function getFileName()
+	{
+		return app('http')->getName() . '/' . date(config('my.upload_subdir'));
+	}
+
+	//获取阿里云oss客户端上传地址
+	private function getendpoint($oss_settings)
+	{
+		if (strpos($oss_settings['oss_domain'], 'aliyuncs.com') !== false) {
+			if (strpos($oss_settings['oss_domain'], 'https') !== false) {
+				$point = 'https://' . $oss_settings['oss_bucket'] . '.' . substr($oss_settings['oss_domain'], 8);
+			} else {
+				$point = 'http://' . $oss_settings['oss_bucket'] . '.' . substr($oss_settings['oss_domain'], 7);
+			}
+		} else {
+			$point = $oss_settings['oss_domain'];
+		}
+		return $point;
+	}
+
+	//阿里云oss上传异步回调返回上传路径,放到这是因为这个地址必须外部能直接访问到
+	function aliOssCallBack()
+	{
+		$oss_settings = \app\model\OssUpload::getSettings('ali');
+
+		$body = file_get_contents('php://input');
+		header("Content-Type: application/json");
+		$url = $this->getendpoint($oss_settings['oss_domain']) . '/' . str_replace('%2F', '/', $body);
+		return $this->json(['code' => 1, 'data' => $url, 'url' => $url]);
+	}
+}

+ 100 - 0
app/ExceptionHandle.php

@@ -0,0 +1,100 @@
+<?php
+/**
+ * 统一异常接管
+ */
+ 
+namespace app;
+
+use think\db\exception\DataNotFoundException;
+use think\db\exception\ModelNotFoundException;
+use think\exception\FuncNotFoundException;
+use think\exception\ClassNotFoundException;
+use think\exception\ErrorException;
+use think\exception\Handle;
+use think\exception\HttpException;
+use think\exception\HttpResponseException;
+use think\exception\ValidateException;
+use think\template\exception\TemplateNotFoundException;
+use think\db\exception\PDOException;
+use think\db\exception\DbException;
+use think\Response;
+use Throwable;
+use think\facade\Log;
+use RuntimeException;
+
+/**
+ * 应用异常处理类
+ */
+class ExceptionHandle extends Handle
+{
+	
+	
+	private $error_log_db = true;	//异常日志是否写入数据库
+	
+    /**
+     * Render an exception into an HTTP response.
+     * @access public
+     * @param \think\Request   $request
+     * @param Throwable $e
+     * @return Response
+     */
+    public function render($request, Throwable $e): Response
+    {
+		//方法不存在
+        if ($e instanceof FuncNotFoundException) {
+			if($request->isAjax()){
+				return json(['status'=>404,'msg'=>$e->getFunc().'方法不存在']);
+			}else{
+				return response($e->getFunc().'控制器不存在', 404);
+			}
+        }
+		
+		//控制器不存在
+        if ($e instanceof ClassNotFoundException) {
+			if($request->isAjax()){
+				return json(['status'=>404,'msg'=>$e->getClass().'控制器不存在']);
+			}else{
+				return response($e->getClass().'控制器不存在', 404);
+			}  
+        }
+		
+		//模板不存在
+        if ($e instanceof TemplateNotFoundException) {
+			return response($e->getTemplate().'模板不存在', 404);
+        }
+		
+		//验证器异常
+        if ($e instanceof ValidateException) {
+            return json(['status'=>411,'msg'=>$e->getError()]);
+        }
+		
+		//pdo异常
+        if ($e instanceof PDOException) {
+			return response($e->getMessage(), 500);
+        }
+		
+		//db异常
+        if ($e instanceof DbException) {
+			return response($e->getMessage(), 500);
+        }
+		
+		//error系统层面错误异常
+        if ($e instanceof ErrorException) {
+			return response($e->getMessage(), 500);
+        }
+		
+        // 请求异常 多为自定义的请求异常 
+        if ($e instanceof HttpException) {
+			Log::error('错误信息:'.print_r($e->getMessage(),true));
+			if($e->getStatusCode() == 500 && $this->error_log_db){
+				event('ExceptionLog', $e->getMessage());
+			}
+			return json(['status'=>$e->getStatusCode(),'msg'=>$e->getMessage()]); 
+        }
+		
+        return parent::render($request, $e);
+    }
+	
+	
+	
+}

+ 8 - 0
app/Request.php

@@ -0,0 +1,8 @@
+<?php
+namespace app;
+
+// 应用请求对象类
+class Request extends \think\Request
+{
+	protected $filter = ['remove_xss'];
+}

+ 13 - 0
app/admin/common.php

@@ -0,0 +1,13 @@
+<?php
+// +----------------------------------------------------------------------
+// | 应用公共文件
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 
+// +----------------------------------------------------------------------
+
+error_reporting(0);
+

+ 91 - 0
app/admin/controller/AccountController.php

@@ -0,0 +1,91 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Account;
+
+class AccountController extends Base
+{
+
+	function index()
+	{
+
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = new Account;
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('sort asc,id asc')
+			->paginate(getpage())
+			->toArray();
+
+		foreach ($res['data'] as &$vo) {
+			$vo['logo'] = toimg($vo['logo']);
+			$vo['loginbgimg'] = toimg($vo['loginbgimg']);
+			$vo['loginurl'] = gethost() . '/admin?i=' . $vo['id'];
+			if ($vo['endtime']) {
+				$vo['endtime'] = time_format($vo['endtime']);
+			} else {
+				$vo['endtime'] = '永久';
+			}
+		}
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Account::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+		if ($data['endtime']) {
+			$data['endtime'] = strtotime($data['endtime']);
+		} else {
+			$data['endtime'] = (int) $data['endtime'];
+		}
+
+
+		if (empty($id)) {
+			try {
+				$res = Account::create($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				Account::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = Account::getInfo($id);
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Account());
+	}
+}

+ 87 - 0
app/admin/controller/AdController.php

@@ -0,0 +1,87 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Ad;
+
+class AdController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = Ad::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('sort asc,id asc')
+			->paginate(getpage())
+			->toArray();
+
+		foreach ($res['data'] as &$vo) {
+			$vo['pic'] = toimg($vo['pic']);
+		}
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Ad::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = Ad::create($data);
+				if ($res->id && empty($data['sort'])) {
+					Ad::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				Ad::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = Ad::find($id);
+
+		if ($data) {
+			$data = $data->toArray();
+			$data['pic'] = toimg($data['pic']);
+		}
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Ad());
+	}
+}

+ 97 - 0
app/admin/controller/AdminmenuController.php

@@ -0,0 +1,97 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\AdminMenu;
+
+class AdminmenuController extends Base
+{
+
+	function index()
+	{
+		if ($this->userInfo['username'] == 'admin') {
+			$keyword = input('post.keyword', '', 'serach_in');
+			$query = AdminMenu::field('*');
+
+			if (!empty($keyword)) {
+				$query->where('title', 'like', '%' . $keyword . '%');
+			}
+
+			$list = $query->order('sort asc')->select()->toArray();
+			//var_dump($query->getLastSql());
+			if (!empty($keyword)) {
+				$data['data'] = $list;
+			} else {
+				$data['data'] = _generateListTree($list, 0, ['id', 'pid']);
+			}
+
+			return $this->json($data);
+		}
+	}
+
+	function listUpdate()
+	{
+		if ($this->userInfo['username'] == 'admin') {
+			$data = only('id,is_console,is_admin,is_city,is_tuanzhang,is_store,is_v2,is_v3,is_v6,status,sort');
+			if (!$data['id']) throw new ValidateException('参数错误');
+			AdminMenu::update($data);
+
+			return $this->json(['msg' => '操作成功']);
+		}
+	}
+
+	public function update()
+	{
+		if ($this->userInfo['username'] == 'admin') {
+			$id = $this->request->post('id');
+			$data = input('post.');
+			$data['pid'] = (int)$data['pid'];
+
+			if (empty($id)) {
+				try {
+					$res = AdminMenu::create($data);
+					if ($res->id && empty($data['sort'])) {
+						AdminMenu::update(['sort' => $res->id, 'id' => $res->id]);
+					}
+				} catch (\Exception $e) {
+					throw new ValidateException($e->getMessage());
+				}
+
+				return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+			} else {
+
+				try {
+					AdminMenu::update($data);
+				} catch (\Exception $e) {
+					throw new ValidateException($e->getMessage());
+				}
+				return $this->json(['msg' => '修改成功']);
+			}
+		}
+	}
+
+	function getInfo()
+	{
+		if ($this->userInfo['username'] == 'admin') {
+			$id =  $this->request->post('id', '', 'serach_in');
+			if (!$id) throw new ValidateException('参数错误');
+			$field = '*';
+			$res = AdminMenu::field($field)->find($id);
+			return $this->json(['data' => $res]);
+		}
+	}
+
+	function delete()
+	{
+		if ($this->userInfo['username'] == 'admin') {
+			return $this->del(new AdminMenu());
+		}
+	}
+
+	function getField()
+	{
+		$data['pids'] = _generateSelectTree(AdminMenu::getpidarray());
+		return $this->json(['data' => $data]);
+	}
+}

+ 133 - 0
app/admin/controller/AgentController.php

@@ -0,0 +1,133 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Incomelog;
+use app\model\Member;
+use app\model\Order;
+use app\model\Agent;
+use app\model\AgentLevel;
+use app\model\RegisterField;
+
+class AgentController extends Base
+{
+	function index()
+	{
+		$weid = weid();
+		$page = input('post.page', 1, 'intval');
+		$ptype = 'agent';
+
+		$Fielddata = RegisterField::where(['weid' => $weid, 'ptype' => $ptype])->select()->toArray();
+
+		if (empty($Fielddata)) {
+			RegisterField::datainitial($ptype);
+		}
+
+		$query = $this->setSearch();
+
+		$res = $query->order('sort asc,id desc')
+			->paginate(getpage())
+			->toArray();
+
+		if (!empty($res['data'])) {
+			foreach ($res['data'] as &$vo) {
+				$vo['agent_level'] = AgentLevel::getLevel($vo['agent_level']) ?? '初级';
+			}
+		}
+		$data['data'] = $res;
+		if ($page == 1) {
+			$data['field_data']['RegisterField'] = RegisterField::getlistViewField($ptype);
+		}
+
+		return $this->json($data);
+	}
+	function setSearch()
+	{
+		$keyword = trim(input('post.keyword', '', 'serach_in'));
+		$status = input('post.status', '', 'serach_in');
+		$path = input('post.path', '', 'serach_in');
+		$weid = weid();
+
+		if ($path == "/agent/audit") {
+			$status = "0";
+		}
+
+		$query = Agent::where(['weid' => $weid]);
+
+		if (!empty($keyword)) {
+			$query->where('title|tel', 'like', '%' . $keyword . '%');
+		}
+
+		if (!empty($status) || $status === "0") {
+			$query->where(['status' => $status]);
+		}
+		return $query;
+	}
+	function listUpdate()
+	{
+		$data = only('id,status');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Agent::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+	function delete()
+	{
+		return $this->del(new Agent());
+	}
+	function subordinates()
+	{
+		$weid = weid();
+		$uid = input('post.uid', '', 'serach_in');
+		$keyword = input('post.keyword', '', 'serach_in');
+		if (empty($uid)) {
+			$uid = -1;
+		}
+		$query = Member::where(['weid' => $weid, 'pid' => $uid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('id asc')
+			->paginate(getpage())
+			->toArray();
+
+		foreach ($res['data'] as &$vo) {
+			$vo['is_agent'] = yesno(Agent::is_agent($vo['id']));
+			$vo['subordinatescount'] = Member::where(['pid' => $vo['id']])->count();
+			$vo['ordercount'] = Incomelog::where(['weid' => $weid, 'uid' => $vo['id']])->count();
+		}
+
+		$data['data'] = $res;
+
+		return $this->json($data);
+	}
+
+	public function agentorder()
+	{
+		$weid = weid();
+		$uid = input('post.uid', '', 'serach_in');
+		$keyword = input('post.keyword', '', 'serach_in');
+		if (empty($uid)) {
+			$uid = -1;
+		}
+
+		$where['weid'] = $weid;
+		$where['uid'] = $uid;
+
+		$query = Incomelog::where($where);
+
+		$res = $query->order('id desc')
+			->paginate(getpage())
+			->toArray();
+
+		foreach ($res['data'] as &$vo) {
+			$vo['username'] = Member::get_name($vo['buyer_id']);
+			$vo['pay_time'] = time_format($vo['pay_time']);
+		}
+		$data['data'] = $res;
+
+		return $this->json($data);
+	}
+}

+ 84 - 0
app/admin/controller/AgentcodeController.php

@@ -0,0 +1,84 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\AgentCode;
+use app\model\Member;
+
+class AgentcodeController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = AgentCode::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('agent_code', 'like', '%' . $keyword . '%');
+		}
+
+		$datalist = $query->order('id asc')->select()->toArray();
+
+		foreach ($datalist as &$vo) {
+			$vo['uid'] = Member::get_name($vo['uid']);
+		}
+
+		$data['data'] = $datalist;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		AgentCode::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+
+				$res = AgentCode::create($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			$Agentdata = AgentCode::where(['agent_code' => $data['agent_code']])->find();
+
+			if (!empty($Agentdata)) {
+				return $this->json(['code' => 2001, 'msg' => '修改失败,这个邀请码已有人用']);
+			}
+			try {
+				AgentCode::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = AgentCode::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new AgentCode());
+	}
+}

+ 91 - 0
app/admin/controller/AgentlevelController.php

@@ -0,0 +1,91 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\AgentLevel;
+
+class AgentlevelController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = AgentLevel::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$datalist = $query->order('grade asc,id asc')->select()->toArray();
+
+		if (empty($datalist)) {
+			AgentLevel::datainitial();
+			$datalist = $query->order('grade asc,id asc')->select()->toArray();
+		}
+
+		$data['data'] = $datalist;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,is_default,is_teamaward,grade');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		AgentLevel::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+		$weid = weid();
+
+		if (empty($data['grade'])) throw new ValidateException('等级不能为空');
+
+		if (empty($id)) {
+
+			if (AgentLevel::where('weid', $weid)->where('grade', $data['grade'])->find()) {
+				throw new ValidateException('当前等级已经存在');
+			}
+			$data['weid'] = $weid;
+			try {
+				$res = AgentLevel::create($data);
+				if ($res->id && empty($data['sort'])) {
+					AgentLevel::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+			if (AgentLevel::where('weid', $weid)->where('grade', $data['grade'])->where('id', '<>', $data['id'])->find()) {
+				throw new ValidateException('当前等级已经存在');
+			}
+			try {
+				AgentLevel::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = AgentLevel::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new AgentLevel());
+	}
+}

+ 78 - 0
app/admin/controller/AgentteamawardController.php

@@ -0,0 +1,78 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\AgentTeamaWard;
+
+class AgentteamawardController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = AgentTeamaWard::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$datalist = $query->order('sort asc,id asc')->select()->toArray();
+
+		$data['data'] = $datalist;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		AgentTeamaWard::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+		try {
+			$res = AgentTeamaWard::create($data);
+			if ($res->id && empty($data['sort'])) {
+				AgentTeamaWard::update(['sort' => $res->id, 'id' => $res->id]);
+			}
+		} catch (\Exception $e) {
+			throw new ValidateException($e->getMessage());
+		}
+
+		return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+
+		} else {
+
+			try {
+				AgentTeamaWard::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = AgentTeamaWard::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new AgentTeamaWard());
+	}
+}

+ 77 - 0
app/admin/controller/AgreementController.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Agreement;
+
+class AgreementController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		Agreement::datainitial();
+		$query = Agreement::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('id asc')
+			->paginate(getpage())
+			->toArray();
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Agreement::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = Agreement::create($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				Agreement::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = Agreement::find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Agreement());
+	}
+}

+ 138 - 0
app/admin/controller/AreaController.php

@@ -0,0 +1,138 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use Overtrue\Pinyin\Pinyin;
+use app\model\Area;
+
+class AreaController extends Base
+{
+
+	function index()
+	{
+		$keyword = input('post.keyword', '', 'serach_in');
+		$parent_id =  input('post.parent_id', '', 'serach_in');
+
+		if (empty($parent_id)) {
+			$parent_id = 0;
+		}
+
+		$query = Area::where('area_parent_id', $parent_id);
+
+		if (!empty($keyword)) {
+			$query->where('area_name|keyword', 'like', '%' . $keyword . '%');
+		}
+		$pages = getpage();
+		$pages['list_rows'] = 50;
+		$res = $query->order('area_sort asc,id asc')
+			->paginate($pages)
+			->toArray();
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,area_sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Area::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+
+		$data['area_parent_id'] = (int)$data['area_parent_id'];
+
+		$pinyin = new Pinyin();
+		$data['letter'] = strtoupper($pinyin->permalink($data['area_name'], '')[0]);
+		$data['keyword'] = $data['area_name'] . strtoupper($pinyin->permalink($data['area_name'], ''));
+
+		if (empty($id)) {
+			try {
+				$res = Area::create($data);
+				if ($res->id && empty($data['area_sort'])) {
+					Area::update(['area_sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+			try {
+				Area::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$res = Area::find($id);
+		if ($res) {
+			$res = $res->toArray();
+		}
+
+		return $this->json(['data' => $res]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Area());
+	}
+
+	function getField()
+	{
+		$data['pids'] = _generateSelectTree(Area::getpcTree());
+
+		return $this->json(['data' => $data]);
+	}
+
+	function getpcTree()
+	{
+		$data['data'] = Area::getpcTree();
+		return $this->json($data);
+	}
+	public function geteltree()
+	{
+		$data = $this->eltree(0);
+
+		return $this->json(['data' => $data]);
+	}
+
+	private function eltree($pid)
+	{
+		$field = 'id,area_name';
+		$list = Area::field($field)
+			->where(['area_parent_id' => $pid])
+			->select()
+			->toArray();
+		if ($list) {
+			foreach ($list as $key => $val) {
+				$datas[$key]['id'] = $val['id'];
+				$datas[$key]['title'] = $val['area_name'];
+
+				$sublist = Area::field($field)
+					->where(['area_parent_id' => $val['id']])
+					->select()
+					->toArray();
+				if ($sublist) {
+					$datas[$key]['children'] = $this->eltree($val['id']);
+				}
+			}
+			if(is_array($datas)){
+				$datas = array_values($datas);
+			}
+			return $datas;
+		}
+	}
+}

+ 86 - 0
app/admin/controller/ArticleController.php

@@ -0,0 +1,86 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Article;
+use app\model\ArticleCategory;
+
+class ArticleController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = Article::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('sort asc,id asc')
+			->paginate(getpage())
+			->toArray();
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Article::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = Article::create($data);
+				if ($res->id && empty($data['sort'])) {
+					Article::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				Article::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = Article::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Article());
+	}
+	function getField()
+	{
+		$data['cidarray'] = ArticleCategory::getpagearray();
+
+		return $this->json(['data' => $data]);
+	}
+}

+ 83 - 0
app/admin/controller/ArticlecategoryController.php

@@ -0,0 +1,83 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\ArticleCategory;
+
+class ArticlecategoryController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = ArticleCategory::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$datalist = $query->order('sort asc,id asc')->select()->toArray();
+
+		if (empty($datalist)) {
+			ArticleCategory::datainitial();
+			$datalist = $query->order('sort asc,id asc')->select()->toArray();
+		}
+
+		$data['data'] = $datalist;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		ArticleCategory::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+		try {
+			$res = ArticleCategory::create($data);
+			if ($res->id && empty($data['sort'])) {
+				ArticleCategory::update(['sort' => $res->id, 'id' => $res->id]);
+			}
+		} catch (\Exception $e) {
+			throw new ValidateException($e->getMessage());
+		}
+
+		return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+
+		} else {
+
+			try {
+				ArticleCategory::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = ArticleCategory::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new ArticleCategory());
+	}
+}

+ 28 - 0
app/admin/controller/AuthorizationController.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Authorization;
+
+class AuthorizationController extends Base
+{
+
+	public function update()
+	{
+		$postdata = $this->request->post();
+		if (!empty($postdata['id'])) {
+			$updata['ip'] = trim($postdata['ip']);
+			$updata['domainname'] = trim($postdata['domainname']);
+			$updata['secret'] = trim($postdata['secret']);
+			Authorization::where('id', $postdata['id'])->update($updata);
+		}
+		return $this->json(['msg' => '操作成功','show'=>1]);
+	}
+
+	function getInfo()
+	{
+		$res = Author()::authorizationInfo();
+		return $this->json(['data' => $res]);
+	}
+}

+ 139 - 0
app/admin/controller/BargaingoodsController.php

@@ -0,0 +1,139 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\BargainGoods;
+use app\model\BargainGoodsSkuValue;
+use app\model\GoodsSku;
+use app\model\Goods;
+
+class BargaingoodsController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = BargainGoods::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+		if (!empty($this->sid)) {
+			$query->where('sid', $this->sid);
+		}
+
+		$res = $query->order('sort asc,id desc')
+			->paginate(getpage())
+			->toArray();
+
+		foreach ($res['data'] as &$vo) {
+			$vo['begin_date'] = time_format($vo['begin_date']);
+			$vo['end_date'] = time_format($vo['end_date']);
+
+			if(!empty($vo['goods_id'])){
+				$goods = Goods::find($vo['goods_id']);
+				if(!empty($goods)){
+					$vo['goods'] = $goods->toArray();
+					$vo['image'] = toimg($vo['goods']['image']);
+				}
+			}
+			
+		}
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		BargainGoods::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		$data['begin_date'] = strtotime($data['begin_date']);
+		$data['end_date'] = strtotime($data['end_date']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			if (!empty($this->sid)) {
+				$data['sid'] = $this->sid;
+			}
+			try {
+				$res = BargainGoods::create($data);
+				if ($res->id && empty($data['sort'])) {
+					BargainGoods::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+				$data['id'] = $res->id;
+				$this->_synupdata($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				BargainGoods::update($data);
+				$this->_synupdata($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+	function _synupdata($data)
+	{
+		BargainGoodsSkuValue::where(['bargain_id' => $data['id'], 'goods_id' => $data['goods_id']])->delete();
+		if (isset($data['sku'])) {
+			foreach ($data['sku'] as $skuarr) {
+				BargainGoodsSkuValue::create([
+					'bargain_id' => (int) $data['id'],
+					'goods_id' => (int) $data['goods_id'],
+					'sku' => $skuarr['sku'],
+					'image' => $skuarr['image'],
+					'quantity' => $skuarr['quantity'],
+					'price' => $skuarr['price']
+				]);
+			}
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = BargainGoods::field('*')->find($id)->toArray();
+		if(!empty($data['goods_id'])){
+			$goods = Goods::find($data['goods_id']);
+			if(!empty($goods)){
+				$data['goods'] = $goods->toArray();
+			}
+		}
+		$data['attribute'] = GoodsSku::get_goods_sku($data['goods_id']);
+		$data['sourceAttribute'] = $data['attribute'];
+
+		$data['sku'] = BargainGoodsSkuValue::field('sku,image,quantity,price')->where(['bargain_id' => $id, 'goods_id' => $data['goods_id']])
+			->order('id asc')
+			->select()->toArray();
+		
+		$data['begin_date'] = time_format($data['begin_date']);
+		$data['end_date'] = time_format($data['end_date']);
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new BargainGoods());
+	}
+}

+ 331 - 0
app/admin/controller/Base.php

@@ -0,0 +1,331 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\FuncNotFoundException;
+use think\exception\ValidateException;
+use think\facade\Request;
+use think\facade\Cache;
+use app\model\UsersSessions;
+use app\model\Users;
+use app\model\Store;
+use app\model\TextReplace;
+use app\model\Operatingcity;
+use app\model\Tuanzhang;
+
+class Base extends \app\BaseController
+{
+
+	protected $userInfo = [];
+	protected $sid = '';
+	protected $ocid = '';
+	protected $tzid = '';
+	protected $console = '';
+	protected $actionurl = '';
+
+	protected function initialize()
+	{
+		$controller = $this->request->controller();
+		$action = $this->request->action();
+		$app = app('http')->getName();
+
+		$url =  "{$app}/{$controller}/{$action}";
+		$url = strtolower($url);
+		$this->actionurl = $url;
+
+		if (!in_array($url, array_map('strtolower', config('my.nocheck')))) {
+			$this->checkTokenAuth();
+		}
+	}
+
+	//设置token
+	protected function setToken($data)
+	{
+
+		$weid =	$data['weid'];
+		$data =	serialize($data);
+		$token = md5(uniqid());
+
+		//登录的时候把token写入数据表
+		$tokenInfo = UsersSessions::where('token', $token)->find();
+		if (empty($tokenInfo)) {
+			UsersSessions::create([
+				'weid' => $weid,
+				'token' => $token,
+				'ptype' => 'pc',
+				'ip' => getRealIP(),
+				'expire_time' => time(),
+				'data' => $data,
+				'status' => 1
+			]);
+		} else {
+			UsersSessions::where('token', $token)->update([
+				'weid' => $weid,
+				'token' => $token,
+				'ptype' => 'pc',
+				'ip' => getRealIP(),
+				'expire_time' => time(),
+				'data' => $data,
+				'status' => 1
+			]);
+		}
+
+		return $token;
+	}
+	//设置token
+	protected function getToken()
+	{
+		global $_W;
+		$Authorization = Request::header('Authorization');
+		$tokenarr = explode('|', $Authorization);
+		$token = $tokenarr[0];
+
+		if (is_array($tokenarr)) {
+			foreach ($tokenarr as $vo) {
+				$tmp = explode('=', $vo);
+				if (is_array($tmp)) {
+					$arr[$tmp[0]] = $tmp[1];
+				}
+			}
+		}
+		$this->sid =  $arr['sid'];
+		$this->ocid =  $arr['ocid'];
+		$this->tzid =  $arr['tzid'];
+		$this->console =  $arr['console'];
+		$_W['i'] = $arr['i'];
+
+		return $token;
+	}
+
+	//检测token
+	protected function checkTokenAuth()
+	{
+		global $_W;
+		$token = $this->getToken();
+		if (!$token) {
+			abort(101, 'token不能为空');
+		}
+
+		$tokenInfo = UsersSessions::where('token', $token)->find();
+
+		if (empty($tokenInfo)) {
+			abort(101, 'token不存在');
+		} else {
+			$tokenInfo = $tokenInfo->toArray();
+		}
+
+		if (!$tokenInfo['status']) {
+			abort(101, '状态被禁用');
+		}
+
+		if (!$tokenInfo['dev_status']) {
+			abort(101, '你已下线,账户在其它设备登录!');
+		}
+
+		if (($tokenInfo['expire_time'] - config('my.token_expire_time')) > time()) {
+			abort(101, '登录状态已过期,请重新登录');
+		}
+
+		$this->userInfo = iunserializer($tokenInfo['data']);
+
+		if ($this->console == 1 && (int) $this->userInfo['weid'] > 0) {
+			abort(101, '你没有控制台的权限');
+		}
+
+		if (!empty($this->userInfo['sid'])) {
+			$this->sid = $this->userInfo['sid'];
+			$Store = Store::find($this->sid);
+			if ($Store && $Store->status == 1) {
+			} else {
+				abort(101, '你的商铺被禁用');
+			}
+		}
+		if (!empty($this->userInfo['ocid'])) {
+			$this->ocid = $this->userInfo['ocid'];
+			$Operatingcity = Operatingcity::find($this->ocid);
+			if ($Operatingcity && $Operatingcity->status == 1) {
+			} else {
+				abort(101, '你的城市代理被禁用');
+			}
+		}
+
+		if (!empty($this->userInfo['tzid'])) {
+			$this->tzid = $this->userInfo['tzid'];
+			$Tuanzhang = Tuanzhang::find($this->tzid);
+			if ($Tuanzhang && $Tuanzhang->status == 1) {
+			} else {
+				abort(101, '你的帐号被禁用');
+			}
+		}
+
+		if ((int) $this->userInfo['weid'] > 0) {
+			$_W['uniacid'] = $this->userInfo['weid'];
+		} else {
+			if (!empty($_W['i'])) {
+				if (!empty($this->userInfo['id'] && (int) $this->userInfo['weid'] == 0)) {
+					Users::where('id', $this->userInfo['id'])->update(['lastweid' => $_W['i']]);
+					$this->userInfo['lastweid'] =  $_W['i'];
+				}
+			}
+
+			$_W['uniacid'] = $this->userInfo['lastweid'];
+			if ($this->console == 1) {
+				$_W['console'] = $this->console;
+				$_W['uniacid'] = 0;
+			}
+		}
+
+		if (file_exists($this->getRoot() . '/data/test.lock')) {
+			if ($this->userInfo['username'] != 'admin' && in_array($this->actionurl, array_map('strtolower', config('my.testnoupdate')))) {
+				throw new ValidateException('演示站不能修改核心设置!');
+			}
+		}
+
+		$_W['w7copyright'] = $this->userInfo['w7copyright'];
+
+		event('DoLog', $this->userInfo['username']); //写入操作日志
+	}
+
+	//获取所有菜单
+	protected function getTotalMenus()
+	{
+		$menu =  $this->getBaseMenus();
+		$order_array = array_column($menu, 'sort');	 //数组排序
+		array_multisort($order_array, SORT_ASC, $menu);
+		return $menu;
+	}
+
+	//返回当前应用的菜单列表
+	protected function getBaseMenus()
+	{
+		$where = [];
+		$where[] = ['type', 'in', [0, 1]];
+		$where[] = ['status', '=', 1];
+
+		$query = \app\model\AdminMenu::where($where);
+		if (!empty($this->sid)) {
+			$query->where('is_store', 1);
+		} elseif (!empty($this->ocid)) {
+			$query->where('is_city', 1);
+		} elseif (!empty($this->tzid)) {
+			$query->where('is_tuanzhang', 1);
+		} elseif ($this->console == 1) {
+			$query->where('is_console', 1);
+		} else {
+			$query->where('is_admin', 1);
+		}
+
+		if (config('database.app_name') == config('my.app_v2')) {
+			$query->where('is_v2', 1);
+			$version = 'v2';
+		}
+
+		if (config('database.app_name') == config('my.app_v3')) {
+			$query->where('is_v3', 1);
+			$version = 'v3';
+		}
+
+		if (config('database.app_name') == config('my.app_v6')) {
+			$query->where('is_v6', 1);
+			$version = 'v6';
+		}
+
+		if (!empty($this->userInfo['w7copyright'])) {
+			$query->where('w7_hidden', 0);
+		}
+
+		$list = $query->order('sort asc')->select()->toArray();
+		if ($list) {
+			foreach ($list as $key => $val) {
+
+				//$menus[$key]['name'] = $val['path'];
+				$menus[$key]['name'] = $val['title'];
+				$menus[$key]['pid'] = $val['pid'];
+				$menus[$key]['id'] = $val['id'];
+				$menus[$key]['title'] = $val['title'];
+				$menus[$key]['sort'] = $val['sort'];
+				$menus[$key]['icon'] = $val['icon'] ? $val['icon'] : 'el-icon-menu';
+				$menus[$key]['path'] = $val['path'];
+				$menus[$key]['pages_path'] = $val['pages_path'];
+				if (empty($menus[$key]['pages_path'])) {
+					$menus[$key]['pages_path'] = '';
+				}
+
+				//vue3
+				$menus[$key]['component'] = str_replace('.vue', '', $val['pages_path']);
+				$menus[$key]['paths'] = $val['path'];
+				$menus[$key]['perms'] = $val['path'];
+				$menus[$key]['selected'] = $val['selected'];
+				$menus[$key]['params'] = $val['params'];
+				$menus[$key]['is_show'] = $val['is_show'];
+				$menus[$key]['is_cache'] = $val['is_cache'];
+
+				if ($val['type'] == 0) {
+					$menus[$key]['type'] = 'M';
+				} elseif ($val['type'] == 1) {
+					$menus[$key]['type'] = 'C';
+					unset($menus[$key]['children']);
+				} elseif ($val['type'] == 2) {
+					$menus[$key]['type'] = 'A';
+				}
+			}
+
+			$retmenus = _generateListTree($menus, 0, ['id', 'pid']);
+			return $retmenus;
+		}
+	}
+
+	function del($model)
+	{
+		$idx =  $this->request->post('id', '', 'serach_in');
+		if (!$idx) throw new ValidateException('参数错误');
+		if (!is_array($idx)) {
+			$idx = explode(',', $idx);
+		}
+		$model->destroy(['id' => $idx], true);
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	protected function json($result)
+	{
+		if (empty($result['code'])) {
+			$result['code'] = 2000;
+		}
+		if (is_array($result['data'])) {
+			if ($result['data']['current_page']) {
+				$result['data']['lists'] = $result['data']['data'];
+				$result['data']['count'] = $result['data']['total'];
+				$result['data']['page_no'] = $result['data']['current_page'];
+				$result['data']['page_size'] = $result['data']['per_page'];
+			}
+		}
+		$result = TextReplace::setreplace($result);
+		return json($result);
+	}
+
+	//获取要加载的组件
+	protected function getComponents($menu)
+	{
+		$components = [];
+		foreach ($menu as $v) {
+			$components[] = [
+				'name' => $v['name'],
+				'path' => $v['path'],
+				'meta' => ['title' => $v['title']],
+				'pages_path' => $v['pages_path']
+			];
+			if ($v['children']) {
+				$components = array_merge($components, $this->getComponents($v['children']));
+			}
+		}
+		return $components;
+	}
+	public function getRoot()
+	{
+		return dirname(dirname(dirname(__DIR__)));
+	}
+	public function __call($method, $args)
+	{
+		throw new FuncNotFoundException('方法不存在', $method);
+	}
+}

+ 136 - 0
app/admin/controller/BottommenuController.php

@@ -0,0 +1,136 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\BottomMenu;
+use app\model\BottomMenuOriginal;
+use app\model\BottomMenuType;
+use app\model\DiyPage;
+
+class BottommenuController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$tid = input('post.tid', '', 'serach_in');
+		$tid = str_ireplace('aaa', '', $tid);
+		$path = input('post.path', '', 'serach_in');
+
+		if ($path == '/bottommenu/index') {
+			$mo = 'bottom';
+		}
+
+		if ($path == '/bottommenu/technical') {
+			$mo = 'technical';
+		}
+
+		if ($path == '/bottommenu/store') {
+			$mo = 'store';
+		}
+
+		if ($path == '/clientmenu/member') {
+			$mo = 'member';
+		}
+
+		$query = BottomMenu::where(['weid' => $weid, 'tid' => (int) $tid, 'module' => $mo]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$datalist = $query->order('sort asc,id asc')->select()->toArray();
+
+		if (empty($datalist)) {
+			BottomMenu::datainitial($mo, $tid);
+			$datalist = $query->order('sort asc,id asc')->select()->toArray();
+		}
+
+		foreach ($datalist as &$vo) {
+
+			$vo['hump'] = yesno($vo['hump']);
+			$vo['is_index'] = yesno($vo['is_index']);
+			$vo['icon'] = toimg($vo['icon']);
+			$vo['iconactive'] = toimg($vo['iconactive']);
+		}
+		$data['MenuType'] = BottomMenuType::getpagearray();
+		$data['data'] = $datalist;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,is_submitaudit,is_index,hump,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		BottomMenu::update($data);
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		$data['tid'] = (int) str_ireplace('aaa', '', $data['tid']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			$data['module'] = 'bottom';
+
+			if ($data['path'] == '/clientmenu/member') {
+				$data['module'] = 'member';
+			}
+	
+			if ($data['path'] == '/bottommenu/technical') {
+				$data['module'] = 'technical';
+			}
+	
+			if ($data['path'] == '/bottommenu/store') {
+				$data['module'] = 'store';
+			}
+			try {
+				$res = BottomMenu::create($data);
+				if ($res->id && empty($data['sort'])) {
+					BottomMenu::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				BottomMenu::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = BottomMenu::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new BottomMenu());
+	}
+	function getField()
+	{
+		$data['urlarray'] = BottomMenuOriginal::getpagearray();
+
+		$diypagearray =  DiyPage::getpagearray();
+		if (!empty($diypagearray)) {
+			$data['urlarray'] = array_merge($data['urlarray'], $diypagearray);
+		}
+
+		return $this->json(['data' => $data]);
+	}
+}

+ 64 - 0
app/admin/controller/BottommenutypeController.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\BottomMenuType;
+
+class BottommenutypeController extends Base
+{
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = BottomMenuType::create($data);
+				if ($res->id && empty($data['sort'])) {
+					BottomMenuType::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				BottomMenuType::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+	function getpclist()
+	{
+
+		$BottomMenu = BottomMenuType::getpagearray();
+		$alldata[0]['val'] = '0';
+		$alldata[0]['key'] = '默认';
+		if (!empty($BottomMenu)) {
+			$data = array_merge($alldata, $BottomMenu);
+		} else {
+			$data = $alldata;
+		}
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		$idx =  $this->request->post('id', '', 'serach_in');
+		$idx = str_ireplace('aaa', '', $idx);
+		if (!$idx) throw new ValidateException('参数错误');
+		if (!is_array($idx)) {
+			$idx = explode(',', $idx);
+		}
+		BottomMenuType::destroy(['id' => $idx], true);
+		return $this->json(['msg' => '操作成功']);
+	}
+}

+ 76 - 0
app/admin/controller/BroadcastController.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Broadcast;
+
+class BroadcastController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = Broadcast::where(['weid' => $weid,'ptype'=>'basis']);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('id desc')
+			->paginate(getpage())
+			->toArray();
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Broadcast::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = Broadcast::create($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				Broadcast::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = Broadcast::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Broadcast());
+	}
+}

+ 128 - 0
app/admin/controller/CategoryController.php

@@ -0,0 +1,128 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Category;
+use app\model\ServiceTimeptype;
+
+class CategoryController extends Base
+{
+
+	function index()
+	{
+		$keyword = input('post.keyword', '', 'serach_in');
+		$ptype = input('post.ptype', '', 'serach_in');
+
+		$query = Category::where('weid', weid());
+
+		if (!empty($ptype)) {
+			$query->where('ptype', $ptype);
+		}
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$list = $query->order('sort asc')->select()->toArray();
+
+		foreach ($list as &$vo) {
+			$vo['image'] = toimg($vo['image']);
+			if ($vo['ptype'] == 1) {
+				$vo['deliverymodename'] = getgoodsdeliverymodename($vo['deliverymode']);
+			} elseif ($vo['ptype'] == 2) {
+				$vo['deliverymodename'] = getservicedeliverymodename($vo['deliverymode']);
+				$vo['servicetime_ptype'] = ServiceTimeptype::getTitle($vo['servicetime_ptype']);
+			}
+			$vo['ptype'] = getptype($vo['ptype']);
+		}
+		$data['data'] = _generateListTree($list, 0, ['id', 'pid']);
+
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,is_binding,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Category::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+		$data['pid'] = (int)$data['pid'];
+		if (!empty($data['deliverymode'])) {
+			$data['deliverymode'] = implode(',', $data['deliverymode']);
+		}
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = Category::create($data);
+				if ($res->id && empty($data['sort'])) {
+					Category::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+			try {
+				Category::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id = input('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$res = Category::find($id);
+		if ($res) {
+			$res = $res->toArray();
+			$res['image'] = toimg($res['image']);
+			if (empty($res['deliverymode'])) {
+				$res['deliverymode'] = [];
+			} else {
+				$res['deliverymode'] =  explode(',', $res['deliverymode']);
+			}
+		}
+
+		return $this->json(['data' => $res]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Category());
+	}
+
+	function getField()
+	{
+		$ptype = input('post.ptype', '', 'serach_in');
+		$data['pids'] = _generateSelectTree(Category::getpcarray($ptype));
+		$data['ptypearray'] = getptype();
+		$data['goodsdeliverymodearray'] = getgoodsdeliverymode();
+		$data['servicedeliverymodearray'] = getservicedeliverymode();
+		$data['servicetime_ptypearray'] = ServiceTimeptype::getpcarray();
+		return $this->json(['data' => $data]);
+	}
+	function getTree()
+	{
+
+		$alldata[0]['val'] = '0';
+		$alldata[0]['key'] = '全部分类';
+		$alldata[0]['pid'] = 0;
+
+		$cdata = _generateSelectTree(Category::getpcarray());
+
+		$data = array_merge($alldata, $cdata);
+		return $this->json(['data' => $data]);
+	}
+}

+ 16 - 0
app/admin/controller/ClearcacheController.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\model\UsersSessions;
+
+class ClearcacheController extends Base
+{
+
+	public function index()
+	{
+		UsersSessions::where('token', '<>', $this->getToken())->delete();
+
+		return $this->json(['data' => '清除缓存功成!']);
+	}
+}

+ 45 - 0
app/admin/controller/CommentController.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Comment;
+use app\model\Goods;
+use app\model\Order;
+
+class CommentController extends Base
+{
+
+	function index()
+	{
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = Comment::where(['weid' => weid()]);
+		if (!empty($keyword)) {
+			$query->where('content', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('id desc')
+			->paginate(getpage())
+			->toArray();
+		if (!empty($res['data'])) {
+			foreach ($res['data'] as &$vo) {
+				$vo['goodsName'] = Goods::getGoodsName($vo['goods_id']);
+			}
+		}
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Comment::update($data);
+		$comment = Comment::find($data['id']);
+
+		if ($comment) {
+			Order::where('uuid', $comment->technical_uuid)->update(['comment' => Comment::total_byuuid($comment->technical_uuid)]);
+		}
+
+		return $this->json(['msg' => '操作成功']);
+	}
+}

+ 181 - 0
app/admin/controller/ConfigController.php

@@ -0,0 +1,181 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Config;
+use app\model\MemberAuthGroup;
+use app\model\OrderStatus;
+use app\samos\wechat\SubscribeMessage;
+use app\samos\wechat\Messagetpl;
+
+class ConfigController extends Base
+{
+
+	public function update()
+	{
+		$config = $this->request->post();
+		$mo = $config['mo'];
+		if (empty($mo)) {
+			$mo = 'common';
+		}
+		if ($mo == 'common') {
+			if (!empty($config['keyword'])) {
+				$config['keyword'] = implode(',', $config['keyword']);
+			}
+		}
+
+		if ($mo == 'collect') {
+			if (!empty($config['collect_type'])) {
+				$config['collect_type'] = implode(',', $config['collect_type']);
+			}
+		}
+		if ($mo == 'miniprogram') {
+			if ($config['app_id'] == $config['techapp_id']) {
+				throw new ValidateException("用户端小程序AppId和师傅端AppId不能相同!");
+			}
+		}
+
+		$configstr = serialize($config);
+
+		if (empty($config['id'])) {
+			$data["weid"] = weid();
+			$data["module"] = $mo;
+			$data["status"] = 1;
+			$data["settings"] = $configstr;
+			Config::create($data);
+		} else {
+			Config::update(['settings' => $configstr], ['id' => $config['id']]);
+		}
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	function getInfo()
+	{
+		$mo = input('post.mo', '', 'serach_in');
+		if (empty($mo)) {
+			$mo = 'common';
+		}
+		$res = Config::getconfig($mo);
+		$res['mo'] = $mo;
+		if ($mo == 'common') {
+			$res['logo'] = toimg($res['logo']);
+			if (!empty($res['keyword'])) {
+				$res['keyword'] = explode(',', $res['keyword']);
+			}
+
+			$res['autoapi'] = gethost() . scriptPath() . '/public/index.php/index/auto?i=' . weid();
+		}
+		if ($mo == 'mp') {
+			$res['h5url'] = gethost() . scriptPath() . "/h5/?i=" . weid();
+		}
+		if ($mo == 'messagetpl') {
+			$res['ordertploption'] = getordertploption();
+		}
+
+		if ($mo == 'collect') {
+			if (empty($res['collect_type'])) {
+				$res['collect_type'] = ['bank'];
+			} else {
+				if (!empty($res['collect_type'])) {
+					$res['collect_type'] = explode(',', $res['collect_type']);
+				}
+			}
+		}
+		return $this->json(['data' => $res]);
+	}
+
+	function getField()
+	{
+		$data['member_auth_group'] = MemberAuthGroup::getpcarray();
+		$data['collect_typearray'] = getcollect_type();
+
+		return $this->json(['data' => $data]);
+	}
+	public function getsubscribemessage()
+	{
+		$tpl = input('post.tpl', '', 'serach_in');
+		$mo = 'subscribemessage';
+		$res = Config::getconfig($mo);
+		$res['mo'] = $mo;
+		$app = \app\samos\wechat\MiniProgram::makemini();
+		$sm = SubscribeMessage::addparam($tpl);
+
+		$Templates = $app->subscribe_message->getTemplates();
+		foreach ($Templates['data'] as $vo) {
+			if ($vo['title'] == $sm['title']) {
+				$res[$tpl] = $vo['priTmplId'];
+				break;
+			}
+		}
+
+		if (empty($res[$tpl])) {
+
+			$result =	$app->subscribe_message->addTemplate($sm['tid'], $sm['kidList'], $sm['sceneDesc']);
+
+			if ($result['errmsg'] == 'ok') {
+				$res[$tpl] = $result['priTmplId'];
+			} else {
+				throw new ValidateException("获取失败!" . $result['errcode']);
+			}
+		}
+		if (empty($res['id'])) {
+			$data["weid"] = weid();
+			$data["module"] = $mo;
+			$data["status"] = 1;
+			$data["settings"] = serialize($res);
+			Config::create($data);
+		} else {
+			Config::update(['settings' => serialize($res)], ['id' => $res['id']]);
+		}
+
+		$res = Config::getconfig($mo);
+
+		return $this->json(['data' => $res]);
+	}
+	public function getmessagetpl()
+	{
+		$tpl = input('post.tpl', '', 'serach_in');
+		$mo = 'messagetpl';
+		$res = Config::getconfig($mo);
+		$res['mo'] = $mo;
+		$app = Messagetpl::maketpl();
+
+		$sm = Messagetpl::addparam($tpl);
+		$Templates = $app->getAllPrivateTemplate();
+		//var_dump($Templates);
+		$is_oldtpl = true;
+		foreach ($Templates['template_list'] as $vo) {
+			if ($vo['title'] == $sm['title']) {
+				$res[$tpl] = $vo['template_id'];
+				$is_oldtpl = false;
+				break;
+			}
+		}
+
+		if ($is_oldtpl) {
+
+			$result =	$app->addTemplate($sm['tid'], $sm['keyword_name_list']);
+
+			if ($result['errmsg'] == 'ok') {
+				$res[$tpl] = $result['template_id'];
+			} else {
+				throw new ValidateException("获取失败!" . $result['errcode']);
+			}
+		}
+		if (empty($res['id'])) {
+			$data["weid"] = weid();
+			$data["module"] = $mo;
+			$data["status"] = 1;
+			$data["settings"] = serialize($res);
+			Config::create($data);
+		} else {
+			Config::update(['settings' => serialize($res)], ['id' => $res['id']]);
+		}
+
+		$res = Config::getconfig($mo);
+
+		return $this->json(['data' => $res]);
+	}
+}

+ 153 - 0
app/admin/controller/CouponController.php

@@ -0,0 +1,153 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Coupon;
+use app\model\Category;
+use app\model\Goods;
+
+class CouponController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$page = input('post.page', 1, 'intval');
+		$keyword = input('post.keyword', '', 'serach_in');
+		$status = input('post.status', '', 'serach_in');
+		$query = Coupon::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('name', 'like', '%' . $keyword . '%');
+		}
+
+		if (!empty($status) || $status === "0") {
+			$query->where(['status' => $status]);
+		}
+		if (!empty($this->sid)) {
+			$query->where('sid', $this->sid);
+		}
+
+		$res = $query->order('sort asc,id desc')
+			->paginate(getpage())
+			->toArray();
+
+		foreach ($res['data'] as &$vo) {
+			if ($vo['coupon_type'] == 10) {
+				$vo['couponway'] = '满:' . $vo['min_price'] . '元,减:' . $vo['reduce_price'] . '元';
+			} elseif ($vo['coupon_type'] == 20) {
+				$vo['couponway'] = '满:' . $vo['min_price'] . '元,打:' . $vo['discount'] . '折';
+			}
+
+			if ($vo['expire_type'] == 10) {
+
+				if ($vo['expire_day'] > 0) {
+					$vo['expire_day'] = $vo['expire_day'] . "天";
+				} else {
+					$vo['expire_day'] = "长期";
+				}
+
+				$vo['expire_type'] = '领取后:' . $vo['expire_day'] . '有效';;
+			} elseif ($vo['expire_type'] == 20) {
+
+				$vo['expire_type'] = '有效期:' . time_format($vo['start_time']) . '到' . time_format($vo['end_time']);
+			}
+
+			$vo['ptype'] = getCouponPtype($vo['ptype']);
+			$vo['coupon_type'] = getCouponType($vo['coupon_type']);
+			$vo['color'] = getColor($vo['color']);
+		}
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Coupon::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		$data['start_time'] = strtotime($data['start_time']);
+		$data['end_time'] = strtotime($data['end_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			if (!empty($this->sid)) {
+				$data['sid'] = $this->sid;
+			}
+			try {
+				$res = Coupon::create($data);
+				if ($res->id && empty($data['sort'])) {
+					Coupon::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				Coupon::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = Coupon::field('*')->find($id)->toArray();
+
+		if ($data['use_goods']==2 && !empty($data['goods_ids'])) {
+			$goods = Goods::find($data['goods_ids']);
+			if (!empty($goods)) {
+				$data['goods'] = $goods->toArray();
+			}
+		}else{
+			$data['goods'] = [];
+		}
+
+		if (empty($data['start_time'])) {
+			$data['start_time'] = "";
+		} else {
+			$data['start_time'] = time_ymd($data['start_time']);
+		}
+		if (empty($data['end_time'])) {
+			$data['end_time'] = "";
+		} else {
+			$data['end_time'] = time_ymd($data['end_time']);
+		}
+
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Coupon());
+	}
+	function getField()
+	{
+		
+		$data['colorarray'] = getColor();
+		$data['ptypearray'] = getCouponPtype();
+		$data['coupon_typearray'] = getCouponType();
+		$data['expire_typearray'] = getExpireType();
+		$data['cat_idsarray'] = _generateSelectTree(Category::getpcarray());
+		
+		return $this->json(['data' => $data]);
+	}
+}

+ 296 - 0
app/admin/controller/DashboardController.php

@@ -0,0 +1,296 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Order;
+use app\model\OrderStatus;
+use app\model\Goods;
+use app\model\Member;
+use app\model\Technical;
+use app\model\Agent;
+use app\model\Operatingcity;
+use app\model\Tuanzhang;
+use app\model\RegisterField;
+use app\model\AgentLevel;
+use app\model\PartnerLevel;
+use app\model\Agreement;
+use app\model\OperatingcityLevel;
+use app\model\Paymethod;
+use app\model\TechnicalLevel;
+use app\model\Lang;
+use app\model\BottomMenu;
+use app\model\GoodsQuantityUnit;
+
+class DashboardController extends Base
+{
+
+    function index()
+    {
+        $weid = weid();
+        $where['weid'] = $weid;
+
+        $orderwhere = $where;
+        $Goodswhere = $where;
+        $Memberwhere = $where;
+        $Technicalwhere = $where;
+
+        if (!empty($this->sid)) {
+            $sidwhere = $where;
+            $sidwhere['sid'] = $this->sid;
+            $orderwhere = $sidwhere;
+            $Goodswhere = $sidwhere;
+            $Memberwhere = $sidwhere;
+            $Technicalwhere = $sidwhere;
+        } elseif (!empty($this->ocid)) {
+            $Operatingcitydata = Operatingcity::find($this->ocid);
+            if ($Operatingcitydata) {
+                $Operatingcitydata = $Operatingcitydata->toArray();
+                if(empty($Operatingcitydata['areatype'])){
+					$Operatingcitydata['areatype'] = 3;
+				}
+                if ($Operatingcitydata['areatype'] == 3) {
+                    $orderwhere['shipping_district_name'] = $Operatingcitydata['district_name'];
+                    $Goodswhere['district_name'] = $Operatingcitydata['district_name'];
+                    $Technicalwhere['district_name'] = $Operatingcitydata['district_name'];
+                } elseif ($Operatingcitydata['areatype'] == 2) {
+                    $orderwhere['shipping_city_name'] = $Operatingcitydata['city_name'];
+                    $Goodswhere['city_name'] = $Operatingcitydata['city_name'];
+                    $Technicalwhere['city_name'] = $Operatingcitydata['city_name'];
+                } elseif ($Operatingcitydata['areatype'] == 1) {
+                    $orderwhere['shipping_province_name'] = $Operatingcitydata['province_name'];
+                    $Goodswhere['province_name'] = $Operatingcitydata['province_name'];
+                    $Technicalwhere['province_name'] = $Operatingcitydata['province_name'];
+                }
+            }
+
+            $Memberwhere['ocid'] = $this->ocid;
+        } elseif (!empty($this->tzid)) {
+            $Tuanzhangdata = Tuanzhang::find($this->tzid);
+            if ($Tuanzhangdata) {
+                $Tuanzhangdata = $Tuanzhangdata->toArray();
+                $orderwhere['shipping_district_name'] = $Tuanzhangdata['district_name'];
+                $Goodswhere['district_name'] = $Tuanzhangdata['district_name'];
+                $Technicalwhere['district_name'] = $Tuanzhangdata['district_name'];
+            }
+        }
+        $statistical['deliverOrder'] = Order::where($orderwhere)->where('order_status_id', '>', 2)->count();
+        $statistical['returnOrder'] = Order::where($orderwhere)->where(['order_status_id' => 6])->count();
+        $statistical['sellOut'] = Goods::where($Goodswhere)->where(['quantity' => 0])->count();
+        $statistical['member_count'] = Member::where($Memberwhere)->count();
+        $statistical['technical_count'] = Technical::where($Technicalwhere)->count();
+        $statistical['agent_count'] = Agent::where($where)->count();
+        $statistical['order_count'] = $this->getOrdercount();
+        $statistical['order_paycount'] = $this->getOrdercount(['where' => ['order_status_id' => 2]]);
+        $statistical['order_paytotal'] = Order::where($orderwhere)->where('pay_time', '>', 0)->sum('total') + Order::where($orderwhere)->where('pay_time', '>', 0)->sum('additional');
+        $statistical['order_paytotal'] = round($statistical['order_paytotal'], 2);
+        $statistical['order_pay'] = $this->getOrdercount(['pay' => 1]);
+        $statistical['memberAccess'] = $this->getAccess();
+
+        $statistical['accessTopay_conversionrate'] = to_percent($statistical['order_paycount'], $statistical['memberAccess']);
+        $statistical['accessToorder_conversionrate'] = to_percent($statistical['order_count'], $statistical['memberAccess']);
+        $statistical['orderTopay_conversionrate'] = to_percent($statistical['order_paycount'], $statistical['order_count']);
+
+        $clinchadeal[] = $this->getOrderdaycount(['getday' => 7, 'pay' => 1]);
+        $clinchadeal[] = $this->getOrderdaycount(['getday' => 6, 'pay' => 1]);
+        $clinchadeal[] = $this->getOrderdaycount(['getday' => 5, 'pay' => 1]);
+        $clinchadeal[] = $this->getOrderdaycount(['getday' => 4, 'pay' => 1]);
+        $clinchadeal[] = $this->getOrderdaycount(['getday' => 3, 'pay' => 1]);
+        $clinchadeal[] = $this->getOrderdaycount(['getday' => 2, 'pay' => 1]);
+        $clinchadeal[] = $this->getOrderdaycount(['getday' => 1, 'pay' => 1]);
+
+        $res['statistical'] = $statistical;
+        $res['clinchadeal'] = $clinchadeal;
+        $res['goodssaletop5'] = Goods::where($Goodswhere)->order('sale_count desc')->limit(5)->select()->toArray();
+        $res['consumedop5'] = Member::where($Memberwhere)->order('totleconsumed desc')->limit(5)->select()->toArray();
+        $res['service_timestop5'] = Technical::where($Technicalwhere)->order('service_times desc')->limit(5)->select()->toArray();
+
+        if (config('database.app_name') == ('xm_mal' . 'lv3')) {
+            $res['version'] = 'v3';
+        } else {
+            $res['version'] = 'v2';
+        }
+
+        $data['data'] = $res;
+
+
+        return $this->json($data);
+    }
+    function datainitial()
+    {
+        RegisterField::datainitial('member');
+        RegisterField::datainitial('agent');
+        RegisterField::datainitial('partner');
+        RegisterField::datainitial('technical');
+        RegisterField::datainitial('store');
+        RegisterField::datainitial('operatingcity');
+
+        AgentLevel::datainitial();
+        PartnerLevel::datainitial();
+        Agreement::datainitial();
+        OperatingcityLevel::datainitial();
+        Paymethod::datainitial();
+        TechnicalLevel::datainitial();
+        Lang::datainitial();
+
+        BottomMenu::datainitial('bottom');
+        BottomMenu::datainitial('technical');
+        BottomMenu::datainitial('store');
+        BottomMenu::datainitial('member');
+
+        OrderStatus::datainitial('goods');
+        OrderStatus::datainitial('goodsuser');
+        OrderStatus::datainitial('service');
+        OrderStatus::datainitial('storeservice');
+        OrderStatus::datainitial('serviceuser');
+
+        GoodsQuantityUnit::datainitial(1);
+        GoodsQuantityUnit::datainitial(2);
+
+        return $this->json($data);
+    }
+
+    public function getAccess()
+    {
+
+        $getdata = input('get.');
+        if (empty($getdata['getday'])) {
+            $getdata['getday'] = 1;
+        }
+        $query = Member::where(['weid' => weid()]);
+
+        if (empty($getdata['date_start'])) {
+            $getdata['date_start'] = date("Y-m-d H:i:s", strtotime("-" . $getdata['getday'] . " day"));
+        }
+
+        if (empty($getdata['date_end'])) {
+            $getdata['date_end'] = date("Y-m-d H:i:s");
+        }
+
+        if (!empty($getdata['date_start'])) {
+            $query->where('regdate', '>=', strtotime(trim($getdata['date_start'])));
+        }
+        if (!empty($getdata['date_end'])) {
+            $query->where('regdate', '<=', strtotime(trim($getdata['date_end'])) + 86400);
+        }
+
+        return $query->count();
+    }
+    public function getOrdercount($data = [])
+    {
+        $where = $data['where'];
+        $pay = $data['pay'];
+        $getdata = input('get.');
+        if (empty($getdata['getday'])) {
+            $getdata['getday'] = 1;
+        }
+        $where['weid'] = weid();
+
+        if (!empty($this->sid)) {
+            $where['sid'] = $this->sid;
+        } elseif (!empty($this->ocid)) {
+
+            $Operatingcitydata = Operatingcity::find($this->ocid);
+            if ($Operatingcitydata) {
+                $Operatingcitydata = $Operatingcitydata->toArray();
+                if(empty($Operatingcitydata['areatype'])){
+					$Operatingcitydata['areatype'] = 3;
+				}
+                if ($Operatingcitydata['areatype'] == 3) {
+                    $where['shipping_district_name'] = $Operatingcitydata['district_name'];
+                } elseif ($Operatingcitydata['areatype'] == 2) {
+                    $where['shipping_city_name'] = $Operatingcitydata['city_name'];
+                } elseif ($Operatingcitydata['areatype'] == 1) {
+                    $where['shipping_province_name'] = $Operatingcitydata['province_name'];
+                }
+            }
+        } elseif (!empty($this->tzid)) {
+
+            $Tuanzhangdata = Tuanzhang::find($this->tzid);
+            if ($Tuanzhangdata) {
+                $Tuanzhangdata = $Tuanzhangdata->toArray();
+                $where['shipping_district_name'] = $Tuanzhangdata['district_name'];
+            }
+        }
+        $query =  Order::where($where);
+
+        if (empty($getdata['date_start'])) {
+            $getdata['date_start'] = date("Y-m-d H:i:s", strtotime("-" . $getdata['getday'] . " day"));
+        }
+
+        if (empty($getdata['date_end'])) {
+            $getdata['date_end'] = date("Y-m-d H:i:s");
+        }
+
+        if (!empty($getdata['date_start'])) {
+            $query->where('create_time', '>=', strtotime(trim($getdata['date_start'])));
+        }
+        if (!empty($getdata['date_end'])) {
+            $query->where('create_time', '<=', strtotime(trim($getdata['date_end'])) + 86400);
+        }
+
+        if (empty($pay)) {
+            return $query->count();
+        } else {
+            return $query->sum('total');
+        }
+    }
+
+    public function getOrderdaycount($data = [])
+    {
+        $where = $data['where'];
+        $pay = $data['pay'];
+        $getdata['getday'] = $data['getday'];
+        $where['weid'] = weid();
+        if (!empty($this->sid)) {
+            $where['sid'] = $this->sid;
+        } elseif (!empty($this->ocid)) {
+
+            $Operatingcitydata = Operatingcity::find($this->ocid);
+            if ($Operatingcitydata) {
+                $Operatingcitydata = $Operatingcitydata->toArray();
+                if(empty($Operatingcitydata['areatype'])){
+					$Operatingcitydata['areatype'] = 3;
+				}
+                if ($Operatingcitydata['areatype'] == 3) {
+                    $where['shipping_district_name'] = $Operatingcitydata['district_name'];
+                } elseif ($Operatingcitydata['areatype'] == 2) {
+                    $where['shipping_city_name'] = $Operatingcitydata['city_name'];
+                } elseif ($Operatingcitydata['areatype'] == 1) {
+                    $where['shipping_province_name'] = $Operatingcitydata['province_name'];
+                }
+            }
+        } elseif (!empty($this->tzid)) {
+
+            $Tuanzhangdata = Tuanzhang::find($this->tzid);
+            if ($Tuanzhangdata) {
+                $Tuanzhangdata = $Tuanzhangdata->toArray();
+                $where['shipping_district_name'] = $Tuanzhangdata['district_name'];
+            }
+        }
+
+        $query =  Order::where($where);
+
+        if (empty($getdata['date_start'])) {
+            $getdata['date_start'] = date("Y-m-d H:i:s", strtotime("-" . $getdata['getday'] . " day"));
+        }
+
+        if (empty($getdata['date_end'])) {
+            $getdata['date_end'] = date("Y-m-d H:i:s", strtotime("-" . ($getdata['getday'] - 1) . " day"));
+        }
+
+        if (!empty($getdata['date_start'])) {
+            $query->where('create_time', '>=', strtotime(trim($getdata['date_start'])));
+        }
+        if (!empty($getdata['date_end'])) {
+            $query->where('create_time', '<=', strtotime(trim($getdata['date_end'])) + 86400);
+        }
+
+        if (empty($pay)) {
+            return $query->count();
+        } else {
+            //var_dump($query->getLastsql());
+            return $query->sum('total');
+        }
+    }
+}

+ 77 - 0
app/admin/controller/DepartmentController.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Department;
+
+class DepartmentController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = Department::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$datalist = $query->order('sort asc,id asc')->select()->toArray();
+
+		$data['data'] = $datalist;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Department::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = Department::create($data);
+				if ($res->id && empty($data['sort'])) {
+					Department::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+			
+			try {
+				Department::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = Department::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Department());
+	}
+}

+ 112 - 0
app/admin/controller/DictdataController.php

@@ -0,0 +1,112 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\DictData;
+
+class DictdataController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = DictData::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('sort asc,id asc')
+			->paginate(getpage())
+			->toArray();
+
+		foreach ($res['data'] as &$vo) {
+			$vo['pic'] = toimg($vo['pic']);
+		}
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		DictData::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = DictData::create($data);
+				if ($res->id && empty($data['sort'])) {
+					DictData::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				DictData::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = DictData::find($id);
+
+		if ($data) {
+			$data = $data->toArray();
+			$data['pic'] = toimg($data['pic']);
+		}
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new DictData());
+	}
+
+	function getoptions()
+	{
+		$type = input('get.type', '', 'serach_in');
+		if (!is_string($type)) {
+			return [];
+		}
+
+		$type = explode(',', $type);
+		$lists = DictData::whereIn('type_value', $type)->select()->toArray();
+
+		if (empty($lists)) {
+			return [];
+		}
+
+		$result = [];
+		foreach ($type as $item) {
+			foreach ($lists as $dict) {
+				if ($dict['type_value'] == $item) {
+					$result[$item][] = $dict;
+				}
+			}
+		}
+		return $this->json(['data' => $result]);
+	}
+}

+ 364 - 0
app/admin/controller/DiyfieldsController.php

@@ -0,0 +1,364 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use think\facade\Validate;
+use app\model\Technical;
+use app\model\Agent;
+use app\model\Partner;
+use app\model\Tuanzhang;
+use app\model\Member;
+use app\model\Store;
+use app\model\Operatingcity;
+use app\model\RegisterField;
+use app\model\Category;
+use app\model\StoreCate;
+use app\model\Users;
+use app\model\Openid;
+
+class DiyfieldsController extends Base
+{
+	function getModel()
+	{
+		$ptype = $this->getPath()[1];
+		if ($ptype == 'technical') {
+			return new Technical;
+		} else if ($ptype == 'agent') {
+			return new Agent;
+		} else if ($ptype == 'member') {
+			return new Member;
+		} else if ($ptype == 'operatingcity') {
+			return new Operatingcity;
+		} else if ($ptype == 'store') {
+			return new Store;
+		} else if ($ptype == 'partner') {
+			return new Partner;
+		} else if ($ptype == 'tuanzhang') {
+			return new Tuanzhang;
+		}
+	}
+	function getPath()
+	{
+		$path = input('post.path', '', 'serach_in');
+		if (!empty($path)) {
+			$tmppath = explode('/', $path);
+		}
+		if (empty($tmppath)) {
+			$con = input('con');
+			if (!empty($con)) {
+				$tmppath[1] = $con;
+			}
+		}
+
+		return $tmppath;
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$uuid = $this->request->post('uuid');
+		$postdata = only('id,fields');
+
+		$regdata = RegisterField::fieldToData($postdata, 'pc');
+
+		$data = $regdata['data'];
+		unset($data['create_time']);
+
+		if ($data['username'] && empty($id)) {
+			$data['uuid'] = uniqid(rand(1, 10000));
+		}
+		$usersdata['password'] = $data['password'];
+
+		$data['password'] = '12345678';
+
+		$validate = Validate::rule($regdata['rule']);
+		if (!$validate->check($data)) {
+			throw new ValidateException($validate->getError());
+		}
+
+		unset($data['password']);
+		if (empty($id)) {
+			$usersdata['username'] = trim($data['username']);
+		}
+		unset($data['username']);
+
+		if ($usersdata['username']) {
+			if (Users::where('username', $usersdata['username'])->find()) {
+				throw new ValidateException('用户名已被占用');
+			}
+		}
+
+		if ($this->getPath()[1] == 'technical') {
+			if ($data['photoalbum']) {
+				$data['touxiang'] = explode(',', $data['photoalbum'])[0];
+			}
+		}
+
+		if (empty($id)) {
+			$data['uid'] = 0;
+			$data['weid'] = weid();
+			$data['sort'] = 100;
+			try {
+				$res = $this->getModel()->create($data);
+				if ($this->getPath()[1] == 'store' || $this->getPath()[1] == 'technical' || $this->getPath()[1] == 'tuanzhang' || $this->getPath()[1] == 'operatingcity') {
+
+					if ($res->id && !empty($usersdata['username'])) {
+						if (!empty($usersdata['password'])) {
+							$usersdata["salt"] = substr(md5(uniqid()), 8, 8);
+							$usersdata['password'] = pass_hash($usersdata['password'], $usersdata["salt"]);
+						} else {
+							unset($usersdata['password']);
+						}
+						if ($this->getPath()[1] == 'store') {
+							$usersdata['sid'] = $res->id;
+						}
+						if ($this->getPath()[1] == 'operatingcity') {
+							$usersdata['ocid'] = $res->id;
+						}
+						if ($this->getPath()[1] == 'tuanzhang') {
+							$usersdata['tzid'] = $res->id;
+						}
+
+						$usersdata['weid'] = weid();
+						$usersdata['uuid'] = $data['uuid'];
+						$usersdata['w7uid'] = 0;
+						Users::create($usersdata);
+					}
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+			$data['id'] = $id;
+
+			if ($this->getPath()[1] == 'technical') {
+				$Technicalwhere['id'] = $data['id'];
+				$Technicalwhere['province_name'] = $data['province_name'];
+				$Technicalwhere['city_name'] = $data['city_name'];
+				$Technicalwhere['district_name'] = $data['district_name'];
+				$Technicalwhere['house_number'] = $data['house_number'];
+				if (Technical::where($Technicalwhere)->find()) {
+					unset($data['latitude']);
+					unset($data['longitude']);
+					unset($data['region_name']);
+				}
+			}
+			if ($this->getPath()[1] == 'store') {
+				$storewhere['id'] = $data['id'];
+				$storewhere['province_name'] = $data['province_name'];
+				$storewhere['city_name'] = $data['city_name'];
+				$storewhere['district_name'] = $data['district_name'];
+				$storewhere['house_number'] = $data['house_number'];
+				if (Store::where($storewhere)->find()) {
+					unset($data['latitude']);
+					unset($data['longitude']);
+					unset($data['region_name']);
+				}
+			}
+			try {
+
+				if (!empty($usersdata['password'])) {
+					$usersdata["salt"] = substr(md5(uniqid()), 8, 8);
+					$usersdata['password'] = pass_hash($usersdata['password'], $usersdata["salt"]);
+
+					Users::where('uuid', $uuid)->update($usersdata);
+				} else {
+					unset($usersdata['password']);
+				}
+
+				$this->getModel()->update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '操作成功']);
+		}
+	}
+	public function audit()
+	{
+		$id = $this->request->post('id');
+		$data['id'] = $id;
+		unset($data['create_time']);
+		$data['status'] = 1;
+
+		try {
+			$this->getModel()->update($data);
+		} catch (\Exception $e) {
+			throw new ValidateException($e->getMessage());
+		}
+		return $this->json(['msg' => '审核成功']);
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		$ptype = $this->getPath()[1];
+		$data = RegisterField::getinputField($ptype);
+
+		if (!empty($id)) {
+
+			$infodata = $this->getModel()->find($id);
+
+			if (!empty($infodata)) {
+				$infodata = $infodata->toArray();
+				$infodata['password'] = "";
+
+				if (!empty($infodata['uuid'])) {
+
+					$infodata['user'] = Users::getuserbyuuid($infodata['uuid']);
+					unset($infodata['user']['password']);
+					unset($infodata['user']['salt']);
+					$infodata['username'] = $infodata['user']['username'];
+
+					if (!empty($infodata['user']['id'])) {
+						$infodata['Openid'] = Openid::getMpOpenidbyuid($infodata['user']['id']);
+					}
+					if (empty($infodata['Openid'])) {
+						$infodata['Openid'] = Openid::getMpOpenidbyuuid($infodata['uuid']);
+					}
+				}
+
+				$area[0] = areaconversion($infodata['province_name']);
+				$area[1] = $infodata['city_name'];
+				if (!empty($infodata['district_name'])) {
+					$area[2] = $infodata['district_name'];
+				}
+
+				$infodata['region_name'] = $area;
+
+				$customtext = iunserializer($infodata['customtext']);
+			}
+		}
+
+		foreach ($data as &$vo) {
+
+			if ($vo['is_sys'] == 1) {
+				if(!empty($infodata[$vo['fieldsmingcheng']])){
+					$vo['fieldsvalue'] = $infodata[$vo['fieldsmingcheng']];
+				}
+				if ($vo['fieldsmingcheng'] == "sex") {
+					$vo['selectvaluearray'] = sexarray();
+				}
+
+				if ($vo['fieldsmingcheng'] == 'category_id') {
+					$vo['selectvaluearray'] = \app\model\TechnicalCategory::getpcarray();
+				}
+
+				if ($vo['fieldsmingcheng'] == 'sid') {
+					$vo['selectvaluearray'] = Store::getpcarray();
+				}
+
+				if ($vo['fieldsmingcheng'] == 'level') {
+					if ($vo['ptype'] == 'technical') {
+						$vo['selectvaluearray'] = \app\model\TechnicalLevel::getpcarray();
+					} elseif ($vo['ptype'] == 'tuanzhang') {
+						$vo['selectvaluearray'] = \app\model\TuanzhangLevel::getpcarray();
+					} elseif ($vo['ptype'] == 'partner') {
+						$vo['selectvaluearray'] = \app\model\PartnerLevel::getpcarray();
+					} elseif ($vo['ptype'] == 'operatingcity') {
+						$vo['selectvaluearray'] = \app\model\OperatingcityLevel::getpcarray();
+					}
+				}
+				if ($vo['fieldsmingcheng'] == 'agent_level') {
+					if ($vo['ptype'] == 'agent') {
+						$vo['selectvaluearray'] = \app\model\AgentLevel::getpcarray();
+					}
+				}
+
+				if ($vo['fieldsmingcheng'] == 'areatype') {
+					$vo['selectvaluearray'] = \app\model\OperatingcityType::getpcarray();
+				}
+				if ($vo['fieldsmingcheng'] == 'stid') {
+					$vo['selectvaluearray'] = StoreCate::getpcarray();
+				}
+
+				if ($vo['fieldsmingcheng'] == 'gid') {
+					$vo['selectvaluearray'] = \app\model\MemberAuthGroup::getpcarray();
+				}
+
+				if ($vo['inputtype'] == 'checkbox' && $vo['fieldsmingcheng'] == 'cate_ids') {
+					if (empty($vo['fieldsvalue'])) {
+						$vo['fieldsvalue'] = [];
+					} else {
+						$vo['fieldsvalue'] =  explode(',', $vo['fieldsvalue']);
+					}
+					if ($vo['ptype'] == 'technical') {
+						$ctopptype = 2;
+					} else {
+						$ctopptype = '';
+					}
+					$vo['selectvaluearray'] = Category::gettoparray($ctopptype);
+				}
+			} else {
+				$vo['fieldsvalue'] = $customtext[$vo['inputtype']][$vo['id']];
+				if (!empty($vo['selectvalue'])) {
+					$selectvaluearray = explode(',', $vo['selectvalue']);
+					if (is_array($selectvaluearray)) {
+						foreach ($selectvaluearray as $key => $svo) {
+							$vo['selectvaluearray'][$key]['val'] = $svo;
+							$vo['selectvaluearray'][$key]['key'] = $svo;
+						}
+					}
+				}
+			}
+
+			if ($vo['inputtype'] == 'pics') {
+				$vo['fieldsvalue1'] = $vo['fieldsvalue'];
+				if (empty($vo['fieldsvalue'])) {
+					$vo['fieldsvalue'] = [];
+				} else {
+					$vo['fieldsvalue'] = setPicsView($vo['fieldsvalue']);
+				}
+			}
+
+			if ($vo['inputtype'] == 'date') {
+				$vo['fieldsvalue'] =  time_format($vo['fieldsvalue']);
+			}
+		}
+		if(!empty($infodata)){
+			$retdata['id'] = $infodata['id'];
+			$retdata['uuid'] = $infodata['uuid'];
+			$retdata['infodata'] = $infodata;
+		}
+		
+		$retdata['fields'] = $data;
+
+		return $this->json(['data' => $retdata]);
+	}
+
+	function delete()
+	{
+		return $this->del($this->getModel());
+	}
+	/*
+ 	*  导入
+ 	*/
+	public function importData()
+	{
+		$data = input('post.');
+		$ptype = $this->getPath()[1];
+		$mob = $this->getModel();
+		RegisterField::importData($mob, $ptype, $data);
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function get_idbytitle($list, $title)
+	{
+		foreach ($list as  $v) {
+			if ($v['key'] == $title) {
+				return $v['val'];
+			}
+		}
+		return 0;
+	}
+	public function get_idbyarea_name($list, $area_name)
+	{
+		foreach ($list as  $v) {
+			if ($v['area_name'] == $area_name) {
+				return $v['area_id'];
+			}
+		}
+		return 0;
+	}
+}

+ 244 - 0
app/admin/controller/DiypageController.php

@@ -0,0 +1,244 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\DiyPage;
+use app\model\DomainReplace;
+use think\db\Where;
+
+class DiypageController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = DiyPage::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('id asc')
+			->paginate(getpage())
+			->toArray();
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+	public function add()
+	{
+		$weid = weid();
+		$data['weid'] = $weid;
+		$data['title'] = '自定义页面';
+		$data['version'] = 2;
+		$data['pagebase'] = serialize(input('post.pagebase'));
+		$res = DiyPage::create($data);
+		return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$weid = weid();
+		$postdata = input('post.');
+		unset($data['create_time']);
+
+		if (!empty($postdata['pageList'])) {
+			foreach ($postdata['pageList'] as $vo) {
+
+				$dp	= DiyPage::where(['weid' => $weid, 'id' => $vo['id'], 'version' => 2])->find();
+				$data['weid'] = $weid;
+				$data['title'] = $vo['pagebase'][0]['params']['title'];
+				$data['pagebase'] = serialize($vo['pagebase']);
+				$data['modulelist'] = serialize($vo['modulelist']);
+				$data['version'] = 2;
+				$data['status'] = 1;
+				if (empty($dp)) {
+					try {
+						$res = DiyPage::create($data);
+					} catch (\Exception $e) {
+						throw new ValidateException($e->getMessage());
+					}
+				} else {
+					$data['id'] = $vo['id'];
+					try {
+						DiyPage::update($data);
+					} catch (\Exception $e) {
+						throw new ValidateException($e->getMessage());
+					}
+				}
+			}
+			return $this->json(['msg' => '保存成功']);
+		} else {
+			if (empty($id)) {
+				$data['weid'] = $weid;
+				$data['title'] = $postdata['title'];
+				$data['is_index'] = $postdata['is_index'];
+				$data['status'] = $postdata['status'];
+				try {
+					$res = DiyPage::create($data);
+				} catch (\Exception $e) {
+					throw new ValidateException($e->getMessage());
+				}
+
+				return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+			} else {
+
+				try {
+					DiyPage::update($data);
+				} catch (\Exception $e) {
+					throw new ValidateException($e->getMessage());
+				}
+				return $this->json(['msg' => '修改成功']);
+			}
+		}
+	}
+
+	public function listUpdate()
+	{
+		$data = only('id,status,is_submitaudit,is_index');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		DiyPage::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function setaudit()
+	{
+
+		$id = input('post.id');
+		DiyPage::where('id', '>', 0)->where(['weid' => weid()])->where(['version' => 2])->where(['version' => 2])->update(['is_submitaudit' => 0]);
+		DiyPage::where('id', '=', $id)->update(['is_submitaudit' => 1]);
+
+		return $this->json(['msg' => '设为审核成功']);
+	}
+
+	public function setindex()
+	{
+
+		$id = input('post.id');
+		DiyPage::where('id', '>', 0)->where(['weid' => weid()])->update(['is_index' => 0]);
+		DiyPage::where('id', '=', $id)->update(['is_index' => 1]);
+
+		return $this->json(['msg' => '设置首页成功']);
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = DiyPage::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+	function getpageInfo()
+	{
+		$text = [
+			'subtitle' => '',
+			'miaoshu' => '',
+			'show' => false,
+			'defaultstyle' => false,
+			'fontsize' => 14,
+			'color' => '#333333',
+			'bold' => false,
+			'italics' => false,
+			'underline' => false
+		];
+		$link = [
+			'ptype' => '',
+			'miaoshu' => '',
+			'id' => '',
+			'path' => ''
+		];
+		$base = [
+			'style' => 0,
+			'margin' => true,
+			'bg' => 1,
+			'bt' => 1,
+			'bc' => '#ffffff',
+			'bi' => '',
+			'fc' => ''
+		];
+
+		$data = DiyPage::where(['weid' => weid(), 'version' => 2])->select()->toArray();
+		if (!empty($data)) {
+			foreach ($data as &$vo) {
+				$vo['title'] = $vo['title'];
+				$vo['pagebase'] = iunserializer($vo['pagebase']);
+				if (empty($vo['pagebase'][0]['base']['titleBackground'])) {
+					$vo['pagebase'][0]['base']['titleBackground'] = $base;
+				}
+				$vo['modulelist'] = iunserializer($vo['modulelist']);
+
+				foreach ($vo['modulelist'] as &$movo) {
+					if ($movo['type'] == 'goods') {
+						if (empty($movo['title']['title'])) {
+							$movo['title']['title'] = $text;
+							$movo['title']['title']['prompt'] = '模块标题';
+							$movo['title']['title']['txt'] = '商品模块标题';
+
+							$movo['title']['more'] = $text;
+							$movo['title']['more']['prompt'] = '更多文字';
+							$movo['title']['more']['txt'] = '更多';
+							$movo['title']['link'] = $link;
+						}
+						if(empty($movo['base']['auto']['ptype'])){
+							$movo['base']['auto']['ptype'] = 0;
+						}
+					}
+					if ($movo['type'] == 'tuan') {
+						if (empty($movo['title']['title'])) {
+							$movo['title']['title'] = $text;
+							$movo['title']['title']['prompt'] = '模块标题';
+							$movo['title']['title']['txt'] = '超值拼团';
+							$movo['title']['title']['show'] = true;
+
+							$movo['title']['more'] = $text;
+							$movo['title']['more']['prompt'] = '更多文字';
+							$movo['title']['more']['txt'] = '更多';
+							$movo['title']['more']['show'] = true;
+						}
+					}
+					if ($movo['type'] == 'miaosha') {
+						if (empty($movo['title']['title'])) {
+							$movo['title']['title'] = $text;
+							$movo['title']['title']['prompt'] = '模块标题';
+							$movo['title']['title']['txt'] = '限时秒杀';
+							$movo['title']['title']['show'] = true;
+
+							$movo['title']['more'] = $text;
+							$movo['title']['more']['prompt'] = '更多文字';
+							$movo['title']['more']['txt'] = '更多';
+							$movo['title']['more']['show'] = true;
+						}
+					}
+					if ($movo['type'] == 'window') {
+						if (empty($movo['base']['style'])) {
+							$movo['base']['style'] = 'style1';
+						}
+						foreach ($movo['list'] as &$wlistvo) {
+							if (empty($wlistvo['type'])) {
+								$wlistvo['type'] = "";
+							}
+							if (empty($wlistvo['windowbody'])) {
+								$wlistvo['windowbody'] = [];
+							}
+						}
+					}
+				}
+			}
+		} else {
+			$data = '';
+		}
+
+		$data = DomainReplace::setreplace($data);
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new DiyPage());
+	}
+}

+ 139 - 0
app/admin/controller/DiypagelinkController.php

@@ -0,0 +1,139 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\BottomMenuOriginal;
+use app\model\Goods;
+use app\model\Category;
+use app\model\Technical;
+use app\model\Article;
+use app\model\ArticleCategory;
+use app\model\DiyPageLink;
+use app\model\DiyPage;
+use app\model\Tree;
+
+class DiypagelinkController extends Base
+{
+	function getModel()
+	{
+
+		$ptype = input('post.ptype', '', 'serach_in');
+		if ($ptype == 'pageslist') {
+			return new BottomMenuOriginal;
+		} else if ($ptype == 'diypageslist') {
+			return new DiyPage;
+		} else if ($ptype == 'servicelist' || $ptype == 'goodslist') {
+			return new Category;
+		} else if ($ptype == 'serviceDetail' || $ptype == 'goodsDetail') {
+			return new Goods;
+		} else if ($ptype == 'technicalDetail') {
+			return new Technical;
+		} else if ($ptype == 'articlelist') {
+			return new ArticleCategory;
+		} else if ($ptype == 'articleDetail') {
+			return new Article;
+		}
+	}
+
+	function index()
+	{
+		$page = input('post.page', 1, 'intval');
+		$ptype = input('post.ptype', '', 'serach_in');
+		$weid = weid();
+
+		if ($ptype != 'custom') {
+			$query = $this->setSearch();
+
+			if ($ptype == 'servicelist' || $ptype == 'goodslist') {
+				$res = $query->order('sort asc')->select()->toArray();
+			} else {
+				$res = $query->paginate(getpage())->toArray();
+			}
+
+			if (!empty($res['data'])) {
+				foreach ($res['data'] as &$vo) {
+					$vo['image'] = toimg($vo['image']);
+					if ($ptype == 'serviceDetail') {
+						$vo['cat_id'] = Category::getTitle($vo['cat_id']);
+					}
+					if ($ptype == 'articleDetail') {
+						$vo['cid'] = ArticleCategory::getTitle($vo['cid']);
+					}
+				}
+			}
+			if ($ptype == 'servicelist' || $ptype == 'goodslist') {
+
+				$data['data']['data'] = Tree::title($res, 0);
+			} else {
+				$data['data'] = $res;
+			}
+
+			if ($ptype == 'diypageslist') {
+				if (!empty($data['data']['data'])) {
+					foreach ($data['data']['data'] as &$vo) {
+						$vo['url'] = "/pages/index/index?id=" . $vo['id'];
+					}
+				}
+			}
+
+			$data['field_data']['Fields'] = DiyPageLink::getFields($ptype);
+		}
+
+		return $this->json($data);
+	}
+	function setSearch()
+	{
+		$ptype = input('post.ptype', '', 'serach_in');
+		$keyword = trim(input('post.keyword', '', 'serach_in'));
+		$weid = weid();
+		if ($ptype == 'pageslist') {
+			$plwhere['weid'] = 0;
+			if (config('database.app_name') == config('my.app_v2')) {
+				$plwhere['is_v2'] = 1;
+			}
+
+			if (config('database.app_name') == config('my.app_v3')) {
+				$plwhere['is_v3'] = 1;
+			}
+			if (config('database.app_name') == config('my.app_v6')) {
+				$plwhere['is_v6'] = 1;
+			}
+			$query = $this->getModel()->where($plwhere)->order('id asc');
+		} else {
+			$query = $this->getModel()->where(['weid' => $weid])->order('id desc');
+		}
+
+		if ($ptype == 'goodslist') {
+			$query->where('ptype', 1);
+		}
+		if ($ptype == 'servicelist') {
+			$query->where('ptype', 2);
+		}
+
+		if (!empty($keyword)) {
+			if ($ptype == 'serviceDetail' || $ptype == 'goodsDetail') {
+				$query->where('name', 'like', '%' . $keyword . '%');
+			} else {
+				$query->where('title', 'like', '%' . $keyword . '%');
+			}
+		}
+		return $query;
+	}
+	function linklist()
+	{
+		$linklist = DiyPageLink::linklist();
+		$i = 0;
+		foreach ($linklist as $key => $vo) {
+			if ($vo['v3'] == 1 && config('database.app_name') != config('my.app_v3')) {
+			} else {
+				$vo['ptype'] = $key;
+				$list[$i] = $vo;
+				$i++;
+			}
+		}
+		$data['data'] = $list;
+
+		return $this->json($data);
+	}
+}

+ 82 - 0
app/admin/controller/DomainreplaceController.php

@@ -0,0 +1,82 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\DomainReplace;
+
+class DomainreplaceController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = DomainReplace::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('sort asc,id asc')
+			->paginate(getpage())
+			->toArray();
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		DomainReplace::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = DomainReplace::create($data);
+				if ($res->id && empty($data['sort'])) {
+					DomainReplace::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				DomainReplace::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = DomainReplace::find($id);
+
+		if ($data) {
+			$data = $data->toArray();
+		}
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new DomainReplace());
+	}
+}

+ 49 - 0
app/admin/controller/FilesController.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Files;
+use app\model\FilesCate;
+
+class FilesController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = Files::where(['weid' => $weid]);
+
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$res = $query->order('sort asc,id asc')
+			->paginate(getpage())
+			->toArray();
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Files::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	function delete()
+	{
+		return $this->del(new Files());
+	}
+	function getField()
+	{
+		$data['cidarray'] = FilesCate::getpagearray();
+
+		return $this->json(['data' => $data]);
+	}
+}

+ 75 - 0
app/admin/controller/FilescateController.php

@@ -0,0 +1,75 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\FilesCate;
+
+class FilescateController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$query = FilesCate::where(['weid' => $weid]);
+		$list = $query->order('sort asc')->select()->toArray();
+		$data['data'] = _generateListTree($list, 0, ['id', 'pid']);
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		FilesCate::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = FilesCate::create($data);
+				if ($res->id && empty($data['sort'])) {
+					FilesCate::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				FilesCate::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = FilesCate::find($id);
+
+		if ($data) {
+			$data = $data->toArray();
+			$data['pic'] = toimg($data['pic']);
+		}
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new FilesCate());
+	}
+}

+ 59 - 0
app/admin/controller/ForhelpController.php

@@ -0,0 +1,59 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Forhelp;
+
+class ForhelpController extends Base
+{
+
+	/*
+ 	* @Description  数据列表
+ 	*/
+	function index()
+	{
+		$keyword = input('post.keyword', '', 'serach_in');
+		$create_time = input('post.create_time', '', 'serach_in');
+
+		$where = [];
+		$where['weid'] = weid();
+		$query = Forhelp::where($where);
+
+		if (!empty($keyword)) {
+			$query->where('username|tel', 'like', '%' . $keyword . '%');
+		}
+
+		if (!empty($create_time)) {
+			$query->where('create_time', 'between', [strtotime($create_time[0]), strtotime($create_time[1])]);
+		}
+		$res = $query->order('id desc')->paginate(getpage())->toArray();
+
+		$data['data'] = $res;
+		return $this->json($data);
+	}
+
+
+	/*
+ 	* @Description  删除
+ 	*/
+	function delete()
+	{
+		return $this->del(new Forhelp());
+	}
+
+
+	/*
+ 	* @Description  查看详情
+ 	*/
+	function detail()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$res = Forhelp::find($id);
+		if (!empty($res)) {
+			$res = $res->toArray();
+		}
+		return $this->json(['data' => $res]);
+	}
+}

+ 428 - 0
app/admin/controller/GoodsController.php

@@ -0,0 +1,428 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Goods;
+use app\model\Category;
+use app\model\GoodsDescription;
+use app\model\GoodsImage;
+use app\model\GoodsSku;
+use app\model\GoodsSkuValue;
+use app\model\Store;
+use app\model\MemberAuthGroup;
+use app\model\GoodsMemberDiscount;
+use app\model\GoodsTimeDiscount;
+use app\model\Operatingcity;
+use app\model\Tuanzhang;
+
+class GoodsController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$page = input('post.page', 1, 'intval');
+		$path = input('post.path', '', 'serach_in');
+		$ptypeistimes = input('post.ptypeistimes', '', 'serach_in');
+		$ptype = input('post.ptype', '', 'serach_in');
+		$is_times = input('post.is_times', '', 'serach_in');
+		$is_all = input('post.is_all', '', 'serach_in');
+		$is_mg = input('post.is_mg', '', 'serach_in');
+		$status = input('post.status', '', 'serach_in');
+
+		$keyword = input('post.keyword', '', 'serach_in');
+		$cat_id = input('post.cat_id', '', 'serach_in');
+		$is_recommended = input('post.is_recommended', '', 'serach_in');
+
+		if ($ptypeistimes == 1) {
+			$ptype = 1;
+		} elseif ($ptypeistimes == 2) {
+			$ptype = 2;
+		} elseif ($ptypeistimes == 3) {
+			$is_times = 1;
+		}
+
+		if ($path == '/order/service' || $path == '/order/storeservice') {
+			$ptype = 2;
+		}
+
+		$query = Goods::where(['weid' => $weid, 'is_mg' => (int)$is_mg]);
+
+		if (!empty($ptype)) {
+			$query->where('ptype', $ptype);
+		} else {
+			$query->where('ptype', '>', 0);
+		}
+
+		if (empty($is_all)) {
+			if (!empty($is_times)) {
+				$query->where('is_times', $is_times);
+			} else {
+				$query->where('is_times', 0);
+			}
+		}
+
+		if (!empty($this->sid)) {
+			$query->where('sid', $this->sid);
+		}
+
+		if (!empty($this->tzid)) {
+			$query->where('sid', Store::getidbytzid($this->tzid));
+		}
+
+		if (!empty($this->ocid)) {
+			$Operatingcitydata = Operatingcity::find($this->ocid);
+			if ($Operatingcitydata) {
+				$Operatingcitydata = $Operatingcitydata->toArray();
+				if (empty($Operatingcitydata['areatype'])) {
+					$Operatingcitydata['areatype'] = 3;
+				}
+
+				if ($Operatingcitydata['areatype'] == 3) {
+					$query->where('district_name', $Operatingcitydata['district_name']);
+				} elseif ($Operatingcitydata['areatype'] == 2) {
+					$query->where('city_name', $Operatingcitydata['city_name']);
+				} elseif ($Operatingcitydata['areatype'] == 1) {
+					$query->where('province_name', $Operatingcitydata['province_name']);
+				}
+			}
+		}
+
+		if (!empty($keyword)) {
+			$query->where('name', 'like', '%' . $keyword . '%');
+		}
+
+		if (!empty($cat_id)) {
+			$query->where('cat_id',  $cat_id);
+		}
+
+		if (!empty($is_recommended) || $is_recommended === "0") {
+			$query->where('is_recommended', $is_recommended);
+		}
+
+		if (!empty($status) || $status === "0") {
+			$query->where(['status' => $status]);
+		}
+
+		$res = $query->order('sort asc,id desc')
+			->paginate(getpage())
+			->toArray();
+
+		foreach ($res['data'] as &$vo) {
+			$vo['image'] = toimg($vo['image']);
+
+			if ($vo['time_amount'] == 0) {
+				$vo['time_amount'] = '无';
+			}
+
+			if ($vo['sid'] == 0) {
+				$vo['name'] = '[自营]' . $vo['name'];
+			} else {
+				$StoreTitle = Store::getTitle($vo['sid']);
+				if (empty($StoreTitle)) {
+					$vo['name'] = '[商户已被删除]' . $vo['name'];
+				} else {
+					$vo['name'] = '[' . $StoreTitle . ']' . $vo['name'];
+				}
+			}
+			if ($vo['ptype'] == 2) {
+				$vo['quantity'] = $vo['timesmum'];
+			}
+			if (empty($vo['quantity'])) {
+				$vo['quantity'] = 1;
+			}
+
+			$vo['cat_id'] = Category::getTitle($vo['cat_id']);
+		}
+		$data['data'] = $res;
+		if ($page == 1) {
+			$data['field_data']['cidarray'] = _generateSelectTree(Category::getpcarray());
+		}
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,is_recommended,is_additional,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Goods::update($data);
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = request()->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+		$data['image'] = $data['images'][0]['url'];
+		if (!empty($data['keyword'])) {
+			$data['keyword'] = implode(',', $data['keyword']);
+		}
+		$data['time_amount'] = intval($data['time_amount']);
+		//判断is_timer是否为1
+		if ($data['is_timer'] == 1) {
+			if (empty($data['time_amount'])) {
+				throw new ValidateException('服务时长不能为空');
+			}
+			$data['quantity_unit'] = '分钟';
+		}
+
+		if ($data['cat_id']) {
+			$cat = Category::find($data['cat_id']);
+			if (!empty($cat)) {
+				$cat = $cat->toArray();
+			}
+			$data['ptype'] = $cat['ptype'];
+		}
+		if (!empty($data['videourl'])) {
+			$data['videotype'] = 1;
+		} elseif (!empty($data['videoid'])) {
+			$data['videotype'] = 2;
+		} else {
+			$data['videotype'] = 0;
+		}
+
+		if (empty($id)) {
+			if (empty($data['cat_id'])) {
+				throw new ValidateException('请选择分类');
+			}
+			if ($data['is_mg'] == 1) {
+				if (empty($data['mgid'])) {
+					throw new ValidateException('请选择会员等级');
+				}
+			}
+			$data['weid'] = weid();
+			if (!empty($this->sid)) {
+				$data['sid'] = $this->sid;
+
+				$storemod = Store::find($this->sid);
+				if ($storemod) {
+					$data['province_name'] = $storemod->province_name;
+					$data['city_name'] = $storemod->city_name;
+					$data['district_name'] = $storemod->district_name;
+				}
+			}
+
+			if (!empty($this->tzid)) {
+				$data['sid'] = Store::getidbytzid($this->tzid);
+				$Tuanzhangmod = Tuanzhang::find($this->tzid);
+				if ($Tuanzhangmod) {
+					$data['province_name'] = $Tuanzhangmod->province_name;
+					$data['city_name'] = $Tuanzhangmod->city_name;
+					$data['district_name'] = $Tuanzhangmod->district_name;
+				}
+			}
+
+			if (!empty($this->ocid)) {
+				$data['ocid'] = $this->ocid;
+				if (!empty($this->ocid)) {
+					$ocmod = Operatingcity::find($this->ocid);
+					if ($ocmod) {
+						$data['province_name'] = $ocmod->province_name;
+						$data['city_name'] = $ocmod->city_name;
+						$data['district_name'] = $ocmod->district_name;
+					}
+				}
+			}
+
+
+			if (empty($data['tel'])) {
+				$data['tel'] = '';
+			}
+			try {
+				$res = Goods::create($data);
+				if ($res->id && empty($data['sort'])) {
+					Goods::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+				$data['id'] = $res->id;
+				$this->_synupdata($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+
+			try {
+				Goods::update($data);
+				$this->_synupdata($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function _synupdata($data)
+	{
+		//详情
+		if (empty(GoodsDescription::where('goods_id', $data['id'])->find())) {
+			GoodsDescription::create([
+				'goods_id' => (int) $data['id'],
+				'description' => $data['description']
+			]);
+		} else {
+			GoodsDescription::where('goods_id', $data['id'])->update(['description' => $data['description']]);
+		}
+
+		//sku
+		GoodsSku::where('goods_id', $data['id'])->delete();
+		if (isset($data['attribute'])) {
+			foreach ($data['attribute'] as $attr) {
+				GoodsSku::create([
+					'goods_id' => (int) $data['id'],
+					'name' => $attr['name'],
+					'ptype' => 'radio',
+					'item' => $attr['item'] ? implode(',', $attr['item']) : ''
+				]);
+			}
+		}
+
+		GoodsSkuValue::where('goods_id', $data['id'])->delete();
+		if (isset($data['sku'])) {
+			foreach ($data['sku'] as $skuarr) {
+				GoodsSkuValue::create([
+					'goods_id' => (int) $data['id'],
+					'sku' => $skuarr['sku'],
+					'image' => $skuarr['image'],
+					'quantity' => $skuarr['quantity'],
+					'price' => $skuarr['price']
+				]);
+			}
+		}
+
+		GoodsMemberDiscount::where('goods_id', $data['id'])->delete();
+		if (!empty($data['is_member_discount']) && !empty($data['MemberGroup'])) {
+			foreach ($data['MemberGroup'] as $mgvo) {
+				if ($mgvo['price'] > 0) {
+					GoodsMemberDiscount::create([
+						'goods_id' => (int) $data['id'],
+						'mgid' => (int) $mgvo['id'],
+						'price' => (float) $mgvo['price'],
+						'is_free' => (int) $mgvo['is_free']
+					]);
+				}
+			}
+		}
+		GoodsTimeDiscount::where('goods_id', $data['id'])->delete();
+		if (!empty($data['timediscount'])) {
+			foreach ($data['timediscount'] as $tdvo) {
+				if ($tdvo['price'] > 0) {
+					GoodsTimeDiscount::create([
+						'discount_method' => 1,
+						'goods_id' => (int) $data['id'],
+						'begin_time' => $tdvo['begin_time'],
+						'end_time' =>  $tdvo['end_time'],
+						'addsubtract' => (int) $tdvo['addsubtract'],
+						'price' => (float) $tdvo['price']
+					]);
+				}
+			}
+		}
+		//图片
+		GoodsImage::where('goods_id', $data['id'])->delete();
+		if (isset($data['images'])) {
+			foreach ($data['images'] as $image) {
+				GoodsImage::create([
+					'goods_id' => (int) $data['id'],
+					'weid' => weid(),
+					'image' => $image['url']
+				]);
+			}
+		}
+	}
+
+	function getgoodssku()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		$data['attribute'] = GoodsSku::get_goods_sku($id);
+		$data['sourceAttribute'] = $data['attribute'];
+		return $this->json(['data' => $data]);
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		//if (!$id) throw new ValidateException('参数错误');
+		if ($id) {
+			$data = Goods::field('*')->find($id)->toArray();
+		} else {
+			$data = [
+				'is_times' => 0,
+				'sort' => 100,
+				'status' => 1,
+			];
+		}
+		if (!empty($data['keyword'])) {
+			$data['keyword'] = explode(',', $data['keyword']);
+		} else {
+			$data['keyword'] = [];
+		}
+
+		$GD = GoodsDescription::where(['goods_id' => $id])->find();
+
+		if (!empty($GD)) {
+			$data['description'] = $GD->description;
+		}
+
+		$goods_image = GoodsImage::where(['goods_id' => $id])
+			->field('image')
+			->order('id asc')
+			->select()->toArray();
+
+		if (!empty($goods_image)) {
+			foreach ($goods_image as $key => $vo) {
+				$data['images'][$key]['url'] = toimg($vo['image']);
+			}
+		}
+
+		$data['attribute'] = GoodsSku::get_goods_sku($id);
+		$data['sourceAttribute'] = $data['attribute'];
+
+		$MGDiscountarray = GoodsMemberDiscount::where(['goods_id' => $id])->select()->toArray();
+
+		if (!empty($MGDiscountarray)) {
+			$MGDiscount = [];
+			foreach ($MGDiscountarray as $vo) {
+				$MGDiscount[$vo['mgid']] = $vo;
+			}
+		}
+
+		$data['MemberGroup'] = MemberAuthGroup::getGroup();
+		foreach ($data['MemberGroup'] as &$mvo) {
+			if (!empty($MGDiscount[$mvo['id']])) {
+				$mvo['price'] = $MGDiscount[$mvo['id']]['price'];
+				$mvo['addsubtract'] = $MGDiscount[$mvo['id']]['addsubtract'];
+				$mvo['is_free'] = $MGDiscount[$mvo['id']]['is_free'];
+			}
+		}
+
+		$timediscount = GoodsTimeDiscount::where(['goods_id' => $id])->select()->toArray();
+
+		if (!empty($timediscount)) {
+			$data['timediscount'] = $timediscount;
+		} else {
+			$data['timediscount'] = [['begin_time' => '', 'end_time' => '', 'addsubtract' => '', 'price' => '']];
+		}
+
+		$data['sku'] = GoodsSkuValue::field('sku,image,quantity,price')->where(['goods_id' => $id])
+			->order('id asc')
+			->select()->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new Goods());
+	}
+	function getField()
+	{
+		$ptype = input('post.ptype', '', 'serach_in');
+		$data['cidarray'] = _generateSelectTree(Category::getpcarray($ptype));
+		$data['mgidarray'] = \app\model\MemberAuthGroup::getpcarray(1);
+		$data['unitarray'] = \app\model\GoodsQuantityUnit::getpcarray($ptype);
+
+		return $this->json(['data' => $data]);
+	}
+}

+ 92 - 0
app/admin/controller/GoodsquantityunitlController.php

@@ -0,0 +1,92 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\GoodsQuantityUnit;
+
+class GoodsquantityunitlController extends Base
+{
+	function getPtype()
+	{
+		$path = input('post.path', '', 'serach_in');
+		if ($path == '/goodsquantityunitl/service') {
+			return 2;
+		} else {
+			return 1;
+		}
+	}
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$ptype = $this->getPtype();
+		GoodsQuantityUnit::datainitial($ptype);
+
+		$query = GoodsQuantityUnit::where(['weid' => $weid, 'ptype' => $ptype]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$datalist = $query->order('sort asc,id asc')->select()->toArray();
+
+		$data['data'] = $datalist;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		GoodsQuantityUnit::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+		$weid = weid();
+		$ptype = $this->getPtype();
+
+		if (empty($id)) {
+			$data['weid'] = $weid;
+			$data['ptype'] = $ptype;
+			try {
+				$res = GoodsQuantityUnit::create($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+			try {
+				GoodsQuantityUnit::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = GoodsQuantityUnit::find($id);
+
+		if ($data) {
+			$data = $data->toArray();
+		}
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new GoodsQuantityUnit());
+	}
+}

+ 114 - 0
app/admin/controller/HospitalController.php

@@ -0,0 +1,114 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\Hospital;
+use app\model\HospitalCate;
+use app\model\Operatingcity;
+
+class HospitalController extends Base
+{
+
+	function index()
+	{
+		$query = $this->setSearch();
+
+		$res = $query->order('sort asc,id desc')
+			->paginate(getpage())
+			->toArray();
+
+		if (!empty($res['data'])) {
+			foreach ($res['data'] as &$vo) {
+				$vo = Hospital::conversion($vo);
+			}
+		}
+		$data['data'] = $res;
+
+		return $this->json($data);
+	}
+	function setSearch()
+	{
+		$keyword = trim(input('post.keyword', '', 'serach_in'));
+		$status = input('post.status', '', 'serach_in');
+		$weid = weid();
+
+		$query = Hospital::where(['weid' => $weid]);
+
+		if (!empty($this->ocid)) {
+			$Operatingcitydata = Operatingcity::find($this->ocid);
+			if ($Operatingcitydata) {
+				$Operatingcitydata = $Operatingcitydata->toArray();
+				if(empty($Operatingcitydata['areatype'])){
+					$Operatingcitydata['areatype'] = 3;
+				}
+
+				if ($Operatingcitydata['areatype'] == 3) {
+					$query->where('district_name', $Operatingcitydata['district_name']);
+				} elseif ($Operatingcitydata['areatype'] == 2) {
+					$query->where('city_name', $Operatingcitydata['city_name']);
+				} elseif ($Operatingcitydata['areatype'] == 1) {
+					$query->where('province_name', $Operatingcitydata['province_name']);
+				}
+			}
+		}
+
+		if (!empty($keyword)) {
+			$query->where('title|tel', 'like', '%' . $keyword . '%');
+		}
+
+		if (!empty($status) || $status === "0") {
+			$query->where(['status' => $status]);
+		}
+		return $query;
+	}
+	function listUpdate()
+	{
+		$data = only('id,status');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		Hospital::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+
+			try {
+				$res = Hospital::create($data);
+				if ($res->id && empty($data['sort'])) {
+					Hospital::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+			try {
+				Hospital::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = Hospital::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+	function delete()
+	{
+		return $this->del(new Hospital());
+	}
+}

+ 76 - 0
app/admin/controller/HospitalcateController.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\HospitalCate;
+
+class HospitalcateController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = HospitalCate::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$datalist = $query->order('sort asc,id asc')->select()->toArray();
+
+		$data['data'] = $datalist;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		HospitalCate::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = HospitalCate::create($data);
+				if ($res->id && empty($data['sort'])) {
+					HospitalCate::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+			try {
+				HospitalCate::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = HospitalCate::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new HospitalCate());
+	}
+}

+ 104 - 0
app/admin/controller/HospitaldepartmentsController.php

@@ -0,0 +1,104 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\HospitalDepartments;
+
+class HospitaldepartmentsController extends Base
+{
+
+	function index()
+	{
+		$keyword = input('post.keyword', '', 'serach_in');
+
+		$query = HospitalDepartments::where('weid', weid());
+
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$list = $query->order('sort asc')->select()->toArray();
+
+		foreach ($list as &$vo) {
+			$vo['image'] = toimg($vo['image']);
+		}
+		$data['data'] = _generateListTree($list, 0, ['id', 'pid']);
+
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,is_binding,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		HospitalDepartments::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+		$data['pid'] = (int)$data['pid'];
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+			try {
+				$res = HospitalDepartments::create($data);
+				if ($res->id && empty($data['sort'])) {
+					HospitalDepartments::update(['sort' => $res->id, 'id' => $res->id]);
+				}
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+		} else {
+			try {
+				HospitalDepartments::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$res = HospitalDepartments::find($id);
+		if ($res) {
+			$res = $res->toArray();
+			$res['image'] = toimg($res['image']);
+			
+		}
+
+		return $this->json(['data' => $res]);
+	}
+
+	function delete()
+	{
+		return $this->del(new HospitalDepartments());
+	}
+
+	function getField()
+	{
+		$data['pids'] = _generateSelectTree(HospitalDepartments::getpcarray());
+		return $this->json(['data' => $data]);
+	}
+	function getTree()
+	{
+
+		$alldata[0]['val'] = '0';
+		$alldata[0]['key'] = '全部分类';
+		$alldata[0]['pid'] = 0;
+		
+		$cdata = _generateSelectTree(HospitalDepartments::getpcarray());
+
+		$data = array_merge($alldata,$cdata);
+		return $this->json(['data' => $data]);
+	}
+}

+ 83 - 0
app/admin/controller/HospitallevelController.php

@@ -0,0 +1,83 @@
+<?php
+
+namespace app\admin\controller;
+
+use think\exception\ValidateException;
+use app\model\HospitalLevel;
+
+class HospitallevelController extends Base
+{
+
+	function index()
+	{
+		$weid = weid();
+		$keyword = input('post.keyword', '', 'serach_in');
+		$query = HospitalLevel::where(['weid' => $weid]);
+		if (!empty($keyword)) {
+			$query->where('title', 'like', '%' . $keyword . '%');
+		}
+
+		$datalist = $query->order('sort asc,id asc')->select()->toArray();
+
+		if (empty($datalist)) {
+			HospitalLevel::datainitial();
+			$datalist = $query->order('sort asc,id asc')->select()->toArray();
+		}
+
+		$data['data'] = $datalist;
+		return $this->json($data);
+	}
+
+	function listUpdate()
+	{
+		$data = only('id,status,sort');
+		if (!$data['id']) throw new ValidateException('参数错误');
+		HospitalLevel::update($data);
+
+		return $this->json(['msg' => '操作成功']);
+	}
+
+	public function update()
+	{
+		$id = $this->request->post('id');
+		$data = input('post.');
+		unset($data['create_time']);
+
+		if (empty($id)) {
+			$data['weid'] = weid();
+		try {
+			$res = HospitalLevel::create($data);
+			if ($res->id && empty($data['sort'])) {
+				HospitalLevel::update(['sort' => $res->id, 'id' => $res->id]);
+			}
+		} catch (\Exception $e) {
+			throw new ValidateException($e->getMessage());
+		}
+
+		return $this->json(['msg' => '添加成功', 'data' => $res->id]);
+
+		} else {
+
+			try {
+				HospitalLevel::update($data);
+			} catch (\Exception $e) {
+				throw new ValidateException($e->getMessage());
+			}
+			return $this->json(['msg' => '修改成功']);
+		}
+	}
+
+	function getInfo()
+	{
+		$id =  $this->request->post('id', '', 'serach_in');
+		if (!$id) throw new ValidateException('参数错误');
+		$data = HospitalLevel::field('*')->find($id)->toArray();
+
+		return $this->json(['data' => $data]);
+	}
+
+	function delete()
+	{
+		return $this->del(new HospitalLevel());
+	}
+}

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä