소스 검색

[更新]升级基础框架(同步自framework2)

Anyon 5 년 전
부모
커밋
8f7389acdf
100개의 변경된 파일1908개의 추가작업 그리고 2984개의 파일을 삭제
  1. 21 0
      LICENSE
  2. 17 1
      README.md
  3. 47 248
      admin_v4_1.sql
  4. 37 29
      application/admin/controller/Auth.php
  5. 63 66
      application/admin/controller/Config.php
  6. 56 58
      application/admin/controller/Index.php
  7. 67 77
      application/admin/controller/Login.php
  8. 25 18
      application/admin/controller/Menu.php
  9. 0 93
      application/admin/controller/Message.php
  10. 0 88
      application/admin/controller/Node.php
  11. 10 4
      application/admin/controller/Oplog.php
  12. 14 7
      application/admin/controller/Queue.php
  13. 22 26
      application/admin/controller/User.php
  14. 0 64
      application/admin/controller/api/Message.php
  15. 6 93
      application/admin/controller/api/Plugs.php
  16. 9 7
      application/admin/queue/JobsQueue.php
  17. 0 176
      application/admin/service/AuthService.php
  18. 0 72
      application/admin/service/MessageService.php
  19. 322 0
      application/admin/service/NodeService.php
  20. 10 12
      application/admin/service/OplogService.php
  21. 7 5
      application/admin/service/QueueService.php
  22. 29 45
      application/admin/sys.php
  23. 2 2
      application/admin/view/api/plugs/icon.html
  24. 0 432
      application/admin/view/api/plugs/upfile.html
  25. 8 0
      application/admin/view/auth/apply.html
  26. 1 1
      application/admin/view/auth/form.html
  27. 17 14
      application/admin/view/auth/index.html
  28. 1 1
      application/admin/view/auth/index_search.html
  29. 0 44
      application/admin/view/config/file.html
  30. 0 19
      application/admin/view/config/file_local.html
  31. 0 77
      application/admin/view/config/file_oss.html
  32. 0 78
      application/admin/view/config/file_qiniu.html
  33. 21 0
      application/admin/view/config/info-storage-local.html
  34. 79 0
      application/admin/view/config/info-storage-oss.html
  35. 80 0
      application/admin/view/config/info-storage-qiniu.html
  36. 32 0
      application/admin/view/config/info-storage.html
  37. 54 0
      application/admin/view/config/info-website.html
  38. 23 51
      application/admin/view/config/info.html
  39. 0 8
      application/admin/view/index/command.html
  40. 17 24
      application/admin/view/index/index.html
  41. 7 7
      application/admin/view/login/index.html
  42. 4 1
      application/admin/view/menu/form.html
  43. 5 5
      application/admin/view/menu/index.html
  44. 0 98
      application/admin/view/message/index.html
  45. 0 57
      application/admin/view/message/index_search.html
  46. 0 238
      application/admin/view/node/index.html
  47. 6 4
      application/admin/view/oplog/index.html
  48. 1 1
      application/admin/view/oplog/index_search.html
  49. 11 14
      application/admin/view/queue/index.html
  50. 3 3
      application/admin/view/queue/index_search.html
  51. 0 40
      application/admin/view/user/auth.html
  52. 18 23
      application/admin/view/user/index.html
  53. 1 1
      application/admin/view/user/index_search.html
  54. 4 4
      application/index/controller/Index.php
  55. 23 10
      application/service/controller/Config.php
  56. 14 5
      application/service/controller/Index.php
  57. 5 4
      application/service/controller/api/Client.php
  58. 4 3
      application/service/controller/api/Push.php
  59. 4 3
      application/service/handler/PublishHandler.php
  60. 4 3
      application/service/handler/ReceiveHandler.php
  61. 5 4
      application/service/handler/WechatHandler.php
  62. 5 4
      application/service/service/BuildService.php
  63. 4 3
      application/service/service/WechatService.php
  64. 1 1
      application/service/view/config/index.html
  65. 8 7
      application/service/view/index/index.html
  66. 1 1
      application/service/view/index/index_search.html
  67. 5 4
      application/store/command/AutoRun.php
  68. 15 20
      application/store/controller/Config.php
  69. 14 5
      application/store/controller/ExpressCompany.php
  70. 0 92
      application/store/controller/ExpressProvince.php
  71. 22 13
      application/store/controller/ExpressTemplate.php
  72. 33 26
      application/store/controller/Goods.php
  73. 18 12
      application/store/controller/GoodsCate.php
  74. 7 4
      application/store/controller/Member.php
  75. 8 4
      application/store/controller/Message.php
  76. 12 6
      application/store/controller/Order.php
  77. 5 4
      application/store/controller/api/Express.php
  78. 12 8
      application/store/controller/api/Goods.php
  79. 5 14
      application/store/controller/api/Member.php
  80. 8 5
      application/store/controller/api/Notify.php
  81. 12 8
      application/store/controller/api/Wechat.php
  82. 5 4
      application/store/controller/api/member/Address.php
  83. 15 9
      application/store/controller/api/member/Center.php
  84. 31 17
      application/store/controller/api/member/Order.php
  85. 14 1
      application/store/service/ExpressService.php
  86. 285 4
      application/store/service/ExtendService.php
  87. 5 4
      application/store/service/GoodsService.php
  88. 5 4
      application/store/service/OrderService.php
  89. 5 4
      application/store/sys.php
  90. 32 0
      application/store/view/config/index-store-config.html
  91. 46 0
      application/store/view/config/index-store-message.html
  92. 22 34
      application/store/view/config/index.html
  93. 0 51
      application/store/view/config/sms.html
  94. 3 2
      application/store/view/express_company/form.html
  95. 6 3
      application/store/view/express_company/index.html
  96. 0 22
      application/store/view/express_province/form.html
  97. 0 71
      application/store/view/express_province/index.html
  98. 0 35
      application/store/view/express_province/index_search.html
  99. 2 2
      application/store/view/express_template/index.html
  100. 21 8
      application/store/view/express_template/index_item.html

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 邹景立
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 17 - 1
README.md

@@ -3,7 +3,7 @@
 
 大道至简 · 原生框架
 --
-ThinkAdmin V4.0 是一个基于 ThinkPHP5.1 开发的后台管理系统。
+ThinkAdmin V4.1 是一个基于 ThinkPHP5.1 开发的后台管理系统。
 
 我们致力于二次开发底层框架,提供完整的组件及API,基于此框架可以快速开发应用。
 
@@ -26,6 +26,22 @@ PHP 开发技术交流( QQ 群 513350915)
 [![PHP微信开发群 (SDK)](http://pub.idqqimg.com/wpa/images/group.png)](http://shang.qq.com/wpa/qunwpa?idkey=ae25cf789dafbef62e50a980ffc31242f150bc61a61164458216dd98c411832a) 
 
 
+#### 权限管理
+* 此版本的权限使用注解实现管理
+* 注释必需使用标准的块注释,如:
+```php
+/**
+* 操作的名称
+* @auth true  # 表示需要验证权限
+* @menu true  # 在菜单编辑的节点可选项
+*/
+public function index(){
+   // @todo
+}
+```
+* 其中`@auth true`表示需要权限验证
+* 其中`@menu true`显示在菜单编辑的节点可选项
+
 代码仓库
 --
  framework 为 MIT 协议开源项目,安装使用或二次开发不受约束,欢迎 fork 项目。

+ 47 - 248
admin_v4.sql → admin_v4_1.sql

@@ -11,7 +11,7 @@
  Target Server Version : 50562
  File Encoding         : 65001
 
- Date: 14/06/2019 16:55:44
+ Date: 04/07/2019 17:51:38
 */
 
 SET NAMES utf8mb4;
@@ -45,7 +45,7 @@ INSERT INTO `store_express_company` VALUES (10, '百福东方国际物流', 'bai
 INSERT INTO `store_express_company` VALUES (11, '中国东方(COE)', 'coe', NULL, 0, 0, 0, '2017-09-13 16:05:48');
 INSERT INTO `store_express_company` VALUES (12, '长宇物流', 'changyuwuliu', NULL, 0, 0, 0, '2017-09-13 16:05:58');
 INSERT INTO `store_express_company` VALUES (13, '大田物流', 'datianwuliu', NULL, 0, 0, 0, '2017-09-13 16:06:06');
-INSERT INTO `store_express_company` VALUES (14, '德邦物流', 'debangwuliu', '', 1, 1, 0, '2017-09-13 16:06:14');
+INSERT INTO `store_express_company` VALUES (14, '德邦物流', 'debangwuliu', '', 0, 1, 0, '2017-09-13 16:06:14');
 INSERT INTO `store_express_company` VALUES (15, 'DHL', 'dhl', NULL, 0, 0, 0, '2017-09-13 16:06:24');
 INSERT INTO `store_express_company` VALUES (16, 'DPEX', 'dpex', NULL, 0, 0, 0, '2017-09-13 16:06:29');
 INSERT INTO `store_express_company` VALUES (17, 'd速快递', 'dsukuaidi', NULL, 0, 0, 0, '2017-09-13 16:06:34');
@@ -125,57 +125,7 @@ INSERT INTO `store_express_company` VALUES (90, '中铁快运', 'zhongtiekuaiyun
 INSERT INTO `store_express_company` VALUES (91, '中通速递', 'zhongtong', '', 0, 0, 0, '2017-09-13 16:17:16');
 INSERT INTO `store_express_company` VALUES (92, '中邮物流', 'zhongyouwuliu', NULL, 0, 0, 0, '2017-09-13 16:17:27');
 INSERT INTO `store_express_company` VALUES (93, '忠信达', 'zhongxinda', NULL, 0, 0, 0, '2017-09-13 16:17:34');
-INSERT INTO `store_express_company` VALUES (94, '芝麻开门', 'zhimakaimen', '', 0, 0, 0, '2017-09-13 16:17:41');
-
--- ----------------------------
--- Table structure for store_express_province
--- ----------------------------
-DROP TABLE IF EXISTS `store_express_province`;
-CREATE TABLE `store_express_province`  (
-  `id` bigint(20) NOT NULL AUTO_INCREMENT,
-  `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '地区名称',
-  `sort` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '排序权限',
-  `status` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '数据状态',
-  `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-  PRIMARY KEY (`id`) USING BTREE,
-  INDEX `index_store_express_province_title`(`title`) USING BTREE,
-  INDEX `index_store_express_province_status`(`status`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 3109 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商城-快递-省份';
-
--- ----------------------------
--- Records of store_express_province
--- ----------------------------
-INSERT INTO `store_express_province` VALUES (1, '北京市', 1, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (19, '天津市', 2, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (37, '河北省', 3, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (217, '山西省', 4, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (348, '内蒙古自治区', 5, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (464, '辽宁省', 6, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (579, '吉林省', 7, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (649, '黑龙江省', 8, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (792, '上海市', 9, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (810, '江苏省', 10, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (920, '浙江省', 11, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (1021, '安徽省', 12, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (1143, '福建省', 13, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (1238, '江西省', 14, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (1350, '山东省', 15, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (1505, '河南省', 16, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (1681, '湖北省', 17, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (1798, '湖南省', 18, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (1935, '广东省', 19, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (2079, '广西壮族自治区', 20, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (2205, '海南省', 21, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (2236, '重庆市', 22, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (2277, '四川省', 23, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (2482, '贵州省', 24, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (2580, '云南省', 25, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (2726, '西藏自治区', 26, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (2808, '陕西省', 27, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (2926, '甘肃省', 28, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (3027, '青海省', 29, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (3080, '宁夏回族自治区', 30, 1, '2017-09-12 11:53:40');
-INSERT INTO `store_express_province` VALUES (3108, '新疆维吾尔自治区', 31, 1, '2017-09-12 11:53:40');
+INSERT INTO `store_express_company` VALUES (94, '芝麻开门', 'zhimakaimen', '', 1, 0, 0, '2017-09-13 16:17:41');
 
 -- ----------------------------
 -- Table structure for store_express_template
@@ -463,11 +413,11 @@ CREATE TABLE `system_config`  (
 -- ----------------------------
 -- Records of system_config
 -- ----------------------------
-INSERT INTO `system_config` VALUES (1, 'app_name', 'ThinkAdmin');
-INSERT INTO `system_config` VALUES (2, 'site_name', 'ThinkAdmin');
-INSERT INTO `system_config` VALUES (3, 'app_version', 'v4.1');
+INSERT INTO `system_config` VALUES (1, 'app_name', 'framework');
+INSERT INTO `system_config` VALUES (2, 'site_name', 'framework');
+INSERT INTO `system_config` VALUES (3, 'app_version', 'v2.0');
 INSERT INTO `system_config` VALUES (4, 'site_copy', '©版权所有 2014-2018 楚才科技');
-INSERT INTO `system_config` VALUES (5, 'site_icon', 'http://127.0.0.1:8000/upload/f47b8fe06e38ae99/08e8398da45583b9.png');
+INSERT INTO `system_config` VALUES (5, 'site_icon', '/upload/decb0fe26fa3f486/b3f6521bf29403c8.png');
 INSERT INTO `system_config` VALUES (7, 'miitbeian', '粤ICP备16006642号-2');
 INSERT INTO `system_config` VALUES (8, 'storage_type', 'local');
 INSERT INTO `system_config` VALUES (9, 'storage_local_exts', 'doc,gif,icon,jpg,mp3,mp4,p12,pem,png,rar');
@@ -496,7 +446,7 @@ INSERT INTO `system_config` VALUES (54, 'wechat_encodingaeskey', '');
 INSERT INTO `system_config` VALUES (55, 'wechat_push_url', '消息推送地址:http://127.0.0.1:8000/wechat/api.push');
 INSERT INTO `system_config` VALUES (56, 'wechat_type', 'thr');
 INSERT INTO `system_config` VALUES (57, 'wechat_thr_appid', 'wx60a43dd8161666d4');
-INSERT INTO `system_config` VALUES (58, 'wechat_thr_appkey', '6d1116ba978018ceb84d24d6dda4fed0');
+INSERT INTO `system_config` VALUES (58, 'wechat_thr_appkey', 'd2c0139213d7a27898ca047d81a617be');
 INSERT INTO `system_config` VALUES (60, 'wechat_thr_appurl', '消息推送地址:http://127.0.0.1:8000/wechat/api.push');
 INSERT INTO `system_config` VALUES (61, 'component_appid', 'wx28b58798480874f9');
 INSERT INTO `system_config` VALUES (62, 'component_appsecret', '87ddce1cc24e4cd691039f926febd942');
@@ -527,7 +477,7 @@ CREATE TABLE `system_data`  (
 -- ----------------------------
 -- Records of system_data
 -- ----------------------------
-INSERT INTO `system_data` VALUES (1, 'menudata', '[]');
+INSERT INTO `system_data` VALUES (1, 'menudata', '[{\"name\":\"请输入名称\",\"type\":\"view\",\"url\":\"https:\\/\\/baidu.com\"}]');
 
 -- ----------------------------
 -- Table structure for system_jobs
@@ -605,200 +555,48 @@ CREATE TABLE `system_menu`  (
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `index_system_menu_node`(`node`(191)) USING BTREE,
   INDEX `index_system_menu_status`(`status`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 55 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-菜单';
+) ENGINE = InnoDB AUTO_INCREMENT = 56 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-菜单';
 
 -- ----------------------------
 -- Records of system_menu
 -- ----------------------------
-INSERT INTO `system_menu` VALUES (1, 0, '后台首页', '', '', 'admin/index/main', '', '_self', 100, 1, '2018-09-05 17:59:38');
-INSERT INTO `system_menu` VALUES (2, 0, '系统管理', '', '', '#', '', '_self', 300, 1, '2018-09-05 18:04:52');
-INSERT INTO `system_menu` VALUES (3, 12, '系统菜单管理', '', 'layui-icon layui-icon-layouts', 'admin/menu/index', '', '_self', 2, 1, '2018-09-05 18:05:26');
-INSERT INTO `system_menu` VALUES (4, 2, '系统配置', '', '', '#', '', '_self', 10, 1, '2018-09-05 18:07:17');
-INSERT INTO `system_menu` VALUES (5, 12, '系统用户管理', '', 'layui-icon layui-icon-username', 'admin/user/index', '', '_self', 4, 1, '2018-09-06 11:10:42');
-INSERT INTO `system_menu` VALUES (6, 12, '功能节点管理', '', 'layui-icon layui-icon-template', 'admin/node/index', '', '_self', 1, 1, '2018-09-06 14:16:13');
-INSERT INTO `system_menu` VALUES (7, 12, '访问权限管理', '', 'layui-icon layui-icon-vercode', 'admin/auth/index', '', '_self', 3, 1, '2018-09-06 15:17:14');
-INSERT INTO `system_menu` VALUES (10, 4, '文件存储配置', '', 'layui-icon layui-icon-template-1', 'admin/config/file', '', '_self', 2, 1, '2018-09-06 16:43:19');
-INSERT INTO `system_menu` VALUES (11, 4, '系统参数配置', '', 'layui-icon layui-icon-set', 'admin/config/info', '', '_self', 1, 1, '2018-09-06 16:43:47');
-INSERT INTO `system_menu` VALUES (12, 2, '权限管理', '', '', '#', '', '_self', 20, 1, '2018-09-06 18:01:31');
-INSERT INTO `system_menu` VALUES (13, 0, '商城管理', '', '', '#', '', '_self', 200, 1, '2018-10-12 13:56:29');
-INSERT INTO `system_menu` VALUES (14, 48, '商品信息管理', '', 'layui-icon layui-icon-component', 'store/goods/index', '', '_self', 30, 1, '2018-10-12 13:56:48');
-INSERT INTO `system_menu` VALUES (16, 0, '微信管理', '', '', '#', '', '_self', 210, 1, '2018-10-31 15:15:27');
-INSERT INTO `system_menu` VALUES (17, 16, '微信管理', '', '', '#', '', '_self', 10, 1, '2018-10-31 15:16:46');
-INSERT INTO `system_menu` VALUES (18, 17, '微信授权配置', '', 'layui-icon layui-icon-set', 'wechat/config/options', '', '_self', 1, 1, '2018-10-31 15:17:11');
-INSERT INTO `system_menu` VALUES (19, 17, '微信支付配置', '', 'layui-icon layui-icon-rmb', 'wechat/config/payment', '', '_self', 2, 1, '2018-10-31 18:28:09');
-INSERT INTO `system_menu` VALUES (20, 16, '微信定制', '', '', '#', '', '_self', 20, 1, '2018-11-13 11:46:27');
-INSERT INTO `system_menu` VALUES (21, 20, '图文素材管理', '', 'layui-icon layui-icon-template', 'wechat/news/index', '', '_self', 1, 1, '2018-11-13 11:46:55');
-INSERT INTO `system_menu` VALUES (22, 20, '粉丝信息管理', '', 'layui-icon layui-icon-user', 'wechat/fans/index', '', '_self', 2, 1, '2018-11-15 09:51:13');
-INSERT INTO `system_menu` VALUES (23, 20, '回复规则管理', '', 'layui-icon layui-icon-engine', 'wechat/keys/index', '', '_self', 3, 1, '2018-11-22 11:29:08');
-INSERT INTO `system_menu` VALUES (24, 20, '关注回复配置', '', 'layui-icon layui-icon-senior', 'wechat/keys/subscribe', '', '_self', 4, 1, '2018-11-27 11:45:28');
-INSERT INTO `system_menu` VALUES (25, 20, '默认回复配置', '', 'layui-icon layui-icon-survey', 'wechat/keys/defaults', '', '_self', 5, 1, '2018-11-27 11:45:58');
-INSERT INTO `system_menu` VALUES (26, 20, '微信菜单管理', '', 'layui-icon layui-icon-cellphone', 'wechat/menu/index', '', '_self', 6, 1, '2018-11-27 17:56:56');
+INSERT INTO `system_menu` VALUES (1, 0, '后台首页', '', '', 'admin/index/main', '', '_self', 500, 1, '2018-09-05 17:59:38');
+INSERT INTO `system_menu` VALUES (2, 0, '系统管理', '', '', '#', '', '_self', 100, 1, '2018-09-05 18:04:52');
+INSERT INTO `system_menu` VALUES (3, 4, '系统菜单管理', '', 'layui-icon layui-icon-layouts', 'admin/menu/index', '', '_self', 1, 1, '2018-09-05 18:05:26');
+INSERT INTO `system_menu` VALUES (4, 2, '系统配置', '', '', '#', '', '_self', 20, 1, '2018-09-05 18:07:17');
+INSERT INTO `system_menu` VALUES (5, 12, '系统用户管理', '', 'layui-icon layui-icon-username', 'admin/user/index', '', '_self', 1, 1, '2018-09-06 11:10:42');
+INSERT INTO `system_menu` VALUES (7, 12, '访问权限管理', '', 'layui-icon layui-icon-vercode', 'admin/auth/index', '', '_self', 2, 1, '2018-09-06 15:17:14');
+INSERT INTO `system_menu` VALUES (11, 4, '系统参数配置', '', 'layui-icon layui-icon-set', 'admin/config/info', '', '_self', 4, 1, '2018-09-06 16:43:47');
+INSERT INTO `system_menu` VALUES (12, 2, '权限管理', '', '', '#', '', '_self', 10, 1, '2018-09-06 18:01:31');
+INSERT INTO `system_menu` VALUES (13, 0, '商城管理', '', '', '#', '', '_self', 400, 1, '2018-10-12 13:56:29');
+INSERT INTO `system_menu` VALUES (14, 48, '商品信息管理', '', 'layui-icon layui-icon-component', 'store/goods/index', '', '_self', 3, 1, '2018-10-12 13:56:48');
+INSERT INTO `system_menu` VALUES (16, 0, '微信管理', '', '', '#', '', '_self', 300, 1, '2018-10-31 15:15:27');
+INSERT INTO `system_menu` VALUES (17, 16, '微信管理', '', '', '#', '', '_self', 20, 1, '2018-10-31 15:16:46');
+INSERT INTO `system_menu` VALUES (18, 17, '微信授权配置', '', 'layui-icon layui-icon-set', 'wechat/config/options', '', '_self', 2, 1, '2018-10-31 15:17:11');
+INSERT INTO `system_menu` VALUES (19, 17, '微信支付配置', '', 'layui-icon layui-icon-rmb', 'wechat/config/payment', '', '_self', 1, 1, '2018-10-31 18:28:09');
+INSERT INTO `system_menu` VALUES (20, 16, '微信定制', '', '', '#', '', '_self', 10, 1, '2018-11-13 11:46:27');
+INSERT INTO `system_menu` VALUES (21, 20, '图文素材管理', '', 'layui-icon layui-icon-template', 'wechat/news/index', '', '_self', 6, 1, '2018-11-13 11:46:55');
+INSERT INTO `system_menu` VALUES (22, 20, '粉丝信息管理', '', 'layui-icon layui-icon-user', 'wechat/fans/index', '', '_self', 5, 1, '2018-11-15 09:51:13');
+INSERT INTO `system_menu` VALUES (23, 20, '回复规则管理', '', 'layui-icon layui-icon-engine', 'wechat/keys/index', '', '_self', 4, 1, '2018-11-22 11:29:08');
+INSERT INTO `system_menu` VALUES (24, 20, '关注回复配置', '', 'layui-icon layui-icon-senior', 'wechat/keys/subscribe', '', '_self', 3, 1, '2018-11-27 11:45:28');
+INSERT INTO `system_menu` VALUES (25, 20, '默认回复配置', '', 'layui-icon layui-icon-survey', 'wechat/keys/defaults', '', '_self', 2, 1, '2018-11-27 11:45:58');
+INSERT INTO `system_menu` VALUES (26, 20, '微信菜单管理', '', 'layui-icon layui-icon-cellphone', 'wechat/menu/index', '', '_self', 1, 1, '2018-11-27 17:56:56');
 INSERT INTO `system_menu` VALUES (27, 4, '系统任务管理', '', 'layui-icon layui-icon-log', 'admin/queue/index', '', '_self', 3, 1, '2018-11-29 11:13:34');
-INSERT INTO `system_menu` VALUES (35, 4, '系统消息管理', '', 'layui-icon layui-icon-notice', 'admin/message/index', '', '_self', 4, 1, '2018-12-24 14:03:52');
-INSERT INTO `system_menu` VALUES (37, 0, '开放平台', '', '', '#', '', '_self', 220, 1, '2018-12-28 13:29:25');
+INSERT INTO `system_menu` VALUES (37, 0, '开放平台', '', '', '#', '', '_self', 200, 1, '2018-12-28 13:29:25');
 INSERT INTO `system_menu` VALUES (38, 40, '开放平台配置', '', 'layui-icon layui-icon-set', 'service/config/index', '', '_self', 0, 1, '2018-12-28 13:29:44');
 INSERT INTO `system_menu` VALUES (39, 40, '公众授权管理', '', 'layui-icon layui-icon-template-1', 'service/index/index', '', '_self', 0, 1, '2018-12-28 13:30:07');
-INSERT INTO `system_menu` VALUES (40, 37, '开放平台管理', '', '', '#', '', '_self', 0, 1, '2018-12-28 16:05:46');
-INSERT INTO `system_menu` VALUES (42, 48, '会员信息管理', '', 'layui-icon layui-icon-user', 'store/member/index', '', '_self', 50, 1, '2019-01-22 14:24:23');
-INSERT INTO `system_menu` VALUES (43, 48, '订单记录管理', '', 'layui-icon layui-icon-template-1', 'store/order/index', '', '_self', 40, 1, '2019-01-22 14:46:22');
-INSERT INTO `system_menu` VALUES (44, 48, '商品分类管理', '', 'layui-icon layui-icon-app', 'store/goods_cate/index', '', '_self', 20, 1, '2019-01-23 10:41:06');
-INSERT INTO `system_menu` VALUES (45, 47, '商城参数配置', '', 'layui-icon layui-icon-set', 'store/config/index', '', '_self', 10, 1, '2019-01-24 16:47:33');
-INSERT INTO `system_menu` VALUES (46, 47, '短信发送记录', '', 'layui-icon layui-icon-console', 'store/message/index', '', '_self', 30, 1, '2019-01-24 18:09:58');
-INSERT INTO `system_menu` VALUES (47, 13, '商城配置', '', '', '#', '', '_self', 10, 1, '2019-01-25 16:47:49');
-INSERT INTO `system_menu` VALUES (48, 13, '数据管理', '', '', '#', '', '_self', 20, 1, '2019-01-25 16:48:35');
-INSERT INTO `system_menu` VALUES (49, 4, '系统日志管理', '', 'layui-icon layui-icon-form', 'admin/oplog/index', '', '_self', 5, 1, '2019-02-18 12:56:56');
-INSERT INTO `system_menu` VALUES (50, 47, '快递公司管理', '', 'layui-icon layui-icon-form', 'store/express_company/index', '', '_self', 40, 1, '2019-04-01 17:10:59');
-INSERT INTO `system_menu` VALUES (52, 47, '邮费模板管理', '', 'layui-icon layui-icon-fonts-clear', 'store/express_template/index', '', '_self', 60, 1, '2019-04-23 13:17:10');
-INSERT INTO `system_menu` VALUES (53, 47, '配送省份管理', '', 'layui-icon layui-icon-location', 'store/express_province/index', '', '_self', 55, 1, '2019-04-24 14:47:27');
-INSERT INTO `system_menu` VALUES (54, 47, '商城短信配置', '', 'layui-icon layui-icon-dialogue', 'store/config/sms', '', '_self', 0, 1, '2019-06-14 14:21:19');
-
--- ----------------------------
--- Table structure for system_message
--- ----------------------------
-DROP TABLE IF EXISTS `system_message`;
-CREATE TABLE `system_message`  (
-  `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-  `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '消息编号',
-  `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '消息名称',
-  `url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '跳转地址',
-  `desc` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '消息描述',
-  `node` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '消息授权',
-  `read_state` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '读取状态',
-  `read_uid` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '读取用户',
-  `read_at` datetime NULL DEFAULT NULL COMMENT '读取时间',
-  `status` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '消息状态',
-  `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-  PRIMARY KEY (`id`) USING BTREE,
-  INDEX `index_system_message_code`(`code`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-消息';
-
--- ----------------------------
--- Table structure for system_node
--- ----------------------------
-DROP TABLE IF EXISTS `system_node`;
-CREATE TABLE `system_node`  (
-  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
-  `node` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '节点代码',
-  `title` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '节点标题',
-  `is_menu` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否可设置为菜单',
-  `is_auth` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '是否启动RBAC权限控制',
-  `is_login` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '是否启动登录控制',
-  `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-  PRIMARY KEY (`id`) USING BTREE,
-  INDEX `index_system_node_node`(`node`) USING BTREE,
-  INDEX `index_system_node_is_menu`(`is_menu`) USING BTREE,
-  INDEX `index_system_node_is_auth`(`is_auth`) USING BTREE,
-  INDEX `index_system_node_is_login`(`is_login`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 106 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-节点';
-
--- ----------------------------
--- Records of system_node
--- ----------------------------
-INSERT INTO `system_node` VALUES (1, 'admin', '系统管理', 0, 1, 1, '2019-06-14 16:51:00');
-INSERT INTO `system_node` VALUES (2, 'admin/auth/index', '系统权限管理', 1, 1, 1, '2019-06-14 16:51:01');
-INSERT INTO `system_node` VALUES (3, 'admin/auth/apply', '权限配置节点', 0, 1, 1, '2019-06-14 16:51:01');
-INSERT INTO `system_node` VALUES (4, 'admin/auth/add', '添加系统权限', 0, 1, 1, '2019-06-14 16:51:01');
-INSERT INTO `system_node` VALUES (5, 'admin/auth/edit', '编辑系统权限', 0, 1, 1, '2019-06-14 16:51:02');
-INSERT INTO `system_node` VALUES (6, 'admin/auth/forbid', '禁用系统权限', 0, 1, 1, '2019-06-14 16:51:02');
-INSERT INTO `system_node` VALUES (7, 'admin/auth/resume', '启用系统权限', 0, 1, 1, '2019-06-14 16:51:02');
-INSERT INTO `system_node` VALUES (8, 'admin/auth/remove', '删除系统权限', 0, 1, 1, '2019-06-14 16:51:02');
-INSERT INTO `system_node` VALUES (9, 'admin/config/info', '系统参数配置', 1, 1, 1, '2019-06-14 16:51:03');
-INSERT INTO `system_node` VALUES (10, 'admin/config/file', '文件存储配置', 1, 1, 1, '2019-06-14 16:51:04');
-INSERT INTO `system_node` VALUES (11, 'admin/menu/index', '系统菜单管理', 1, 1, 1, '2019-06-14 16:51:07');
-INSERT INTO `system_node` VALUES (12, 'admin/menu/add', '添加系统菜单', 0, 1, 1, '2019-06-14 16:51:07');
-INSERT INTO `system_node` VALUES (13, 'admin/menu/edit', '编辑系统菜单', 0, 1, 1, '2019-06-14 16:51:07');
-INSERT INTO `system_node` VALUES (14, 'admin/menu/resume', '启用系统菜单', 0, 1, 1, '2019-06-14 16:51:07');
-INSERT INTO `system_node` VALUES (15, 'admin/menu/forbid', '禁用系统菜单', 0, 1, 1, '2019-06-14 16:51:07');
-INSERT INTO `system_node` VALUES (16, 'admin/menu/remove', '删除系统菜单', 0, 1, 1, '2019-06-14 16:51:07');
-INSERT INTO `system_node` VALUES (17, 'admin/message/index', '系统消息管理', 1, 1, 1, '2019-06-14 16:51:10');
-INSERT INTO `system_node` VALUES (18, 'admin/message/read', '设置消息状态', 0, 1, 1, '2019-06-14 16:51:10');
-INSERT INTO `system_node` VALUES (19, 'admin/message/clear', '清理所有消息', 0, 1, 1, '2019-06-14 16:51:10');
-INSERT INTO `system_node` VALUES (20, 'admin/message/state', '设置消息开关', 0, 1, 1, '2019-06-14 16:51:10');
-INSERT INTO `system_node` VALUES (21, 'admin/message/remove', '删除系统消息', 0, 1, 1, '2019-06-14 16:51:11');
-INSERT INTO `system_node` VALUES (22, 'admin/node/index', '系统节点管理', 1, 1, 1, '2019-06-14 16:51:12');
-INSERT INTO `system_node` VALUES (23, 'admin/node/clear', '清理无效的节点', 0, 1, 1, '2019-06-14 16:51:13');
-INSERT INTO `system_node` VALUES (24, 'admin/node/save', '更新节点数据', 0, 1, 1, '2019-06-14 16:51:13');
-INSERT INTO `system_node` VALUES (25, 'admin/oplog/index', '系统操作日志', 1, 1, 1, '2019-06-14 16:51:16');
-INSERT INTO `system_node` VALUES (26, 'admin/oplog/clear', '清理系统日志', 0, 1, 1, '2019-06-14 16:51:16');
-INSERT INTO `system_node` VALUES (27, 'admin/oplog/remove', '删除系统日志', 0, 1, 1, '2019-06-14 16:51:16');
-INSERT INTO `system_node` VALUES (28, 'admin/queue/index', '系统消息任务', 1, 1, 1, '2019-06-14 16:51:19');
-INSERT INTO `system_node` VALUES (29, 'admin/queue/redo', '重置失败的任务', 0, 1, 1, '2019-06-14 16:51:19');
-INSERT INTO `system_node` VALUES (30, 'admin/queue/remove', '删除消息任务', 0, 1, 1, '2019-06-14 16:51:19');
-INSERT INTO `system_node` VALUES (31, 'admin/user/index', '系统用户管理', 1, 1, 1, '2019-06-14 16:51:22');
-INSERT INTO `system_node` VALUES (32, 'admin/user/auth', '用户授权管理', 0, 1, 1, '2019-06-14 16:51:22');
-INSERT INTO `system_node` VALUES (33, 'admin/user/add', '添加系统用户', 0, 1, 1, '2019-06-14 16:51:22');
-INSERT INTO `system_node` VALUES (34, 'admin/user/edit', '编辑系统用户', 0, 1, 1, '2019-06-14 16:51:22');
-INSERT INTO `system_node` VALUES (35, 'admin/user/pass', '修改用户密码', 0, 1, 1, '2019-06-14 16:51:23');
-INSERT INTO `system_node` VALUES (36, 'admin/user/forbid', '禁用系统用户', 0, 1, 1, '2019-06-14 16:51:23');
-INSERT INTO `system_node` VALUES (37, 'admin/user/resume', '启用系统用户', 0, 1, 1, '2019-06-14 16:51:23');
-INSERT INTO `system_node` VALUES (38, 'admin/user/remove', '删除系统用户', 0, 1, 1, '2019-06-14 16:51:23');
-INSERT INTO `system_node` VALUES (39, 'service', '开放平台', 0, 1, 1, '2019-06-14 16:51:33');
-INSERT INTO `system_node` VALUES (40, 'service/config/index', '开放平台参数配置', 1, 1, 1, '2019-06-14 16:51:34');
-INSERT INTO `system_node` VALUES (41, 'service/index/index', '公众授权管理', 1, 1, 1, '2019-06-14 16:51:34');
-INSERT INTO `system_node` VALUES (42, 'service/index/clearquota', '清理调用次数', 0, 1, 1, '2019-06-14 16:51:34');
-INSERT INTO `system_node` VALUES (43, 'service/index/sync', '同步指定授权公众号', 0, 1, 1, '2019-06-14 16:51:34');
-INSERT INTO `system_node` VALUES (44, 'service/index/syncall', '同步所有授权公众号', 0, 1, 1, '2019-06-14 16:51:34');
-INSERT INTO `system_node` VALUES (45, 'service/index/del', '删除公众号授权', 0, 1, 1, '2019-06-14 16:51:35');
-INSERT INTO `system_node` VALUES (46, 'service/index/forbid', '禁用公众号授权', 0, 1, 1, '2019-06-14 16:51:35');
-INSERT INTO `system_node` VALUES (47, 'service/index/resume', '启用公众号授权', 0, 1, 1, '2019-06-14 16:51:35');
-INSERT INTO `system_node` VALUES (48, 'store/config/index', '商城参数配置', 1, 1, 1, '2019-06-14 16:51:39');
-INSERT INTO `system_node` VALUES (49, 'store/config/sms', '商城短信配置', 1, 1, 1, '2019-06-14 16:51:40');
-INSERT INTO `system_node` VALUES (50, 'store/express_company/index', '快递公司管理', 1, 1, 1, '2019-06-14 16:51:42');
-INSERT INTO `system_node` VALUES (51, 'store/express_company/add', '添加快递公司', 0, 1, 1, '2019-06-14 16:51:43');
-INSERT INTO `system_node` VALUES (52, 'store/express_company/edit', '编辑快递公司', 0, 1, 1, '2019-06-14 16:51:43');
-INSERT INTO `system_node` VALUES (53, 'store/express_company/forbid', '禁用快递公司', 0, 1, 1, '2019-06-14 16:51:43');
-INSERT INTO `system_node` VALUES (54, 'store/express_company/resume', '启用快递公司', 0, 1, 1, '2019-06-14 16:51:43');
-INSERT INTO `system_node` VALUES (55, 'store/express_company/remove', '删除快递公司', 0, 1, 1, '2019-06-14 16:51:43');
-INSERT INTO `system_node` VALUES (56, 'store/express_province/index', '配送省份管理', 1, 1, 1, '2019-06-14 16:51:43');
-INSERT INTO `system_node` VALUES (57, 'store/express_province/add', '添加配送省份', 0, 1, 1, '2019-06-14 16:51:44');
-INSERT INTO `system_node` VALUES (58, 'store/express_province/edit', '编辑配送省份', 0, 1, 1, '2019-06-14 16:51:44');
-INSERT INTO `system_node` VALUES (59, 'store/express_province/resume', '启用配送省份', 0, 1, 1, '2019-06-14 16:51:44');
-INSERT INTO `system_node` VALUES (60, 'store/express_province/forbid', '禁用配送省份', 0, 1, 1, '2019-06-14 16:51:44');
-INSERT INTO `system_node` VALUES (61, 'store/express_province/remove', '删除配送省份', 0, 1, 1, '2019-06-14 16:51:44');
-INSERT INTO `system_node` VALUES (62, 'store/express_template/index', '邮费模板管理', 1, 1, 1, '2019-06-14 16:51:46');
-INSERT INTO `system_node` VALUES (63, 'store/goods/index', '商品信息管理', 1, 1, 1, '2019-06-14 16:51:46');
-INSERT INTO `system_node` VALUES (64, 'store/goods/stock', '商品库存入库', 0, 1, 1, '2019-06-14 16:51:46');
-INSERT INTO `system_node` VALUES (65, 'store/goods/add', '添加商品信息', 0, 1, 1, '2019-06-14 16:51:47');
-INSERT INTO `system_node` VALUES (66, 'store/goods/edit', '编辑商品信息', 0, 1, 1, '2019-06-14 16:51:47');
-INSERT INTO `system_node` VALUES (67, 'store/goods/forbid', '禁用商品信息', 0, 1, 1, '2019-06-14 16:51:47');
-INSERT INTO `system_node` VALUES (68, 'store/goods/resume', '启用商品信息', 0, 1, 1, '2019-06-14 16:51:47');
-INSERT INTO `system_node` VALUES (69, 'store/goods/remove', '删除商品信息', 0, 1, 1, '2019-06-14 16:51:47');
-INSERT INTO `system_node` VALUES (70, 'store/goods_cate/index', '商品分类管理', 1, 1, 1, '2019-06-14 16:51:48');
-INSERT INTO `system_node` VALUES (71, 'store/goods_cate/add', '添加商品分类', 0, 1, 1, '2019-06-14 16:51:48');
-INSERT INTO `system_node` VALUES (72, 'store/goods_cate/edit', '编辑添加商品分类', 0, 1, 1, '2019-06-14 16:51:48');
-INSERT INTO `system_node` VALUES (73, 'store/goods_cate/forbid', '禁用添加商品分类', 0, 1, 1, '2019-06-14 16:51:48');
-INSERT INTO `system_node` VALUES (74, 'store/goods_cate/resume', '启用商品分类', 0, 1, 1, '2019-06-14 16:51:48');
-INSERT INTO `system_node` VALUES (75, 'store/goods_cate/remove', '删除商品分类', 0, 1, 1, '2019-06-14 16:51:49');
-INSERT INTO `system_node` VALUES (76, 'store/member/index', '会员信息管理', 1, 1, 1, '2019-06-14 16:51:49');
-INSERT INTO `system_node` VALUES (77, 'store/message/index', '短信发送管理', 1, 1, 1, '2019-06-14 16:51:49');
-INSERT INTO `system_node` VALUES (78, 'store/order/index', '订单记录管理', 1, 1, 1, '2019-06-14 16:51:49');
-INSERT INTO `system_node` VALUES (79, 'store/order/express', '修改快递管理', 0, 1, 1, '2019-06-14 16:51:49');
-INSERT INTO `system_node` VALUES (80, 'store/order/expressquery', '快递追踪查询', 0, 1, 1, '2019-06-14 16:51:50');
-INSERT INTO `system_node` VALUES (81, 'store', '商城管理', 0, 1, 1, '2019-06-14 16:52:11');
-INSERT INTO `system_node` VALUES (82, 'wechat', '微信管理', 0, 1, 1, '2019-06-14 16:52:17');
-INSERT INTO `system_node` VALUES (83, 'wechat/config/options', '公众号授权绑定', 1, 1, 1, '2019-06-14 16:52:18');
-INSERT INTO `system_node` VALUES (84, 'wechat/config/payment', '公众号支付配置', 1, 1, 1, '2019-06-14 16:52:18');
-INSERT INTO `system_node` VALUES (85, 'wechat/fans/index', '微信粉丝管理', 1, 1, 1, '2019-06-14 16:52:20');
-INSERT INTO `system_node` VALUES (86, 'wechat/fans/setblack', '批量拉黑粉丝', 0, 1, 1, '2019-06-14 16:52:20');
-INSERT INTO `system_node` VALUES (87, 'wechat/fans/delblack', '取消拉黑粉丝', 0, 1, 1, '2019-06-14 16:52:20');
-INSERT INTO `system_node` VALUES (88, 'wechat/fans/sync', '同步粉丝列表', 0, 1, 1, '2019-06-14 16:52:20');
-INSERT INTO `system_node` VALUES (89, 'wechat/fans/del', '删除粉丝信息', 0, 1, 1, '2019-06-14 16:52:21');
-INSERT INTO `system_node` VALUES (90, 'wechat/keys/index', '回复规则管理', 1, 1, 1, '2019-06-14 16:52:22');
-INSERT INTO `system_node` VALUES (91, 'wechat/keys/add', '添加关键字', 0, 1, 1, '2019-06-14 16:52:22');
-INSERT INTO `system_node` VALUES (92, 'wechat/keys/edit', '编辑关键字', 0, 1, 1, '2019-06-14 16:52:22');
-INSERT INTO `system_node` VALUES (93, 'wechat/keys/del', '删除关键字', 0, 1, 1, '2019-06-14 16:52:22');
-INSERT INTO `system_node` VALUES (94, 'wechat/keys/forbid', '禁用关键字', 0, 1, 1, '2019-06-14 16:52:22');
-INSERT INTO `system_node` VALUES (95, 'wechat/keys/resume', '启用关键字', 0, 1, 1, '2019-06-14 16:52:23');
-INSERT INTO `system_node` VALUES (96, 'wechat/keys/subscribe', '配置关注回复', 0, 1, 1, '2019-06-14 16:52:23');
-INSERT INTO `system_node` VALUES (97, 'wechat/keys/defaults', '配置默认回复', 0, 1, 1, '2019-06-14 16:52:23');
-INSERT INTO `system_node` VALUES (98, 'wechat/menu/index', '微信菜单管理', 1, 1, 1, '2019-06-14 16:52:25');
-INSERT INTO `system_node` VALUES (99, 'wechat/menu/edit', '编辑微信菜单', 0, 1, 1, '2019-06-14 16:52:25');
-INSERT INTO `system_node` VALUES (100, 'wechat/menu/cancel', '取消微信菜单', 0, 1, 1, '2019-06-14 16:52:25');
-INSERT INTO `system_node` VALUES (101, 'wechat/news/index', '微信图文管理', 1, 1, 1, '2019-06-14 16:52:27');
-INSERT INTO `system_node` VALUES (102, 'wechat/news/select', '图文选择器', 0, 1, 1, '2019-06-14 16:52:27');
-INSERT INTO `system_node` VALUES (103, 'wechat/news/add', '添加微信图文', 0, 1, 1, '2019-06-14 16:52:27');
-INSERT INTO `system_node` VALUES (104, 'wechat/news/edit', '编辑微信图文', 0, 1, 1, '2019-06-14 16:52:27');
-INSERT INTO `system_node` VALUES (105, 'wechat/news/del', '删除微信图文', 0, 1, 1, '2019-06-14 16:52:28');
+INSERT INTO `system_menu` VALUES (40, 37, '平台管理', '', '', '#', '', '_self', 0, 1, '2018-12-28 16:05:46');
+INSERT INTO `system_menu` VALUES (42, 48, '会员信息管理', '', 'layui-icon layui-icon-user', 'store/member/index', '', '_self', 1, 1, '2019-01-22 14:24:23');
+INSERT INTO `system_menu` VALUES (43, 48, '订单记录管理', '', 'layui-icon layui-icon-template-1', 'store/order/index', '', '_self', 2, 1, '2019-01-22 14:46:22');
+INSERT INTO `system_menu` VALUES (44, 48, '商品分类管理', '', 'layui-icon layui-icon-app', 'store/goods_cate/index', '', '_self', 4, 1, '2019-01-23 10:41:06');
+INSERT INTO `system_menu` VALUES (45, 47, '商城参数配置', '', 'layui-icon layui-icon-set', 'store/config/index', '', '_self', 5, 1, '2019-01-24 16:47:33');
+INSERT INTO `system_menu` VALUES (46, 47, '短信发送记录', '', 'layui-icon layui-icon-console', 'store/message/index', '', '_self', 4, 1, '2019-01-24 18:09:58');
+INSERT INTO `system_menu` VALUES (47, 13, '商城配置', '', '', '#', '', '_self', 20, 1, '2019-01-25 16:47:49');
+INSERT INTO `system_menu` VALUES (48, 13, '数据管理', '', '', '#', '', '_self', 10, 1, '2019-01-25 16:48:35');
+INSERT INTO `system_menu` VALUES (49, 4, '系统日志管理', '', 'layui-icon layui-icon-form', 'admin/oplog/index', '', '_self', 2, 1, '2019-02-18 12:56:56');
+INSERT INTO `system_menu` VALUES (50, 47, '快递公司管理', '', 'layui-icon layui-icon-form', 'store/express_company/index', '', '_self', 3, 1, '2019-04-01 17:10:59');
+INSERT INTO `system_menu` VALUES (52, 47, '邮费模板管理', '', 'layui-icon layui-icon-fonts-clear', 'store/express_template/index', '', '_self', 1, 1, '2019-04-23 13:17:10');
+INSERT INTO `system_menu` VALUES (55, 17, '微信数据统计', '', 'layui-icon layui-icon-chart-screen', 'wechat/index/index', '', '_self', 3, 1, '2019-06-15 15:03:51');
 
 -- ----------------------------
 -- Table structure for system_user
@@ -823,12 +621,13 @@ CREATE TABLE `system_user`  (
   UNIQUE INDEX `index_system_user_username`(`username`) USING BTREE,
   INDEX `index_system_user_status`(`status`) USING BTREE,
   INDEX `index_system_user_deleted`(`is_deleted`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 10001 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-用户';
+) ENGINE = InnoDB AUTO_INCREMENT = 10002 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-用户';
 
 -- ----------------------------
 -- Records of system_user
 -- ----------------------------
-INSERT INTO `system_user` VALUES (10000, 'admin', '21232f297a57a5a743894a0e4a801fc3', '22222222', '', '', '2019-06-14 10:19:46', '127.0.0.1', 569, '', '', 1, 0, '2015-11-13 15:14:22');
+INSERT INTO `system_user` VALUES (10000, 'admin', '21232f297a57a5a743894a0e4a801fc3', '22222222', '', '', '2019-07-04 17:43:24', '127.0.0.1', 608, '', '', 1, 0, '2015-11-13 15:14:22');
+INSERT INTO `system_user` VALUES (10001, 'tests', '0aad729995c6eb64866dbfc08a9858c9', '', '', '', '2019-07-02 11:11:08', '127.0.0.1', 9, '1', '', 1, 0, '2019-06-27 17:58:14');
 
 -- ----------------------------
 -- Table structure for wechat_fans

+ 37 - 29
application/admin/controller/Auth.php

@@ -1,21 +1,24 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\controller;
 
+use app\admin\service\NodeService;
 use library\Controller;
 use think\Db;
+use think\exception\HttpResponseException;
 
 /**
  * 系统权限管理
@@ -32,6 +35,8 @@ class Auth extends Controller
 
     /**
      * 系统权限管理
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -42,12 +47,12 @@ class Auth extends Controller
     {
         $this->title = '系统权限管理';
         $query = $this->_query($this->table)->dateBetween('create_at');
-        $query->like('title,desc')->equal('status')->order('sort asc,id desc')->page();
+        $query->like('title,desc')->equal('status')->order('sort desc,id desc')->page();
     }
 
     /**
      * 权限配置节点
-     * @return mixed
+     * @auth true
      * @throws \ReflectionException
      * @throws \think\Exception
      * @throws \think\exception\PDOException
@@ -58,11 +63,8 @@ class Auth extends Controller
         $auth = $this->request->post('id', '0');
         switch (strtolower($this->request->post('action'))) {
             case 'get': // 获取权限配置
-                $nodes = \app\admin\service\AuthService::get();
-                $checked = Db::name('SystemAuthNode')->where(['auth' => $auth])->column('node');
-                foreach ($nodes as &$node) $node['checked'] = in_array($node['node'], $checked);
-                $data = $this->_apply_filter(\library\tools\Data::arr2tree($nodes, 'node', 'pnode', '_sub_'));
-                return $this->success('获取权限节点成功!', $data);
+                $checks = Db::name('SystemAuthNode')->where(['auth' => $auth])->column('node');
+                return $this->success('获取权限节点成功!', NodeService::getAuthTree($checks));
             case 'save': // 保存权限配置
                 list($post, $data) = [$this->request->post(), []];
                 foreach (isset($post['nodes']) ? $post['nodes'] : [] as $node) {
@@ -70,6 +72,7 @@ class Auth extends Controller
                 }
                 Db::name('SystemAuthNode')->where(['auth' => $auth])->delete();
                 Db::name('SystemAuthNode')->insertAll($data);
+                NodeService::applyUserAuth();
                 return $this->success('权限授权更新成功!');
             default:
                 return $this->_form($this->table, 'apply');
@@ -77,22 +80,8 @@ class Auth extends Controller
     }
 
     /**
-     * 节点数据拼装
-     * @param array $nodes
-     * @param integer $level
-     * @return array
-     */
-    private function _apply_filter($nodes, $level = 1)
-    {
-        foreach ($nodes as $key => $node) if (!empty($node['_sub_']) && is_array($node['_sub_'])) {
-            $node[$key]['_sub_'] = $this->_apply_filter($node['_sub_'], $level + 1);
-        }
-        return $nodes;
-    }
-
-    /**
      * 添加系统权限
-     * @return array|string
+     * @auth true
      */
     public function add()
     {
@@ -102,7 +91,7 @@ class Auth extends Controller
 
     /**
      * 编辑系统权限
-     * @return array|string
+     * @auth true
      */
     public function edit()
     {
@@ -111,7 +100,24 @@ class Auth extends Controller
     }
 
     /**
+     * 刷新系统权限
+     * @auth true
+     */
+    public function refresh()
+    {
+        try {
+            NodeService::applyUserAuth(true);
+            $this->success('刷新系统授权成功!');
+        } catch (HttpResponseException $exception) {
+            throw  $exception;
+        } catch (\Exception $e) {
+            $this->error("刷新系统授权失败<br>{$e->getMessage()}");
+        }
+    }
+
+    /**
      * 禁用系统权限
+     * @auth true
      */
     public function forbid()
     {
@@ -121,6 +127,7 @@ class Auth extends Controller
 
     /**
      * 启用系统权限
+     * @auth true
      */
     public function resume()
     {
@@ -130,6 +137,7 @@ class Auth extends Controller
 
     /**
      * 删除系统权限
+     * @auth true
      */
     public function remove()
     {
@@ -146,12 +154,12 @@ class Auth extends Controller
     protected function _remove_delete_result($result)
     {
         if ($result) {
-            $where = ['auth' => $this->request->post('id')];
-            Db::name('SystemAuthNode')->where($where)->delete();
+            $map = ['auth' => $this->request->post('id')];
+            Db::name('SystemAuthNode')->where($map)->delete();
             $this->success("权限删除成功!", '');
         } else {
             $this->error("权限删除失败,请稍候再试!");
         }
     }
 
-}
+}

+ 63 - 66
application/admin/controller/Config.php

@@ -1,20 +1,22 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\controller;
 
 use library\Controller;
+use think\exception\HttpResponseException;
 
 /**
  * 系统参数配置
@@ -30,82 +32,77 @@ class Config extends Controller
     protected $table = 'SystemConfig';
 
     /**
+     * 阿里云OSS上传点
+     * @var array
+     */
+    protected $ossPoints = [
+        'oss-cn-hangzhou.aliyuncs.com'    => '华东 1 杭州',
+        'oss-cn-shanghai.aliyuncs.com'    => '华东 2 上海',
+        'oss-cn-qingdao.aliyuncs.com'     => '华北 1 青岛',
+        'oss-cn-beijing.aliyuncs.com'     => '华北 2 北京',
+        'oss-cn-zhangjiakou.aliyuncs.com' => '华北 3 张家口',
+        'oss-cn-huhehaote.aliyuncs.com'   => '华北 5 呼和浩特',
+        'oss-cn-shenzhen.aliyuncs.com'    => '华南 1 深圳',
+        'oss-cn-hongkong.aliyuncs.com'    => '香港 1',
+        'oss-us-west-1.aliyuncs.com'      => '美国西部 1 硅谷',
+        'oss-us-east-1.aliyuncs.com'      => '美国东部 1 弗吉尼亚',
+        'oss-ap-southeast-1.aliyuncs.com' => '亚太东南 1 新加坡',
+        'oss-ap-southeast-2.aliyuncs.com' => '亚太东南 2 悉尼',
+        'oss-ap-southeast-3.aliyuncs.com' => '亚太东南 3 吉隆坡',
+        'oss-ap-southeast-5.aliyuncs.com' => '亚太东南 5 雅加达',
+        'oss-ap-northeast-1.aliyuncs.com' => '亚太东北 1 日本',
+        'oss-ap-south-1.aliyuncs.com'     => '亚太南部 1 孟买',
+        'oss-eu-central-1.aliyuncs.com'   => '欧洲中部 1 法兰克福',
+        'oss-eu-west-1.aliyuncs.com'      => '英国 1 伦敦',
+        'oss-me-east-1.aliyuncs.com'      => '中东东部 1 迪拜',
+    ];
+
+    /**
      * 系统参数配置
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
+     * @auth true
+     * @menu true
      */
     public function info()
     {
-        $this->applyCsrfToken();
-        if ($this->request->isGet()) {
-            $this->title = '系统参数配置';
-            $this->fetch();
-        } else {
-            foreach ($this->request->post() as $k => $v) sysconf($k, $v);
-            $this->success('系统参数配置成功!');
-        }
+        $this->title = '系统参数配置';
+        $this->applyCsrfToken('save');
+        $this->fetch();
     }
 
     /**
-     * 文件存储配置
+     * 保存参数到服务器
+     * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
-    public function file()
+    public function save()
     {
-        $this->applyCsrfToken();
-        if ($this->request->isGet()) {
-            $this->fetch('file', [
-                'title' => '文件存储配置',
-                'point' => [
-                    'oss-cn-hangzhou.aliyuncs.com'    => '华东 1 杭州',
-                    'oss-cn-shanghai.aliyuncs.com'    => '华东 2 上海',
-                    'oss-cn-qingdao.aliyuncs.com'     => '华北 1 青岛',
-                    'oss-cn-beijing.aliyuncs.com'     => '华北 2 北京',
-                    'oss-cn-zhangjiakou.aliyuncs.com' => '华北 3 张家口',
-                    'oss-cn-huhehaote.aliyuncs.com'   => '华北 5 呼和浩特',
-                    'oss-cn-shenzhen.aliyuncs.com'    => '华南 1 深圳',
-                    'oss-cn-hongkong.aliyuncs.com'    => '香港 1',
-                    'oss-us-west-1.aliyuncs.com'      => '美国西部 1 硅谷',
-                    'oss-us-east-1.aliyuncs.com'      => '美国东部 1 弗吉尼亚',
-                    'oss-ap-southeast-1.aliyuncs.com' => '亚太东南 1 新加坡',
-                    'oss-ap-southeast-2.aliyuncs.com' => '亚太东南 2 悉尼',
-                    'oss-ap-southeast-3.aliyuncs.com' => '亚太东南 3 吉隆坡',
-                    'oss-ap-southeast-5.aliyuncs.com' => '亚太东南 5 雅加达',
-                    'oss-ap-northeast-1.aliyuncs.com' => '亚太东北 1 日本',
-                    'oss-ap-south-1.aliyuncs.com'     => '亚太南部 1 孟买',
-                    'oss-eu-central-1.aliyuncs.com'   => '欧洲中部 1 法兰克福',
-                    'oss-eu-west-1.aliyuncs.com'      => '英国 1 伦敦',
-                    'oss-me-east-1.aliyuncs.com'      => '中东东部 1 迪拜',
-                ],
-            ]);
-        } else {
-            $post = $this->request->post();
-            if (isset($post['storage_type']) && $post['storage_type'] === 'local') {
-                $exts = array_unique(explode(',', $post['storage_local_exts']));
-                if (in_array('php', $exts)) $this->error('禁止上传可执行文件到本地服务器!');
-                sort($exts);
-                $post['storage_local_exts'] = join(',', $exts);
-            }
-            foreach ($post as $key => $value) sysconf($key, $value);
-            if (isset($post['storage_type']) && $post['storage_type'] === 'oss') {
-                try {
-                    $local = sysconf('storage_oss_domain');
-                    $bucket = $this->request->post('storage_oss_bucket');
-                    $domain = \library\File::instance('oss')->setBucket($bucket);
-                    if (empty($local) || stripos($local, '.aliyuncs.com') !== false) {
-                        sysconf('storage_oss_domain', $domain);
-                    }
-                    $this->success('阿里云OSS存储动态配置成功!');
-                } catch (\think\exception\HttpResponseException $exception) {
-                    throw $exception;
-                } catch (\Exception $e) {
-                    $this->error("阿里云OSS存储配置失效,{$e->getMessage()}");
+        $this->applyCsrfToken('save');
+        $post = $this->request->post();
+        if (isset($post['storage_type']) && isset($post['storage_local_exts'])) {
+            $exts = array_unique(explode(',', strtolower($post['storage_local_exts'])));
+            sort($exts);
+            if (in_array('php', $exts)) $this->error('禁止上传可执行文件到本地服务器!');
+            $post['storage_local_exts'] = join(',', $exts);
+        }
+        foreach ($post as $key => $value) sysconf($key, $value);
+        if (isset($post['storage_type']) && $post['storage_type'] === 'oss') {
+            try {
+                $local = sysconf('storage_oss_domain');
+                $bucket = $this->request->post('storage_oss_bucket');
+                $domain = \library\File::instance('oss')->setBucket($bucket);
+                if (empty($local) || stripos($local, '.aliyuncs.com') !== false) {
+                    sysconf('storage_oss_domain', $domain);
                 }
-            } else {
-                $this->success('文件存储配置成功!');
+                $this->success('阿里云OSS存储动态配置成功!');
+            } catch (HttpResponseException $exception) {
+                throw $exception;
+            } catch (\Exception $e) {
+                $this->error("阿里云OSS存储配置失效,{$e->getMessage()}");
             }
+        } else {
+            $this->success('系统参数配置成功!');
         }
     }
 
-}
+}

+ 56 - 58
application/admin/controller/Index.php

@@ -1,27 +1,29 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\controller;
 
-use app\admin\service\AuthService;
+use app\admin\service\NodeService;
 use library\Controller;
 use library\tools\Data;
 use think\Console;
 use think\Db;
+use think\exception\HttpResponseException;
 
 /**
- * 后台入口管理
+ * 系统公共操作
  * Class Index
  * @package app\admin\controller
  */
@@ -38,8 +40,9 @@ class Index extends Controller
     public function index()
     {
         $this->title = '系统管理后台';
-        $this->menus = AuthService::getAuthMenu();
-        if (empty($this->menus) && !session('user.id')) {
+        NodeService::applyUserAuth(true);
+        $this->menus = NodeService::getMenuNodeTree();
+        if (empty($this->menus) && !NodeService::islogin()) {
             $this->redirect('@admin/login');
         } else {
             $this->fetch();
@@ -48,7 +51,6 @@ class Index extends Controller
 
     /**
      * 后台环境信息
-     * @return mixed
      */
     public function main()
     {
@@ -58,52 +60,6 @@ class Index extends Controller
     }
 
     /**
-     * 清理系统运行缓存
-     */
-    public function clearRuntime()
-    {
-        if (!AuthService::isLogin()) {
-            $this->error('需要登录才能操作哦!');
-        }
-        $this->list = [
-            [
-                'title'   => 'Clean up running cached files',
-                'message' => nl2br(Console::call('clear')->fetch()),
-            ], [
-                'title'   => 'Clean up invalid session files',
-                'message' => nl2br(Console::call('xclean:session')->fetch()),
-            ],
-        ];
-        $this->fetch('admin@index/command');
-    }
-
-    /**
-     * 压缩发布系统
-     */
-    public function buildOptimize()
-    {
-        if (!AuthService::isLogin()) {
-            $this->error('需要登录才能操作哦!');
-        }
-        $this->list = [
-            [
-                'title'   => 'Build route cache',
-                'message' => nl2br(Console::call('optimize:route')->fetch()),
-            ], [
-                'title'   => 'Build database schema cache',
-                'message' => nl2br(Console::call('optimize:schema')->fetch()),
-            ], [
-                'title'   => 'Optimizes PSR0 and PSR4 packages',
-                'message' => nl2br(Console::call('optimize:autoload')->fetch()),
-            ], [
-                'title'   => 'Build config and common file cache',
-                'message' => nl2br(Console::call('optimize:config')->fetch()),
-            ],
-        ];
-        $this->fetch('admin@index/command');
-    }
-
-    /**
      * 修改密码
      * @param integer $id
      * @throws \think\Exception
@@ -115,9 +71,12 @@ class Index extends Controller
     public function pass($id)
     {
         $this->applyCsrfToken();
-        if (intval($id) !== intval(session('user.id'))) {
+        if (intval($id) !== intval(session('admin_user.id'))) {
             $this->error('只能修改当前用户的密码!');
         }
+        if (!NodeService::islogin()) {
+            $this->error('需要登录才能操作哦!');
+        }
         if ($this->request->isGet()) {
             $this->verify = true;
             $this->_form('SystemUser', 'admin@user/pass', 'id', [], ['id' => $id]);
@@ -141,7 +100,7 @@ class Index extends Controller
             if (md5($data['oldpassword']) !== $user['password']) {
                 $this->error('旧密码验证失败,请重新输入!');
             }
-            $result = AuthService::checkPassword($data['password']);
+            $result = NodeService::checkpwd($data['password']);
             if (empty($result['code'])) $this->error($result['msg']);
             if (Data::save('SystemUser', ['id' => $user['id'], 'password' => md5($data['password'])])) {
                 $this->success('密码修改成功,下次请使用新密码登录!', '');
@@ -157,12 +116,51 @@ class Index extends Controller
      */
     public function info($id = 0)
     {
+        if (!NodeService::islogin()) {
+            $this->error('需要登录才能操作哦!');
+        }
         $this->applyCsrfToken();
-        if (intval($id) === intval(session('user.id'))) {
+        if (intval($id) === intval(session('admin_user.id'))) {
             $this->_form('SystemUser', 'admin@user/form', 'id', [], ['id' => $id]);
         } else {
             $this->error('只能修改登录用户的资料!');
         }
     }
 
-}
+    /**
+     * 清理运行缓存
+     * @auth true
+     */
+    public function clearRuntime()
+    {
+        try {
+            Console::call('clear');
+            Console::call('xclean:session');
+            $this->success('清理运行缓存成功!');
+        } catch (HttpResponseException $exception) {
+            throw $exception;
+        } catch (\Exception $e) {
+            $this->error("清理运行缓存失败,{$e->getMessage()}");
+        }
+    }
+
+    /**
+     * 压缩发布系统
+     * @auth true
+     */
+    public function buildOptimize()
+    {
+        try {
+            Console::call('optimize:route');
+            Console::call('optimize:schema');
+            Console::call('optimize:autoload');
+            Console::call('optimize:config');
+            $this->success('压缩发布成功!');
+        } catch (HttpResponseException $exception) {
+            throw $exception;
+        } catch (\Exception $e) {
+            $this->error("压缩发布失败,{$e->getMessage()}");
+        }
+    }
+
+}

+ 67 - 77
application/admin/controller/Login.php

@@ -1,20 +1,21 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\controller;
 
-use app\admin\service\AuthService;
+use app\admin\service\NodeService;
 use library\Controller;
 use think\Db;
 
@@ -28,89 +29,78 @@ class Login extends Controller
 
     /**
      * 后台登录入口
-     */
-    public function index()
-    {
-        $this->title = '系统登录';
-    }
-
-    /**
-     * 后台登录页面显示
-     */
-    protected function _index_get()
-    {
-        if (AuthService::isLogin()) {
-            $this->redirect('@admin');
-        } else {
-            $this->loginskey = session('loginskey');
-            if (empty($this->loginskey)) {
-                $this->loginskey = uniqid();
-                session('loginskey', $this->loginskey);
-            }
-            $this->fetch();
-        }
-    }
-
-    /**
-     * 后台登录数据处理
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      * @throws \think\exception\PDOException
      */
-    protected function _index_post()
+    public function index()
     {
-        $data = $this->_input([
-            'username' => $this->request->post('username'),
-            'password' => $this->request->post('password'),
-        ], [
-            'username' => 'require|min:4',
-            'password' => 'require|min:4',
-        ], [
-            'username.require' => '登录账号不能为空!',
-            'password.require' => '登录密码不能为空!',
-            'username.min'     => '登录账号长度不能少于4位有效字符!',
-            'password.min'     => '登录密码长度不能少于4位有效字符!',
-        ]);
-        // 用户信息验证
-        $map = ['is_deleted' => '0', 'username' => $data['username']];
-        $user = Db::name('SystemUser')->where($map)->order('id desc')->find();
-        if (empty($user)) $this->error('登录账号或密码错误,请重新输入!');
-        if (empty($user['status'])) $this->error('账号已经被禁用,请联系管理员!');
-        // 账号锁定消息
-        $cache = cache("user_login_{$user['username']}");
-        if (is_array($cache) && !empty($cache['number']) && !empty($cache['time'])) {
-            if ($cache['number'] >= 10 && ($diff = $cache['time'] + 3600 - time()) > 0) {
-                list($m, $s, $info) = [floor($diff / 60), floor($diff % 60), ''];
-                if ($m > 0) $info = "{$m} 分";
-                $this->error("<strong class='color-red'>抱歉,该账号已经被锁定!</strong><p class='nowrap'>连续 10 次登录错误,请 {$info} {$s} 秒后再登录!</p>");
+        $this->title = '系统登录';
+        if ($this->request->isGet()) {
+            if (NodeService::islogin()) {
+                $this->redirect('@admin');
+            } else {
+                $this->loginskey = session('loginskey');
+                if (empty($this->loginskey)) {
+                    $this->loginskey = uniqid();
+                    session('loginskey', $this->loginskey);
+                }
+                $this->fetch();
             }
-        }
-        if (md5($user['password'] . session('loginskey')) !== $data['password']) {
-            if (empty($cache) || empty($cache['time']) || empty($cache['number']) || $cache['time'] + 3600 < time()) {
-                $cache = ['time' => time(), 'number' => 1, 'geoip' => $this->request->ip()];
-            } elseif ($cache['number'] + 1 <= 10) {
-                $cache = ['time' => time(), 'number' => $cache['number'] + 1, 'geoip' => $this->request->ip()];
+        } else {
+            $data = $this->_input([
+                'username' => $this->request->post('username'),
+                'password' => $this->request->post('password'),
+            ], [
+                'username' => 'require|min:4',
+                'password' => 'require|min:4',
+            ], [
+                'username.require' => '登录账号不能为空!',
+                'password.require' => '登录密码不能为空!',
+                'username.min'     => '登录账号长度不能少于4位有效字符!',
+                'password.min'     => '登录密码长度不能少于4位有效字符!',
+            ]);
+            // 用户信息验证
+            $map = ['is_deleted' => '0', 'username' => $data['username']];
+            $user = Db::name('SystemUser')->where($map)->order('id desc')->find();
+            if (empty($user)) $this->error('登录账号或密码错误,请重新输入!');
+            if (empty($user['status'])) $this->error('账号已经被禁用,请联系管理员!');
+            // 账号锁定消息
+            $cache = cache("user_login_{$user['username']}");
+            if (is_array($cache) && !empty($cache['number']) && !empty($cache['time'])) {
+                if ($cache['number'] >= 10 && ($diff = $cache['time'] + 3600 - time()) > 0) {
+                    list($m, $s, $info) = [floor($diff / 60), floor($diff % 60), ''];
+                    if ($m > 0) $info = "{$m} 分";
+                    $this->error("<strong class='color-red'>抱歉,该账号已经被锁定!</strong><p class='nowrap'>连续 10 次登录错误,请 {$info} {$s} 秒后再登录!</p>");
+                }
             }
-            cache("user_login_{$user['username']}", $cache);
-            if (($diff = 10 - $cache['number']) > 0) {
-                $this->error("<strong class='color-red'>登录账号或密码错误!</strong><p class='nowrap'>还有 {$diff} 次尝试机会,将锁定一小时内禁止登录!</p>");
-            } else {
-                _syslog('系统管理', "账号{$user['username']}连续10次登录密码错误,请注意账号安全!");
-                $this->error("<strong class='color-red'>登录账号或密码错误!</strong><p class='nowrap'>尝试次数达到上限,锁定一小时内禁止登录!</p>");
+            if (md5($user['password'] . session('loginskey')) !== $data['password']) {
+                if (empty($cache) || empty($cache['time']) || empty($cache['number']) || $cache['time'] + 3600 < time()) {
+                    $cache = ['time' => time(), 'number' => 1, 'geoip' => $this->request->ip()];
+                } elseif ($cache['number'] + 1 <= 10) {
+                    $cache = ['time' => time(), 'number' => $cache['number'] + 1, 'geoip' => $this->request->ip()];
+                }
+                cache("user_login_{$user['username']}", $cache);
+                if (($diff = 10 - $cache['number']) > 0) {
+                    $this->error("<strong class='color-red'>登录账号或密码错误!</strong><p class='nowrap'>还有 {$diff} 次尝试机会,将锁定一小时内禁止登录!</p>");
+                } else {
+                    sysoplog('系统管理', "账号{$user['username']}连续10次登录密码错误,请注意账号安全!");
+                    $this->error("<strong class='color-red'>登录账号或密码错误!</strong><p class='nowrap'>尝试次数达到上限,锁定一小时内禁止登录!</p>");
+                }
             }
+            // 登录成功并更新账号
+            cache("user_login_{$user['username']}", null);
+            Db::name('SystemUser')->where(['id' => $user['id']])->update([
+                'login_at' => Db::raw('now()'), 'login_ip' => $this->request->ip(), 'login_num' => Db::raw('login_num+1'),
+            ]);
+            session('loginskey', null);
+            session('admin_user', $user);
+            NodeService::applyUserAuth();
+            sysoplog('系统管理', '用户登录系统成功');
+            $this->success('登录成功,正在进入系统...', url('@admin'));
         }
-        // 登录成功并更新账号
-        cache("user_login_{$user['username']}", null);
-        Db::name('SystemUser')->where(['id' => $user['id']])->update([
-            'login_at' => Db::raw('now()'), 'login_ip' => $this->request->ip(), 'login_num' => Db::raw('login_num+1'),
-        ]);
-        session('user', $user);
-        session('loginskey', null);
-        _syslog('系统管理', '用户登录系统成功');
-        empty($user['authorize']) || AuthService::applyNode();
-        $this->success('登录成功,正在进入系统...', url('@admin'));
     }
 
     /**
@@ -123,4 +113,4 @@ class Login extends Controller
         $this->success('退出登录成功!', url('@admin/login'));
     }
 
-}
+}

+ 25 - 18
application/admin/controller/Menu.php

@@ -1,19 +1,21 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\controller;
 
+use app\admin\service\NodeService;
 use library\Controller;
 use library\tools\Data;
 use think\Db;
@@ -34,6 +36,8 @@ class Menu extends Controller
 
     /**
      * 系统菜单管理
+     * @auth true
+     * @menu true
      */
     public function index()
     {
@@ -58,6 +62,7 @@ class Menu extends Controller
 
     /**
      * 添加系统菜单
+     * @auth true
      */
     public function add()
     {
@@ -67,6 +72,7 @@ class Menu extends Controller
 
     /**
      * 编辑系统菜单
+     * @auth true
      */
     public function edit()
     {
@@ -85,27 +91,26 @@ class Menu extends Controller
     protected function _form_filter(&$vo)
     {
         if ($this->request->isGet()) {
-            // 上级菜单处理
-            $_menus = Db::name($this->table)->where(['status' => '1'])->order('sort asc,id asc')->select();
-            $_menus[] = ['title' => '顶级菜单', 'id' => '0', 'pid' => '-1'];
-            $menus = Data::arr2table($_menus);
-            foreach ($menus as $key => &$menu) if (substr_count($menu['path'], '-') > 3) unset($menus[$key]); # 移除三级以下的菜单
-            elseif (isset($vo['pid']) && $vo['pid'] !== '' && $cur = "-{$vo['pid']}-{$vo['id']}")
-                if (stripos("{$menu['path']}-", "{$cur}-") !== false || $menu['path'] === $cur) unset($menus[$key]); # 移除与自己相关联的菜单
+            $menus = Db::name($this->table)->where(['status' => '1'])->order('sort desc,id asc')->select();
+            $menus[] = ['title' => '顶级菜单', 'id' => '0', 'pid' => '-1'];
+            foreach ($this->menus = Data::arr2table($menus) as $key => &$menu) {
+                if (substr_count($menu['path'], '-') > 3) unset($this->menus[$key]); # 移除三级以下的菜单
+                elseif (isset($vo['pid']) && $vo['pid'] !== '' && $cur = "-{$vo['pid']}-{$vo['id']}") {
+                    if (stripos("{$menu['path']}-", "{$cur}-") !== false || $menu['path'] === $cur) unset($this->menus[$key]); # 移除与自己相关联的菜单
+                }
+            }
             // 选择自己的上级菜单
-            if (!isset($vo['pid']) && $this->request->get('pid', '0')) $vo['pid'] = $this->request->get('pid', '0');
-            // 读取系统功能节点
-            $nodes = \app\admin\service\AuthService::get();
-            foreach ($nodes as $key => $node) {
-                if (empty($node['is_menu'])) unset($nodes[$key]);
-                unset($nodes[$key]['pnode'], $nodes[$key]['is_login'], $nodes[$key]['is_menu'], $nodes[$key]['is_auth']);
+            if (empty($vo['pid']) && $this->request->get('pid', '0')) {
+                $vo['pid'] = $this->request->get('pid', '0');
             }
-            list($this->menus, $this->nodes) = [$menus, array_values($nodes)];
+            // 读取系统功能节点
+            $this->nodes = NodeService::getMenuNodeList();
         }
     }
 
     /**
      * 启用系统菜单
+     * @auth true
      */
     public function resume()
     {
@@ -115,6 +120,7 @@ class Menu extends Controller
 
     /**
      * 禁用系统菜单
+     * @auth true
      */
     public function forbid()
     {
@@ -124,6 +130,7 @@ class Menu extends Controller
 
     /**
      * 删除系统菜单
+     * @auth true
      */
     public function remove()
     {
@@ -131,4 +138,4 @@ class Menu extends Controller
         $this->_delete($this->table);
     }
 
-}
+}

+ 0 - 93
application/admin/controller/Message.php

@@ -1,93 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------
-// | framework
-// +----------------------------------------------------------------------
-// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
-// +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
-// +----------------------------------------------------------------------
-// | 开源协议 ( https://mit-license.org )
-// +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
-// +----------------------------------------------------------------------
-
-namespace app\admin\controller;
-
-use library\Controller;
-use think\Db;
-
-/**
- * 系统消息管理
- * Class Message
- * @package app\admin\controller
- */
-class Message extends Controller
-{
-    /**
-     * 指定数据表
-     * @var string
-     */
-    protected $table = 'SystemMessage';
-
-    /**
-     * 系统消息管理
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function index()
-    {
-        $this->title = '系统消息管理';
-        $query = $this->_query($this->table)->like('title,desc')->equal('read_state');
-        $query->dateBetween('create_at,read_at')->order('id desc')->page();
-    }
-
-    /**
-     * 设置消息状态
-     */
-    public function read()
-    {
-        $this->_save($this->table, ['read_state' => '1', 'read_at' => date('Y-m-d H:i:s')]);
-    }
-
-    /**
-     * 清理所有消息
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function clear()
-    {
-        if (Db::name($this->table)->whereRaw('1=1')->delete() !== false) {
-            $this->success('系统消息清理成功!');
-        } else {
-            $this->error('系统消息清理失败,请稍候再试!');
-        }
-    }
-
-    /**
-     * 设置消息开关
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function state()
-    {
-        sysconf('system_message_state', sysconf('system_message_state') ? 0 : 1);
-        if (sysconf('system_message_state')) {
-            $this->success('系统消息提示开启成功!');
-        } else {
-            $this->success('系统消息提示关闭成功!');
-        }
-    }
-
-    /**
-     * 删除系统消息
-     */
-    public function remove()
-    {
-        $this->_delete($this->table);
-    }
-
-}

+ 0 - 88
application/admin/controller/Node.php

@@ -1,88 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------
-// | framework
-// +----------------------------------------------------------------------
-// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
-// +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
-// +----------------------------------------------------------------------
-// | 开源协议 ( https://mit-license.org )
-// +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
-// +----------------------------------------------------------------------
-
-namespace app\admin\controller;
-
-use library\Controller;
-use library\tools\Data;
-use think\Db;
-
-/**
- * 系统节点管理
- * Class Node
- * @package app\admin\controller
- */
-class Node extends Controller
-{
-    /**
-     * 指定当前数据表
-     * @var string
-     */
-    protected $table = 'SystemNode';
-
-    /**
-     * 系统节点管理
-     * @throws \ReflectionException
-     */
-    public function index()
-    {
-        $this->title = '系统节点管理';
-        list($nodes, $groups) = [\app\admin\service\AuthService::get(), []];
-        $this->nodes = Data::arr2table($nodes, 'node', 'pnode');
-        foreach ($this->nodes as $node) {
-            $pnode = explode('/', $node['node'])[0];
-            if ($node['node'] === $pnode) $groups[$pnode]['node'] = $node;
-            $groups[$pnode]['list'][] = $node;
-        }
-        $this->groups = $groups;
-        $this->fetch();
-    }
-
-    /**
-     * 清理无效的节点
-     * @throws \ReflectionException
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function clear()
-    {
-        $nodes = array_unique(array_column(\app\admin\service\AuthService::get(), 'node'));
-        if (false !== Db::name($this->table)->whereNotIn('node', $nodes)->delete()) {
-            $this->success('清理无效的节点配置成功!', '');
-        } else {
-            $this->error('清理无效的节点配置,请稍候再试!');
-        }
-    }
-
-    /**
-     * 更新节点数据
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function save()
-    {
-        if ($this->request->isPost()) {
-            list($post, $data) = [$this->request->post(), []];
-            foreach ($post['list'] as $vo) if (!empty($vo['node'])) {
-                $data['node'] = $vo['node'];
-                $data[$vo['name']] = $vo['value'];
-            }
-            empty($data) || data_save($this->table, $data, 'node');
-            $this->success('节点配置保存成功!', '');
-        } else {
-            $this->error('访问异常,请重新进入...');
-        }
-    }
-
-}

+ 10 - 4
application/admin/controller/Oplog.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\controller;
@@ -33,6 +34,8 @@ class Oplog extends Controller
 
     /**
      * 系统操作日志
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -47,6 +50,7 @@ class Oplog extends Controller
 
     /**
      * 列表数据处理
+     * @auth true
      * @param array $data
      * @throws \Exception
      */
@@ -62,6 +66,7 @@ class Oplog extends Controller
 
     /**
      * 清理系统日志
+     * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
@@ -76,6 +81,7 @@ class Oplog extends Controller
 
     /**
      * 删除系统日志
+     * @auth true
      */
     public function remove()
     {
@@ -83,4 +89,4 @@ class Oplog extends Controller
         $this->_delete($this->table);
     }
 
-}
+}

+ 14 - 7
application/admin/controller/Queue.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\controller;
@@ -33,6 +34,8 @@ class Queue extends Controller
 
     /**
      * 系统消息任务
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -42,15 +45,18 @@ class Queue extends Controller
     public function index()
     {
         $this->title = '消息任务管理';
-        $this->cmd = 'php ' . env('root_path') . 'think xtask:start';
-        $this->message = Console::call('xtask:state')->fetch();
+        if (session('admin_user.username') === 'admin') {
+            $this->cmd = 'php ' . env('root_path') . 'think xtask:start';
+            $this->message = Console::call('xtask:state')->fetch();
+        }
         $this->uris = Db::name($this->table)->distinct(true)->column('uri');
         $query = $this->_query($this->table)->dateBetween('create_at,status_at');
         $query->equal('status,title,uri')->order('id desc')->page();
     }
 
     /**
-     * 重置失败的任务
+     * 重置失败任务
+     * @auth true
      */
     public function redo()
     {
@@ -70,6 +76,7 @@ class Queue extends Controller
 
     /**
      * 删除消息任务
+     * @auth true
      */
     public function remove()
     {
@@ -87,4 +94,4 @@ class Queue extends Controller
         }
     }
 
-}
+}

+ 22 - 26
application/admin/controller/User.php

@@ -1,19 +1,21 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\controller;
 
+use app\admin\service\NodeService;
 use library\Controller;
 use library\tools\Data;
 use think\Db;
@@ -22,8 +24,6 @@ use think\Db;
  * 系统用户管理
  * Class User
  * @package app\admin\controller
- * @author Anyon <zoujingli@qq.com>
- * @date 2017/02/15 18:12
  */
 class User extends Controller
 {
@@ -36,6 +36,8 @@ class User extends Controller
 
     /**
      * 系统用户管理
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -45,23 +47,13 @@ class User extends Controller
     public function index()
     {
         $this->title = '系统用户管理';
-        $query = $this->_query($this->table)->like('username,phone,mail')->dateBetween('login_at');
-        $query->equal('status')->where(['is_deleted' => '0'])->order('id desc')->page();
-    }
-
-    /**
-     * 用户授权管理
-     * @return mixed
-     */
-    public function auth()
-    {
-        $this->applyCsrfToken();
-        $this->_form($this->table, 'auth');
+        $query = $this->_query($this->table)->like('username,phone,mail')->equal('status');
+        $query->dateBetween('login_at')->where(['is_deleted' => '0'])->order('id desc')->page();
     }
 
     /**
      * 添加系统用户
-     * @return mixed
+     * @auth true
      */
     public function add()
     {
@@ -71,7 +63,7 @@ class User extends Controller
 
     /**
      * 编辑系统用户
-     * @return mixed
+     * @auth true
      */
     public function edit()
     {
@@ -81,7 +73,7 @@ class User extends Controller
 
     /**
      * 修改用户密码
-     * @return mixed
+     * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
@@ -96,10 +88,9 @@ class User extends Controller
             if ($post['password'] !== $post['repassword']) {
                 $this->error('两次输入的密码不一致!');
             }
-            $result = \app\admin\service\AuthService::checkPassword($post['password']);
+            $result = NodeService::checkpwd($post['password']);
             if (empty($result['code'])) $this->error($result['msg']);
-            $data = ['id' => $post['id'], 'password' => md5($post['password'])];
-            if (Data::save($this->table, $data, 'id')) {
+            if (Data::save($this->table, ['id' => $post['id'], 'password' => md5($post['password'])], 'id')) {
                 $this->success('密码修改成功,下次请使用新密码登录!', '');
             } else {
                 $this->error('密码修改失败,请稍候再试!');
@@ -117,19 +108,22 @@ class User extends Controller
     public function _form_filter(&$data)
     {
         if ($this->request->isPost()) {
+            NodeService::applyUserAuth();
             $data['authorize'] = (isset($data['authorize']) && is_array($data['authorize'])) ? join(',', $data['authorize']) : '';
-            if (isset($data['id'])) unset($data['username']);
-            elseif (Db::name($this->table)->where(['username' => $data['username']])->count() > 0) {
+            if (isset($data['id'])) {
+                unset($data['username']);
+            } elseif (Db::name($this->table)->where(['username' => $data['username']])->count() > 0) {
                 $this->error('用户账号已经存在,请使用其它账号!');
             }
         } else {
             $data['authorize'] = explode(',', isset($data['authorize']) ? $data['authorize'] : '');
-            $this->assign('authorizes', Db::name('SystemAuth')->where(['status' => '1'])->select());
+            $this->authorizes = Db::name('SystemAuth')->where(['status' => '1'])->order('sort desc,id desc')->select();
         }
     }
 
     /**
      * 禁用系统用户
+     * @auth true
      */
     public function forbid()
     {
@@ -142,6 +136,7 @@ class User extends Controller
 
     /**
      * 启用系统用户
+     * @auth true
      */
     public function resume()
     {
@@ -151,6 +146,7 @@ class User extends Controller
 
     /**
      * 删除系统用户
+     * @auth true
      */
     public function remove()
     {

+ 0 - 64
application/admin/controller/api/Message.php

@@ -1,64 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------
-// | framework
-// +----------------------------------------------------------------------
-// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
-// +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
-// +----------------------------------------------------------------------
-// | 开源协议 ( https://mit-license.org )
-// +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
-// +----------------------------------------------------------------------
-
-namespace app\admin\controller\api;
-
-use library\Controller;
-
-/**
- * Class Message
- * @package app\admin\controller\api
- */
-class Message extends Controller
-{
-    /**
-     * Message constructor.
-     * @throws \think\Exception
-     */
-    public function __construct()
-    {
-        parent::__construct();
-        if (!\app\admin\service\AuthService::isLogin()) {
-            $this->error('访问授权失败,请重新登录授权再试!');
-        }
-    }
-
-    /**
-     * 获取系统消息列表
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function gets()
-    {
-        $list = \app\admin\service\MessageService::gets();
-        $this->success('获取系统消息成功!', $list);
-    }
-
-    /**
-     * 系统消息状态更新
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function set()
-    {
-        $code = $this->request->post('code');
-        if (\app\admin\service\MessageService::set($code)) {
-            $this->success('系统消息状态更新成功!');
-        } else {
-            $this->error('系统消息状态更新失败,请稍候再试!');
-        }
-    }
-
-}

+ 6 - 93
application/admin/controller/api/Plugs.php

@@ -14,6 +14,7 @@
 
 namespace app\admin\controller\api;
 
+use app\admin\service\NodeService;
 use library\Controller;
 use library\File;
 
@@ -27,104 +28,16 @@ class Plugs extends Controller
 
     /**
      * Plugs constructor.
-     * @throws \think\Exception
      */
     public function __construct()
     {
         parent::__construct();
-        if (!\app\admin\service\AuthService::isLogin()) {
+        if (!NodeService::islogin()) {
             $this->error('访问授权失败,请重新登录授权再试!');
         }
     }
 
     /**
-     * 文件状态检查
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function upstate()
-    {
-        $ext = strtolower(pathinfo($this->request->post('filename', ''), PATHINFO_EXTENSION));
-        $name = File::name($this->request->post('md5'), $ext, '', 'strtolower');
-        // 检查文件是否已上传
-        $this->safe = $this->getUploadSafe();
-        if (is_string($siteUrl = File::url($name))) {
-            $this->success('检测到该文件已经存在,无需再次上传!', [
-                'site_url' => $this->safe ? $name : $siteUrl,
-            ]);
-        }
-        // 文件驱动
-        $file = File::instance($this->getUploadType());
-        // 生成上传授权参数
-        $param = [
-            'file_url' => $name, 'uptype' => $this->uptype, 'token' => md5($name . session_id()),
-            'site_url' => $file->base($name), 'server' => $file->upload(), 'safe' => $this->safe,
-        ];
-        if (strtolower($this->uptype) === 'qiniu') {
-            $auth = new \Qiniu\Auth(sysconf('storage_qiniu_access_key'), sysconf('storage_qiniu_secret_key'));
-            $param['token'] = $auth->uploadToken(sysconf('storage_qiniu_bucket'), $name, 3600, [
-                'returnBody' => json_encode(['code' => 1, 'data' => ['site_url' => $file->base($name)]], JSON_UNESCAPED_UNICODE),
-            ]);
-        } elseif (strtolower($this->uptype) === 'oss') {
-            $param['OSSAccessKeyId'] = sysconf('storage_oss_keyid');
-            $param['policy'] = base64_encode(json_encode(['conditions' => [['content-length-range', 0, 1048576000]], 'expiration' => gmdate("Y-m-d\TH:i:s\Z", time() + 3600)]));
-            $param['signature'] = base64_encode(hash_hmac('sha1', $param['policy'], sysconf('storage_oss_secret'), true));
-        }
-        $this->error('未检测到文件,需要上传完整的文件!', $param);
-    }
-
-    /**
-     * 文件上传
-     * @return mixed
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function upfile()
-    {
-        $this->safe = $this->getUploadSafe();
-        $this->uptype = $this->getUploadType();
-        $this->mode = $this->request->get('mode', 'one');
-        $this->field = $this->request->get('field', 'file');
-        $this->types = $this->request->get('type', 'jpg,png');
-        $this->mimes = File::mine($this->types);
-        $this->fetch();
-    }
-
-    /**
-     * WebUpload 文件上传
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function upload()
-    {
-        // 文件接收
-        if (!($file = $this->getUploadFile()) || empty($file)) {
-            $this->error('文件上传异常,文件可能过大或未上传!');
-        }
-        if (!$file->checkExt(strtolower(sysconf('storage_local_exts')))) {
-            $this->error('文件上传类型受限,请在后台配置!');
-        }
-        if ($file->checkExt('php')) {
-            $this->error('可执行文件禁止上传到本地服务器!');
-        }
-        // 唯一名称
-        $ext = strtolower(pathinfo($file->getInfo('name'), PATHINFO_EXTENSION));
-        $name = File::name($this->request->post('md5'), $ext, '', 'strtolower');
-        // Token 验证
-        if ($this->request->post('token') !== md5($name . session_id())) {
-            $this->error('文件上传验证失败,请刷新页面重新上传!');
-        }
-        $this->safe = $this->getUploadSafe();
-        $pathinfo = pathinfo(File::instance('local')->path($name, $this->safe));
-        if ($file->move($pathinfo['dirname'], $pathinfo['basename'], true)) {
-            if (is_array($info = File::instance('local')->info($name, $this->safe)) && isset($info['url'])) {
-                $this->success('文件上传成功!', ['site_url' => $this->safe ? $name : $info['url']]);
-            }
-        }
-        $this->error('文件上传失败,请稍候再试!');
-    }
-
-    /**
      * Plupload 插件上传文件
      * @return \think\response\Json
      * @throws \think\Exception
@@ -143,13 +56,14 @@ class Plugs extends Controller
         }
         $this->safe = $this->getUploadSafe();
         $this->uptype = $this->getUploadType();
-        $this->ext = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
-        $name = File::name($file->getPathname(), $this->ext, '', 'md5_file');
+        $this->extend = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
+        $name = File::name($file->getPathname(), $this->extend, '', 'md5_file');
         $info = File::instance($this->uptype)->save($name, file_get_contents($file->getRealPath()), $this->safe);
         if (is_array($info) && isset($info['url'])) {
             return json(['uploaded' => true, 'filename' => $name, 'url' => $this->safe ? $name : $info['url']]);
+        } else {
+            return json(['uploaded' => false, 'error' => ['message' => '文件处理失败,请稍候再试!']]);
         }
-        return json(['uploaded' => false, 'error' => ['message' => '文件处理失败,请稍候再试!']]);
     }
 
     /**
@@ -191,7 +105,6 @@ class Plugs extends Controller
 
     /**
      * 系统选择器图标
-     * @return mixed
      */
     public function icon()
     {

+ 9 - 7
application/admin/queue/JobsQueue.php

@@ -1,24 +1,26 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\queue;
 
 use app\admin\service\QueueService;
+use think\console\Output;
 
 /**
  * 基础指令公共类
- * Class QueueBase
+ * Class JobsQueue
  * @package app\admin
  */
 class JobsQueue
@@ -68,7 +70,7 @@ class JobsQueue
     protected $status;
 
     /**
-     * @var \think\console\Output
+     * @var Output
      */
     protected $output;
 
@@ -88,7 +90,7 @@ class JobsQueue
     public function fire(\think\queue\Job $job, $data = [])
     {
         $this->data = $data;
-        $this->output = new \think\console\Output();
+        $this->output = new Output();
         $this->id = isset($data['_job_id_']) ? $data['_job_id_'] : '';
         $this->title = isset($data['_job_title_']) ? $data['_job_title_'] : '';
         $this->output->newLine();
@@ -119,4 +121,4 @@ class JobsQueue
         return true;
     }
 
-}
+}

+ 0 - 176
application/admin/service/AuthService.php

@@ -1,176 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------
-// | framework
-// +----------------------------------------------------------------------
-// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
-// +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
-// +----------------------------------------------------------------------
-// | 开源协议 ( https://mit-license.org )
-// +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
-// +----------------------------------------------------------------------
-
-namespace app\admin\service;
-
-use library\tools\Data;
-use library\tools\Node;
-use think\Db;
-
-/**
- * 权限访问及菜单管理
- * Class AuthService
- * @package app\admin\service
- */
-class AuthService
-{
-
-    /**
-     * 权限节点忽略规则
-     * @return array
-     */
-    public static function getIgnore()
-    {
-        return ['index', 'admin/login', 'admin/index'];
-    }
-
-    /**
-     * 获取系统代码节点
-     * @param array $nodes
-     * @return array
-     * @throws \ReflectionException
-     */
-    public static function get($nodes = [])
-    {
-        list($ignore, $map) = [self::getIgnore(), Node::getClassTreeNode(env('app_path'))];
-        $alias = Db::name('SystemNode')->column('node,is_menu,is_auth,is_login,title');
-        foreach (Node::getMethodTreeNode(env('app_path')) as $thr => $title) {
-            foreach ($ignore as $str) if (stripos($thr, $str) === 0) continue 2;
-            $tmp = explode('/', $thr);
-            list($one, $two) = ["{$tmp[0]}", "{$tmp[0]}/{$tmp[1]}"];
-            $nodes[$one] = array_merge(isset($alias[$one]) ? $alias[$one] : ['node' => $one, 'title' => '', 'is_menu' => 0, 'is_auth' => 0, 'is_login' => 0], ['pnode' => '']);
-            $nodes[$two] = array_merge(isset($alias[$two]) ? $alias[$two] : ['node' => $two, 'title' => isset($map[$two]) ? $map[$two] : '', 'is_menu' => 0, 'is_auth' => 0, 'is_login' => 0], ['pnode' => $one]);
-            $nodes[$thr] = array_merge(isset($alias[$thr]) ? $alias[$thr] : ['node' => $thr, 'title' => $title, 'is_menu' => 0, 'is_auth' => 0, 'is_login' => 0], ['pnode' => $two]);
-        }
-        foreach ($nodes as &$node) list($node['is_auth'], $node['is_menu'], $node['is_login']) = [intval($node['is_auth']), intval($node['is_menu']), empty($node['is_auth']) ? intval($node['is_login']) : 1];
-        return $nodes;
-    }
-
-    /**
-     * 检查用户节点权限
-     * @param string $node 节点
-     * @return boolean
-     */
-    public static function checkAuthNode($node)
-    {
-        list($module, $controller, $action) = explode('/', str_replace(['?', '=', '&'], '/', "{$node}///"));
-        $current = Node::parseString("{$module}/{$controller}") . strtolower("/{$action}");
-        // 后台入口无需要验证权限
-        if (stripos($node, 'admin/index') === 0) return true;
-        // 超级管理员无需要验证权限
-        if (session('user.username') === 'admin') return true;
-        // 未配置权限的节点默认放行
-        if (!in_array($current, self::getAuthNode())) return true;
-        // 用户指定角色授权放行
-        return in_array($current, (array)session('user.nodes'));
-    }
-
-    /**
-     * 获取授权节点
-     * @return array
-     */
-    public static function getAuthNode()
-    {
-        $nodes = cache('need_access_node');
-        if (empty($nodes)) {
-            $nodes = Db::name('SystemNode')->where(['is_auth' => '1'])->column('node');
-            cache('need_access_node', $nodes);
-        }
-        return $nodes;
-    }
-
-    /**
-     * 应用用户权限节点
-     * @return boolean
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function applyNode()
-    {
-        cache('need_access_node', null);
-        if (($uid = session('user.id'))) session('user', Db::name('SystemUser')->where('id', $uid)->find());
-        if (session('user.authorize') && ($ids = explode(',', session('user.authorize')))) {
-            $auths = Db::name('SystemAuth')->whereIn('id', $ids)->where('status', '1')->column('id');
-            if (empty($auths)) return session('user.nodes', []);
-            return session('user.nodes', Db::name('SystemAuthNode')->whereIn('auth', $auths)->column('node'));
-        }
-        return false;
-    }
-
-    /**
-     * 判断用户登录状态
-     * @return boolean
-     */
-    public static function isLogin()
-    {
-        return !!session('user');
-    }
-
-    /**
-     * 获取授权后的菜单
-     * @return array
-     * @throws \ReflectionException
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function getAuthMenu()
-    {
-        self::applyNode();
-        $list = Db::name('SystemMenu')->where('status', '1')->order('sort asc,id asc')->select();
-        return self::buildMenuData(Data::arr2tree($list), self::get(), self::isLogin());
-    }
-
-    /**
-     * 后台主菜单权限过滤
-     * @param array $menus 当前菜单列表
-     * @param array $nodes 系统权限节点数据
-     * @param bool $isLogin 是否已经登录
-     * @return array
-     */
-    private static function buildMenuData($menus, $nodes, $isLogin)
-    {
-        foreach ($menus as $key => &$menu) {
-            if (!empty($menu['sub'])) $menu['sub'] = self::buildMenuData($menu['sub'], $nodes, $isLogin);
-            if (!empty($menu['sub'])) $menu['url'] = '#';
-            elseif (preg_match('/^https?\:/i', $menu['url'])) continue;
-            elseif ($menu['url'] !== '#') {
-                $node = join('/', array_slice(explode('/', preg_replace('/[\W]/', '/', $menu['url'])), 0, 3));
-                $menu['url'] = url($menu['url']) . (empty($menu['params']) ? '' : "?{$menu['params']}");
-                if (isset($nodes[$node]) && $nodes[$node]['is_login'] && empty($isLogin)) unset($menus[$key]);
-                elseif (isset($nodes[$node]) && $nodes[$node]['is_auth'] && $isLogin && !self::checkAuthNode($node)) unset($menus[$key]);
-            } else unset($menus[$key]);
-        }
-        return $menus;
-    }
-
-    /**
-     * 检查密码是否合法
-     * @param string $password
-     * @return array
-     */
-    public static function checkPassword($password)
-    {
-        $password = trim($password);
-        if (!strlen($password) >= 6) {
-            return ['code' => 0, 'msg' => '密码必须大于6字符!'];
-        }
-        if (!preg_match("/^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,32}$/", $password)) {
-            return ['code' => 0, 'msg' => '密码必需包含大小写字母、数字、符号任意两者组合!'];
-        }
-        return ['code' => 1, 'msg' => '密码复杂度通过验证!'];
-    }
-
-}

+ 0 - 72
application/admin/service/MessageService.php

@@ -1,72 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------
-// | framework
-// +----------------------------------------------------------------------
-// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
-// +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
-// +----------------------------------------------------------------------
-// | 开源协议 ( https://mit-license.org )
-// +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
-// +----------------------------------------------------------------------
-
-namespace app\admin\service;
-
-use library\tools\Data;
-use think\Db;
-
-/**
- * 系统消息管理
- * Class MessageService
- * @package app\admin\service
- */
-class MessageService
-{
-    /**
-     * 增加系统消息
-     * @param string $title 消息标题
-     * @param string $desc 消息描述
-     * @param string $url 访问链接
-     * @param string $node 权限节点
-     * @return boolean
-     */
-    public static function add($title, $desc, $url, $node)
-    {
-        $code = Data::uniqidNumberCode(12);
-        $data = ['title' => $title, 'desc' => $desc, 'url' => $url, 'code' => $code, 'node' => $node];
-        return Db::name('SystemMessage')->insert($data) !== false;
-    }
-
-    /**
-     * 系统消息状态更新
-     * @param integer $code
-     * @return boolean
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public static function set($code)
-    {
-        $result = Db::name('SystemMessage')->where(['code' => $code, 'read_state' => '0'])->update([
-            'read_state' => '1', 'read_at' => date('Y-m-d H:i:s'), 'read_uid' => session('user.id'),
-        ]);
-        return $result !== false;
-    }
-
-    /**
-     * 获取消息列表成功
-     * @return array
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function gets()
-    {
-        $where = ['read_state' => '0'];
-        $list = Db::name('SystemMessage')->where($where)->order('id desc')->select();
-        foreach ($list as $key => $vo) if (!empty($vo['node']) && !auth($vo['node'])) unset($list[$key]);
-        return $list;
-    }
-
-}

+ 322 - 0
application/admin/service/NodeService.php

@@ -0,0 +1,322 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\admin\service;
+
+use library\tools\Data;
+use library\tools\Node;
+use think\Db;
+use think\facade\Cache;
+use think\facade\Request;
+
+/**
+ * 功能节点管理服务
+ * Class NodeService
+ * @package app\admin\service
+ */
+class NodeService
+{
+
+    /**
+     * 获取标准访问节点
+     * @param string $node
+     * @return string
+     */
+    public static function full($node = null)
+    {
+        if (empty($node)) return self::current();
+        if (count(explode('/', $node)) === 1) {
+            $node = Request::module() . '/' . Request::controller() . '/' . $node;
+        }
+        return self::parseString(trim($node, " /"));
+    }
+
+    /**
+     * 判断是否已经登录
+     * @return boolean
+     */
+    public static function islogin()
+    {
+        return session('admin_user.id') ? true : false;
+    }
+
+    /**
+     * 获取当前访问节点
+     * @return string
+     */
+    public static function current()
+    {
+        return self::parseString(Request::module() . '/' . Request::controller() . '/' . Request::action());
+    }
+
+    /**
+     * 检查密码是否合法
+     * @param string $password
+     * @return array
+     */
+    public static function checkpwd($password)
+    {
+        $password = trim($password);
+        if (!strlen($password) >= 6) {
+            return ['code' => 0, 'msg' => '密码必须大于6字符!'];
+        }
+        if (!preg_match("/^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,32}$/", $password)) {
+            return ['code' => 0, 'msg' => '密码必需包含大小写字母、数字、符号任意两者组合!'];
+        } else {
+            return ['code' => 1, 'msg' => '密码复杂度通过验证!'];
+        }
+    }
+
+    /**
+     * 获取可选菜单节点
+     * @return array
+     * @throws \ReflectionException
+     */
+    public static function getMenuNodeList()
+    {
+        static $nodes = [];
+        if (count($nodes) > 0) return $nodes;
+        foreach (self::getMethodList() as $node => $method) if ($method['menu']) {
+            $nodes[] = ['node' => $node, 'title' => $method['title']];
+        }
+        return $nodes;
+    }
+
+    /**
+     * 获取系统菜单树数据
+     * @return array
+     * @throws \ReflectionException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function getMenuNodeTree()
+    {
+        $list = Db::name('SystemMenu')->where(['status' => '1'])->order('sort desc,id asc')->select();
+        return self::buildMenuData(Data::arr2tree($list), self::getMethodList());
+    }
+
+    /**
+     * 后台主菜单权限过滤
+     * @param array $menus 当前菜单列表
+     * @param array $nodes 系统权限节点
+     * @return array
+     * @throws \ReflectionException
+     */
+    private static function buildMenuData($menus, $nodes)
+    {
+        foreach ($menus as $key => &$menu) {
+            if (!empty($menu['sub'])) $menu['sub'] = self::buildMenuData($menu['sub'], $nodes);
+            if (!empty($menu['sub'])) $menu['url'] = '#';
+            elseif (preg_match('/^https?\:/i', $menu['url'])) continue;
+            elseif ($menu['url'] === '#') unset($menus[$key]);
+            else {
+                $node = join('/', array_slice(explode('/', preg_replace('/[\W]/', '/', $menu['url'])), 0, 3));
+                $menu['url'] = url($menu['url']) . (empty($menu['params']) ? '' : "?{$menu['params']}");
+                if (!self::checkAuth($node)) unset($menus[$key]);
+            }
+        }
+        return $menus;
+    }
+
+    /**
+     * 获取授权节点列表
+     * @return array
+     * @throws \ReflectionException
+     */
+    public static function getAuthList()
+    {
+        static $nodes = [];
+        if (count($nodes) > 0) return $nodes;
+        $nodes = Cache::tag('system')->get('NodeAuthList', []);
+        if (count($nodes) > 0) return $nodes;
+        foreach (self::getMethodList() as $key => $node) {
+            if ($node['auth']) $nodes[$key] = $node['title'];
+        }
+        Cache::tag('system')->set('NodeAuthList', $nodes);
+        return $nodes;
+    }
+
+    /**
+     * 检查节点授权
+     * @param null|string $node
+     * @return boolean
+     * @throws \ReflectionException
+     */
+    public static function checkAuth($node = null)
+    {
+        if (session('admin_user.username') === 'admin') return true;
+        $real = is_null($node) ? self::current() : self::full($node);
+        if (isset(self::getAuthList()[$real])) {
+            return in_array($real, (array)session('admin_user.nodes'));
+        } else {
+            return true;
+        }
+    }
+
+    /**
+     * 获取授权节点列表
+     * @param array $checkeds
+     * @return array
+     * @throws \ReflectionException
+     */
+    public static function getAuthTree($checkeds = [])
+    {
+        static $nodes = [];
+        if (count($nodes) > 0) return $nodes;
+        foreach (self::getAuthList() as $node => $title) {
+            $pnode = substr($node, 0, strripos($node, '/'));
+            $nodes[$node] = ['node' => $node, 'title' => $title, 'pnode' => $pnode, 'checked' => in_array($node, $checkeds)];
+        }
+        foreach (self::getClassList() as $node => $title) foreach (array_keys($nodes) as $key) {
+            if (stripos($key, "{$node}/") !== false) {
+                $pnode = substr($node, 0, strripos($node, '/'));
+                $nodes[$node] = ['node' => $node, 'title' => $title, 'pnode' => $pnode, 'checked' => in_array($node, $checkeds)];
+                $nodes[$pnode] = ['node' => $pnode, 'title' => ucfirst($pnode), 'checked' => in_array($pnode, $checkeds)];
+            }
+        }
+        return $nodes = Data::arr2tree($nodes, 'node', 'pnode', '_sub_');
+    }
+
+    /**
+     * 初始化用户权限
+     * @param boolean $force 是否重置系统权限
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function applyUserAuth($force = false)
+    {
+        if ($force) {
+            Cache::tag('system')->rm('NodeAuthList');
+            Cache::tag('system')->rm('NodeClassData');
+            Cache::tag('system')->rm('NodeMethodData');
+        }
+        if (($uid = session('admin_user.id'))) {
+            session('admin_user', Db::name('SystemUser')->where(['id' => $uid])->find());
+        }
+        $authorize = session('admin_user.authorize');
+        if (!empty($authorize) && $authids = explode(',', $authorize)) {
+            $auths = Db::name('SystemAuth')->where(['status' => '1'])->whereIn('id', $authids)->column('id');
+            if (empty($auths)) {
+                session('admin_user.nodes', []);
+            } else {
+                session('admin_user.nodes', array_unique(Db::name('SystemAuthNode')->whereIn('auth', $auths)->column('node')));
+            }
+        } else {
+            session('admin_user.nodes', []);
+        }
+    }
+
+    /**
+     * 获取控制器节点列表
+     * @return array
+     * @throws \ReflectionException
+     */
+    public static function getClassList()
+    {
+        static $nodes = [];
+        if (count($nodes) > 0) return $nodes;
+        $nodes = Cache::tag('system')->get('NodeClassData', []);
+        if (count($nodes) > 0) return $nodes;
+        self::eachController(function (\ReflectionClass $reflection, $prenode) use (&$nodes) {
+            list($node, $comment) = [trim($prenode, ' / '), $reflection->getDocComment()];
+            $nodes[$node] = preg_replace('/^\/\*\*\*(.*?)\*.*?$/', '$1', preg_replace("/\s/", '', $comment));
+            if (stripos($nodes[$node], '@') !== false) $nodes[$node] = '';
+        });
+        Cache::tag('system')->set('NodeClassData', $nodes);
+        return $nodes;
+    }
+
+    /**
+     * 获取方法节点列表
+     * @return array
+     * @throws \ReflectionException
+     */
+    public static function getMethodList()
+    {
+        static $nodes = [];
+        if (count($nodes) > 0) return $nodes;
+        $nodes = Cache::tag('system')->get('NodeMethodData', []);
+        if (count($nodes) > 0) return $nodes;
+        self::eachController(function (\ReflectionClass $reflection, $prenode) use (&$nodes) {
+            foreach ($reflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
+                $action = strtolower($method->getName());
+                list($node, $comment) = ["{$prenode}{$action}", preg_replace("/\s/", '', $method->getDocComment())];
+                $nodes[$node] = [
+                    'auth'  => stripos($comment, '@authtrue') !== false,
+                    'menu'  => stripos($comment, '@menutrue') !== false,
+                    'title' => preg_replace('/^\/\*\*\*(.*?)\*.*?$/', '$1', $comment),
+                ];
+                if (stripos($nodes[$node]['title'], '@') !== false) $nodes[$node]['title'] = '';
+            }
+        });
+        Cache::tag('system')->set('NodeMethodData', $nodes);
+        return $nodes;
+    }
+
+    /**
+     * 控制器扫描回调
+     * @param callable $callable
+     * @throws \ReflectionException
+     */
+    public static function eachController($callable)
+    {
+        foreach (self::scanPath(env('app_path') . "*/controller/") as $file) {
+            if (!preg_match("|/(\w+)/controller/(.+)\.php$|", $file, $matches)) continue;
+            list($module, $controller) = [$matches[1], strtr($matches[2], '/', '.')];
+            if (class_exists($class = substr(strtr(env('app_namespace') . $matches[0], '/', '\\'), 0, -4))) {
+                call_user_func($callable, new \ReflectionClass($class), Node::parseString("{$module}/{$controller}/"));
+            }
+        }
+    }
+
+    /**
+     * 驼峰转下划线规则
+     * @param string $node 节点名称
+     * @return string
+     */
+    public static function parseString($node)
+    {
+        if (count($nodes = explode('/', $node)) > 1) {
+            $dots = [];
+            foreach (explode('.', $nodes[1]) as $dot) {
+                $dots[] = trim(preg_replace("/[A-Z]/", "_\\0", $dot), "_");
+            }
+            $nodes[1] = join('.', $dots);
+        }
+        return strtolower(join('/', $nodes));
+    }
+
+    /**
+     * 获取所有PHP文件
+     * @param string $dirname 扫描目录
+     * @param array $data 额外数据
+     * @param string $ext 有文件后缀
+     * @return array
+     */
+    private static function scanPath($dirname, $data = [], $ext = 'php')
+    {
+        foreach (glob("{$dirname}*") as $file) {
+            if (is_dir($file)) {
+                $data = array_merge($data, self::scanPath("{$file}/"));
+            } elseif (is_file($file) && pathinfo($file, 4) === $ext) {
+                $data[] = str_replace('\\', '/', $file);
+            }
+        }
+        return $data;
+    }
+
+}

+ 10 - 12
application/admin/service/OplogService.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\service;
@@ -32,18 +33,15 @@ class OplogService
      */
     public static function write($action = '行为', $content = "内容描述")
     {
-        $data = [
-            'node'     => Node::current(),
+        return Db::name('SystemLog')->insert([
+            'node'     => Node::current(), 'action' => $action, 'content' => $content,
             'geoip'    => PHP_SAPI === 'cli' ? '127.0.0.1' : request()->ip(),
-            'action'   => $action,
-            'content'  => $content,
-            'username' => PHP_SAPI === 'cli' ? 'cli' : (string)session('user.username'),
-        ];
-        return Db::name('SystemLog')->insert($data) !== false;
+            'username' => PHP_SAPI === 'cli' ? 'cli' : (string)session('admin_user.username'),
+        ]);
     }
 
     /**
-     * 清理系统日志数据
+     * 清理系统日志
      * @return boolean
      * @throws \think\Exception
      * @throws \think\exception\PDOException
@@ -52,4 +50,4 @@ class OplogService
     {
         return Db::name('SystemLog')->where('1=1')->delete() !== false;
     }
-}
+}

+ 7 - 5
application/admin/service/QueueService.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\admin\service;
@@ -121,8 +122,9 @@ class QueueService
         if (Db::name('SystemJobsLog')->where($where)->delete() > 0) {
             Db::name('SystemJobs')->whereLike('payload', '%"_job_id_":"' . $jobId . '"%')->delete();
             return true;
+        } else {
+            return false;
         }
-        return false;
     }
 
-}
+}

+ 29 - 45
application/admin/sys.php

@@ -1,27 +1,35 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
+use app\admin\service\NodeService;
+use app\admin\service\OplogService;
+use library\File;
+use think\Db;
+use think\facade\Middleware;
+use think\Request;
+
 if (!function_exists('auth')) {
     /**
      * 节点访问权限检查
      * @param string $node
      * @return boolean
+     * @throws ReflectionException
      */
     function auth($node)
     {
-        $real = \library\tools\Node::get($node);
-        return \app\admin\service\AuthService::checkAuthNode($real);
+        return NodeService::checkAuth($node);
     }
 }
 
@@ -37,7 +45,7 @@ if (!function_exists('sysdata')) {
     function sysdata($name, array $value = null)
     {
         if (is_null($value)) {
-            $data = json_decode(\think\Db::name('SystemData')->where(['name' => $name])->value('value'), true);
+            $data = json_decode(Db::name('SystemData')->where(['name' => $name])->value('value'), true);
             return empty($data) ? [] : $data;
         } else {
             return data_save('SystemData', ['name' => $name, 'value' => json_encode($value, JSON_UNESCAPED_UNICODE)], 'name');
@@ -45,31 +53,16 @@ if (!function_exists('sysdata')) {
     }
 }
 
-if (!function_exists('_sysmsg')) {
-    /**
-     * 增加系统消息
-     * @param string $title 消息标题
-     * @param string $desc 消息描述
-     * @param string $url 访问链接
-     * @param string $node 权限节点
-     * @return boolean
-     */
-    function _sysmsg($title, $desc, $url, $node)
-    {
-        return \app\admin\service\MessageService::add($title, $desc, $url, $node);
-    }
-}
-
-if (!function_exists('_syslog')) {
+if (!function_exists('sysoplog')) {
     /**
      * 写入系统日志
      * @param string $action 日志行为
      * @param string $content 日志内容
      * @return boolean
      */
-    function _syslog($action, $content)
+    function sysoplog($action, $content)
     {
-        return \app\admin\service\OplogService::write($action, $content);
+        return OplogService::write($action, $content);
     }
 }
 
@@ -81,7 +74,7 @@ if (!function_exists('local_image')) {
      */
     function local_image($url)
     {
-        $result = \library\File::down($url);
+        $result = File::down($url);
         if (isset($result['url'])) {
             return $result['url'];
         } else {
@@ -102,7 +95,7 @@ if (!function_exists('base64_image')) {
         try {
             if (preg_match('|^data:image/(.*?);base64,|i', $content)) {
                 list($ext, $base) = explode('|||', preg_replace('|^data:image/(.*?);base64,|i', '$1|||', $content));
-                $info = \library\File::save($predir . md5($base) . '.' . (empty($ext) ? 'tmp' : $ext), base64_decode($base));
+                $info = File::save($predir . md5($base) . '.' . (empty($ext) ? 'tmp' : $ext), base64_decode($base));
                 return $info['url'];
             } else {
                 return $content;
@@ -113,25 +106,16 @@ if (!function_exists('base64_image')) {
     }
 }
 
-// 系统权限检查中间键
-\think\facade\Middleware::add(function (\think\Request $request, \Closure $next) {
-    // 系统消息处理
-    if (($code = $request->get('messagecode')) > 0) \app\admin\service\MessageService::set($code);
-    // 节点忽略跳过
-    $node = \library\tools\Node::current();
-    foreach (\app\admin\service\AuthService::getIgnore() as $str) if (stripos($node, $str) === 0) return $next($request);
-    // 节点权限查询
-    $auth = \think\Db::name('SystemNode')->cache(true, 60)->field('is_auth,is_login')->where(['node' => $node])->find();
-    $info = ['is_auth' => $auth['is_auth'], 'is_login' => $auth['is_auth'] ? 1 : $auth['is_login']];
-    // 登录状态检查
-    if (!empty($info['is_login']) && !\app\admin\service\AuthService::isLogin()) {
-        $message = ['code' => 0, 'msg' => '抱歉,您还没有登录获取访问权限!', 'url' => url('@admin/login')];
-        return $request->isAjax() ? json($message) : redirect($message['url']);
-    }
+// 访问权限检查中间键
+Middleware::add(function (Request $request, \Closure $next) {
     // 访问权限检查
-    if (!empty($info['is_auth']) && !\app\admin\service\AuthService::checkAuthNode($node)) {
-        return json(['code' => 0, 'msg' => '抱歉,您没有访问该模块的权限!']);
-    } else {
+    if (NodeService::checkAuth()) {
         return $next($request);
+    } else {
+        if (NodeService::islogin()) {
+            return json(['code' => 0, 'msg' => '抱歉,没有访问该操作的权限!']);
+        } else {
+            return json(['code' => 0, 'msg' => '抱歉,您还没有登录获取访问权限!', 'url' => url('@admin/login')]);
+        }
     }
-});
+});

+ 2 - 2
application/admin/view/api/plugs/icon.html

@@ -3645,8 +3645,8 @@
 <script src="__ROOT__/static/plugs/jquery/jquery.min.js" type="text/javascript"></script>
 <script>
     $(function () {
-        $('li').on('click', function () {
-            var className = $(this).find('i').get(0).className;
+        $('li').on('click', function (className) {
+            className = $(this).find('i').get(0).className;
             if (className) {
                 top.$('[name="{$field}"]').val(className).trigger('change');
                 top.layer.close(top.layer.getFrameIndex(window.name));

+ 0 - 432
application/admin/view/api/plugs/upfile.html

@@ -1,432 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh-CN">
-<head>
-    <title>{:sysconf('app_name')} {:sysconf('app_version')}</title>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <link href="{:sysconf('site_icon')}" rel="shortcut icon">
-    <meta name="viewport" content="width=device-width, initial-scale=0">
-    <link href="__ROOT__/static/plugs/uploader/webuploader.css" rel="stylesheet" type="text/css"/>
-    <link href="__ROOT__/static/plugs/uploader/theme/uploader.css" rel="stylesheet" type="text/css"/>
-    <script src="__ROOT__/static/plugs/jquery/jquery.min.js"></script>
-    <script src="__ROOT__/static/plugs/uploader/webuploader.min.js"></script>
-    <script src="__ROOT__/static/plugs/uploader/theme/upload.js"></script>
-</head>
-<body>
-<div id="uploader">
-    <div class="queueList">
-        <div id="dndArea" class="placeholder">
-            <div id="filePicker"></div>
-        </div>
-    </div>
-    <div class="statusBar" style="display:none;">
-        <div class="progress">
-            <span class="text">0%</span>
-            <span class="percentage"></span>
-        </div>
-        <div class="info"></div>
-        <div class="btns">
-            {if $mode!=='one'}
-            <div id="filePicker2"></div>
-            {/if}
-            <div class="uploadBtn">开始上传</div>
-        </div>
-    </div>
-</div>
-<script>
-    /* global WebUploader */
-
-    /**
-     * 每个文件上传成功调用
-     * @type Function
-     */
-    function uploaded(ret, file) {
-        var url = ret.url || ret.site_url;
-        $('#' + file.id).attr('data-md5', file.md5).attr('data-src', url);
-        /*{if $mode === 'one'}*/
-        top.$('[name="{$field}"]').map(function () {
-            top.$(this).attr('data-srcs', ret.url).attr('data-md5', file.md5).val(url).trigger('change');
-        });
-        top.layer.close(top.layer.getFrameIndex(window.name));
-        /*{/if}*/
-    }
-
-    var isSuccessState = false;
-
-    function completed() {
-        var btnHTML = '完成上传';
-        $('.uploadBtn').html(btnHTML).on('click', successSelected);
-
-        function successSelected() {
-            if (!isSuccessState && this.innerHTML === btnHTML) {
-                isSuccessState = true;
-                var srcs = [], md5s = [];
-                $('[data-md5] .success').map(function () {
-                    var $li = $(this).parents('[data-md5]');
-                    md5s.push($li.attr('data-md5'));
-                    srcs.push($li.attr('data-src'));
-                });
-                if (srcs.length < 1) return top.$.msg.tips('还没有选择文件,请勾选需要使用的文件!');
-                top.$('[name="{$field}"]').map(function () {
-                    top.$(this).attr('data-srcs', srcs.join('|')).attr('data-md5', md5s.join('|')).val(srcs.join('|')).trigger('change');
-                });
-                top.layer.close(top.layer.getFrameIndex(window.name));
-            }
-        }
-    }
-
-    // 当domReady的时候开始初始化
-    $(function () {
-        var uploader;
-        var $wrap = $('#uploader');
-        /* 文件容器 */
-        var $queue = $('<ul class="filelist"></ul>').appendTo($wrap.find('.queueList'));
-        /* 状态栏,包括进度和控制按钮 */
-        var $statusBar = $wrap.find('.statusBar');
-        /* 文件总体选择信息。 */
-        var $info = $statusBar.find('.info');
-        /* 上传按钮 */
-        var $upload = $wrap.find('.uploadBtn');
-        /* 没选择文件之前的内容。*/
-        var $placeHolder = $wrap.find('.placeholder');
-        var $progress = $statusBar.find('.progress').hide();
-        /* 添加的文件数量 */
-        var fileCount = 0;
-        /* 添加的文件总大小 */
-        var fileSize = 0;
-        /* 优化retina, 在retina下这个值是2 */
-        var ratio = window.devicePixelRatio || 1;
-        /* 缩略图大小 */
-        var thumbnailWidth = 110 * ratio;
-        var thumbnailHeight = 110 * ratio;
-        /* 可能有pedding, ready, uploading, confirm, done */
-        var state = "pedding";
-        /* 所有文件的进度信息,key为file id */
-        var percentages = {};
-        /* 判断浏览器是否支持文件的base64 */
-        var isSupportBase64 = (function () {
-            var data = new Image(), support = true;
-            data.onload = data.onerror = function () {
-                if (parseInt(this.width) !== 1 || parseInt(this.height) !== 1) support = false;
-            };
-            data.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
-            return support;
-        }.call(this));
-        /* 检测是否已经安装flash, 检测flash的版本 */
-        var flashVersion = (function () {
-            var version;
-            try {
-                version = navigator.plugins['Shockwave Flash'].description;
-            } catch (ex) {
-                try {
-                    version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
-                } catch (ex2) {
-                    version = '0.0';
-                }
-            }
-            version = version.match(/\d+/g);
-            return parseFloat(version[0] + '.' + version[1], 10);
-        })();
-        var supportTransition = (function () {
-            var style = document.createElement('p').style;
-            var isTransition = 'transition' in style || 'WebkitTransition' in style || 'MozTransition' in style || 'msTransition' in style || 'OTransition' in style;
-            return (style = null), isTransition;
-        })();
-
-        if (!WebUploader.Uploader.support('flash') && WebUploader.browser.ie) {
-            /*flash 安装了但是版本过低*/
-            if (flashVersion) return (function (container) {
-                window['expressinstallcallback'] = function (state) {
-                    if (state === 'Download.Cancelled') alert('您取消了更新!');
-                    else if (state === 'Download.Failed') alert('安装失败!');
-                    else alert('安装已成功,请刷新!');
-                    delete window['expressinstallcallback'];
-                };
-                var swf = '__ROOT__/static/plugs/uploader/expressInstall.swf';
-                var html = '<object type="application/' + 'x-shockwave-flash" data="' + swf + '" ';
-                if (WebUploader.browser.ie) html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
-                container.html(html + 'width="100%" height="100%" style="outline:0"><param name="movie" value="' + swf + '" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>');
-            })($wrap);
-            return $wrap.html('<a href="http://www.adobe.com/go/getflashplayer" target="_blank" border="0"><img alt="get flash player" src="http://www.adobe.com/macromedia/style_guide/images/160x41_Get_Flash_Player.jpg" /></a>');
-        } else if (!WebUploader.Uploader.support()) return alert('Web Uploader 不支持您的浏览器!');
-        // 文件上传前的检查
-        WebUploader.Uploader.register({'before-send-file': 'preupload'}, {
-            preupload: function (file) {
-                var me = this, owner = this.owner, deferred = WebUploader.Deferred();
-                owner.md5File(file.source).fail(function () {
-                    deferred.reject();
-                }).then(function (md5) {
-                    file.md5 = md5;
-                    var data = {id: file.id, md5: md5, uptype: '{$uptype}', filename: file.name, safe: '{$safe}' || 0};
-                    $.ajax("{:url('@')}?s=admin/api.plugs/upstate", {
-                        dataType: 'json', method: 'post', data: data, success: function (ret) {
-                            if (parseInt(ret.code) === 1) {
-                                owner.skipFile(file);
-                                uploaded.call(uploader, ret.data, file);
-                                percentages[file.id] = [file.size, 1];
-                                updateTotalProgress();
-                                console.log('文件秒传成功 --> ' + file.name);
-                            } else {
-                                file.md5 = md5;
-                                file.token = ret.data.token || '';
-                                file.key = ret.data.file_url || '';
-                                file.site_url = ret.data.site_url || '';
-                                me.options.server = ret.data.server;
-                                me.options.formData.safe = ret.data.safe || '0';
-                                me.options.formData.OSSAccessKeyId = ret.data.OSSAccessKeyId || ''; // OSS
-                                me.options.formData.signature = ret.data.signature; // OSS
-                                me.options.formData.policy = ret.data.policy; // OSS
-                                me.options.formData.success_action_status = '200'; // OSS
-                            }
-                            deferred.resolve();
-                        }
-                    });
-                });
-                return deferred.promise();
-            }
-        });
-
-        // 实例化
-        uploader = WebUploader.create({
-            pick: {
-                id: '#filePicker',
-                label: '点击选择文件',
-                /*{if $mode === 'one'}*/
-                multiple: false,
-                /*{else}*/
-                multiple: true,
-                /*{/if}*/
-            },
-            accept: {title: '选择文件', extensions: '{$types}', mimeTypes: '{$mimes}'},
-            formData: {},
-            /*{if $mode === 'one'}*/
-            auto: true,
-            fileNumLimit: 1,
-            /*{else}*/
-            auto: false,
-            fileNumLimit: 300,
-            /*{/if}*/
-            swf: '__ROOT__/static/plugs/uploader/Uploader.swf',
-            chunked: false,
-            dnd: '#dndArea',
-            paste: document.body,
-            chunkSize: 512 * 1024,
-            disableGlobalDnd: true,
-            fileSizeLimit: 200 * 1024 * 1024, // 200 M
-            fileSingleSizeLimit: 200 * 1024 * 1024, // 200 M
-            compress: {
-                width: 1600,
-                height: 16000,
-                crop: false, // 是否允许裁剪
-                quality: 90, // 图片质量(只有type为`image/jpeg`的时候才有效)
-                allowMagnify: false, // 是否允许放大(如果想要生成小图的时候不失真,此选项应该设置为false).
-                preserveHeaders: true, // 是否保留头部meta信息
-                noCompressIfLarger: false, // 如果发现压缩后文件大小比原来还大,则使用原来图片
-                compressSize: 1024 * 512, // 单位字节(如果图片大小小于此值,不会采用压缩)
-            }
-        });
-
-        /* 上传开始前的处理 */
-        uploader.on('uploadBeforeSend', function (file, data, header) {
-            header['X_Requested_With'] = 'XMLHttpRequest';
-            data['allowed_types'] = this.options.accept[0].extensions.split(',').join('|');
-            data['md5'] = file.file.md5 || '';
-            data['key'] = file.file.key || '';
-            data['safe'] = file.file.safe || 0;
-            data['token'] = file.file.token || '';
-        });
-
-        /* 处理上传后的结果 */
-        uploader.on('uploadAccept', function (fieldata, ret) {
-            // Qiniu or Local 上传
-            if (parseInt(ret.code) === 1) return uploaded.call(uploader, ret.data, fieldata.file), true;
-            // AliOSS 上传
-            if (fieldata.file.site_url) return uploaded.call(uploader, {'site_url': fieldata.file.site_url}, fieldata.file), true;
-            // 接收错误消息
-            return fieldata.file.setStatus('error', ret.msg), false;
-        });
-
-        // 拖拽时不接受 js, txt 文件。
-        uploader.on('dndAccept', function (items) {
-            var denied = false, len = items.length, unAllowed = 'text/plain;application/javascript ';
-            for (var i = 0; i < len; i++) if (~unAllowed.indexOf(items[i].type)) if (denied = true) break;
-            return !denied;
-        });
-
-        // 添加“添加文件”的按钮,
-        uploader.addButton({id: '#filePicker2', label: '继续添加'});
-        uploader.on('ready', function () {
-            window.uploader = uploader;
-        });
-
-        // 当有文件添加进来时执行,负责view的创建
-        function addFile(file) {
-            var $li = $('<li id="' + file.id + '"><p class="title">' + file.name + '</p><p class="imgWrap"></p><p class="progress"><span></span></p></li>'),
-                $btns = $('<div class="file-panel"><span class="cancel">删除</span><span class="rotateRight">向右旋转</span><span class="rotateLeft">向左旋转</span></div>').appendTo($li),
-                $prgress = $li.find('p.progress span'), $wrap = $li.find('p.imgWrap'), $info = $('<p class="error"></p>');
-            var showError = function (code) {
-                var text = '';
-                if (code === 'exceed_size') text = '文件大小超出';
-                else if (code === 'interrupt') text = '上传暂停';
-                else if (code === 'http' || code === 'server' || code === 'abort') text = '上传失败,请重试';
-                else text = code;
-                $info.text(text).appendTo($li);
-            };
-            if (file.getStatus() === 'invalid') showError(file.statusText);
-            else {
-                $wrap.text('预览中');
-                uploader.makeThumb(file, function (error, src) {
-                    if (error) return $wrap.text('不能预览');
-                    if (isSupportBase64) $wrap.empty().append($('<img src="' + src + '">'));
-                    else $.ajax('{:url("@")}?s=plugs/file/preview', {method: 'post', data: src, dataType: 'json'}).done(function (response) {
-                        if (response.result) $wrap.empty().append($('<img src="' + response.result + '">')); else $wrap.text("预览出错");
-                    });
-                }, thumbnailWidth, thumbnailHeight);
-                percentages[file.id] = [file.size, 0];
-                file.rotation = 0;
-                $upload.html('开始上传');
-            }
-            // 文件上传状态变化
-            file.on('statuschange', function (cur, prev) {
-                if (prev === 'progress') $prgress.hide().width(0);
-                else if (prev === 'queued') $li.off('mouseenter mouseleave'), $btns.remove();
-                if (cur === 'error' || cur === 'invalid') showError(file.statusText), percentages[file.id][1] = 1;
-                else if (cur === 'interrupt') showError('interrupt');
-                else if (cur === 'queued') percentages[file.id][1] = 0;
-                else if (cur === 'progress') $info.remove(), $prgress.css('display', 'block');
-                else if (cur === 'complete') $li.append('<span class="success"></span>');
-                $li.removeClass('state-' + prev).addClass('state-' + cur);
-            });
-            $li.on('mouseenter', function () {
-                $btns.stop().animate({height: 30});
-            }).on('mouseleave', function () {
-                $btns.stop().animate({height: 0});
-            });
-            $btns.on('click', 'span', function () {
-                var index = $(this).index();
-                if (index === 0) return removeFile(file), uploader.removeFile(file);
-                if (index === 1) file.rotation += 90;
-                if (index === 2) file.rotation -= 90;
-                if (supportTransition) {
-                    var deg = 'rotate(' + file.rotation + 'deg)';
-                    $wrap.css({'-webkit-transform': deg, '-mos-transform': deg, '-o-transform': deg, 'transform': deg});
-                } else $wrap.css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + (~~((file.rotation / 90) % 4 + 4) % 4) + ')');
-            });
-            $li.appendTo($queue);
-        }
-
-        // 负责view的销毁
-        function removeFile(file) {
-            delete percentages[file.id];
-            updateTotalProgress();
-            $('#' + file.id).off().find('.file-panel').off().end().remove();
-        }
-
-        function updateTotalProgress() {
-            var loaded = 0, total = 0, spans = $progress.children(), percent;
-            $.each(percentages, function (k, v) {
-                total += v[0], loaded += v[0] * v[1];
-            });
-            percent = total ? loaded / total : 0;
-            spans.eq(0).text(Math.round(percent * 100) + '%');
-            spans.eq(1).css('width', Math.round(percent * 100) + '%');
-            updateStatus();
-        }
-
-        function updateStatus() {
-            var text = '', stats = '';
-            if (state === 'ready') text = '选中' + fileCount + '个文件,共' + WebUploader.formatSize(fileSize) + '。';
-            else if (state === 'confirm') {
-                stats = uploader.getStats();
-                if (stats.uploadFailNum) text = '已成功上传' + stats.successNum + '个文件,' + stats.uploadFailNum + '个文件上传失败,<a class="retry" href="#">重新上传</a>失败文件'
-            } else {
-                stats = uploader.getStats();
-                text = '共' + fileCount + '个(' + WebUploader.formatSize(fileSize) + '),已上传' + stats.successNum + '个';
-                if (stats.uploadFailNum) text += ',失败' + stats.uploadFailNum + '个';
-            }
-            $info.html(text);
-        }
-
-        function setState(val) {
-            if (val === state) return;
-            $upload.removeClass('state-' + state);
-            $upload.addClass('state-' + val);
-            state = val;
-            switch (state) {
-                case 'pedding':
-                    $placeHolder.removeClass('element-invisible');
-                    $queue.hide(), $statusBar.addClass('element-invisible'), uploader.refresh();
-                    break;
-                case 'ready':
-                    $placeHolder.addClass('element-invisible');
-                    $('#filePicker2').removeClass('element-invisible');
-                    $queue.show(), $statusBar.removeClass('element-invisible'), uploader.refresh();
-                    break;
-                case 'uploading':
-                    $('#filePicker2').addClass('element-invisible');
-                    $progress.show(), $upload.text('暂停上传');
-                    break;
-                case 'paused':
-                    $progress.show(), $upload.text('继续上传');
-                    break;
-                case 'confirm':
-                    $('#filePicker2').removeClass('element-invisible');
-                    $progress.hide(), $upload.text('开始上传');
-                    var stats = uploader.getStats();
-                    if (stats.successNum && !stats.uploadFailNum) return setState('finish')
-                    break;
-                case 'finish':
-                    if (uploader.getStats().successNum) completed.call(this);
-                    else (state = 'done'), location.reload();
-                    break;
-            }
-            updateStatus();
-        }
-
-        uploader.onUploadProgress = function (file, percentage) {
-            var $li = $('#' + file.id), $percent = $li.find('.progress span');
-            $percent.css('width', percentage * 100 + '%');
-            percentages[file.id][1] = percentage;
-            updateTotalProgress();
-        };
-
-        uploader.onFileQueued = function (file) {
-            fileCount++, fileSize += file.size;
-            if (fileCount === 1) $placeHolder.addClass('element-invisible'), $statusBar.show();
-            addFile(file), setState('ready'), updateTotalProgress();
-        };
-
-        uploader.onfieldequeued = function (file) {
-            fileCount--, fileSize -= file.size;
-            if (!fileCount) setState('pedding');
-            removeFile(file), updateTotalProgress();
-        };
-
-        uploader.on('all', function (type) {
-            if (type === 'uploadFinished') return setState('confirm');
-            if (type === 'startUpload') return setState('uploading');
-            if (type === 'stopUpload') return setState('paused');
-        });
-
-        uploader.onError = function () {
-            console.error(JSON.stringify(arguments));
-        };
-
-        $upload.on('click', function () {
-            if ($(this).hasClass('disabled')) return false;
-            if (state === 'ready') uploader.upload();
-            else if (state === 'paused') uploader.upload();
-            else if (state === 'uploading') uploader.stop();
-        });
-
-        $info.on('click', '.retry', function () {
-            uploader.retry();
-        });
-
-        $upload.addClass('state-' + state);
-        updateTotalProgress();
-    });
-
-</script>
-</body>
-</html>

+ 8 - 0
application/admin/view/auth/apply.html

@@ -1,5 +1,13 @@
 {extend name='main'}
 
+{block name="button"}
+
+{if auth("admin/auth/refresh")}
+<button data-load='{:url("refresh")}' class='layui-btn layui-btn-sm layui-btn-primary'>刷新权限</button>
+{/if}
+
+{/block}
+
 {block name="content"}
 <div class="think-box-shadow">
     <ul id="zTree" class="ztree notselect"></ul>

+ 1 - 1
application/admin/view/auth/form.html

@@ -14,8 +14,8 @@
         </div>
     </div>
     <div class="hr-line-dashed"></div>
+    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
     <div class="layui-form-item text-center">
-        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
         <button class="layui-btn" type='submit'>保存数据</button>
         <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
     </div>

+ 17 - 14
application/admin/view/auth/index.html

@@ -1,30 +1,31 @@
 {extend name='main'}
 
 {block name="button"}
-<!--{if auth("admin/auth/add")}-->
+
+{if auth("admin/auth/add")}
 <button data-modal='{:url("add")}' data-title="添加权限" class='layui-btn layui-btn-sm layui-btn-primary'>添加权限</button>
-<!--{/if}-->
+{/if}
 
-<!--{if auth("admin/auth/remove")}-->
+{if auth("admin/auth/remove")}
 <button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('admin/auth/remove')}" data-confirm="确定要删除这些权限吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除权限</button>
-<!--{/if}-->
+{/if}
+
 {/block}
 
 {block name="content"}
 
 <div class="think-box-shadow">
-
-    <table class="layui-table" lay-skin="line">
-        <caption class="margin-bottom-10 text-left">{include file='auth/index_search'}</caption>
+    {include file='auth/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
         {notempty name='list'}
         <thead>
         <tr>
             <th class='list-table-check-td think-checkbox'>
-                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
             </th>
             <th class='text-left nowrap'>权限信息</th>
             <th class='text-left nowrap'>创建时间</th>
-            <th class="text-center">状态</th>
+            <th class="text-center nowrap">使用状态</th>
             <th></th>
         </tr>
         </thead>
@@ -32,13 +33,15 @@
         <tbody>
         {foreach $list as $key=>$vo}
         <tr data-dbclick>
-            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class='list-table-check-td think-checkbox'>
+                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
+            </td>
             <td class='text-left'>
                 权限名称:{$vo.title|default='-'}<br>
-                权限描述:{$vo.desc|default="<span class='color-desc'>没有写描述哦!</span>"}
+                <p class="color-desc">权限描述:{$vo.desc|default="没有写描述哦!"}</p>
             </td>
             <td class="text-left nowrap">
-                日期:{$vo.create_at|format_datetime|str_replace=' ','<br>时间:',###|raw}
+                日期:{$vo.create_at|format_datetime|str_replace=' ','<br><span class="color-desc">时间:',###|raw}</span>
             </td>
             <td class='text-center nowrap'>
                 {eq name='vo.status' value='0'}<span class="color-red">已禁用</span>{else}<span class="color-green">使用中</span>{/eq}
@@ -56,7 +59,7 @@
 
                 {if $vo.status eq 1 and auth("admin/auth/forbid")}
                 <a class="layui-btn layui-btn-warm layui-btn-sm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('admin/auth/forbid')}">禁 用</a>
-                {elseif auth("admin/auth/resume")}
+                {elseif $vo.status eq 0 and auth("admin/auth/resume")}
                 <a class="layui-btn layui-btn-warm layui-btn-sm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('admin/auth/resume')}">启 用</a>
                 {/if}
 
@@ -74,4 +77,4 @@
 
 </div>
 
-{/block}
+{/block}

+ 1 - 1
application/admin/view/auth/index_search.html

@@ -1,5 +1,5 @@
 <fieldset>
-    <legend class="layui-bg-cyan">条件搜索</legend>
+    <legend>条件搜索</legend>
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
         <div class="layui-form-item layui-inline">
             <label class="layui-form-label">权限名称</label>

+ 0 - 44
application/admin/view/config/file.html

@@ -1,44 +0,0 @@
-{extend name="main"}
-
-{block name="content"}
-
-<div style="max-width:1000px">
-    <form class="layui-card layui-form">
-        <div class="layui-card-body think-box-shadow">
-            <div class="layui-form-item margin-bottom-0">
-                <label class="layui-form-label">Storage<br><span class="nowrap color-desc">存储类型</span></label>
-                <div class="layui-input-block">
-                    {foreach ['local'=>'本地服务器存储','qiniu'=>'七牛云对象存储','oss'=>'阿里云OSS存储'] as $k=>$v}
-                    <input type="radio" data-storagetype="{$k}" name="storage_type" value="{$k}" title="{$v}" lay-filter="storage_type">
-                    {/foreach}
-                    <p class="help-block">请选择文件存储类型,其它云储存需要配置正确的参数才可以上传文件哦!</p>
-                </div>
-            </div>
-        </div>
-    </form>
-    <div class="padding-top-15 padding-bottom-10 think-box-shadow">
-        <div class="layui-anim layui-anim-upbit" data-type="oss">{include file='config/file_oss'}</div>
-        <div class="layui-anim layui-anim-upbit" data-type="local">{include file='config/file_local'}</div>
-        <div class="layui-anim layui-anim-upbit" data-type="qiniu">{include file='config/file_qiniu'}</div>
-    </div>
-</div>
-
-{/block}
-
-{block name="script"}
-<script>
-    $(function () {
-        apply('{:sysconf("storage_type")}');
-        window.form.render();
-        window.form.on('radio(storage_type)', function (data) {
-            apply(data.value);
-        });
-
-        function apply(value) {
-            this.$active = $("[data-storagetype='" + value + "']").trigger('click');
-            if (this.$active.size() < 1) $("[data-storagetype]:first").trigger('click');
-            $('[data-type="' + value + '"]').show().siblings('[data-type]').hide();
-        }
-    });
-</script>
-{/block}

+ 0 - 19
application/admin/view/config/file_local.html

@@ -1,19 +0,0 @@
-<form onsubmit="return false;" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
-    <div class="layui-card-body">
-        <div class="color-blue padding-left-40 padding-bottom-20">
-            文件将存储在本地服务器,需确保服务器的 public/upload 目录有写入权限,还需要有足够的存储空间。
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">AllowExts<br><span class="nowrap color-desc">允许类型</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_local_exts" required value="{:sysconf('storage_local_exts')}" placeholder="请输入系统文件上传后缀" class="layui-input">
-                <p class="help-block">设置系统允许上传文件的后缀,多个以英文逗号隔开。如:png,jpg,rar,doc</p>
-            </div>
-        </div>
-        <div class="hr-line-dashed margin-left-40"></div>
-        <div class="layui-form-item text-center">
-            <input type="hidden" name="storage_type" value="local">
-            <button class="layui-btn" type="submit">保存配置</button>
-        </div>
-    </div>
-</form>

+ 0 - 77
application/admin/view/config/file_oss.html

@@ -1,77 +0,0 @@
-<form onsubmit="return false;" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
-    <div class="layui-card-body">
-        <div class="color-blue padding-left-40 padding-bottom-20">
-            文件将上传到阿里云OSS空间,需要配置OSS公开访问及跨域策略(目前已实现自动创建空间及配置访问策略)。
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">AllowExts<br><span class="nowrap color-desc">允许类型</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_local_exts" required value="{:sysconf('storage_local_exts')}" placeholder="请输入系统文件上传后缀" class="layui-input">
-                <p class="help-block">设置系统允许上传文件的后缀,多个以英文逗号隔开。如:png,jpg,rar,doc</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label label-required">Protocol<br><span class="nowrap color-desc">访问协议</span></label>
-            <div class="layui-input-block">
-                <!--{foreach ['http','https','auto'] as $pro}-->
-                <label class="think-radio">
-                    <!--{if sysconf('storage_oss_is_https') eq $pro}-->
-                    <input checked type="radio" name="storage_oss_is_https" value="{$pro}" lay-ignore> {$pro}
-                    <!--{else}-->
-                    <input type="radio" name="storage_oss_is_https" value="{$pro}" lay-ignore> {$pro}
-                    <!--{/if}-->
-                </label>
-                <!--{/foreach}-->
-                <p class="help-block">阿里云对象存储访问协议(http、https、auto),其中 https 需要配置证书才能使用,auto 为相对协议自动根据域名切换http与https。</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">Bucket<br><span class="nowrap color-desc">空间名称</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_oss_bucket" required value="{:sysconf('storage_oss_bucket')}" placeholder="请输入OSS Bucket (空间名称)" class="layui-input">
-                <p class="help-block">填写OSS存储空间名称,如:think-admin-oss(需要是全区唯一的值,不存在时会自动创建)</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">EndPoint<br><span class="nowrap color-desc">数据中心</span></label>
-            <div class="layui-input-block">
-                <select required name="storage_oss_endpoint" class="layui-select">
-                    {foreach $point as $k=>$p}
-                    <!--{if sysconf('storage_oss_endpoint') eq $k}-->
-                    <option selected value="{$k}">{$p} <span class="font-s10 color-desc">({$k})</span></option>
-                    <!--{else}-->
-                    <option value="{$k}">{$p} <span class="font-s10 color-desc">({$k})</span></option>
-                    <!--{/if}-->
-                    {/foreach}
-                </select>
-                <p class="help-block">请选择OSS数据中心访问节点,有效值如:oss-cn-shenzhen.aliyuncs.com</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">AccessKey<br><span class="nowrap color-desc">访问密钥</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_oss_keyid" required value="{:sysconf('storage_oss_keyid')}" maxlength="16" placeholder="请输入OSS AccessKey (访问密钥)" class="layui-input">
-                <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到访问密钥。</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">SecretKey<br><span class="nowrap color-desc">安全密钥</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_oss_secret" required value="{:sysconf('storage_oss_secret')}" maxlength="30" placeholder="请输入OSS SecretKey (安全密钥)" class="layui-input">
-                <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到安全密钥。</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">Domain<br><span class="nowrap color-desc">访问域名</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_oss_domain" value="{:sysconf('storage_oss_domain')}" placeholder="请输入OSS存储 Domain (访问域名)" class="layui-input">
-                <p class="help-block">填写OSS存储外部访问域名,如:think-admin-oss.oss-cn-shenzhen.aliyuncs.com(正常情况下是自动获取的)</p>
-            </div>
-        </div>
-        <div class="hr-line-dashed margin-left-40"></div>
-        <div class="layui-form-item text-center">
-            <input type="hidden" name="storage_type" value="oss">
-            <button class="layui-btn" type="submit">保存配置</button>
-        </div>
-    </div>
-</form>

+ 0 - 78
application/admin/view/config/file_qiniu.html

@@ -1,78 +0,0 @@
-<form onsubmit="return false;" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
-    <div class="layui-card-body">
-        <div class="color-blue padding-left-40 padding-bottom-20">
-            文件将上传到七牛云空间(<a target="_blank" href="https://portal.qiniu.com/signup?code=3lhz6nmnwbple">点击这里免费申请10G存储</a>),申请成功后添加公开bucket并配置接口密钥。
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">AllowExts<br><span class="nowrap color-desc">允许类型</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_local_exts" required value="{:sysconf('storage_local_exts')}" placeholder="请输入系统文件上传后缀" class="layui-input">
-                <p class="help-block">设置系统允许上传文件的后缀,多个以英文逗号隔开。如:png,jpg,rar,doc</p>
-            </div>
-        </div>
-        <div class="layui-form-item" data-storage-type="qiniu">
-            <label class="layui-form-label label-required">Protocol<br><span class="nowrap color-desc">访问协议</span></label>
-            <div class="layui-input-block">
-                <!--{foreach ['http','https','auto'] as $pro}-->
-                <label class="think-radio">
-                    <!--{if sysconf('storage_qiniu_is_https') eq $pro}-->
-                    <input checked type="radio" name="storage_qiniu_is_https" value="{$pro}" lay-ignore> {$pro}
-                    <!--{else}-->
-                    <input type="radio" name="storage_qiniu_is_https" value="{$pro}" lay-ignore> {$pro}
-                    <!--{/if}-->
-                </label>
-                <!--{/foreach}-->
-                <p class="help-block">七牛云存储访问协议(http、https、auto),其中 https 需要配置证书才能使用,auto 为相对协议自动根据域名切换http与https。</p>
-            </div>
-        </div>
-        <div class="layui-form-item" data-storage-type="qiniu">
-            <label class="layui-form-label">Region<br><span class="nowrap color-desc label-required">存储区域</span></label>
-            <div class="layui-input-block">
-                {foreach ['华东','华北','华南','北美'] as $area}
-                <label class="think-radio">
-                    <!--{if sysconf('storage_qiniu_region') eq $area}-->
-                    <input checked type="radio" name="storage_qiniu_region" value="{$area}" lay-ignore>
-                    <!--{else}-->
-                    <input type="radio" name="storage_qiniu_region" value="{$area}" lay-ignore>
-                    <!--{/if}-->
-                    {$area}
-                </label>
-                {/foreach}
-                <p class="help-block">七牛云存储空间所在区域,需要严格对应储存所在区域才能上传文件。</p>
-            </div>
-        </div>
-        <div class="layui-form-item" data-storage-type="qiniu">
-            <label class="layui-form-label">Bucket<br><span class="nowrap color-desc">空间名称</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_qiniu_bucket" required value="{:sysconf('storage_qiniu_bucket')}" placeholder="请输入七牛云存储 Bucket (空间名称)" class="layui-input">
-                <p class="help-block">填写七牛云存储空间名称,如:static</p>
-            </div>
-        </div>
-        <div class="layui-form-item" data-storage-type="qiniu">
-            <label class="layui-form-label">Domain<br><span class="nowrap color-desc">访问域名</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_qiniu_domain" required value="{:sysconf('storage_qiniu_domain')}" placeholder="请输入七牛云存储 Domain (访问域名)" class="layui-input">
-                <p class="help-block">填写七牛云存储访问域名,如:static.ctolog.cc</p>
-            </div>
-        </div>
-        <div class="layui-form-item" data-storage-type="qiniu">
-            <label class="layui-form-label">AccessKey<br><span class="nowrap color-desc">访问密钥</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_qiniu_access_key" required value="{:sysconf('storage_qiniu_access_key')}" placeholder="请输入七牛云 AccessKey (访问密钥)" class="layui-input">
-                <p class="help-block">可以在 [ 七牛云 > 个人中心 ] 设置并获取到访问密钥。</p>
-            </div>
-        </div>
-        <div class="layui-form-item" data-storage-type="qiniu">
-            <label class="layui-form-label">SecretKey<br><span class="nowrap color-desc">安全密钥</span></label>
-            <div class="layui-input-block">
-                <input type="text" name="storage_qiniu_secret_key" required value="{:sysconf('storage_qiniu_secret_key')}" maxlength="43" placeholder="请输入七牛云 SecretKey (安全密钥)" class="layui-input">
-                <p class="help-block">可以在 [ 七牛云 > 个人中心 ] 设置并获取到安全密钥。</p>
-            </div>
-        </div>
-        <div class="hr-line-dashed margin-left-40"></div>
-        <div class="layui-form-item text-center">
-            <input type="hidden" name="storage_type" value="qiniu">
-            <button class="layui-btn" type="submit">保存配置</button>
-        </div>
-    </div>
-</form>

+ 21 - 0
application/admin/view/config/info-storage-local.html

@@ -0,0 +1,21 @@
+<form onsubmit="return false;" data-auto="true" action="{:url('save')}" method="post" class='layui-form layui-card' autocomplete="off">
+    <div class="layui-card-body">
+        <div class="padding-right-40">
+            <div class="color-blue padding-left-40 padding-bottom-20">
+                文件将存储在本地服务器,需确保服务器的 public/upload 目录有写入权限,有足够的存储空间。
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">AllowExts<br><span class="nowrap color-desc">允许类型</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_local_exts" required value="{:sysconf('storage_local_exts')}" placeholder="请输入系统文件上传后缀" class="layui-input">
+                    <p class="help-block">设置系统允许上传文件的后缀,多个以英文逗号隔开。如:png,jpg,rar,doc</p>
+                </div>
+            </div>
+            <div class="hr-line-dashed margin-left-40"></div>
+            <div class="layui-form-item text-center">
+                <input type="hidden" name="storage_type" value="local">
+                <button class="layui-btn" type="submit">保存配置</button>
+            </div>
+        </div>
+    </div>
+</form>

+ 79 - 0
application/admin/view/config/info-storage-oss.html

@@ -0,0 +1,79 @@
+<form onsubmit="return false;" data-auto="true" action="{:url('save')}" method="post" class='layui-form layui-card' autocomplete="off">
+    <div class="layui-card-body">
+        <div class="padding-right-40">
+            <div class="color-blue padding-left-40 padding-bottom-20">
+                文件将上传到阿里云OSS空间,需要配置OSS公开访问及跨域策略(目前已实现自动创建空间及配置访问策略)。
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">AllowExts<br><span class="nowrap color-desc">允许类型</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_local_exts" required value="{:sysconf('storage_local_exts')}" placeholder="请输入系统文件上传后缀" class="layui-input">
+                    <p class="help-block">设置系统允许上传文件的后缀,多个以英文逗号隔开。如:png,jpg,rar,doc</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">Protocol<br><span class="nowrap color-desc">访问协议</span></label>
+                <div class="layui-input-block">
+                    <!--{foreach ['http','https','auto'] as $pro}-->
+                    <label class="think-radio">
+                        <!--{if sysconf('storage_oss_is_https') eq $pro}-->
+                        <input checked type="radio" name="storage_oss_is_https" value="{$pro}" lay-ignore> {$pro}
+                        <!--{else}-->
+                        <input type="radio" name="storage_oss_is_https" value="{$pro}" lay-ignore> {$pro}
+                        <!--{/if}-->
+                    </label>
+                    <!--{/foreach}-->
+                    <p class="help-block">阿里云对象存储访问协议(http、https、auto),其中 https 需要配置证书才能使用,auto 为相对协议自动根据域名切换http与https。</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">Bucket<br><span class="nowrap color-desc">空间名称</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_oss_bucket" required value="{:sysconf('storage_oss_bucket')}" placeholder="请输入OSS Bucket (空间名称)" class="layui-input">
+                    <p class="help-block">填写OSS存储空间名称,如:think-admin-oss(需要是全区唯一的值,不存在时会自动创建)</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">EndPoint<br><span class="nowrap color-desc">数据中心</span></label>
+                <div class="layui-input-block">
+                    <select required name="storage_oss_endpoint" class="layui-select" lay-search>
+                        {foreach $ossPoints as $k=>$p}
+                        <!--{if sysconf('storage_oss_endpoint') eq $k}-->
+                        <option selected value="{$k}">{$p} <span class="font-s10 color-desc">({$k})</span></option>
+                        <!--{else}-->
+                        <option value="{$k}">{$p} <span class="font-s10 color-desc">({$k})</span></option>
+                        <!--{/if}-->
+                        {/foreach}
+                    </select>
+                    <p class="help-block">请选择OSS数据中心访问节点,有效值如:oss-cn-shenzhen.aliyuncs.com</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">AccessKey<br><span class="nowrap color-desc">访问密钥</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_oss_keyid" required value="{:sysconf('storage_oss_keyid')}" maxlength="16" placeholder="请输入OSS AccessKey (访问密钥)" class="layui-input">
+                    <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到访问密钥。</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">SecretKey<br><span class="nowrap color-desc">安全密钥</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_oss_secret" required value="{:sysconf('storage_oss_secret')}" maxlength="30" placeholder="请输入OSS SecretKey (安全密钥)" class="layui-input">
+                    <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到安全密钥。</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">Domain<br><span class="nowrap color-desc">访问域名</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_oss_domain" value="{:sysconf('storage_oss_domain')}" placeholder="请输入OSS存储 Domain (访问域名)" class="layui-input">
+                    <p class="help-block">填写OSS存储外部访问域名,如:think-admin-oss.oss-cn-shenzhen.aliyuncs.com(正常情况下是自动获取的)</p>
+                </div>
+            </div>
+            <div class="hr-line-dashed margin-left-40"></div>
+            <div class="layui-form-item text-center">
+                <input type="hidden" name="storage_type" value="oss">
+                <button class="layui-btn" type="submit">保存配置</button>
+            </div>
+        </div>
+    </div>
+</form>

+ 80 - 0
application/admin/view/config/info-storage-qiniu.html

@@ -0,0 +1,80 @@
+<form onsubmit="return false;" data-auto="true" action="{:url('save')}" method="post" class='layui-form layui-card' autocomplete="off">
+    <div class="layui-card-body">
+        <div class="padding-right-40">
+            <div class="color-blue padding-left-40 padding-bottom-20">
+                文件将上传到七牛云空间(<a target="_blank" href="https://portal.qiniu.com/signup?code=3lhz6nmnwbple">点击这里免费申请10G存储</a>),申请成功后添加公开bucket并配置接口密钥。
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">AllowExts<br><span class="nowrap color-desc">允许类型</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_local_exts" required value="{:sysconf('storage_local_exts')}" placeholder="请输入系统文件上传后缀" class="layui-input">
+                    <p class="help-block">设置系统允许上传文件的后缀,多个以英文逗号隔开。如:png,jpg,rar,doc</p>
+                </div>
+            </div>
+            <div class="layui-form-item" data-storage-type="qiniu">
+                <label class="layui-form-label label-required">Protocol<br><span class="nowrap color-desc">访问协议</span></label>
+                <div class="layui-input-block">
+                    <!--{foreach ['http','https','auto'] as $pro}-->
+                    <label class="think-radio">
+                        <!--{if sysconf('storage_qiniu_is_https') eq $pro}-->
+                        <input checked type="radio" name="storage_qiniu_is_https" value="{$pro}" lay-ignore> {$pro}
+                        <!--{else}-->
+                        <input type="radio" name="storage_qiniu_is_https" value="{$pro}" lay-ignore> {$pro}
+                        <!--{/if}-->
+                    </label>
+                    <!--{/foreach}-->
+                    <p class="help-block">七牛云存储访问协议(http、https、auto),其中 https 需要配置证书才能使用,auto 为相对协议自动根据域名切换http与https。</p>
+                </div>
+            </div>
+            <div class="layui-form-item" data-storage-type="qiniu">
+                <label class="layui-form-label">Region<br><span class="nowrap color-desc label-required">存储区域</span></label>
+                <div class="layui-input-block">
+                    {foreach ['华东','华北','华南','北美'] as $area}
+                    <label class="think-radio">
+                        <!--{if sysconf('storage_qiniu_region') eq $area}-->
+                        <input checked type="radio" name="storage_qiniu_region" value="{$area}" lay-ignore>
+                        <!--{else}-->
+                        <input type="radio" name="storage_qiniu_region" value="{$area}" lay-ignore>
+                        <!--{/if}-->
+                        {$area}
+                    </label>
+                    {/foreach}
+                    <p class="help-block">七牛云存储空间所在区域,需要严格对应储存所在区域才能上传文件。</p>
+                </div>
+            </div>
+            <div class="layui-form-item" data-storage-type="qiniu">
+                <label class="layui-form-label">Bucket<br><span class="nowrap color-desc">空间名称</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_qiniu_bucket" required value="{:sysconf('storage_qiniu_bucket')}" placeholder="请输入七牛云存储 Bucket (空间名称)" class="layui-input">
+                    <p class="help-block">填写七牛云存储空间名称,如:static</p>
+                </div>
+            </div>
+            <div class="layui-form-item" data-storage-type="qiniu">
+                <label class="layui-form-label">Domain<br><span class="nowrap color-desc">访问域名</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_qiniu_domain" required value="{:sysconf('storage_qiniu_domain')}" placeholder="请输入七牛云存储 Domain (访问域名)" class="layui-input">
+                    <p class="help-block">填写七牛云存储访问域名,如:static.ctolog.cc</p>
+                </div>
+            </div>
+            <div class="layui-form-item" data-storage-type="qiniu">
+                <label class="layui-form-label">AccessKey<br><span class="nowrap color-desc">访问密钥</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_qiniu_access_key" required value="{:sysconf('storage_qiniu_access_key')}" placeholder="请输入七牛云 AccessKey (访问密钥)" class="layui-input">
+                    <p class="help-block">可以在 [ 七牛云 > 个人中心 ] 设置并获取到访问密钥。</p>
+                </div>
+            </div>
+            <div class="layui-form-item" data-storage-type="qiniu">
+                <label class="layui-form-label">SecretKey<br><span class="nowrap color-desc">安全密钥</span></label>
+                <div class="layui-input-block">
+                    <input type="text" name="storage_qiniu_secret_key" required value="{:sysconf('storage_qiniu_secret_key')}" maxlength="43" placeholder="请输入七牛云 SecretKey (安全密钥)" class="layui-input">
+                    <p class="help-block">可以在 [ 七牛云 > 个人中心 ] 设置并获取到安全密钥。</p>
+                </div>
+            </div>
+            <div class="hr-line-dashed margin-left-40"></div>
+            <div class="layui-form-item text-center">
+                <input type="hidden" name="storage_type" value="qiniu">
+                <button class="layui-btn" type="submit">保存配置</button>
+            </div>
+        </div>
+    </div>
+</form>

+ 32 - 0
application/admin/view/config/info-storage.html

@@ -0,0 +1,32 @@
+<div class="layui-card layui-form">
+    <div class="layui-card-body">
+        <div class="layui-form-item padding-top-20">
+            <label class="layui-form-label">Storage<br><span class="nowrap color-desc">存储类型</span></label>
+            <div class="layui-input-block">
+                {foreach ['local'=>'本地服务器存储','qiniu'=>'七牛云对象存储','oss'=>'阿里云OSS存储'] as $k=>$v}
+                <input type="radio" data-storagetype="{$k}" name="storage_type" value="{$k}" title="{$v}" lay-filter="storage_type">
+                {/foreach}
+                <p class="help-block">请选择文件存储类型,其它云储存需要配置正确的参数才可以上传文件哦!</p>
+            </div>
+        </div>
+    </div>
+</div>
+
+<div class="padding-bottom-10">
+    <div data-type="oss">{include file='config/info-storage-oss'}</div>
+    <div data-type="local">{include file='config/info-storage-local'}</div>
+    <div data-type="qiniu">{include file='config/info-storage-qiniu'}</div>
+</div>
+
+<script>
+    apply('{:sysconf("storage_type")}');
+    form.render().on('radio(storage_type)', function (data) {
+        apply(data.value);
+    });
+
+    function apply(value) {
+        this.$active = $("[data-storagetype='" + value + "']").trigger('click');
+        if (this.$active.size() < 1) $("[data-storagetype]:first").trigger('click');
+        $('[data-type="' + value + '"]').show().siblings('[data-type]').hide();
+    }
+</script>

+ 54 - 0
application/admin/view/config/info-website.html

@@ -0,0 +1,54 @@
+<form onsubmit="return false;" data-auto="true" action="{:url('save')}" method="post" class='layui-form layui-card' autocomplete="off">
+    <div class="layui-card-body">
+        <div class="padding-right-40 padding-bottom-10 margin-top-20">
+            <div class="layui-form-item">
+                <label class="layui-form-label">Name<br><span class="nowrap color-desc">程序名称</span></label>
+                <div class="layui-input-block">
+                    <input name="app_name" required placeholder="请输入程序名称" value="{:sysconf('app_name')}" class="layui-input">
+                    <p class="help-block">当前程序名称,在后台主标题上显示 {:sysconf('app_name')}</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">Version<br><span class="nowrap color-desc">程序版本</span></label>
+                <div class="layui-input-block">
+                    <input name="app_version" placeholder="请输入程序版本" value="{:sysconf('app_version')}" class="layui-input">
+                    <p class="help-block">当前程序版本号,在后台主标题上标显示版本 {:sysconf('app_version')}</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">Website<br><span class="nowrap color-desc">网站名称</span></label>
+                <div class="layui-input-block">
+                    <input name="site_name" required placeholder="请输入网站名称" value="{:sysconf('site_name')}" class="layui-input">
+                    <p class="help-block">网站名称,将在浏览器的标签上显示 {:sysconf('site_name')}</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">Browser<br><span class="nowrap color-desc">浏览器图标</span></label>
+                <div class="layui-input-block">
+                    <img alt="icon" data-tips-image style="height:auto;max-height:32px;min-width:32px" src="{:sysconf('site_icon')}"/>
+                    <input type="hidden" name="site_icon" onchange="$(this).prev('img').attr('src', this.value)" value="{:sysconf('site_icon')}" class="layui-input">
+                    <a class="margin-left-10" data-file="btn" data-type="ico,png" data-field="site_icon">上传图片</a>
+                    <p class="help-block">建议上传 ICO 图标的尺寸为 128x128px,此图标用于网站标题前,<a href="http://www.favicon-icon-generator.com/" target="_blank">ICON在线制作</a></p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">Copyright<br><span class="nowrap color-desc">版权信息</span></label>
+                <div class="layui-input-block">
+                    <input name="site_copy" required placeholder="请输入版权信息" value="{:sysconf('site_copy')}" class="layui-input">
+                    <p class="help-block">程序的版权信息设置,在后台登录页面显示版本信息</p>
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">Miitbeian<br><span class="nowrap color-desc">网站备案号</span></label>
+                <div class="layui-input-block">
+                    <input name="miitbeian" placeholder="请输入网站备案号" value="{:sysconf('miitbeian')}" class="layui-input">
+                    <p class="help-block">网站备案号,可以在<a target="_blank" href="http://www.miitbeian.gov.cn">备案管理中心</a>查询获取,将在登录页面下面显示</p>
+                </div>
+            </div>
+            <div class="hr-line-dashed margin-left-40"></div>
+            <div class="layui-form-item text-center padding-bottom-10">
+                <button class="layui-btn" type="submit">保存配置</button>
+            </div>
+        </div>
+    </div>
+</form>

+ 23 - 51
application/admin/view/config/info.html

@@ -2,56 +2,28 @@
 
 {block name="content"}
 
-<form onsubmit="return false;" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off" style="max-width:1000px">
-    <div class="layui-card-body padding-bottom-10 think-box-shadow" style="padding-right:60px!important">
-        <div class="layui-form-item margin-top-20">
-            <label class="layui-form-label">Name<br><span class="nowrap color-desc">程序名称</span></label>
-            <div class="layui-input-block">
-                <input name="app_name" required placeholder="请输入程序名称" value="{:sysconf('app_name')}" class="layui-input">
-                <p class="help-block">当前程序名称,在后台主标题上显示 {:sysconf('app_name')}</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">Version<br><span class="nowrap color-desc">程序版本</span></label>
-            <div class="layui-input-block">
-                <input name="app_version" placeholder="请输入程序版本" value="{:sysconf('app_version')}" class="layui-input">
-                <p class="help-block">当前程序版本号,在后台主标题上标显示版本 {:sysconf('app_version')}</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">Website<br><span class="nowrap color-desc">网站名称</span></label>
-            <div class="layui-input-block">
-                <input name="site_name" required placeholder="请输入网站名称" value="{:sysconf('site_name')}" class="layui-input">
-                <p class="help-block">网站名称,将在浏览器的标签上显示 {:sysconf('site_name')}</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">Browser<br><span class="nowrap color-desc">浏览器图标</span></label>
-            <div class="layui-input-block">
-                <img alt="icon" data-tips-image style="height:auto;max-height:32px;min-width:32px" src="{:sysconf('site_icon')}"/>
-                <input type="hidden" name="site_icon" onchange="$(this).prev('img').attr('src', this.value)" value="{:sysconf('site_icon')}" class="layui-input">
-                <a class="margin-left-10" data-file="btn" data-type="ico,png" data-field="site_icon">上传图片</a>
-                <p class="help-block">建议上传ICO图标的尺寸为128x128px,此图标用于网站标题前,<a href="http://www.favicon-icon-generator.com/" target="_blank">ICON在线制作</a></p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">Copyright<br><span class="nowrap color-desc">版权信息</span></label>
-            <div class="layui-input-block">
-                <input name="site_copy" required placeholder="请输入版权信息" value="{:sysconf('site_copy')}" class="layui-input">
-                <p class="help-block">程序的版权信息设置,在后台登录页面显示版本信息</p>
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">Miitbeian<br><span class="nowrap color-desc">网站备案号</span></label>
-            <div class="layui-input-block">
-                <input name="miitbeian" placeholder="请输入网站备案号" value="{:sysconf('miitbeian')}" class="layui-input">
-                <p class="help-block">网站备案号,可以在<a target="_blank" href="http://www.miitbeian.gov.cn">备案管理中心</a>查询获取,将在登录页面下面显示</p>
-            </div>
-        </div>
-        <div class="hr-line-dashed margin-left-40"></div>
-        <div class="layui-form-item text-center padding-bottom-10">
-            <button class="layui-btn" type="submit">保存配置</button>
-        </div>
+<div class="layui-tab layui-tab-card think-bg-white">
+    <ul class="layui-tab-title notselect">
+        <li data-type='website'>网站参数设置</li>
+        <li data-type="storage">文件存储配置</li>
+    </ul>
+    <div class="layui-tab-content">
+        <div class="layui-tab-item">{include file='config/info-website'}</div>
+        <div class="layui-tab-item">{include file='config/info-storage'}</div>
     </div>
-</form>
+</div>
+
+<script>
+    (function (storage) {
+        (function (type, $default, $checked) {
+            $default = $('.layui-tab ul.layui-tab-title li:first');
+            $checked = $('.layui-tab ul.layui-tab-title li[data-type="' + type + '"]');
+            ($checked.length > 0 ? $checked : $default).trigger('click');
+        })(layui.data(storage)['type'] || '');
+        $('.layui-tab ul.layui-tab-title li[data-type]').on('click', function () {
+            layui.data(storage, {key: 'type', value: this.getAttribute('data-type')});
+        });
+    })('website-config-type');
+</script>
+
 {/block}

+ 0 - 8
application/admin/view/index/command.html

@@ -1,8 +0,0 @@
-<div class="layui-code border-0 margin-0 padding-20" style="max-height:400px;overflow:auto">
-    {foreach $list as $vo}
-    <fieldset class="margin-bottom-10">
-        <legend><span class="layui-bg-gray padding-left-5 padding-right-5">{$vo.title|default='--'}</span></legend>
-        <div class="padding-bottom-10">{$vo.message|raw|default=''}</div>
-    </fieldset>
-    {/foreach}
-</div>

+ 17 - 24
application/admin/view/index/index.html

@@ -25,8 +25,15 @@
 
     <!-- 顶部菜单 开始 -->
     <div class="layui-header notselect">
-        <a href="{:url('@')}" class="layui-logo layui-elip">{:sysconf('app_name')} {if sysconf('app_version')}<sup class="padding-left-5">{:sysconf('app_version')}</sup>{/if}</a>
+        <a href="{:url('@')}" class="layui-logo layui-elip">
+            {:sysconf('app_name')} {if sysconf('app_version')}<sup class="padding-left-5">{:sysconf('app_version')}</sup>{/if}
+        </a>
         <ul class="layui-nav layui-layout-left">
+            <li class="layui-nav-item" lay-unselect>
+                <a class="text-center" data-target-menu-type>
+                    <i class="layui-icon layui-icon-spread-left"></i>
+                </a>
+            </li>
             {foreach $menus as $oneMenu}
             <li class="layui-nav-item">
                 <a data-menu-node="m-{$oneMenu.id}" data-open="{$oneMenu.url}">
@@ -38,16 +45,20 @@
         </ul>
         <ul class="layui-nav layui-layout-right">
             <li lay-unselect class="layui-nav-item"><a data-reload><i class="layui-icon layui-icon-refresh-3"></i></a></li>
-            {notempty name='Think.session.user'}
+            {notempty name='Think.session.admin_user.username'}
             <li class="layui-nav-item">
                 <dl class="layui-nav-child">
-                    <dd lay-unselect><a data-modal="{:url('admin/index/info',['id'=>session('user.id')])}"><i class="layui-icon layui-icon-set-fill margin-right-5"></i>基本资料</a></dd>
-                    <dd lay-unselect><a data-modal="{:url('admin/index/pass',['id'=>session('user.id')])}"><i class="layui-icon layui-icon-component margin-right-5"></i>安全设置</a></dd>
+                    <dd lay-unselect><a data-modal="{:url('admin/index/info',['id'=>session('admin_user.id')])}"><i class="layui-icon layui-icon-set-fill margin-right-5"></i>基本资料</a></dd>
+                    <dd lay-unselect><a data-modal="{:url('admin/index/pass',['id'=>session('admin_user.id')])}"><i class="layui-icon layui-icon-component margin-right-5"></i>安全设置</a></dd>
+                    {if auth('admin/index/buildoptimize')}
                     <dd lay-unselect><a data-modal="{:url('admin/index/buildOptimize')}"><i class="layui-icon layui-icon-template-1 margin-right-5"></i>压缩发布</a></dd>
+                    {/if}
+                    {if auth('admin/index/clearruntime')}
                     <dd lay-unselect><a data-modal="{:url('admin/index/clearRuntime')}"><i class="layui-icon layui-icon-fonts-clear margin-right-5"></i>清理缓存</a></dd>
+                    {/if}
                     <dd lay-unselect><a data-confirm="确定要退出登录吗?" data-load="{:url('admin/login/out')}"><i class="layui-icon layui-icon-release margin-right-5"></i>退出登录</a></dd>
                 </dl>
-                <a><span><i class="layui-icon layui-icon-username margin-right-5"></i> {:session('user.username')}</span></a>
+                <a><span><i class="layui-icon layui-icon-username margin-right-5"></i> {:session('admin_user.username')}</span></a>
             </li>
             {else}
             <li class="layui-nav-item">
@@ -61,9 +72,7 @@
     <!-- 左则菜单 开始 -->
     <div class="layui-side layui-bg-black notselect">
         <div class="layui-side-scroll">
-            <ul class="layui-nav layui-nav-tree layui-nav-tree-top">
-                <li class="layui-nav-item" lay-unselect><a class="text-center" data-target-menu-type><i class="layui-icon layui-icon-spread-left"></i></a></li>
-            </ul>
+
             {foreach $menus as $oneMenu}
             {notempty name='oneMenu.sub'}
             <ul class="layui-nav layui-nav-tree layui-hide" data-menu-layout="m-{$oneMenu.id}">
@@ -111,22 +120,6 @@
 <script src="__ROOT__/static/plugs/require/require.js"></script>
 <script src="__ROOT__/static/admin.js"></script>
 {block name='script'}{/block}
-{if session('user.id') and sysconf('system_message_state')}
-<script>
-    require(['spop'], function () {
-        (function syncMessage() {
-            $.get('{:url("@admin/api.message/gets")}').then(function (ret) {
-                if (ret.code && ret.data.length > 0) for (var i in ret.data) if ($('[data-message-code=' + ret.data[i].code + ']').size() < 1) spop({
-                    template: '<h4 data-message-code="' + ret.data[i].code + '" class="spop-title">' + ret.data[i].title + '</h4>' + ret.data[i].desc + '<span class="font-s10 color-desc pull-right"> ' + ret.data[i].create_at + ' </span>', position: 'bottom-right', style: 'success', group: ret.data[i].code, onClose: function () {
-                        $.post('{:url("@admin/api.message/set")}', {code: this.group});
-                    }
-                });
-                setTimeout(syncMessage, 3000)
-            });
-        })();
-    });
-</script>
-{/if}
 </body>
 
 </html>

+ 7 - 7
application/admin/view/login/index.html

@@ -1,13 +1,12 @@
 {extend name="admin@index/index"}
 
 {block name="body"}
-<div class="login-container full-height" data-supersized="__ROOT__/static/theme/img/login/bg1.jpg,__ROOT__/static/theme/img/login/bg2.jpg">
+<div class="login-container" data-supersized="__ROOT__/static/theme/img/login/bg1.jpg,__ROOT__/static/theme/img/login/bg2.jpg">
     <div class="header notselect layui-hide-xs">
-        <a href="{:url('@')}" class="title">{:sysconf('app_name')} <span class="padding-left-5 font-s10">{:sysconf('app_version')}</span></a>
-        <ul>
-            <li class="layui-hide"><a target="_blank" href="http://document.framework.thinkadmin.top">在线帮助</a></li>
-            <li><a target="_blank" href="https://www.google.cn/chrome">推荐使用谷歌浏览器</a></li>
-        </ul>
+        <a href="{:url('@')}" class="title">{:sysconf('app_name')}<span class="padding-left-5 font-s10">{:sysconf('app_version')}</span></a>
+        <a class="pull-right layui-anim layui-anim-fadein" href='https://gitee.com/zoujingli/ThinkAdmin'>
+            <img src='https://gitee.com/zoujingli/ThinkAdmin/widgets/widget_1.svg' alt='Fork me on Gitee'>
+        </a>
     </div>
     <form data-login-form onsubmit="return false;" method="post" class="layui-anim layui-anim-upbit" autocomplete="off">
         <h2 class="notselect">系统管理</h2>
@@ -31,8 +30,9 @@
         </ul>
     </form>
     <div class="footer notselect">
+        <p class="layui-hide-xs"><a target="_blank" href="https://www.google.cn/chrome">推荐使用谷歌浏览器</a></p>
         {:sysconf('site_copy')}
-        {if sysconf('miitbeian')}<span>&nbsp;|&nbsp;</span><a target="_blank" href="http://www.miitbeian.gov.cn">{:sysconf('miitbeian')}</a>{/if}
+        {if sysconf('miitbeian')}<span class="padding-5">|</span><a target="_blank" href="http://www.miitbeian.gov.cn">{:sysconf('miitbeian')}</a>{/if}
     </div>
 </div>
 {/block}

+ 4 - 1
application/admin/view/menu/form.html

@@ -49,7 +49,7 @@
             <label class="layui-form-label">菜单图标</label>
             <div class="layui-input-block">
                 <div class="layui-input-inline">
-                    <input placeholder="请输入或选择图标" onchange="$(this).parent().next().find('i').get(0).className=this.value" name="icon" value='{$vo.icon|default=""}' class="layui-input">
+                    <input placeholder="请输入或选择图标" name="icon" value='{$vo.icon|default=""}' class="layui-input">
                 </div>
                 <span style="padding:0 12px;min-width:45px" class='layui-btn layui-btn-primary'>
                     <i style="font-size:1.2em" class='{$vo.icon|default=""} margin-0'></i>
@@ -74,6 +74,9 @@
 {block name='script'}
 <script>
     require(['jquery.autocompleter'], function () {
+        $('[name="icon"]').on('change', function () {
+            $(this).parent().next().find('i').get(0).className = this.value
+        });
         $('input[name=url]').autocompleter({
             limit: 6, highlightMatches: true, template: '{{ label }} <span> {{ title }} </span>', source: (function (subjects, data) {
                 for (var i in subjects) data.push({value: subjects[i].node, label: subjects[i].node, title: subjects[i].title});

+ 5 - 5
application/admin/view/menu/index.html

@@ -2,18 +2,18 @@
 
 {block name="button"}
 
-<!--{if auth("admin/menu/add")}-->
+{if auth("admin/menu/add")}
 <button data-modal='{:url("add")}' data-title="添加菜单" class='layui-btn layui-btn-sm layui-btn-primary'>添加菜单</button>
-<!--{/if}-->
+{/if}
 
-<!--{if auth("admin/menu/remove")}-->
+{if auth("admin/menu/remove")}
 <button data-action='{:url("remove")}' data-csrf="{:systoken('admin/menu/remove')}" data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除菜单</button>
-<!--{/if}-->
+{/if}
 
 {/block}
 
 {block name="content"}
-<div style="background:#fff">
+<div class="think-bg-white">
     {empty name='list'}
     <blockquote class="layui-elem-quote">没 有 记 录 哦!</blockquote>
     {else}

+ 0 - 98
application/admin/view/message/index.html

@@ -1,98 +0,0 @@
-{extend name='main'}
-
-{block name="button"}
-
-{if auth("admin/message/state")}
-<form class="layui-form inline-block StatusSwitch" action="">
-    {if sysconf('system_message_state')}
-    <input type="checkbox" checked lay-skin="switch" lay-filter="StatusSwitch" lay-text="开 启|关 闭">
-    {else}
-    <input type="checkbox" lay-skin="switch" lay-filter="StatusSwitch" lay-text="开 启|关 闭">
-    {/if}
-    <script>
-        form.on('switch(StatusSwitch)', function () {
-            $.form.load('{:url("state")}', {}, 'get', function () {
-                return false;
-            });
-        });
-    </script>
-    <style>
-        form.StatusSwitch .layui-form-switch {
-            height: 28px;
-            line-height: 28px;
-            border-radius: 2px;
-            margin: 0 10px 0 0;
-        }
-
-        form.StatusSwitch .layui-form-switch i {
-            top: 6px;
-        }
-    </style>
-</form>
-{/if}
-
-{if auth("admin/message/clear")}
-<button data-load='{:url("clear")}' data-confirm="确定要清理所有消息记录吗?" class='layui-btn layui-btn-sm layui-btn-primary'>清理消息</button>
-{/if}
-
-{if auth("admin/message/remove")}
-<button data-action='{:url("remove")}' data-rule="id#{key}" data-confirm="确定要删除这些消息吗?" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</button>
-{/if}
-
-{/block}
-
-{block name="content"}
-
-<div class="think-box-shadow">
-
-    <table class="layui-table" lay-skin="line">
-        <caption class="margin-bottom-10 text-left">{include file='message/index_search'}</caption>
-        {notempty name='list'}
-        <thead>
-        <tr>
-            <th class='list-table-check-td think-checkbox'>
-                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
-            </th>
-            <th class='text-left nowrap'>消息信息</th>
-            <th class='text-left nowrap'>消息状态</th>
-            <th class='text-left nowrap'>创建时间</th>
-            <th class='text-left nowrap'></th>
-        </tr>
-        </thead>
-        {/notempty}
-        <tbody>
-        {foreach $list as $key=>$vo}
-        <tr>
-            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
-            <td class='text-left nowrap'>
-                <a class="color-text" href="{:url('@admin')}?messagecode={$vo.code}#{$vo.url|default=''}">{$vo.title|default=''}</a><br>
-                <span class="color-desc">{$vo.desc|default=''}</span><br>
-            </td>
-            <td class='text-left nowrap'>
-                消息状态:{if $vo.read_state}<span class="layui-badge layui-bg-green">已读取</span>{else}<span class="layui-badge layui-bg-blue">未读取</span>{/if}<br>
-                读取时间:{$vo.read_at|default='<span class="layui-badge layui-bg-blue">未读取</span>'|raw}<br>
-            </td>
-            <td class='text-left nowrap'>日期:{$vo.create_at|format_datetime|str_replace=' ','<br>时间:',###|raw}</td>
-            <td class='text-left nowrap'>
-
-                {if $vo.read_state eq 1 and auth("admin/message/read")}
-                <a class="layui-btn layui-btn-sm layui-btn-disabled">已 读</a>
-                {elseif auth("admin/message/read")}
-                <a class="layui-btn layui-btn-sm" data-action="{:url('read')}" data-value="id#{$vo.id};read_state#1">已 读</a>
-                {/if}
-
-                {if auth("admin/message/remove")}
-                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该消息吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
-                {/if}
-
-            </td>
-        </tr>
-        {/foreach}
-        </tbody>
-    </table>
-
-    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
-
-</div>
-
-{/block}

+ 0 - 57
application/admin/view/message/index_search.html

@@ -1,57 +0,0 @@
-<fieldset>
-
-    <legend class="layui-bg-cyan">条件搜索</legend>
-
-    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
-
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">消息标题</label>
-            <div class="layui-input-inline">
-                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入消息标题" class="layui-input">
-            </div>
-        </div>
-
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">消息描述</label>
-            <div class="layui-input-inline">
-                <input name="desc" value="{$Think.get.desc|default=''}" placeholder="请输入消息描述" class="layui-input">
-            </div>
-        </div>
-
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">读取状态</label>
-            <div class="layui-input-inline">
-                <select class="layui-select" name="read_state">
-                    {foreach [''=>'-- 全部状态 --','0'=>'未读取消息','1'=>'已读取消息'] as $k=>$v}
-                    {eq name='Think.get.read_state' value='$k.""'}
-                    <option selected value="{$k}">{$v}</option>
-                    {else}
-                    <option value="{$k}">{$v}</option>
-                    {/eq}
-                    {/foreach}
-                </select>
-            </div>
-        </div>
-
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">读取时间</label>
-            <div class="layui-input-inline">
-                <input data-date-range name="read_at" value="{$Think.get.read_at|default=''}" placeholder="请输入读取时间" class="layui-input">
-            </div>
-        </div>
-
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">创建时间</label>
-            <div class="layui-input-inline">
-                <input data-date-range name="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择创建时间" class="layui-input">
-            </div>
-        </div>
-
-        <div class="layui-form-item layui-inline">
-            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
-        </div>
-    </form>
-
-</fieldset>
-
-<script>form.render()</script>

+ 0 - 238
application/admin/view/node/index.html

@@ -1,238 +0,0 @@
-{extend name='main'}
-
-{block name='button'}
-{if auth("admin/node/clear")}
-<button data-load='{:url("clear")}' class='layui-btn layui-btn-sm layui-btn-primary'>清理记录</button>
-{/if}
-{/block}
-
-{block name='style'}
-<style>
-    .layui-table tr:last-child td {
-        border: none
-    }
-
-    .layui-table label {
-        margin-top: 0;
-        cursor: pointer
-    }
-
-    .layui-table .title-input {
-        width: auto;
-        height: 28px;
-        line-height: 28px
-    }
-</style>
-{/block}
-
-{block name="content"}
-<div class="layui-tab layui-tab-card layui-box" style="background:#fff">
-    <ul class="layui-tab-title notselect">
-        {foreach $groups as $key=>$group}
-        <li data-type='{$key}'>{$group.node.title|default='<span class="color-desc">未配置名称</span>'|raw}({$key})</li>
-        {/foreach}
-    </ul>
-    <div class="layui-tab-content padding-0">
-        {foreach $groups as $key=>$group}
-        <div class="layui-tab-item layui-anim layui-anim-upbit">
-            <table class="layui-table border-0 margin-0" lay-skin="line">
-                <!--{empty name='nodes'}-->
-                <p class="help-block text-center well">没 有 记 录 哦!</p>
-                <!--{else}-->
-                <!--{foreach $group.list as $key=>$vo}-->
-                <tr>
-                    <td class='text-left nowrap'>
-                        <span class="color-desc">{$vo.spl|raw}</span>{$vo.node}
-                        {if auth("admin/node/save")}
-                        <label class="margin-left-5 color-text">
-                            <input autocomplete="off" class='layui-input inline-block title-input' name='title' data-node="{$vo.node}" value="{$vo.title}">
-                        </label>
-                        {/if}
-                    </td>
-                    <td class='text-left nowrap text-middle'>
-                        {if auth("admin/node/save") and $vo.spt eq 1}
-                        <label class="color-desc think-checkbox">
-                            <input data-login-group="{$vo.node}" type="checkbox"> 全部加入登录控制
-                        </label>
-                        <label class="notselect margin-left-20 color-desc think-checkbox">
-                            <input data-auth-group="{$vo.node}" type="checkbox"> 全部加入权限控制
-                        </label>
-                        <label class="notselect margin-left-20 color-desc think-checkbox">
-                            <input data-menu-group="{$vo.node}" type="checkbox"> 全部加入菜单节点选择器
-                        </label>
-                        {/if}
-                        {if auth("admin/node/save") and $vo.spt eq 2}
-                        <span class="color-desc"> ├ </span>
-                        <label class="notselect margin-right-20 think-checkbox">
-                            <!--{notempty name='vo.is_login'}-->
-                            <input data-login-filter="{$vo.pnode}" checked='checked' class="check-box login_{$key}" type='checkbox' value='1' name='is_login' data-node="{$vo.node}" onclick="!this.checked && ($('.auth_{$key}')[0].checked = !!this.checked)">
-                            <!--{else}-->
-                            <input data-login-filter="{$vo.pnode}" class="check-box login_{$key}" type='checkbox' value='1' name='is_login' data-node="{$vo.node}" onclick="!this.checked && ($('.auth_{$key}')[0].checked = !!this.checked)">
-                            <!--{/notempty}-->
-                            加入登录控制
-                        </label>
-                        <span class="color-desc"> ├ </span>
-                        <label class="notselect margin-right-20 think-checkbox">
-                            <!--{notempty name='vo.is_auth'}-->
-                            <input data-auth-filter="{$vo.pnode}" name='is_auth' data-node="{$vo.node}" checked='checked' class="check-box auth_{$key}" type='checkbox' onclick="this.checked && ($('.login_{$key}')[0].checked = !!this.checked)" value='1'>
-                            <!--{else}-->
-                            <input data-auth-filter="{$vo.pnode}" name='is_auth' data-node="{$vo.node}" class="check-box auth_{$key}" type='checkbox' value='1' onclick="this.checked && ($('.login_{$key}')[0].checked = !!this.checked)">
-                            <!--{/notempty}-->
-                            加入权限控制
-                        </label>
-                        <span class="color-desc"> ├ </span>
-                        <label class="notselect think-checkbox">
-                            <!--{notempty name='vo.is_menu'}-->
-                            <input data-menu-filter="{$vo.pnode}" name='is_menu' data-node="{$vo.node}" checked='checked' class='check-box menu_{$key}' type='checkbox' value='1'>
-                            <!--{else}-->
-                            <input data-menu-filter="{$vo.pnode}" name='is_menu' data-node="{$vo.node}" class='check-box menu_{$key}' type='checkbox' value='1'>
-                            <!--{/notempty}-->
-                            加入菜单节点选择器
-                        </label>
-                        {/if}
-                    </td>
-                    <td data-tips-filter="{$vo.pnode}" class="loading-tips nowrap full-width"></td>
-                </tr>
-                <!--{/foreach}-->
-                <!--{/empty}-->
-            </table>
-        </div>
-        {/foreach}
-    </div>
-</div>
-
-<script>
-    $(function () {
-
-        $('.layui-tab ul.layui-tab-title li').on('click', function () {
-            layui.data('node', {key: 'type', value: this.getAttribute('data-type')});
-        });
-
-        (function () {
-            this.selectedType = layui.data('node')['type'] || '';
-            this.selectedItem = $('.layui-tab ul.layui-tab-title li[data-type="' + this.selectedType + '"]');
-            if (this.selectedItem.length < 1) this.selectedItem = $('.layui-tab ul.layui-tab-title li:first');
-            this.selectedItem.trigger('click');
-        }).call({});
-
-        syncLoginGroup.call(this);
-        $('[data-login-group]').on('click', function () {
-            var twoNode = this.getAttribute('data-login-group');
-            if (!checkRequestStatus(twoNode)) {
-                this.checked = !this.checked;
-                return $.msg.tips('正在处理中, 请稍候...');
-            }
-            var checked = !!this.checked;
-            $('[data-login-filter="' + twoNode + '"]').map(function () {
-                if (!(this.checked = checked)) {
-                    $('[data-auth-filter="' + twoNode + '"]').map(function () {
-                        this.checked = false;
-                    });
-                }
-                update(this);
-            });
-        });
-
-        syncAuthGroup.call(this);
-        $('[data-auth-group]').on('click', function () {
-            var twoNode = this.getAttribute('data-auth-group');
-            if (!checkRequestStatus(twoNode)) {
-                this.checked = !this.checked;
-                return $.msg.tips('正在处理中, 请稍候...');
-            }
-            var checked = !!this.checked;
-            $('[data-auth-filter="' + twoNode + '"]').map(function () {
-                if ((this.checked = checked)) {
-                    $('[data-login-filter="' + twoNode + '"]').map(function () {
-                        this.checked = checked;
-                    });
-                }
-                update(this);
-            });
-        });
-
-        syncMenuGroup.call(this);
-        $('[data-menu-group]').on('click', function () {
-            var twoNode = this.getAttribute('data-menu-group');
-            if (!checkRequestStatus(twoNode)) {
-                this.checked = !this.checked;
-                return $.msg.tips('正在处理中, 请稍候...');
-            }
-            var checked = !!this.checked;
-            $('[data-menu-filter="' + twoNode + '"]').map(function () {
-                this.checked = checked;
-                update(this);
-            });
-        });
-
-        // 更新触发更新
-        $('input.check-box').on('click', function () {
-            update(this);
-        });
-
-        $('input.title-input').on('blur', function () {
-            update(this);
-        });
-
-        // 数据自动更新
-        function update(self) {
-            var $item = $(self).parents('tr'), data = {list: []};
-            $item.find('input').map(function () {
-                var value = this.type === 'text' ? this.value : (this.checked ? 1 : 0);
-                data.list.push({name: this.name, value: value, node: this.getAttribute('data-node')});
-            });
-            $item.find('.loading-tips').html('<p class="color-green"><i class="fa fa-spinner fa-spin"></i> 更新数据...</p>');
-            $.form.load('{:url("save")}', data, 'post', function (ret) {
-                if (ret.code === 0) {
-                    var tips = '<p class="color-red"><i class="fa fa-close"></i> 更新异常</p>';
-                    return $item.find('.loading-tips').html(tips), false;
-                }
-                return $item.find('.loading-tips').html(''), false;
-            }, false);
-            return syncLoginGroup(), syncMenuGroup(), syncAuthGroup();
-        }
-
-        // 状态网络处理状态
-        function checkRequestStatus(twoNode) {
-            var status = true;
-            $('.loading-tips[data-tips-filter="' + twoNode + '"]').map(function () {
-                $(this).html() && (status = false);
-            });
-            return status;
-        }
-
-        // 同步登录分组状态
-        function syncLoginGroup() {
-            $('[data-login-group]').map(function () {
-                var node = this.getAttribute('data-login-group'), checked = true;
-                $('[data-login-filter="' + node + '"]').map(function () {
-                    this.checked || (checked = false);
-                });
-                this.checked = checked;
-            });
-        }
-
-        // 同步权限分组状态
-        function syncAuthGroup() {
-            $('[data-auth-group]').map(function () {
-                var node = this.getAttribute('data-auth-group'), checked = true;
-                $('[data-auth-filter="' + node + '"]').map(function () {
-                    this.checked || (checked = false);
-                });
-                this.checked = checked;
-            });
-        }
-
-        // 同步菜单分组状态
-        function syncMenuGroup() {
-            $('[data-menu-group]').map(function () {
-                var node = this.getAttribute('data-menu-group'), checked = true;
-                $('[data-menu-filter="' + node + '"]').map(function () {
-                    this.checked || (checked = false);
-                });
-                this.checked = checked;
-            });
-        }
-    });
-</script>
-{/block}

+ 6 - 4
application/admin/view/oplog/index.html

@@ -14,8 +14,8 @@
 
 {block name="content"}
 <div class="think-box-shadow">
-    <table class="layui-table" lay-skin="line">
-        <caption class="margin-bottom-10 text-left">{include file='oplog/index_search'}</caption>
+    {include file='oplog/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
         {notempty name='list'}
         <thead>
         <tr>
@@ -46,7 +46,9 @@
                 <p class="color-text">{$vo.geoip|default='-'}</p>
                 <p class="color-desc">{$vo.isp|default='-'}</p>
             </td>
-            <td class='text-left nowrap'>{$vo.create_at|format_datetime}</td>
+            <td class='text-left nowrap'>
+                日期:{$vo.create_at|format_datetime|str_replace=' ','<br><span class="color-desc">时间:',###|raw}</span>
+            </td>
             <td class='text-left nowrap'>
                 {if auth("admin/oplog/remove")}
                 <a data-dbclick class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该日志吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('admin/oplog/remove')}">删 除</a>
@@ -62,4 +64,4 @@
 
 </div>
 
-{/block}
+{/block}

+ 1 - 1
application/admin/view/oplog/index_search.html

@@ -1,6 +1,6 @@
 <fieldset>
 
-    <legend class="layui-bg-cyan">条件搜索</legend>
+    <legend>条件搜索</legend>
 
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
 

+ 11 - 14
application/admin/view/queue/index.html

@@ -2,18 +2,17 @@
 
 {block name="button"}
 
-<!--{if auth("admin/queue/remove")}-->
+{if auth("admin/queue/remove")}
 <button data-action='{:url("remove")}' data-confirm="确定要删除这些任务吗?" data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除任务</button>
-<!--{/if}-->
+{/if}
 
 {/block}
 
 {block name="content"}
 
 <div class="think-box-shadow">
-
-    <table class="layui-table" lay-skin="line">
-        <caption class="margin-bottom-10 text-left">{include file='queue/index_search'}</caption>
+    {include file='queue/index_search'}
+    <table class="layui-table margin-top-15" lay-skin="line">
         {notempty name='list'}
         <thead>
         <tr>
@@ -38,13 +37,12 @@
                 任务指令:{$vo.uri}
             </td>
             <td class='text-left nowrap'>
-                创建时间:<span class="layui-badge layui-bg-gray">{$vo.create_at|format_datetime|raw}</span>
+                创建时间:{$vo.create_at|format_datetime|raw}
                 <br>
-                跟进时间:<span class="layui-badge layui-bg-gray">{$vo.status_at|format_datetime|raw}</span>
+                跟进时间:{$vo.status_at|format_datetime|raw}
             </td>
             <td class='text-left nowrap'>
-                任务状态:
-                {eq name='vo.double' value='1'}
+                任务状态:{eq name='vo.double' value='1'}
                 <span class="layui-badge layui-bg-green margin-right-5">复</span>
                 {else}
                 <span class="layui-badge layui-bg-blue margin-right-5">单</span>
@@ -62,14 +60,13 @@
                     <i class="layui-icon font-s12">&#xe669;</i>
                 </a>
                 {/eq}
-                <!--{if auth("admin/queue/remove") and in_array($vo.status,[1,3,4])}-->
+                {if auth("admin/queue/remove") and in_array($vo.status,[1,3,4])}
                 <a data-action='{:url("remove")}' data-confirm="确定要删除该任务吗?" data-value="id#{$vo.id}" data-tips-text="删除该任务" class='layui-badge layui-bg-red margin-left-5'>
                     <i class="layui-icon">&#xe640;</i>
                 </a>
-                <!--{/if}-->
+                {/if}
                 <br>
-                状态描述:
-                <span class="layui-badge layui-bg-gray">{$vo.status_desc|raw|default="<span class='color-desc'>没有获取到状态描述</span>"}</span>
+                状态描述:<span class="color-desc">{$vo.status_desc|raw|default="没有获取到状态描述"}</span>
             </td>
         </tr>
         {/foreach}
@@ -79,4 +76,4 @@
     {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
 
 </div>
-{/block}
+{/block}

+ 3 - 3
application/admin/view/queue/index_search.html

@@ -1,6 +1,6 @@
-{if session('user.username') eq 'admin'}
+{if session('admin_user.username') eq 'admin'}
 <fieldset class="margin-bottom-10">
-    <legend class="layui-bg-cyan">进程守护</legend>
+    <legend>进程守护</legend>
     <div class="layui-code border-0 margin-top-0">
         <p class="color-desc margin-top-10">当前消息队列守护进程运行状态</p>
         {$message|raw|default='--'}
@@ -10,7 +10,7 @@
 </fieldset>
 {/if}
 <fieldset>
-    <legend class="layui-bg-cyan">条件搜索</legend>
+    <legend>条件搜索</legend>
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
         <div class="layui-form-item layui-inline">
             <label class="layui-form-label">任务名称</label>

+ 0 - 40
application/admin/view/user/auth.html

@@ -1,40 +0,0 @@
-<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
-    <div class="layui-card-body">
-        <div class="layui-form-item">
-            <label class="layui-form-label">用户账号</label>
-            <div class="layui-input-block">
-                <!--{if isset($vo) and isset($vo.username)}-->
-                <input type="text" disabled value='{$vo.username|default=""}' class="layui-input layui-bg-gray">
-                <!--{else}-->
-                <input type="text" name="username" value='{$vo.username|default=""}' required placeholder="请输入用户名称" class="layui-input">
-                <!--{/if}-->
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label">访问授权</label>
-            <div class="layui-input-block">
-                {if isset($vo.username) and $vo.username eq 'admin'}
-                <span class="color-desc" style="line-height:36px">超级用户不需要配置权限</span>
-                {else}
-                {foreach $authorizes as $authorize}
-                <label class="think-checkbox">
-                    {if in_array($authorize.id, $vo.authorize)}
-                    <input type="checkbox" checked name="authorize[]" value="{$authorize.id}" lay-ignore> {$authorize.title}
-                    {else}
-                    <input type="checkbox" name="authorize[]" value="{$authorize.id}" lay-ignore> {$authorize.title}
-                    {/if}
-                </label>
-                {/foreach}
-                {empty name='authorizes'}<span class="color-desc" style="line-height:36px">未配置权限</span>{/empty}
-                {/if}
-            </div>
-        </div>
-    </div>
-    <div class="hr-line-dashed"></div>
-    <div class="layui-form-item text-center">
-        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
-        <button class="layui-btn" type='submit'>保存数据</button>
-        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
-    </div>
-    <script>window.form.render();</script>
-</form>

+ 18 - 23
application/admin/view/user/index.html

@@ -14,19 +14,20 @@
 
 {block name="content"}
 <div class="think-box-shadow">
-
-    <table class="layui-table" lay-skin="line">
-        <caption class="margin-bottom-10 text-left">{include file='user/index_search'}</caption>
+    {include file='user/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
         {notempty name='list'}
         <thead>
         <tr>
             <th class='list-table-check-td think-checkbox'>
-                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
             </th>
-            <th class='text-left nowrap' style="width:120px">用户名</th>
-            <th class='text-left nowrap' style="width:120px">账号状态</th>
-            <th class='text-left nowrap' style="width:180px">创建时间</th>
-            <th class='text-left nowrap' style="width:150px">最后登录</th>
+            <th class='text-left nowrap'>用户账号</th>
+            <th class='text-left nowrap'>联系手机</th>
+            <th class='text-center nowrap'>登录次数</th>
+            <th class='text-center nowrap'>使用状态</th>
+            <th class='text-left nowrap'>创建时间</th>
+            <th class='text-left nowrap'>登录时间</th>
             <th class='text-left nowrap'></th>
         </tr>
         </thead>
@@ -34,23 +35,17 @@
         <tbody>
         {foreach $list as $key=>$vo}
         <tr data-dbclick>
-            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
-            <td class='text-left nowrap'>
-                用户账号:{$vo.username|default=''}<br>
-                联系手机:{$vo.phone|default='-'}
-            </td>
-            <td class='text-left nowrap'>
-                登录次数:{$vo.login_num|default=0}<br>
-                使用状态:{eq name='vo.status' value='0'}<span class="color-red">已禁用</span>{else}<span class="color-green">使用中</span>{/eq}
+            <td class='list-table-check-td think-checkbox'>
+                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
             </td>
-            <td class='text-left nowrap'>日期:{$vo.create_at|format_datetime|str_replace=' ','<br>时间:',###|raw}</td>
-            <td class='text-left nowrap'>{if $vo.login_num>0}日期:{$vo.login_at|format_datetime|str_replace=' ','<br>时间:',###|raw}{else} -- {/if}</td>
+            <td class='text-left nowrap'>{$vo.username|default=''}</td>
+            <td class='text-left nowrap'>{$vo.phone|default='-'}</td>
+            <td class='text-center nowrap'>{$vo.login_num|default=0}</td>
+            <td class='text-center nowrap'>{eq name='vo.status' value='0'}<span class="color-red">已禁用</span>{else}<span class="color-green">使用中</span>{/eq}</td>
+            <td class='text-left nowrap'>{$vo.create_at|format_datetime}</td>
+            <td class='text-left nowrap'>{if $vo.login_num>0}{$vo.login_at|format_datetime}{else} - {/if}</td>
             <td class='text-left nowrap'>
 
-                {if auth("admin/user/auth")}
-                <a class="layui-btn layui-btn-primary layui-btn-sm" data-title="用户授权" data-modal='{:url("auth")}?id={$vo.id}'>授 权</a>
-                {/if}
-
                 {if auth("admin/user/pass")}
                 <a class="layui-btn layui-btn-normal layui-btn-sm" data-title="设置密码" data-modal='{:url("pass")}?id={$vo.id}'>密 码</a>
                 {/if}
@@ -61,7 +56,7 @@
 
                 {if $vo.status eq 1 and auth("admin/user/forbid")}
                 <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('admin/user/forbid')}">禁 用</a>
-                {elseif auth("admin/user/resume")}
+                {elseif $vo.status eq 0 and auth("admin/user/resume")}
                 <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('admin/user/resume')}">启 用</a>
                 {/if}
 

+ 1 - 1
application/admin/view/user/index_search.html

@@ -1,6 +1,6 @@
 <fieldset>
 
-    <legend class="layui-bg-cyan">条件搜索</legend>
+    <legend>条件搜索</legend>
 
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
 

+ 4 - 4
application/index/controller/Index.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\index\controller;
@@ -30,5 +31,4 @@ class Index extends Controller
     {
         $this->redirect('@admin/login');
     }
-
 }

+ 23 - 10
application/service/controller/Config.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\service\controller;
@@ -31,20 +32,32 @@ class Config extends Controller
     public $table = 'WechatServiceConfig';
 
     /**
-     * 开放平台参数配置
+     * 开放平台配置
+     * @auth true
+     * @menu true
+     */
+    public function index()
+    {
+        $this->applyCsrfToken('save');
+        $this->title = '开放平台配置';
+        $this->fetch();
+    }
+
+    /**
+     * 保存参数数据
+     * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
-    public function index()
+    public function save()
     {
-        $this->applyCsrfToken();
-        $this->title = '开放平台接口配置';
-        if ($this->request->isGet()) {
-            $this->fetch();
-        } else {
+        $this->applyCsrfToken('save');
+        if ($this->request->post()) {
             $post = $this->request->post();
             foreach ($post as $k => $v) sysconf($k, $v);
             $this->success('开放平台参数修改成功!');
+        } else {
+            $this->error('开放平台参数修改失败!');
         }
     }
 

+ 14 - 5
application/service/controller/Index.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\service\controller;
@@ -34,6 +35,8 @@ class Index extends Controller
 
     /**
      * 公众授权管理
+     * @auth true
+     * @menu true
      * @return string
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -51,6 +54,7 @@ class Index extends Controller
 
     /**
      * 清理调用次数
+     * @auth true
      * @throws \WeChat\Exceptions\InvalidResponseException
      * @throws \WeChat\Exceptions\LocalCacheException
      */
@@ -69,6 +73,7 @@ class Index extends Controller
 
     /**
      * 同步指定授权公众号
+     * @auth true
      */
     public function sync()
     {
@@ -94,6 +99,7 @@ class Index extends Controller
 
     /**
      * 同步所有授权公众号
+     * @auth true
      */
     public function syncall()
     {
@@ -123,8 +129,9 @@ class Index extends Controller
 
     /**
      * 删除公众号授权
+     * @auth true
      */
-    public function del()
+    public function remove()
     {
         $this->applyCsrfToken();
         $this->_delete($this->table);
@@ -132,6 +139,7 @@ class Index extends Controller
 
     /**
      * 禁用公众号授权
+     * @auth true
      */
     public function forbid()
     {
@@ -141,10 +149,11 @@ class Index extends Controller
 
     /**
      * 启用公众号授权
+     * @auth true
      */
     public function resume()
     {
         $this->applyCsrfToken();
         $this->_save($this->table, ['status' => '1']);
     }
-}
+}

+ 5 - 4
application/service/controller/api/Client.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\service\controller\api;
@@ -151,4 +152,4 @@ class Client extends Controller
         return true;
     }
 
-}
+}

+ 4 - 3
application/service/controller/api/Push.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\service\controller\api;

+ 4 - 3
application/service/handler/PublishHandler.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\service\handler;

+ 4 - 3
application/service/handler/ReceiveHandler.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\service\handler;

+ 5 - 4
application/service/handler/WechatHandler.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\service\handler;
@@ -157,4 +158,4 @@ class WechatHandler
         return WechatLogic::WeChatScript($this->appid)->getJsSign($url);
     }
 
-}
+}

+ 5 - 4
application/service/service/BuildService.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\service\service;
@@ -49,4 +50,4 @@ class BuildService
         return $info;
     }
 
-}
+}

+ 4 - 3
application/service/service/WechatService.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\service\service;

+ 1 - 1
application/service/view/config/index.html

@@ -11,7 +11,7 @@
         <div class="layui-col-lg6">
             <fieldset class="think-box-shadow">
                 <legend class="layui-bg-cyan">授权参数</legend>
-                <form onsubmit="return false;" data-auto="true" method="post" class='layui-form padding-left-20 padding-right-20' autocomplete="off">
+                <form onsubmit="return false;" action="{:url('save')}" data-auto="true" method="post" class='layui-form padding-left-20 padding-right-20' autocomplete="off">
                     <div class="layui-form-item">
                         <label class="relative block">
                             <span class="color-green">开放平台服务 AppID</span>

+ 8 - 7
application/service/view/index/index.html

@@ -1,16 +1,17 @@
 {extend name="admin@main"}
 
 {block name="button"}
-<!--{if auth("service/index/syncall")}-->
+
+{if auth("service/index/syncall")}
 <button data-load="{:url('syncall')}" class='layui-btn layui-btn-sm layui-btn-primary'>同步授权信息</button>
-<!--{/if}-->
+{/if}
+
 {/block}
 
 {block name="content"}
 <div class="think-box-shadow">
-
-    <table class="layui-table" lay-skin="line">
-        <caption class="margin-bottom-10 text-left">{include file='index/index_search'}</caption>
+    {include file='index/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
         {notempty name='list'}
         <thead>
         <tr>
@@ -62,8 +63,8 @@
                 <a class="layui-btn layui-btn-sm" data-load='{:url("service/index/sync")}?appid={$vo.authorizer_appid}'>同 步</a>
                 {/if}
 
-                {if auth("service/index/del")}
-                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该公众号吗?" data-action="{:url('del')}" data-csrf="{:systoken('service/index/del')}" data-value="id#{$vo.id}">删 除</a>
+                {if auth("service/index/remove")}
+                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该公众号吗?" data-action="{:url('remove')}" data-csrf="{:systoken('service/index/remove')}" data-value="id#{$vo.id}">删 除</a>
                 {/if}
 
                 {if auth("service/index/clearquota")}

+ 1 - 1
application/service/view/index/index_search.html

@@ -1,6 +1,6 @@
 <fieldset>
 
-    <legend class="layui-bg-cyan">条件搜索</legend>
+    <legend>条件搜索</legend>
 
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
 

+ 5 - 4
application/store/command/AutoRun.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\command;
@@ -184,4 +185,4 @@ class AutoRun extends \think\console\Command
         return date('Y-m-d H:i:s', strtotime("-{$minutes} minutes"));
     }
 
-}
+}

+ 15 - 20
application/store/controller/Config.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller;
@@ -27,38 +28,32 @@ class Config extends Controller
 
     /**
      * 商城参数配置
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
     public function index()
     {
-        $this->applyCsrfToken();
         $this->title = '商城参数配置';
-        if ($this->request->isGet()) {
-            $this->query = ExtendService::querySmsBalance();
-            $this->fetch();
-        } else {
-            foreach ($this->request->post() as $k => $v) sysconf($k, $v);
-            $this->success('商城参数配置保存成功!');
-        }
+        $this->applyCsrfToken('save');
+        $this->query = ExtendService::querySmsBalance();
+        $this->fetch();
     }
 
     /**
-     * 商城短信配置
+     * 保存商城参数
+     * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
-    public function sms()
+    public function save()
     {
-        $this->applyCsrfToken();
-        $this->title = '商城短信配置';
-        if ($this->request->isGet()) {
-            $this->query = ExtendService::querySmsBalance();
-            $this->fetch();
-        } else {
+        if ($this->request->isPost()) {
+            $this->applyCsrfToken('save');
             foreach ($this->request->post() as $k => $v) sysconf($k, $v);
             $this->success('商城短信配置保存成功!');
         }
     }
 
-}
+}

+ 14 - 5
application/store/controller/ExpressCompany.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller;
@@ -32,6 +33,8 @@ class ExpressCompany extends Controller
 
     /**
      * 快递公司管理
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -42,11 +45,12 @@ class ExpressCompany extends Controller
     {
         $this->title = '快递公司管理';
         $query = $this->_query($this->table)->equal('status')->like('express_title,express_code');
-        $query->dateBetween('create_at')->order('status desc,sort asc,id desc')->page();
+        $query->dateBetween('create_at')->order('status desc,sort desc,id desc')->page();
     }
 
     /**
      * 添加快递公司
+     * @auth true
      */
     public function add()
     {
@@ -55,6 +59,7 @@ class ExpressCompany extends Controller
 
     /**
      * 编辑快递公司
+     * @auth true
      */
     public function edit()
     {
@@ -64,6 +69,7 @@ class ExpressCompany extends Controller
     /**
      * 表单数据处理
      * @param array $data
+     * @auth true
      */
     protected function _form_filter(array $data)
     {
@@ -78,6 +84,7 @@ class ExpressCompany extends Controller
 
     /**
      * 禁用快递公司
+     * @auth true
      */
     public function forbid()
     {
@@ -86,6 +93,7 @@ class ExpressCompany extends Controller
 
     /**
      * 启用快递公司
+     * @auth true
      */
     public function resume()
     {
@@ -94,10 +102,11 @@ class ExpressCompany extends Controller
 
     /**
      * 删除快递公司
+     * @auth true
      */
     public function remove()
     {
         $this->_delete($this->table);
     }
 
-}
+}

+ 0 - 92
application/store/controller/ExpressProvince.php

@@ -1,92 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------
-// | framework
-// +----------------------------------------------------------------------
-// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
-// +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
-// +----------------------------------------------------------------------
-// | 开源协议 ( https://mit-license.org )
-// +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
-// +----------------------------------------------------------------------
-
-namespace app\store\controller;
-
-use library\Controller;
-
-/**
- * 配送省份管理
- * Class Area
- * @package app\store\controller
- */
-class ExpressProvince extends Controller
-{
-    /**
-     * 绑定数据表
-     * @var string
-     */
-    protected $table = 'StoreExpressProvince';
-
-    /**
-     * 配送省份管理
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function index()
-    {
-        $this->title = '配送省份管理';
-        $this->_query($this->table)->like('title')->equal('status')->dateBetween('create_at')->order('sort asc,id desc')->page();
-    }
-
-
-    /**
-     * 添加配送省份
-     */
-    public function add()
-    {
-        $this->applyCsrfToken();
-        $this->_form($this->table, 'form');
-    }
-
-    /**
-     * 编辑配送省份
-     */
-    public function edit()
-    {
-        $this->applyCsrfToken();
-        $this->_form($this->table, 'form');
-    }
-
-    /**
-     * 启用配送省份
-     */
-    public function resume()
-    {
-        $this->applyCsrfToken();
-        $this->_save($this->table, ['status' => '1']);
-    }
-
-    /**
-     * 禁用配送省份
-     */
-    public function forbid()
-    {
-        $this->applyCsrfToken();
-        $this->_save($this->table, ['status' => '0']);
-    }
-
-    /**
-     * 删除配送省份
-     */
-    public function remove()
-    {
-        $this->applyCsrfToken();
-        $this->_delete($this->table);
-    }
-
-}

+ 22 - 13
application/store/controller/ExpressTemplate.php

@@ -1,9 +1,21 @@
 <?php
 
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
 namespace app\store\controller;
 
 use library\Controller;
-use library\tools\Data;
 use think\Db;
 
 /**
@@ -21,21 +33,17 @@ class ExpressTemplate extends Controller
 
     /**
      * 邮费模板管理
-     */
-    public function index()
-    {
-        $this->title = '邮费模板管理';
-    }
-
-    /**
-     * 显示邮费模板
+     * @auth true
+     * @menu true
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    protected function _index_get()
+    public function index()
     {
-        $this->provinces = Db::name('StoreExpressProvince')->where(['status' => '1'])->order('sort asc,id desc')->column('title');
+        $this->title = '邮费模板管理';
+        $filename = env('root_path') . 'public/static/plugs/jquery/area/area.json';
+        $this->provinces = array_column(json_decode(file_get_contents($filename), true), 'name');
         $this->list = Db::name($this->table)->where(['is_default' => '0'])->select();
         foreach ($this->list as &$item) $item['rule'] = explode(',', $item['rule']);
         $this->default = Db::name($this->table)->where(['is_default' => '1'])->find();
@@ -44,10 +52,11 @@ class ExpressTemplate extends Controller
 
     /**
      * 保存邮费模板
+     * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
-    protected function _index_post()
+    public function save()
     {
         list($list, $idxs, $post) = [[], [], $this->request->post()];
         foreach (array_keys($post) as $key) if (stripos($key, 'order_reduction_state_') !== false) {
@@ -73,4 +82,4 @@ class ExpressTemplate extends Controller
         $this->success('邮费规则配置成功!');
     }
 
-}
+}

+ 33 - 26
application/store/controller/Goods.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller;
@@ -33,7 +34,8 @@ class Goods extends Controller
 
     /**
      * 商品信息管理
-     * @return mixed
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -43,7 +45,8 @@ class Goods extends Controller
     public function index()
     {
         $this->title = '商品信息管理';
-        $this->_query($this->table)->equal('status,cate_id')->like('title')->where(['is_deleted' => '0'])->order('sort asc,id desc')->page();
+        $query = $this->_query($this->table)->equal('status,cate_id')->like('title');
+        $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
     }
 
     /**
@@ -66,7 +69,7 @@ class Goods extends Controller
 
     /**
      * 商品库存入库
-     * @return mixed
+     * @auth true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -80,44 +83,45 @@ class Goods extends Controller
             $goods = Db::name('StoreGoods')->where(['id' => $GoodsId])->find();
             empty($goods) && $this->error('无效的商品信息,请稍候再试!');
             $goods['list'] = Db::name('StoreGoodsList')->where(['goods_id' => $GoodsId])->select();
-            return $this->fetch('', ['vo' => $goods]);
-        }
-        list($post, $data) = [$this->request->post(), []];
-        if (isset($post['id']) && isset($post['goods_id']) && is_array($post['goods_id'])) {
-            foreach (array_keys($post['goods_id']) as $key) if ($post['goods_number'][$key] > 0) array_push($data, [
-                'goods_id'     => $post['goods_id'][$key],
-                'goods_spec'   => $post['goods_spec'][$key],
-                'number_stock' => $post['goods_number'][$key],
-            ]);
-            if (!empty($data)) {
-                Db::name('StoreGoodsStock')->insertAll($data);
-                \app\store\service\GoodsService::syncStock($post['id']);
-                $this->success('商品信息入库成功!');
+            $this->fetch('', ['vo' => $goods]);
+        } else {
+            list($post, $data) = [$this->request->post(), []];
+            if (isset($post['id']) && isset($post['goods_id']) && is_array($post['goods_id'])) {
+                foreach (array_keys($post['goods_id']) as $key) if ($post['goods_number'][$key] > 0) array_push($data, [
+                    'goods_id'     => $post['goods_id'][$key],
+                    'goods_spec'   => $post['goods_spec'][$key],
+                    'number_stock' => $post['goods_number'][$key],
+                ]);
+                if (!empty($data)) {
+                    Db::name('StoreGoodsStock')->insertAll($data);
+                    \app\store\service\GoodsService::syncStock($post['id']);
+                    $this->success('商品信息入库成功!');
+                }
             }
+            $this->error('没有需要商品入库的数据!');
         }
-        $this->error('没有需要商品入库的数据!');
     }
 
     /**
      * 添加商品信息
-     * @return mixed
+     * @auth true
      */
     public function add()
     {
         $this->title = '添加商品信息';
         $this->isAddMode = '1';
-        return $this->_form($this->table, 'form');
+        $this->_form($this->table, 'form');
     }
 
     /**
      * 编辑商品信息
-     * @return mixed
+     * @auth true
      */
     public function edit()
     {
         $this->title = '编辑商品信息';
         $this->isAddMode = '0';
-        return $this->_form($this->table, 'form');
+        $this->_form($this->table, 'form');
     }
 
     /**
@@ -137,7 +141,7 @@ class Goods extends Controller
             $fields = 'goods_spec,goods_id,status,price_market market,price_selling selling,number_virtual `virtual`,number_express express';
             $defaultValues = Db::name('StoreGoodsList')->where(['goods_id' => $data['id']])->column($fields);
             $this->defaultValues = json_encode($defaultValues, JSON_UNESCAPED_UNICODE);
-            $this->cates = Db::name('StoreGoodsCate')->where(['is_deleted' => '0', 'status' => '1'])->order('sort asc,id desc')->select();
+            $this->cates = Db::name('StoreGoodsCate')->where(['is_deleted' => '0', 'status' => '1'])->order('sort desc,id desc')->select();
         } elseif ($this->request->isPost()) {
             Db::name('StoreGoodsList')->where(['goods_id' => $data['id']])->update(['status' => '0']);
             foreach (json_decode($data['lists'], true) as $vo) Data::save('StoreGoodsList', [
@@ -165,6 +169,7 @@ class Goods extends Controller
 
     /**
      * 禁用商品信息
+     * @auth true
      */
     public function forbid()
     {
@@ -173,6 +178,7 @@ class Goods extends Controller
 
     /**
      * 启用商品信息
+     * @auth true
      */
     public function resume()
     {
@@ -181,10 +187,11 @@ class Goods extends Controller
 
     /**
      * 删除商品信息
+     * @auth true
      */
     public function remove()
     {
         $this->_delete($this->table);
     }
 
-}
+}

+ 18 - 12
application/store/controller/GoodsCate.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller;
@@ -31,6 +32,8 @@ class GoodsCate extends Controller
 
     /**
      * 商品分类管理
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -40,32 +43,33 @@ class GoodsCate extends Controller
     public function index()
     {
         $this->title = '商品分类管理';
-        $where = ['is_deleted' => '0'];
-        $this->_query($this->table)->like('title')->equal('status')->where($where)->order('sort asc,id desc')->page();
+        $query = $this->_query($this->table)->like('title')->equal('status');
+        $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
     }
 
     /**
      * 添加商品分类
-     * @return mixed
+     * @auth true
      */
     public function add()
     {
         $this->title = '添加商品分类';
-        return $this->_form($this->table, 'form');
+        $this->_form($this->table, 'form');
     }
 
     /**
-     * 编辑添加商品分类
-     * @return mixed
+     * 编辑商品分类
+     * @auth true
      */
     public function edit()
     {
         $this->title = '编辑商品分类';
-        return $this->_form($this->table, 'form');
+        $this->_form($this->table, 'form');
     }
 
     /**
-     * 禁用添加商品分类
+     * 禁用商品分类
+     * @auth true
      */
     public function forbid()
     {
@@ -74,6 +78,7 @@ class GoodsCate extends Controller
 
     /**
      * 启用商品分类
+     * @auth true
      */
     public function resume()
     {
@@ -82,10 +87,11 @@ class GoodsCate extends Controller
 
     /**
      * 删除商品分类
+     * @auth true
      */
     public function remove()
     {
         $this->_delete($this->table);
     }
 
-}
+}

+ 7 - 4
application/store/controller/Member.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller;
@@ -31,6 +32,8 @@ class Member extends Controller
 
     /**
      * 会员信息管理
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -55,4 +58,4 @@ class Member extends Controller
         }
     }
 
-}
+}

+ 8 - 4
application/store/controller/Message.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller;
@@ -31,6 +32,8 @@ class Message extends Controller
 
     /**
      * 短信发送管理
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -46,10 +49,11 @@ class Message extends Controller
 
     /**
      * 删除短信记录
+     * @auth true
      */
     public function remove()
     {
         $this->_delete($this->table);
     }
 
-}
+}

+ 12 - 6
application/store/controller/Order.php

@@ -1,20 +1,22 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller;
 
 use library\Controller;
+use library\tools\Express;
 use think\Db;
 
 /**
@@ -32,6 +34,8 @@ class Order extends Controller
 
     /**
      * 订单记录管理
+     * @auth true
+     * @menu true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
@@ -70,6 +74,7 @@ class Order extends Controller
 
     /**
      * 修改快递管理
+     * @auth true
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
@@ -78,20 +83,21 @@ class Order extends Controller
     {
         if ($this->request->isGet()) {
             $where = ['is_deleted' => '0', 'status' => '1'];
-            $this->expressList = Db::name('StoreExpress')->where($where)->order('sort asc,id desc')->select();
+            $this->expressList = Db::name('StoreExpress')->where($where)->order('sort desc,id desc')->select();
         }
         $this->_form($this->table);
     }
 
     /**
      * 快递追踪查询
+     * @auth true
      */
     public function expressQuery()
     {
         list($code, $no) = [input('code', ''), input('no', '')];
         if (empty($no)) $this->error('快递编号不能为空!');
         if (empty($code)) $this->error('快递公司编码不能为空!');
-        $this->result = \library\tools\Express::query($code, $no);
+        $this->result = Express::query($code, $no);
         $this->fetch();
     }
 
@@ -116,4 +122,4 @@ class Order extends Controller
         }
     }
 
-}
+}

+ 5 - 4
application/store/controller/api/Express.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller\api;
@@ -34,4 +35,4 @@ class Express extends Controller
         $this->success('获取物流查询结果!', $result);
     }
 
-}
+}

+ 12 - 8
application/store/controller/api/Goods.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller\api;
@@ -66,7 +67,7 @@ class Goods extends Controller
             $where[] = ['cate_id', 'eq', $this->request->post('cate_id')];
         }
         $field = 'id,title,logo,cate_id,image,number_sales,number_stock,content,specs,lists';
-        $list = Db::name('StoreGoods')->field($field)->where($where)->order('sort asc,id desc')->select();
+        $list = Db::name('StoreGoods')->field($field)->where($where)->order('sort desc,id desc')->select();
         $goodsList = Db::name('StoreGoodsList')->whereIn('goods_id', array_unique(array_column($list, 'id')))->select();
         foreach ($list as &$vo) {
             $vo['list'] = [];
@@ -97,8 +98,11 @@ class Goods extends Controller
         $goods['specs'] = json_decode($goods['specs'], true);
         $goods['lists'] = json_decode($goods['lists'], true);
         $goods['list'] = Db::name('StoreGoodsList')->where(['goods_id' => $goods_id])->select();
-        if (empty($goods['list'])) $this->error('指定商品规格不存在,请更换商品ID重试!');
-        $this->success('获取商品信息成功!', $goods);
+        if (empty($goods['list'])) {
+            $this->error('指定商品规格不存在,请更换商品ID重试!');
+        } else {
+            $this->success('获取商品信息成功!', $goods);
+        }
     }
 
     /**
@@ -111,8 +115,8 @@ class Goods extends Controller
     {
         $where = ['is_deleted' => '0', 'status' => '1'];
         $field = 'id cate_id,logo cate_logo,title cate_title';
-        $list = Db::name('StoreGoodsCate')->field($field)->where($where)->order('sort asc,id desc')->select();
+        $list = Db::name('StoreGoodsCate')->field($field)->where($where)->order('sort desc,id desc')->select();
         $this->success('获取商品分类成功!', ['list' => $list]);
     }
 
-}
+}

+ 5 - 14
application/store/controller/api/Member.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller\api;
@@ -71,20 +72,10 @@ class Member extends Controller
         $this->member = Db::name('StoreMember')->where($where)->find();
         if (empty($this->member)) $this->error('无效的会员信息,请重新登录授权!');
         $this->member['nickname'] = emoji_decode($this->member['nickname']);
-        // 游客会员每月没有领取机会
-        $this->member['times_count'] = 0;
-        // 临时会员及VIP1每月只有1次领取机会
-        if (in_array(intval($this->member['vip_level']), [1, 2])) {
-            $this->member['times_count'] = 1;
-        }
-        // VIP2会员每月只有2次免费领取机会
-        if (intval($this->member['vip_level']) === 3) {
-            $this->member['times_count'] = 2;
-        }
         // 会员当前已经领取次数
         $where = [['mid', 'eq', $this->mid], ['status', 'in', ['2', '3', '4', '5']]];
         $this->member['times_used'] = Db::name('StoreOrder')->where($where)->count();
         return $this->member;
     }
 
-}
+}

+ 8 - 5
application/store/controller/api/Notify.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller\api;
@@ -39,7 +40,9 @@ class Notify
             if ($this->update($notify['out_trade_no'], $notify['transaction_id'], $notify['cash_fee'] / 100, 'wechat')) {
                 return $wechat->getNotifySuccessReply();
             }
-        } else return $wechat->getNotifySuccessReply();
+        } else {
+            return $wechat->getNotifySuccessReply();
+        }
     }
 
     /**
@@ -68,4 +71,4 @@ class Notify
         return $result !== false;
     }
 
-}
+}

+ 12 - 8
application/store/controller/api/Wechat.php

@@ -1,21 +1,23 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller\api;
 
 use library\Controller;
 use think\Db;
+use think\exception\HttpResponseException;
 
 /**
  * Class Wechat
@@ -44,9 +46,10 @@ class Wechat extends Controller
                 data_save('StoreMember', ['openid' => $result['openid']], 'openid');
                 $result['member'] = Db::name('StoreMember')->where(['openid' => $result['openid']])->find();
                 $this->success('授权CODE信息换取成功!', $result);
+            } else {
+                $this->error("[{$result['errcode']}] {$result['errmsg']}");
             }
-            $this->error("[{$result['errcode']}] {$result['errmsg']}");
-        } catch (\think\exception\HttpResponseException $exception) {
+        } catch (HttpResponseException $exception) {
             throw $exception;
         } catch (\Exception $exception) {
             $this->error("授权CODE信息换取失败,{$exception->getMessage()}");
@@ -76,13 +79,14 @@ class Wechat extends Controller
                 ], 'openid');
                 $result['member'] = Db::name('StoreMember')->where(['openid' => $result['openId']])->find();
                 $this->success('小程序加密数据解密成功!', $result);
+            } else {
+                $this->error('小程序加密数据解密失败,请稍候再试!');
             }
-        } catch (\think\exception\HttpResponseException $exception) {
+        } catch (HttpResponseException $exception) {
             throw $exception;
         } catch (\Exception $e) {
             $this->error("小程序加密数据解密失败,{$e->getMessage()}");
         }
-        $this->error('小程序加密数据解密失败,请稍候再试!');
     }
 
-}
+}

+ 5 - 4
application/store/controller/api/member/Address.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller\api\member;
@@ -124,4 +125,4 @@ class Address extends Member
         $this->error('设置默认收货地址失败!');
     }
 
-}
+}

+ 15 - 9
application/store/controller/api/member/Center.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller\api\member;
@@ -43,10 +44,11 @@ class Center extends Member
             $data['username'] = emoji_encode($this->request->post('username'));
         }
         if (empty($data)) $this->error('没有需要修改的数据哦!');
-        if (data_save('StoreMember', array_merge($data, ['id' => $this->mid]), 'id')) {
+        if (data_save('StoreMember', array_merge($data, ['id' => $this->mid]), 'id') !== false) {
             $this->success('会员资料更新成功!', $this->getMember());
+        } else {
+            $this->error('会员资料更新失败,请稍候再试!');
         }
-        $this->error('会员资料更新失败,请稍候再试!');
     }
 
     /**
@@ -82,8 +84,9 @@ class Center extends Member
         if (ExtendService::sendSms($this->mid, $phone, str_replace('{code}', $code, $content))) {
             $dtime = ($cache['time'] + 120 < time()) ? 0 : (120 - time() + $cache['time']);
             $this->success('短信验证码发送成功!', ['time' => $dtime]);
+        } else {
+            $this->error('短信发送失败,请稍候再试!');
         }
-        $this->error('短信发送失败,请稍候再试!');
     }
 
     /**
@@ -100,9 +103,12 @@ class Center extends Member
             $where = ['id' => $this->member['id']];
             if (Db::name('StoreMember')->where($where)->update(['phone' => $phone]) !== false) {
                 $this->success('手机绑定登录成功!');
+            } else {
+                $this->error('手机绑定登录失败,请稍候再试!');
             }
-        } else $this->error('短信验证码验证失败!');
-        $this->error('手机绑定登录失败,请稍候再试!');
+        } else {
+            $this->error('短信验证码验证失败!');
+        }
     }
 
     /**
@@ -113,4 +119,4 @@ class Center extends Member
         $this->success('获取会员资料成功!', $this->member);
     }
 
-}
+}

+ 31 - 17
application/store/controller/api/member/Order.php

@@ -1,23 +1,26 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\controller\api\member;
 
 use app\store\controller\api\Member;
 use app\store\service\GoodsService;
+use app\store\service\OrderService;
 use library\tools\Data;
 use think\Db;
+use think\exception\HttpResponseException;
 
 /**
  * 订单接口管理
@@ -97,7 +100,7 @@ class Order extends Member
             // 同步商品库存及销量
             foreach (array_unique(array_column($orderList, 'goods_id')) as $goodsId) GoodsService::syncStock($goodsId);
             $this->success('订单创建成功,请补全收货信息后支付!', ['order' => $order]);
-        } catch (\think\exception\HttpResponseException $exception) {
+        } catch (HttpResponseException $exception) {
             throw $exception;
         } catch (\Exception $e) {
             $this->error("创建订单失败,请稍候再试!{$e->getMessage()}");
@@ -141,8 +144,9 @@ class Order extends Member
         if (Db::name('StoreOrder')->where($map)->update($update) !== false) {
             $params = $this->getPayParams($order['order_no'], $order['price_total']);
             $this->success('更新订单会员信息成功!', $params);
+        } else {
+            $this->error('更新订单会员信息失败,请稍候再试!');
         }
-        $this->error('更新订单会员信息失败,请稍候再试!');
     }
 
     /**
@@ -161,7 +165,7 @@ class Order extends Member
         try {
             $param = $this->getPayParams($order['order_no'], $order['price_total']);
             $this->success('获取订单支付参数成功!', $param);
-        } catch (\think\exception\HttpResponseException $exception) {
+        } catch (HttpResponseException $exception) {
             throw  $exception;
         } catch (\Exception $e) {
             $this->error("获取订单支付参数失败,{$e->getMessage()}");
@@ -192,7 +196,9 @@ class Order extends Member
             if ($info['return_code'] === 'SUCCESS' && $info['result_code'] === 'SUCCESS') {
                 return $pay->jsapiParams($info['prepay_id']);
             }
-            if (isset($info['err_code_des'])) throw new \think\Exception($info['err_code_des']);
+            if (isset($info['err_code_des'])) {
+                throw new \think\Exception($info['err_code_des']);
+            }
         } catch (\Exception $e) {
             $this->error("创建订单失败参数失败,{$e->getMessage()}");
         }
@@ -252,12 +258,14 @@ class Order extends Member
                 'cancel_at'    => date('Y-m-d H:i:s'),
                 'cancel_desc'  => '用户主动取消订单!',
             ]);
-            if ($result !== false && \app\store\service\OrderService::syncStock($order['order_no'])) {
+            if ($result !== false && OrderService::syncStock($order['order_no'])) {
                 $this->success('订单取消成功!');
+            } else {
+                $this->error('订单取消失败,请稍候再试!');
             }
-            $this->error('订单取消失败,请稍候再试!');
+        } else {
+            $this->error('该订单状态不允许取消哦~');
         }
-        $this->error('该订单状态不允许取消哦~');
     }
 
     /**
@@ -277,11 +285,14 @@ class Order extends Member
         $order = Db::name('StoreOrder')->where($where)->find();
         if (empty($order)) $this->error('待确认的订单不存在,请稍候再试!');
         if (in_array($order['status'], ['4'])) {
-            $result = Db::name('StoreOrder')->where($where)->update(['status' => '5']);
-            if ($result !== false) $this->success('订单确认成功!');
-            $this->error('订单取确认失败,请稍候再试!');
+            if (Db::name('StoreOrder')->where($where)->update(['status' => '5']) !== false) {
+                $this->success('订单确认成功!');
+            } else {
+                $this->error('订单取确认失败,请稍候再试!');
+            }
+        } else {
+            $this->error('该订单状态不允许确认哦~');
         }
-        $this->error('该订单状态不允许确认哦~');
     }
 
     /**
@@ -292,8 +303,11 @@ class Order extends Member
      */
     public function total()
     {
-        $result = Db::name('StoreOrder')->fieldRaw('mid,status,count(1) count')
-            ->where(['mid' => $this->mid])->group('status')->select();
+        $result = Db::name('StoreOrder')
+            ->fieldRaw('mid,status,count(1) count')
+            ->where(['mid' => $this->mid])
+            ->group('status')
+            ->select();
         $this->success('获取订单统计记录!', $result);
     }
-}
+}

+ 14 - 1
application/store/service/ExpressService.php

@@ -1,5 +1,18 @@
 <?php
 
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
 namespace app\store\service;
 
 use think\Db;
@@ -68,4 +81,4 @@ class ExpressService
             'express_desc'  => "续件计费,超出{$rule['first_number']}件,首件费用{$rule['first_price']}元 + 续件费用{$price2}元",
         ];
     }
-}
+}

+ 285 - 4
application/store/service/ExtendService.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\service;
@@ -79,4 +80,284 @@ class ExtendService
         }
     }
 
-}
+    /**
+     * 发送国际短信内容
+     * @param string $mid
+     * @param string $code 国家代码
+     * @param string $phone 手机号码
+     * @param string $content 发送内容
+     * @return boolean
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public static function sendSms2($mid, $code, $phone, $content)
+    {
+        $tkey = date("YmdHis");
+        $data = [
+            'tkey'     => $tkey,
+            'code'     => $code,
+            'mobile'   => $phone,
+            'content'  => $content,
+            'username' => sysconf('sms_zt_username2'),
+            'password' => md5(md5(sysconf('sms_zt_password2')) . $tkey),
+        ];
+        $result = Http::post('http://intl.zthysms.com/intSendSms.do', $data);
+        $insert = ['mid' => $mid, 'phone' => $phone, 'content' => $content, 'result' => $result];
+        Db::name('StoreMemberSmsHistory')->insert($insert);
+        return intval($code) === 1;
+    }
+
+    /**
+     * 查询国际短信余额
+     * @return array
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public static function querySmsBalance2()
+    {
+        $tkey = date("YmdHis");
+        $data = [
+            'username' => sysconf('sms_zt_username2'), 'tkey' => $tkey,
+            'password' => md5(md5(sysconf('sms_zt_password2')) . $tkey),
+        ];
+        $result = Http::post('http://intl.zthysms.com/intBalance.do', $data);
+        if ($result > -1) {
+            return ['code' => 1, 'num' => $result, 'msg' => '获取短信剩余条数成功!'];
+        } elseif ($result > -2) {
+            return ['code' => 0, 'num' => '0', 'msg' => '用户名或者密码不正确!'];
+        } elseif ($result > -3) {
+            return ['code' => 0, 'num' => '0', 'msg' => 'tkey不正确!'];
+        } elseif ($result > -4) {
+            return ['code' => 0, 'num' => '0', 'msg' => '用户不存在或用户停用!'];
+        }
+    }
+
+    /**
+     * 获取国际地域编号
+     * @return array
+     */
+    public static function getRegionMap()
+    {
+        return [
+            ['title' => '中国 台湾', 'english' => 'Taiwan', 'code' => 886],
+            ['title' => '东帝汶民主共和国', 'english' => 'DEMOCRATIC REPUBLIC OF TIMORLESTE', 'code' => 670],
+            ['title' => '中非共和国', 'english' => 'Central African Republic', 'code' => 236],
+            ['title' => '丹麦', 'english' => 'Denmark', 'code' => 45],
+            ['title' => '乌克兰', 'english' => 'Ukraine', 'code' => 380],
+            ['title' => '乌兹别克斯坦', 'english' => 'Uzbekistan', 'code' => 998],
+            ['title' => '乌干达', 'english' => 'Uganda', 'code' => 256],
+            ['title' => '乌拉圭', 'english' => 'Uruguay', 'code' => 598],
+            ['title' => '乍得', 'english' => 'Chad', 'code' => 235],
+            ['title' => '也门', 'english' => 'Yemen', 'code' => 967],
+            ['title' => '亚美尼亚', 'english' => 'Armenia', 'code' => 374],
+            ['title' => '以色列', 'english' => 'Israel', 'code' => 972],
+            ['title' => '伊拉克', 'english' => 'Iraq', 'code' => 964],
+            ['title' => '伊朗', 'english' => 'Iran', 'code' => 98],
+            ['title' => '伯利兹', 'english' => 'Belize', 'code' => 501],
+            ['title' => '佛得角', 'english' => 'Cape Verde', 'code' => 238],
+            ['title' => '俄罗斯', 'english' => 'Russia', 'code' => 7],
+            ['title' => '保加利亚', 'english' => 'Bulgaria', 'code' => 359],
+            ['title' => '克罗地亚', 'english' => 'Croatia', 'code' => 385],
+            ['title' => '关岛', 'english' => 'Guam', 'code' => 1671],
+            ['title' => '冈比亚', 'english' => 'The Gambia', 'code' => 220],
+            ['title' => '冰岛', 'english' => 'Iceland', 'code' => 354],
+            ['title' => '几内亚', 'english' => 'Guinea', 'code' => 224],
+            ['title' => '几内亚比绍', 'english' => 'Guinea - Bissau', 'code' => 245],
+            ['title' => '列支敦士登', 'english' => 'Liechtenstein', 'code' => 423],
+            ['title' => '刚果共和国', 'english' => 'The Republic of Congo', 'code' => 242],
+            ['title' => '刚果民主共和国', 'english' => 'Democratic Republic of the Congo', 'code' => 243],
+            ['title' => '利比亚', 'english' => 'Libya', 'code' => 218],
+            ['title' => '利比里亚', 'english' => 'Liberia', 'code' => 231],
+            ['title' => '加拿大', 'english' => 'Canada', 'code' => 1],
+            ['title' => '加纳', 'english' => 'Ghana', 'code' => 233],
+            ['title' => '加蓬', 'english' => 'Gabon', 'code' => 241],
+            ['title' => '匈牙利', 'english' => 'Hungary', 'code' => 36],
+            ['title' => '南非', 'english' => 'South Africa', 'code' => 27],
+            ['title' => '博茨瓦纳', 'english' => 'Botswana', 'code' => 267],
+            ['title' => '卡塔尔', 'english' => 'Qatar', 'code' => 974],
+            ['title' => '卢旺达', 'english' => 'Rwanda', 'code' => 250],
+            ['title' => '卢森堡', 'english' => 'Luxembourg', 'code' => 352],
+            ['title' => '印尼', 'english' => 'Indonesia', 'code' => 62],
+            ['title' => '印度', 'english' => 'India', 'code' => 91918919],
+            ['title' => '危地马拉', 'english' => 'Guatemala', 'code' => 502],
+            ['title' => '厄瓜多尔', 'english' => 'Ecuador', 'code' => 593],
+            ['title' => '厄立特里亚', 'english' => 'Eritrea', 'code' => 291],
+            ['title' => '叙利亚', 'english' => 'Syria', 'code' => 963],
+            ['title' => '古巴', 'english' => 'Cuba', 'code' => 53],
+            ['title' => '吉尔吉斯斯坦', 'english' => 'Kyrgyzstan', 'code' => 996],
+            ['title' => '吉布提', 'english' => 'Djibouti', 'code' => 253],
+            ['title' => '哥伦比亚', 'english' => 'Colombia', 'code' => 57],
+            ['title' => '哥斯达黎加', 'english' => 'Costa Rica', 'code' => 506],
+            ['title' => '喀麦隆', 'english' => 'Cameroon', 'code' => 237],
+            ['title' => '图瓦卢', 'english' => 'Tuvalu', 'code' => 688],
+            ['title' => '土库曼斯坦', 'english' => 'Turkmenistan', 'code' => 993],
+            ['title' => '土耳其', 'english' => 'Turkey', 'code' => 90],
+            ['title' => '圣卢西亚', 'english' => 'Saint Lucia', 'code' => 1758],
+            ['title' => '圣基茨和尼维斯', 'english' => 'Saint Kitts and Nevis', 'code' => 1869],
+            ['title' => '圣多美和普林西比', 'english' => 'Sao Tome and Principe', 'code' => 239],
+            ['title' => '圣文森特和格林纳丁斯', 'english' => 'Saint Vincent and the Grenadines', 'code' => 1784],
+            ['title' => '圣皮埃尔和密克隆群岛', 'english' => 'Saint Pierre and Miquelon', 'code' => 508],
+            ['title' => '圣赫勒拿岛', 'english' => 'Saint Helena', 'code' => 290],
+            ['title' => '圣马力诺', 'english' => 'San Marino', 'code' => 378],
+            ['title' => '圭亚那', 'english' => 'Guyana', 'code' => 592],
+            ['title' => '坦桑尼亚', 'english' => 'Tanzania', 'code' => 255],
+            ['title' => '埃及', 'english' => 'Egypt', 'code' => 20],
+            ['title' => '埃塞俄比亚', 'english' => 'Ethiopia', 'code' => 251],
+            ['title' => '基里巴斯', 'english' => 'Kiribati', 'code' => 686],
+            ['title' => '塔吉克斯坦', 'english' => 'Tajikistan', 'code' => 992],
+            ['title' => '塞内加尔', 'english' => 'Senegal', 'code' => 221],
+            ['title' => '塞尔维亚', 'english' => 'Serbia and Montenegro', 'code' => 381],
+            ['title' => '塞拉利昂', 'english' => 'Sierra Leone', 'code' => 232],
+            ['title' => '塞浦路斯', 'english' => 'Cyprus', 'code' => 357],
+            ['title' => '塞舌尔', 'english' => 'Seychelles', 'code' => 248],
+            ['title' => '墨西哥', 'english' => 'Mexico', 'code' => 52],
+            ['title' => '多哥', 'english' => 'Togo', 'code' => 228],
+            ['title' => '多米尼克', 'english' => 'Dominica', 'code' => 1767],
+            ['title' => '奥地利', 'english' => 'Austria', 'code' => 43],
+            ['title' => '委内瑞拉', 'english' => 'Venezuela', 'code' => 58],
+            ['title' => '孟加拉', 'english' => 'Bangladesh', 'code' => 880],
+            ['title' => '安哥拉', 'english' => 'Angola', 'code' => 244],
+            ['title' => '安圭拉岛', 'english' => 'Anguilla', 'code' => 1264],
+            ['title' => '安道尔', 'english' => 'Andorra', 'code' => 376],
+            ['title' => '密克罗尼西亚', 'english' => 'Federated States of Micronesia', 'code' => 691],
+            ['title' => '尼加拉瓜', 'english' => 'Nicaragua', 'code' => 505],
+            ['title' => '尼日利亚', 'english' => 'Nigeria', 'code' => 234],
+            ['title' => '尼日尔', 'english' => 'Niger', 'code' => 227],
+            ['title' => '尼泊尔', 'english' => 'Nepal', 'code' => 977],
+            ['title' => '巴勒斯坦', 'english' => 'Palestine', 'code' => 970],
+            ['title' => '巴哈马', 'english' => 'The Bahamas', 'code' => 1242],
+            ['title' => '巴基斯坦', 'english' => 'Pakistan', 'code' => 92],
+            ['title' => '巴巴多斯', 'english' => 'Barbados', 'code' => 1246],
+            ['title' => '巴布亚新几内亚', 'english' => 'Papua New Guinea', 'code' => 675],
+            ['title' => '巴拉圭', 'english' => 'Paraguay', 'code' => 595],
+            ['title' => '巴拿马', 'english' => 'Panama', 'code' => 507],
+            ['title' => '巴林', 'english' => 'Bahrain', 'code' => 973],
+            ['title' => '巴西', 'english' => 'Brazil', 'code' => 55],
+            ['title' => '布基纳法索', 'english' => ' Burkina Faso', 'code' => 226],
+            ['title' => '布隆迪', 'english' => 'Burundi', 'code' => 257],
+            ['title' => '希腊', 'english' => ' Greece', 'code' => 30],
+            ['title' => '帕劳', 'english' => 'Palau', 'code' => 680],
+            ['title' => '库克群岛', 'english' => ' Cook Islands', 'code' => 682],
+            ['title' => '开曼群岛', 'english' => 'Cayman Islands', 'code' => 1345],
+            ['title' => '德国', 'english' => ' Germany', 'code' => 49],
+            ['title' => '意大利', 'english' => 'Italy', 'code' => 39],
+            ['title' => '所罗门群岛', 'english' => ' Solomon Islands', 'code' => 677],
+            ['title' => '托克劳', 'english' => 'Tokelau', 'code' => 690],
+            ['title' => '拉脱维亚', 'english' => 'Latvia', 'code' => 371],
+            ['title' => '挪威', 'english' => 'Norway', 'code' => 47],
+            ['title' => '捷克共和国', 'english' => 'Czech Republic', 'code' => 420],
+            ['title' => '摩尔多瓦', 'english' => 'Moldova', 'code' => 373],
+            ['title' => '摩洛哥', 'english' => 'Morocco', 'code' => 212],
+            ['title' => '摩纳哥', 'english' => 'Monaco', 'code' => 377],
+            ['title' => '文莱', 'english' => 'Brunei Darussalam', 'code' => 673],
+            ['title' => '斐济', 'english' => 'Fiji', 'code' => 679],
+            ['title' => '斯威士兰王国', 'english' => 'The Kingdom of Swaziland', 'code' => 268],
+            ['title' => '斯洛伐克', 'english' => 'Slovakia', 'code' => 421],
+            ['title' => '斯洛文尼亚', 'english' => 'Slovenia', 'code' => 386],
+            ['title' => '斯里兰卡', 'english' => 'Sri Lanka', 'code' => 94],
+            ['title' => '新加坡', 'english' => 'Singapore ', 'code' => 65],
+            ['title' => '新喀里多尼亚', 'english' => 'New Caledonia', 'code' => 687],
+            ['title' => '新西兰', 'english' => 'New Zealand', 'code' => 64],
+            ['title' => '日本', 'english' => 'Japan', 'code' => 81],
+            ['title' => '智利', 'english' => 'Chile', 'code' => 56],
+            ['title' => '朝鲜', 'english' => 'Korea, North', 'code' => 850],
+            ['title' => '柬埔寨 ', 'english' => 'Cambodia', 'code' => 855],
+            ['title' => '格林纳达', 'english' => 'Grenada', 'code' => 1473],
+            ['title' => '格陵兰', 'english' => 'Greenland', 'code' => 299],
+            ['title' => '格鲁吉亚', 'english' => 'Georgia', 'code' => 995],
+            ['title' => '比利时', 'english' => 'Belgium', 'code' => 32],
+            ['title' => '毛里塔尼亚', 'english' => 'Mauritania', 'code' => 222],
+            ['title' => '毛里求斯', 'english' => 'Mauritius', 'code' => 230],
+            ['title' => '汤加', 'english' => 'Tonga', 'code' => 676],
+            ['title' => '沙特阿拉伯', 'english' => 'Saudi Arabia', 'code' => 966],
+            ['title' => '法国', 'english' => 'France', 'code' => 33],
+            ['title' => '法属圭亚那', 'english' => 'French Guiana', 'code' => 594],
+            ['title' => '法属波利尼西亚', 'english' => 'French Polynesia', 'code' => 689],
+            ['title' => '法属西印度群岛', 'english' => 'french west indies', 'code' => 596],
+            ['title' => '法罗群岛', 'english' => 'Faroe Islands', 'code' => 298],
+            ['title' => '波兰', 'english' => 'Poland', 'code' => 48],
+            ['title' => '波多黎各', 'english' => 'The Commonwealth of Puerto Rico', 'code' => 17871939],
+            ['title' => '波黑', 'english' => 'Bosnia and Herzegovina ', 'code' => 387],
+            ['title' => '泰国', 'english' => 'Thailand', 'code' => 66],
+            ['title' => '津巴布韦', 'english' => 'Zimbabwe', 'code' => 263],
+            ['title' => '洪都拉斯', 'english' => 'Honduras', 'code' => 504],
+            ['title' => '海地', 'english' => 'Haiti', 'code' => 509],
+            ['title' => '澳大利亚', 'english' => 'Australia', 'code' => 61],
+            ['title' => '澳门', 'english' => 'Macao', 'code' => 853],
+            ['title' => '爱尔兰', 'english' => 'Ireland', 'code' => 353],
+            ['title' => '爱沙尼亚', 'english' => 'Estonia', 'code' => 372],
+            ['title' => '牙买加 ', 'english' => 'Jamaica', 'code' => 1876],
+            ['title' => '特克斯和凯科斯群岛', 'english' => 'Turks and Caicos Islands', 'code' => 1649],
+            ['title' => '特立尼达和多巴哥', 'english' => 'Trinidad and Tobago', 'code' => 1868],
+            ['title' => '玻利维亚', 'english' => 'Bolivia', 'code' => 591],
+            ['title' => '瑙鲁', 'english' => 'Nauru', 'code' => 674],
+            ['title' => '瑞典', 'english' => 'Sweden', 'code' => 46],
+            ['title' => '瑞士', 'english' => 'Switzerland', 'code' => 41],
+            ['title' => '瓜德罗普', 'english' => 'Guadeloupe', 'code' => 590],
+            ['title' => '瓦利斯和富图纳群岛', 'english' => 'Wallis et Futuna', 'code' => 681],
+            ['title' => '瓦努阿图', 'english' => 'Vanuatu', 'code' => 678],
+            ['title' => '留尼汪 ', 'english' => 'Reunion', 'code' => 262],
+            ['title' => '白俄罗斯', 'english' => 'Belarus', 'code' => 375],
+            ['title' => '百慕大', 'english' => 'Bermuda', 'code' => 1441],
+            ['title' => '直布罗陀', 'english' => 'Gibraltar', 'code' => 350],
+            ['title' => '福克兰群岛', 'english' => 'Falkland', 'code' => 500],
+            ['title' => '科威特', 'english' => 'Kuwait', 'code' => 965],
+            ['title' => '科摩罗和马约特', 'english' => 'Comoros', 'code' => 269],
+            ['title' => '科特迪瓦', 'english' => 'Cote d’Ivoire', 'code' => 225],
+            ['title' => '秘鲁', 'english' => 'Peru', 'code' => 51],
+            ['title' => '突尼斯', 'english' => 'Tunisia', 'code' => 216],
+            ['title' => '立陶宛', 'english' => 'Lithuania', 'code' => 370],
+            ['title' => '索马里', 'english' => 'Somalia', 'code' => 252],
+            ['title' => '约旦', 'english' => 'Jordan', 'code' => 962],
+            ['title' => '纳米比亚', 'english' => 'Namibia', 'code' => 264],
+            ['title' => '纽埃岛', 'english' => 'Island of Niue', 'code' => 683],
+            ['title' => '缅甸  ', 'english' => 'Burma', 'code' => 95],
+            ['title' => '罗马尼亚', 'english' => 'Romania', 'code' => 40],
+            ['title' => '美国', 'english' => 'United States of America', 'code' => 1],
+            ['title' => '美属维京群岛', 'english' => 'Virgin Islands', 'code' => 1340],
+            ['title' => '美属萨摩亚', 'english' => 'American Samoa', 'code' => 1684],
+            ['title' => '老挝', 'english' => 'Laos', 'code' => 856],
+            ['title' => '肯尼亚', 'english' => 'Kenya', 'code' => 254],
+            ['title' => '芬兰', 'english' => 'Finland', 'code' => 358],
+            ['title' => '苏丹', 'english' => 'Sudan', 'code' => 249],
+            ['title' => '苏里南', 'english' => 'Suriname', 'code' => 597],
+            ['title' => '英国', 'english' => 'United Kingdom', 'code' => 44],
+            ['title' => '英属维京群岛', 'english' => 'British Virgin Islands', 'code' => 1284],
+            ['title' => '荷兰', 'english' => 'Netherlands', 'code' => 31],
+            ['title' => '荷属安的列斯', 'english' => 'Netherlands Antilles', 'code' => 599],
+            ['title' => '莫桑比克', 'english' => 'Mozambique', 'code' => 258],
+            ['title' => '莱索托', 'english' => 'Lesotho', 'code' => 266],
+            ['title' => '菲律宾', 'english' => 'Philippines', 'code' => 63],
+            ['title' => '萨尔瓦多', 'english' => 'El Salvador', 'code' => 503],
+            ['title' => '萨摩亚', 'english' => 'Samoa', 'code' => 685],
+            ['title' => '葡萄牙', 'english' => 'Portugal', 'code' => 351],
+            ['title' => '蒙古', 'english' => 'Mongolia', 'code' => 976],
+            ['title' => '西班牙', 'english' => 'Spain', 'code' => 34],
+            ['title' => '贝宁', 'english' => 'Benin', 'code' => 229],
+            ['title' => '赞比亚', 'english' => 'Zambia', 'code' => 260],
+            ['title' => '赤道几内亚', 'english' => 'Equatorial Guinea', 'code' => 240],
+            ['title' => '越南', 'english' => 'Vietnam', 'code' => 84],
+            ['title' => '阿塞拜疆', 'english' => 'Azerbaijan', 'code' => 994],
+            ['title' => '阿富汗', 'english' => 'Afghanistan', 'code' => 93],
+            ['title' => '阿尔及利亚', 'english' => 'Algeria', 'code' => 213],
+            ['title' => '阿尔巴尼亚', 'english' => 'Albania', 'code' => 355],
+            ['title' => '阿拉伯联合酋长国', 'english' => 'United Arab Emirates', 'code' => 971],
+            ['title' => '阿曼', 'english' => 'Oman', 'code' => 968],
+            ['title' => '阿根廷', 'english' => 'Argentina', 'code' => 54],
+            ['title' => '阿鲁巴', 'english' => 'Aruba', 'code' => 297],
+            ['title' => '韩国', 'english' => 'Korea, South)', 'code' => 82],
+            ['title' => '香港', 'english' => 'Hong Kong(SAR)', 'code' => 852],
+            ['title' => '马其顿', 'english' => 'Macedonia', 'code' => 389],
+            ['title' => '马尔代夫', 'english' => 'Maldives  ', 'code' => 960],
+            ['title' => '马拉维', 'english' => ' Malawi', 'code' => 265],
+            ['title' => '马来西亚', 'english' => 'Malaysia', 'code' => 60],
+            ['title' => '马绍尔群岛', 'english' => 'Marshall Islands', 'code' => 692],
+            ['title' => '马耳他', 'english' => 'Malta', 'code' => 356],
+            ['title' => '马达加斯加', 'english' => 'Madagascar', 'code' => 261],
+            ['title' => '马里', 'english' => 'Mali', 'code' => 223],
+            ['title' => '黎巴嫩', 'english' => 'Lebanon', 'code' => 961],
+            ['title' => '黑山共和国', 'english' => 'The Republic of Montenegro', 'code' => 382],
+        ];
+    }
+
+}

+ 5 - 4
application/store/service/GoodsService.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\service;
@@ -67,4 +68,4 @@ class GoodsService
         return true;
     }
 
-}
+}

+ 5 - 4
application/store/service/OrderService.php

@@ -1,15 +1,16 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 namespace app\store\service;
@@ -63,4 +64,4 @@ class OrderService
     {
         // @todo 计算订单返佣
     }
-}
+}

+ 5 - 4
application/store/sys.php

@@ -1,18 +1,19 @@
 <?php
 
 // +----------------------------------------------------------------------
-// | framework
+// | ThinkAdmin
 // +----------------------------------------------------------------------
 // | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 // +----------------------------------------------------------------------
-// | 官方网站: http://framework.thinkadmin.top
+// | 官方网站: http://demo.thinkadmin.top
 // +----------------------------------------------------------------------
 // | 开源协议 ( https://mit-license.org )
 // +----------------------------------------------------------------------
-// | github开源项目:https://github.com/zoujingli/framework
+// | gitee 开源项目:https://gitee.com/zoujingli/ThinkAdmin
+// | github开源项目:https://github.com/zoujingli/ThinkAdmin
 // +----------------------------------------------------------------------
 
 // 注册系统指令
 \think\Console::addDefaultCommands([
     'app\store\command\AutoRun',
-]);
+]);

+ 32 - 0
application/store/view/config/index-store-config.html

@@ -0,0 +1,32 @@
+<form onsubmit="return false;" data-auto="true" action="{:url('save')}" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body padding-40">
+        <label class="layui-form-item block relative">
+            <span class="color-green margin-right-10">商城展示名称</span><span class="nowrap color-desc">StoreTitle</span>
+            <input name="store_title" required placeholder="请输入商城展示名称" value="{:sysconf('store_title')}" class="layui-input">
+            <p class="help-block">订单支付等待时长,新下订单未在此时间内容完成支付将会被自动取消</p>
+        </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">未订单的支付等待时长(小时)</span><span class="nowrap color-desc">OrderWaitTime</span>
+            <input onblur="this.value=Math.abs(parseFloat(this.value)||0.00).toFixed(2)" name="store_order_wait_time" required placeholder="请输入订单支付等待时长" value="{:sysconf('store_order_wait_time')}" class="layui-input">
+            <p class="help-block">订单支付等待时长,新下订单未在此时间内容完成支付将会被自动取消</p>
+        </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">已取消的订单清理时长(小时)</span><span class="nowrap color-desc">OrderClearTime</span>
+            <input onblur="this.value=Math.abs(parseFloat(this.value)||0.00).toFixed(2)" name="store_order_clear_time" required placeholder="请输入已取消订单清理时长" value="{:sysconf('store_order_clear_time')}" class="layui-input">
+            <p class="help-block">已取消订单清理时长,已取消未支付订单将在此时间点将被自动清理掉</p>
+        </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">已发货订单自动确认收货时长(小时)</span><span class="nowrap color-desc">OrderConfirmTime</span>
+            <input onblur="this.value=Math.abs(parseFloat(this.value)||0.00).toFixed(2)" name="store_order_confirm_time" required placeholder="请输入已发货订单自动确认收货时长" value="{:sysconf('store_order_confirm_time')}" class="layui-input">
+            <p class="help-block">已取消订单清理时长,已取消未支付订单将在此时间点将被自动清理掉</p>
+        </label>
+
+        <div class="layui-form-item text-center margin-top-20">
+            <button class="layui-btn" type="submit">保存配置</button>
+        </div>
+    </div>
+</form>

+ 46 - 0
application/store/view/config/index-store-message.html

@@ -0,0 +1,46 @@
+<form onsubmit="return false;" data-auto="true" action="{:url('save')}" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body padding-40">
+
+        <label class="layui-form-item block relative">
+            <span class="color-green margin-right-10">接口查询状态</span><span class="nowrap color-desc">UserState</span>
+            {if empty($query.code)}
+            <p class="layui-input layui-bg-gray color-red">{$query.msg|default=''}</p>
+            {elseif $query.code eq 1}
+            <p class="layui-input layui-bg-gray color-green">平台剩余 {$query.num|default=0} 条可用短信,{$query.msg|default=''}</p>
+            {else}
+            <p class="layui-input layui-bg-gray color-text">没有结果</p>
+            {/if}
+        </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">短信平台账号</span><span class="nowrap color-desc">Username</span>
+            <input name="sms_zt_username" required placeholder="请输入助通短信平台账号" value="{:sysconf('sms_zt_username')}" class="layui-input">
+            <p class="help-block">短信平台账号,可以联系18122377655获取账号与密码</p>
+        </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">短信平台密码</span><span class="nowrap color-desc">Password</span>
+            <input name="sms_zt_password" required placeholder="请输入助通短信平台密码" value="{:sysconf('sms_zt_password')}" class="layui-input">
+            <p class="help-block">短信平台密码,可以联系18122377655获取账号与密码</p>
+        </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">短信发送安全码</span><span class="nowrap color-desc">Secure</span>
+            <input name="sms_secure" required placeholder="请输入短信发送安全码" value="{:sysconf('sms_secure')}" class="layui-input">
+            <p class="help-block">短信发送安全码,调用接口发短信时需要传入此参数</p>
+        </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">注册短信模板</span><span class="nowrap color-desc">Template</span>
+            <textarea class="layui-textarea" required name="sms_reg_template" placeholder="请输入助通短信平台密码">{:sysconf('sms_reg_template')}</textarea>
+            <p class="help-block">会员注册短信模板,验证码变量使用 {code} 代替</p>
+        </label>
+
+        <div class="layui-form-item text-center margin-top-20">
+            <button class="layui-btn" type="submit">保存配置</button>
+        </div>
+
+
+    </div>
+</form>

+ 22 - 34
application/store/view/config/index.html

@@ -1,40 +1,28 @@
 {extend name="admin@main"}
 
 {block name="content"}
-<form onsubmit="return false;" data-auto="true" action="{:request()->url()}" method="post" class='layui-form layui-card' style="max-width:1000px" autocomplete="off">
 
-    <div class="layui-card-body think-box-shadow padding-left-40">
-        <div style="padding:20px 40px">
-
-            <label class="layui-form-item margin-top-20 block relative">
-                <span class="color-green margin-right-10">商城展示名称</span><span class="nowrap color-desc">StoreTitle</span>
-                <input name="store_title" required placeholder="请输入商城展示名称" value="{:sysconf('store_title')}" class="layui-input">
-                <p class="help-block">订单支付等待时长,新下订单未在此时间内容完成支付将会被自动取消</p>
-            </label>
-
-            <label class="layui-form-item margin-top-20 block relative">
-                <span class="color-green margin-right-10">未订单的支付等待时长(小时)</span><span class="nowrap color-desc">OrderWaitTime</span>
-                <input onblur="this.value=Math.abs(parseFloat(this.value)||0.00).toFixed(2)" name="store_order_wait_time" required placeholder="请输入订单支付等待时长" value="{:sysconf('store_order_wait_time')}" class="layui-input">
-                <p class="help-block">订单支付等待时长,新下订单未在此时间内容完成支付将会被自动取消</p>
-            </label>
-
-            <label class="layui-form-item margin-top-20 block relative">
-                <span class="color-green margin-right-10">已取消的订单清理时长(小时)</span><span class="nowrap color-desc">OrderClearTime</span>
-                <input onblur="this.value=Math.abs(parseFloat(this.value)||0.00).toFixed(2)" name="store_order_clear_time" required placeholder="请输入已取消订单清理时长" value="{:sysconf('store_order_clear_time')}" class="layui-input">
-                <p class="help-block">已取消订单清理时长,已取消未支付订单将在此时间点将被自动清理掉</p>
-            </label>
-
-            <label class="layui-form-item margin-top-20 block relative">
-                <span class="color-green margin-right-10">已发货订单自动确认收货时长(小时)</span><span class="nowrap color-desc">OrderConfirmTime</span>
-                <input onblur="this.value=Math.abs(parseFloat(this.value)||0.00).toFixed(2)" name="store_order_confirm_time" required placeholder="请输入已发货订单自动确认收货时长" value="{:sysconf('store_order_confirm_time')}" class="layui-input">
-                <p class="help-block">已取消订单清理时长,已取消未支付订单将在此时间点将被自动清理掉</p>
-            </label>
-
-            <div class="layui-form-item text-center margin-top-20 padding-bottom-20">
-                <button class="layui-btn" type="submit">保存配置</button>
-            </div>
-
-        </div>
+<div class="layui-tab layui-tab-card" style="background:#fff">
+    <ul class="layui-tab-title notselect">
+        <li data-type='store-config-type-params'>商城参数设置</li>
+        <li data-type="store-config-type-sms">商城短信设置</li>
+    </ul>
+    <div class="layui-tab-content">
+        <div class="layui-tab-item">{include file='config/index-store-config'}</div>
+        <div class="layui-tab-item">{include file='config/index-store-message'}</div>
     </div>
-</form>
+</div>
+
+<script>
+    (function (storage) {
+        (function (type, $default, $checked) {
+            $default = $('.layui-tab ul.layui-tab-title li:first');
+            $checked = $('.layui-tab ul.layui-tab-title li[data-type="' + type + '"]');
+            ($checked.length > 0 ? $checked : $default).trigger('click');
+        })(layui.data(storage)['type'] || '');
+        $('.layui-tab ul.layui-tab-title li[data-type]').on('click', function () {
+            layui.data(storage, {key: 'type', value: this.getAttribute('data-type')});
+        });
+    })('store-config-type');
+</script>
 {/block}

+ 0 - 51
application/store/view/config/sms.html

@@ -1,51 +0,0 @@
-{extend name="admin@main"}
-
-{block name="content"}
-<form onsubmit="return false;" data-auto="true" action="{:request()->url()}" method="post" class='layui-form layui-card' style="max-width:1000px" autocomplete="off">
-
-    <div class="layui-card-body think-box-shadow padding-left-40">
-        <div style="padding:20px 40px">
-
-            <label class="layui-form-item block relative">
-                <span class="color-green margin-right-10">接口查询状态</span><span class="nowrap color-desc">UserState</span>
-                {if empty($query.code)}
-                <p class="layui-input layui-bg-gray color-red">{$query.msg|default=''}</p>
-                {elseif $query.code eq 1}
-                <p class="layui-input layui-bg-gray color-green">平台剩余 {$query.num|default=0} 条可用短信,{$query.msg|default=''}</p>
-                {else}
-                <p class="layui-input layui-bg-gray color-text">没有结果</p>
-                {/if}
-            </label>
-
-            <label class="layui-form-item margin-top-20 block relative">
-                <span class="color-green margin-right-10">短信平台账号</span><span class="nowrap color-desc">Username</span>
-                <input name="sms_zt_username" required placeholder="请输入助通短信平台账号" value="{:sysconf('sms_zt_username')}" class="layui-input">
-                <p class="help-block">助通短信平台账号,可以联系客服获取账号与密码</p>
-            </label>
-
-            <label class="layui-form-item margin-top-20 block relative">
-                <span class="color-green margin-right-10">短信平台密码</span><span class="nowrap color-desc">Password</span>
-                <input name="sms_zt_password" required placeholder="请输入助通短信平台密码" value="{:sysconf('sms_zt_password')}" class="layui-input">
-                <p class="help-block">助通短信平台账号,可以联系客服获取账号与密码</p>
-            </label>
-
-            <label class="layui-form-item margin-top-20 block relative">
-                <span class="color-green margin-right-10">短信发送安全码</span><span class="nowrap color-desc">Secure</span>
-                <input name="sms_secure" required placeholder="请输入短信发送安全码" value="{:sysconf('sms_secure')}" class="layui-input">
-                <p class="help-block">短信发送安全码,调用接口发短信时需要传入此参数</p>
-            </label>
-
-            <label class="layui-form-item margin-top-20 block relative">
-                <span class="color-green margin-right-10">注册短信模板</span><span class="nowrap color-desc">Template</span>
-                <textarea class="layui-textarea" required name="sms_reg_template" placeholder="请输入助通短信平台密码">{:sysconf('sms_reg_template')}</textarea>
-                <p class="help-block">会员注册短信模板,验证码变量使用 {code} 代替</p>
-            </label>
-
-            <div class="layui-form-item text-center margin-top-20 padding-bottom-20">
-                <button class="layui-btn" type="submit">保存配置</button>
-            </div>
-
-        </div>
-    </div>
-</form>
-{/block}

+ 3 - 2
application/store/view/express_company/form.html

@@ -26,10 +26,11 @@
     </div>
 
     <div class="hr-line-dashed"></div>
+    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+
     <div class="layui-form-item text-center">
-        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
         <button class="layui-btn" type='submit'>保存数据</button>
         <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
     </div>
-    <script>window.form.render()</script>
+
 </form>

+ 6 - 3
application/store/view/express_company/index.html

@@ -1,18 +1,21 @@
 {extend name='admin@main'}
 
 {block name="button"}
+
 {if auth("store/express_company/add")}
 <button data-modal='{:url("add")}' data-title="添加快递" class='layui-btn layui-btn-sm layui-btn-primary'>添加快递</button>
 {/if}
+
 {if auth("store/express_company/remove")}
 <button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除快递</button>
 {/if}
+
 {/block}
 
 {block name="content"}
 <div class="think-box-shadow">
-    <table class="layui-table" lay-skin="line">
-        <caption class="margin-bottom-10 text-left">{include file='express_company/index_search'}</caption>
+    {include file='express_company/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
         {notempty name='list'}
         <thead>
         <tr>
@@ -68,4 +71,4 @@
     </table>
     {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
 </div>
-{/block}
+{/block}

+ 0 - 22
application/store/view/express_province/form.html

@@ -1,22 +0,0 @@
-<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
-
-    <div class="layui-card-body">
-
-        <div class="layui-form-item">
-            <label class="layui-form-label">省份名称</label>
-            <div class="layui-input-block">
-                <input name="title" value='{$vo.title|default=""}' required placeholder="请输入省份名称" class="layui-input">
-            </div>
-        </div>
-
-    </div>
-
-    <div class="hr-line-dashed"></div>
-
-    <div class="layui-form-item text-center">
-        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
-        <button class="layui-btn" type='submit'>保存数据</button>
-        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
-    </div>
-
-</form>

+ 0 - 71
application/store/view/express_province/index.html

@@ -1,71 +0,0 @@
-{extend name='admin@main'}
-
-{block name="button"}
-
-<!--{if auth("store/express_province/add")}-->
-<button data-modal='{:url("add")}' data-title="添加省份" class='layui-btn layui-btn-sm layui-btn-primary'>添加省份</button>
-<!--{/if}-->
-
-{if auth("store/express_province/remove")}
-<button data-action='{:url("remove")}' data-csrf="{:systoken('store/express_province/remove')}" data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除省份</button>
-{/if}
-
-{/block}
-
-{block name="content"}
-<div class="think-box-shadow">
-    <table class="layui-table" lay-skin="line">
-        <caption class="margin-bottom-10 text-left">{include file='express_province/index_search'}</caption>
-        {notempty name='list'}
-        <thead>
-        <tr>
-            <th class='list-table-check-td think-checkbox'>
-                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
-            </th>
-            <th class='list-table-sort-td'>
-                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
-            </th>
-            <th>省份名称</th>
-            <th>创建时间</th>
-            <th class="text-center">使用状态</th>
-            <th></th>
-        </tr>
-        </thead>
-        <tbody>
-        {foreach $list as $key=>$vo}
-        <tr data-dbclick>
-            <td class='list-table-check-td think-checkbox'>
-                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
-            </td>
-            <td class='list-table-sort-td padding-left-0 padding-right-0'>
-                <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
-            </td>
-            <td class="nowrap">{$vo.title|default='--'}</td>
-            <td class="nowrap">{$vo.create_at|format_datetime}</td>
-            <td class='text-center nowrap'>
-                {eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}
-            </td>
-            <td class='text-center nowrap notselect'>
-
-                {if auth("store/express_province/edit")}
-                <a data-dbclick class="layui-btn layui-btn-xs" data-title="编辑区域" data-modal='{:url("store/express_province/edit")}?id={$vo.id}'>编 辑</a>
-                {/if}
-
-                {if $vo.status eq 1 and auth("store/express_province/forbid")}
-                <a class="layui-btn layui-btn-warm layui-btn-xs" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('store/express_province/forbid')}">禁 用</a>
-                {elseif auth("store/express_province/resume")}
-                <a class="layui-btn layui-btn-warm layui-btn-xs" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('store/express_province/resume')}">启 用</a>
-                {/if}
-
-                {if auth("store/express_province/remove")}
-                <a class="layui-btn layui-btn-danger layui-btn-xs" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('store/express_province/remove')}">删 除</a>
-                {/if}
-            </td>
-        </tr>
-        {/foreach}
-        </tbody>
-        {/notempty}
-    </table>
-    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
-</div>
-{/block}

+ 0 - 35
application/store/view/express_province/index_search.html

@@ -1,35 +0,0 @@
-<fieldset>
-    <legend>条件搜索</legend>
-    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">省份名称</label>
-            <div class="layui-input-inline">
-                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入省份名称" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">使用状态</label>
-            <div class="layui-input-inline">
-                <select class="layui-select" name="status">
-                    {foreach [''=>'- 全部状态 -','1'=>'使用中的模板','0'=>'已禁用的模板'] as $k=>$v}
-                    <!--{eq name='Think.get.status' value='$k.""'}-->
-                    <option selected value="{$k}">{$v}</option>
-                    <!--{else}-->
-                    <option value="{$k}">{$v}</option>
-                    <!--{/eq}-->
-                    {/foreach}
-                </select>
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">创建时间</label>
-            <div class="layui-input-inline">
-                <input data-date-range name="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择创建时间" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
-        </div>
-    </form>
-    <script>form.render()</script>
-</fieldset>

+ 2 - 2
application/store/view/express_template/index.html

@@ -1,9 +1,9 @@
 {extend name="admin@main"}
 
 {block name="content"}
-<form onsubmit="return false;" data-auto="true" action="{:request()->url()}" method="post" class='layui-form layui-card' style="max-width:1000px" autocomplete="off">
+<form onsubmit="return false;" data-auto="true" action="{:url('save')}" method="post" class='layui-form layui-card' autocomplete="off">
 
-    <div class="layui-card-body think-box-shadow padding-bottom-20" style="padding-left:40px">
+    <div class="layui-card-body think-box-shadow padding-bottom-20 padding-left-40">
 
         <div data-item-container>
             {foreach $list as $index=>$item}

+ 21 - 8
application/store/view/express_template/index_item.html

@@ -25,7 +25,11 @@
                     </div>
                 </td>
                 <td width='20px'></td>
-                <td><label class="text-center nowrap">订单满 <input style="width:130px" class="layui-input inline-block text-center padding-left-0" name="order_reduction_price_{$index}" data-blur-number="2" value="{$item.order_reduction_price|default='0.00'}"> 元免邮费</label></td>
+                <td>
+                    <label class="text-center nowrap">
+                        订单满 <input style="width:130px" class="layui-input inline-block text-center padding-left-0" name="order_reduction_price_{$index}" data-blur-number="2" value="{$item.order_reduction_price|default='0.00'}"> 元免邮费
+                    </label>
+                </td>
             </tr>
         </table>
         <!--<span class="color-desc block">订单总金额达到这个金额时,将减免该订单的所有邮费,请谨慎配置。</span>-->
@@ -41,14 +45,16 @@
         <table class="layui-table" lay-skin="line">
             <tr class="layui-bg-gray">
                 <th class="text-center">
-                    <label class="think-checkbox pull-left margin-top-0 notselect"><input type="checkbox" data-check-target="[data-template-province-{$index}]" lay-ignore> 全选</label>
+                    <label class="think-checkbox pull-left margin-top-0 notselect">
+                        <input type="checkbox" data-check-target="[data-template-province-{$index}]" lay-ignore> 全选
+                    </label>
                     <span>可配送区域</span>
                 </th>
             </tr>
             <tr>
                 <td>
                     {foreach $provinces as $p}
-                    <label class="think-checkbox layui-elip" style="width:115px">
+                    <label class="think-checkbox layui-elip notselect" style="width:115px">
                         {if is_numeric($index) and isset($item.rule) and is_array($item.rule) and in_array($p,$item.rule)}
                         <input data-province-input data-template-province-{$index} checked type="checkbox" name="rule_{$index}[]" value="{$p}" lay-ignore> {$p|default=''}
                         {else}
@@ -69,13 +75,20 @@
                 <th class="text-center" width="80px">续费(元)</th>
             </tr>
             <tr>
-                <td class="text-center"><label><input name="first_number_{$index}" value="{$item.first_number|default='1'}" data-blur-number="0" class="layui-input text-center padding-left-0"></label></td>
-                <td class="text-center"><label><input name="first_price_{$index}" value="{$item.first_price|default='0.00'}" data-blur-number="2" class="layui-input text-center padding-left-0"></label></td>
-                <td class="text-center"><label><input name="next_number_{$index}" value="{$item.next_number|default='1'}" data-blur-number="0" class="layui-input text-center padding-left-0"></label></td>
-                <td class="text-center"><label><input name="next_price_{$index}" value="{$item.next_price|default='0.00'}" data-blur-number="2" class="layui-input text-center padding-left-0"></label></td>
+                <td class="text-center">
+                    <label><input name="first_number_{$index}" value="{$item.first_number|default='1'}" data-blur-number="0" class="layui-input text-center padding-left-0"></label>
+                </td>
+                <td class="text-center">
+                    <label><input name="first_price_{$index}" value="{$item.first_price|default='0.00'}" data-blur-number="2" class="layui-input text-center padding-left-0"></label>
+                </td>
+                <td class="text-center">
+                    <label><input name="next_number_{$index}" value="{$item.next_number|default='1'}" data-blur-number="0" class="layui-input text-center padding-left-0"></label>
+                </td>
+                <td class="text-center">
+                    <label><input name="next_price_{$index}" value="{$item.next_price|default='0.00'}" data-blur-number="2" class="layui-input text-center padding-left-0"></label>
+                </td>
             </tr>
         </table>
     </div>
 
-
 </fieldset>

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.