Browse Source

first commit

Your Name 7 months ago
commit
a5e3f24b20
100 changed files with 20530 additions and 0 deletions
  1. 16
    0
      .htaccess
  2. 8
    0
      .idea/.gitignore
  3. 8
    0
      .idea/modules.xml
  4. 22
    0
      .idea/php.xml
  5. 6
    0
      .idea/vcs.xml
  6. 10
    0
      .idea/www.tyqngp.cn.iml
  7. 9
    0
      404.html
  8. 23
    0
      admin.php
  9. 26
    0
      api.php
  10. 391
    0
      apps/admin/controller/IndexController.php
  11. 70
    0
      apps/admin/controller/content/CompanyController.php
  12. 563
    0
      apps/admin/controller/content/ContentController.php
  13. 537
    0
      apps/admin/controller/content/ContentSortController.php
  14. 224
    0
      apps/admin/controller/content/DeleCacheController.php
  15. 244
    0
      apps/admin/controller/content/ExtFieldController.php
  16. 354
    0
      apps/admin/controller/content/FormController.php
  17. 175
    0
      apps/admin/controller/content/LabelController.php
  18. 213
    0
      apps/admin/controller/content/LinkController.php
  19. 128
    0
      apps/admin/controller/content/MessageController.php
  20. 207
    0
      apps/admin/controller/content/ModelController.php
  21. 271
    0
      apps/admin/controller/content/SingleController.php
  22. 82
    0
      apps/admin/controller/content/SiteController.php
  23. 195
    0
      apps/admin/controller/content/SlideController.php
  24. 157
    0
      apps/admin/controller/content/TagsController.php
  25. 118
    0
      apps/admin/controller/member/MemberCommentController.php
  26. 292
    0
      apps/admin/controller/member/MemberController.php
  27. 193
    0
      apps/admin/controller/member/MemberFieldController.php
  28. 187
    0
      apps/admin/controller/member/MemberGroupController.php
  29. 303
    0
      apps/admin/controller/system/AreaController.php
  30. 321
    0
      apps/admin/controller/system/CityController.php
  31. 231
    0
      apps/admin/controller/system/ConfigController.php
  32. 248
    0
      apps/admin/controller/system/DatabaseController.php
  33. 152
    0
      apps/admin/controller/system/ImageExtController.php
  34. 275
    0
      apps/admin/controller/system/MenuController.php
  35. 249
    0
      apps/admin/controller/system/RoleController.php
  36. 40
    0
      apps/admin/controller/system/SyslogController.php
  37. 172
    0
      apps/admin/controller/system/TypeController.php
  38. 408
    0
      apps/admin/controller/system/UpgradeController.php
  39. 227
    0
      apps/admin/controller/system/UserController.php
  40. 225
    0
      apps/admin/model/IndexModel.php
  41. 44
    0
      apps/admin/model/content/CompanyModel.php
  42. 346
    0
      apps/admin/model/content/ContentModel.php
  43. 267
    0
      apps/admin/model/content/ContentSortModel.php
  44. 93
    0
      apps/admin/model/content/ExtFieldModel.php
  45. 238
    0
      apps/admin/model/content/FormModel.php
  46. 89
    0
      apps/admin/model/content/LabelModel.php
  47. 85
    0
      apps/admin/model/content/LinkModel.php
  48. 103
    0
      apps/admin/model/content/MessageModel.php
  49. 140
    0
      apps/admin/model/content/ModelModel.php
  50. 196
    0
      apps/admin/model/content/SingleModel.php
  51. 50
    0
      apps/admin/model/content/SiteModel.php
  52. 85
    0
      apps/admin/model/content/SlideModel.php
  53. 65
    0
      apps/admin/model/content/TagsModel.php
  54. 136
    0
      apps/admin/model/member/MemberCommentModel.php
  55. 79
    0
      apps/admin/model/member/MemberFieldModel.php
  56. 98
    0
      apps/admin/model/member/MemberGroupModel.php
  57. 122
    0
      apps/admin/model/member/MemberModel.php
  58. 101
    0
      apps/admin/model/system/AreaModel.php
  59. 62
    0
      apps/admin/model/system/CityModel.php
  60. 66
    0
      apps/admin/model/system/ConfigModel.php
  61. 102
    0
      apps/admin/model/system/DatabaseModel.php
  62. 161
    0
      apps/admin/model/system/MenuModel.php
  63. 169
    0
      apps/admin/model/system/RoleModel.php
  64. 29
    0
      apps/admin/model/system/SyslogModel.php
  65. 89
    0
      apps/admin/model/system/TypeModel.php
  66. 166
    0
      apps/admin/model/system/UserModel.php
  67. 20
    0
      apps/admin/view/default/common/foot.html
  68. 136
    0
      apps/admin/view/default/common/head.html
  69. 36
    0
      apps/admin/view/default/common/ueditor.html
  70. 113
    0
      apps/admin/view/default/content/company.html
  71. 952
    0
      apps/admin/view/default/content/content.html
  72. 615
    0
      apps/admin/view/default/content/contentsort.html
  73. 135
    0
      apps/admin/view/default/content/delecache.html
  74. 68
    0
      apps/admin/view/default/content/exform.html
  75. 76
    0
      apps/admin/view/default/content/exmessage.html
  76. 230
    0
      apps/admin/view/default/content/extfield.html
  77. 327
    0
      apps/admin/view/default/content/form.html
  78. 254
    0
      apps/admin/view/default/content/label.html
  79. 170
    0
      apps/admin/view/default/content/link.html
  80. 148
    0
      apps/admin/view/default/content/message.html
  81. 191
    0
      apps/admin/view/default/content/model.html
  82. 426
    0
      apps/admin/view/default/content/single.html
  83. 107
    0
      apps/admin/view/default/content/site.html
  84. 187
    0
      apps/admin/view/default/content/slide.html
  85. 105
    0
      apps/admin/view/default/content/tags.html
  86. 265
    0
      apps/admin/view/default/css/comm.css
  87. 28
    0
      apps/admin/view/default/css/jquery.treetable.css
  88. 102
    0
      apps/admin/view/default/css/login.css
  89. 7
    0
      apps/admin/view/default/font-awesome/HELP-US-OUT.txt
  90. 2337
    0
      apps/admin/view/default/font-awesome/css/font-awesome.css
  91. 4
    0
      apps/admin/view/default/font-awesome/css/font-awesome.min.css
  92. BIN
      apps/admin/view/default/font-awesome/fonts/FontAwesome.otf
  93. BIN
      apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.eot
  94. 2671
    0
      apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.svg
  95. BIN
      apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.ttf
  96. BIN
      apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.woff
  97. BIN
      apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.woff2
  98. 34
    0
      apps/admin/view/default/font-awesome/less/animated.less
  99. 25
    0
      apps/admin/view/default/font-awesome/less/bordered-pulled.less
  100. 0
    0
      apps/admin/view/default/font-awesome/less/core.less

+ 16
- 0
.htaccess View File

@@ -0,0 +1,16 @@
1
+<IfModule mod_rewrite.c>
2
+  Options +FollowSymlinks
3
+  RewriteEngine On
4
+  
5
+
6
+  
7
+  
8
+  RewriteCond %{REQUEST_FILENAME} !-d
9
+  RewriteCond %{REQUEST_FILENAME} !-f
10
+  
11
+  RewriteRule ^(.*)$ index.php?p=$1 [QSA,PT,L]
12
+  
13
+
14
+
15
+
16
+</IfModule>

+ 8
- 0
.idea/.gitignore View File

@@ -0,0 +1,8 @@
1
+# 默认忽略的文件
2
+/shelf/
3
+/workspace.xml
4
+# 基于编辑器的 HTTP 客户端请求
5
+/httpRequests/
6
+# Datasource local storage ignored files
7
+/dataSources/
8
+/dataSources.local.xml

+ 8
- 0
.idea/modules.xml View File

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/www.tyqngp.cn.iml" filepath="$PROJECT_DIR$/.idea/www.tyqngp.cn.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 22
- 0
.idea/php.xml View File

@@ -0,0 +1,22 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="MessDetectorOptionsConfiguration">
4
+    <option name="transferred" value="true" />
5
+  </component>
6
+  <component name="PHPCSFixerOptionsConfiguration">
7
+    <option name="transferred" value="true" />
8
+  </component>
9
+  <component name="PHPCodeSnifferOptionsConfiguration">
10
+    <option name="highlightLevel" value="WARNING" />
11
+    <option name="transferred" value="true" />
12
+  </component>
13
+  <component name="PhpProjectSharedConfiguration" php_language_level="7.0">
14
+    <option name="suggestChangeDefaultLanguageLevel" value="false" />
15
+  </component>
16
+  <component name="PhpStanOptionsConfiguration">
17
+    <option name="transferred" value="true" />
18
+  </component>
19
+  <component name="PsalmOptionsConfiguration">
20
+    <option name="transferred" value="true" />
21
+  </component>
22
+</project>

+ 6
- 0
.idea/vcs.xml View File

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 10
- 0
.idea/www.tyqngp.cn.iml View File

@@ -0,0 +1,10 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="WEB_MODULE" version="4">
3
+  <component name="NewModuleRootManager">
4
+    <content url="file://$MODULE_DIR$">
5
+      <sourceFolder url="file://$MODULE_DIR$/apps" isTestSource="false" packagePrefix="app" />
6
+    </content>
7
+    <orderEntry type="inheritedJdk" />
8
+    <orderEntry type="sourceFolder" forTests="false" />
9
+  </component>
10
+</module>

+ 9
- 0
404.html View File

@@ -0,0 +1,9 @@
1
+
2
+<html>
3
+<head><title>404 Not Found</title></head>
4
+<body>
5
+<center><h1>404 Not Found</h1></center>
6
+<hr><center>nginx</center>
7
+</body>
8
+</html>
9
+        

+ 23
- 0
admin.php View File

@@ -0,0 +1,23 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2016年11月5日
7
+ *  管理后台入口文件
8
+ */
9
+
10
+// 定义为入口文件
11
+define('IS_INDEX', true);
12
+
13
+// 入口文件地址绑定
14
+define('URL_BIND', 'admin');
15
+
16
+// PHP版本检测
17
+if (PHP_VERSION < '5.3') {
18
+    header('Content-Type:text/html; charset=utf-8');
19
+    exit('您服务器PHP的版本太低,程序要求PHP版本不小于5.3');
20
+}
21
+
22
+// 引用内核启动文件
23
+require dirname(__FILE__) . '/core/start.php';

+ 26
- 0
api.php View File

@@ -0,0 +1,26 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2016年11月5日
7
+ *  API入口文件
8
+ */
9
+
10
+// 定义为入口文件
11
+define('IS_INDEX', true);
12
+
13
+// 入口文件地址绑定
14
+define('URL_BIND', 'api');
15
+
16
+// PHP版本检测
17
+if (PHP_VERSION < '5.3') {
18
+    echo json_encode(array(
19
+        'code' => 0,
20
+        'data' => 'The version of your server PHP is too low, and the program requires PHP version not less than 5.3.'
21
+    ));
22
+    exit();
23
+}
24
+
25
+// 引用内核启动文件
26
+require dirname(__FILE__) . '/core/start.php';

+ 391
- 0
apps/admin/controller/IndexController.php View File

@@ -0,0 +1,391 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年3月13日
7
+ *  默认主页
8
+ */
9
+namespace app\admin\controller;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\IndexModel;
13
+
14
+class IndexController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new IndexModel();
22
+    }
23
+
24
+    // 登录页面
25
+    public function index()
26
+    {
27
+        if (session('sid')) {
28
+            location(url('admin/Index/home'));
29
+        }
30
+        $this->assign('admin_check_code', $this->config('admin_check_code'));
31
+        $this->display('index.html');
32
+    }
33
+
34
+    // 主页面
35
+    public function home()
36
+    {
37
+        // 手动修改数据名称
38
+        if (get('action') == 'moddb') {
39
+            if ($this->modDB()) {
40
+                alert_back('修改成功!');
41
+            } else {
42
+                alert_back('修改失败!');
43
+            }
44
+        }
45
+
46
+        // 删除修改后老数据库(上一步无法直接修改删除)
47
+        if (issetSession('deldb')) {
48
+            @unlink(ROOT_PATH . session('deldb'));
49
+            unset($_SESSION['deldb']);
50
+        }
51
+
52
+        $dbsecurity = true;
53
+        // 如果是sqlite数据库,并且路径为默认的,则标记为不安全
54
+        if (get_db_type() == 'sqlite') {
55
+            // 数据库配置含有默认名字则进行修改
56
+            if (strpos($this->config('database.dbname'), 'pbootcms') !== false) {
57
+                if (get_user_ip() != '127.0.0.1' && $this->modDB()) { // 非本地测试时尝试自动修改数据库名称
58
+                    $dbsecurity = true;
59
+                } else {
60
+                    $dbsecurity = false;
61
+                }
62
+            } elseif (file_exists(ROOT_PATH . '/data/pbootcms.db')) { // 存在多余的默认数据库文件则改名
63
+                rename(ROOT_PATH . '/data/pbootcms.db', ROOT_PATH . '/data/' . get_uniqid() . '.db');
64
+            }
65
+        } elseif (file_exists(ROOT_PATH . '/data/pbootcms.db')) {
66
+            rename(ROOT_PATH . '/data/pbootcms.db', ROOT_PATH . '/data/' . get_uniqid() . '.db');
67
+        }
68
+
69
+        $this->assign('dbsecurity', $dbsecurity);
70
+
71
+        if (!session('pwsecurity')) {
72
+            location(url('/admin/Index/ucenter'));
73
+        }
74
+
75
+        $this->assign('server', get_server_info());
76
+        $this->assign('branch', $this->config('upgrade_branch') == '3.X.dev' ? '3.X.dev' : '3.X');
77
+        $this->assign('revise', $this->config('revise_version') ?: '0');
78
+        $this->assign('snuser', $this->config('sn_user') ?: '0');
79
+        $this->assign('site', get_http_url());
80
+
81
+        $this->assign('user_info', $this->model->getUserInfo(session('ucode')));
82
+
83
+        $this->assign('sum_msg', model('admin.content.Message')->getCount());
84
+
85
+        // 内容模型菜单
86
+        $model = model('admin.content.Model');
87
+        $models = $model->getModelMenu();
88
+        foreach ($models as $key => $value) {
89
+            $models[$key]->count = $model->getModelCount($value->mcode)->count;
90
+        }
91
+
92
+        $this->assign('model_msg', $models);
93
+        $this->display('system/home.html');
94
+    }
95
+
96
+    // 异步登录验证
97
+    public function login()
98
+    {
99
+        if (!$_POST) {
100
+            return;
101
+        }
102
+
103
+        // 在安装了gd库时才执行验证码验证
104
+        if (extension_loaded("gd") && $this->config('admin_check_code') && strtolower(post('checkcode', 'var')) != session('checkcode')) {
105
+            json(0, '验证码错误!');
106
+        }
107
+
108
+        // 就收数据
109
+        $username = post('username');
110
+        $password = post('password');
111
+
112
+        if (!preg_match('/^[\x{4e00}-\x{9fa5}\w\-\.@]+$/u', $username)) {
113
+            json(0, '用户名含有不允许的特殊字符!');
114
+        }
115
+
116
+        if (!$username) {
117
+            json(0, '用户名不能为空!');
118
+        }
119
+
120
+        if (!$password) {
121
+            json(0, '密码不能为空!');
122
+        }
123
+
124
+        if (!!$time = $this->checkLoginBlack()) {
125
+            $this->log('登录锁定!');
126
+            json(0, '您登录失败次数太多已被锁定,请' . $time . '秒后再试!');
127
+        }
128
+
129
+        // 执行用户登录
130
+        $where = array(
131
+            'username' => $username,
132
+            'password' => encrypt_string($password)
133
+        );
134
+
135
+        // 判断数据库写入权限
136
+        if ((get_db_type() == 'sqlite') && !is_writable(ROOT_PATH . $this->config('database.dbname'))) {
137
+            json(0, '数据库目录写入权限不足!');
138
+        }
139
+
140
+        if (!!$login = $this->model->login($where)) {
141
+
142
+            session_regenerate_id(true);
143
+            session('sid', encrypt_string(session_id() . $login->id)); // 会话标识
144
+            session('M', M);
145
+
146
+            session('id', $login->id); // 用户id
147
+            session('ucode', $login->ucode); // 用户编码
148
+            session('username', $login->username); // 用户名
149
+            session('realname', $login->realname); // 真实名字
150
+
151
+            if ($where['password'] != '14e1b600b1fd579f47433b88e8d85291') {
152
+                session('pwsecurity', true);
153
+            }
154
+
155
+            session('acodes', $login->acodes); // 用户管理区域
156
+            if ($login->acodes) { // 当前显示区域
157
+                session('acode', $login->acodes[0]);
158
+            } else {
159
+                session('acode', '');
160
+            }
161
+
162
+            session('rcodes', $login->rcodes); // 用户角色代码表
163
+            session('levels', $login->levels); // 用户权限URL列表
164
+            session('menu_tree', $login->menus); // 菜单树
165
+            session('area_map', $login->area_map); // 区域代码名称映射表
166
+            session('area_tree', $login->area_tree); // 用户区域树
167
+
168
+            $this->log('登录成功!');
169
+            json(1, url('admin/Index/home'));
170
+        } else {
171
+            $this->setLoginBlack();
172
+            $this->log('登录失败!');
173
+            session('checkcode', mt_rand(10000, 99999)); // 登录失败,随机打乱原有验证码
174
+            json(0, '用户名或密码错误!');
175
+        }
176
+    }
177
+
178
+    // 退出登录
179
+    public function loginOut()
180
+    {
181
+        session_unset();
182
+        location(url('/admin/Index/index'));
183
+    }
184
+
185
+    // 用户中心,修改密码
186
+    public function ucenter()
187
+    {
188
+        if ($_POST) {
189
+            $username = post('username'); // 用户名
190
+            $realname = post('realname'); // 真实姓名
191
+            $cpassword = post('cpassword'); // 现在密码
192
+            $password = post('password'); // 新密码
193
+            $rpassword = post('rpassword'); // 确认密码
194
+
195
+            if (!$username) {
196
+                alert_back('用户名不能为空!');
197
+            }
198
+            if (!$cpassword) {
199
+                alert_back('当前密码不能为空!');
200
+            }
201
+
202
+            if (!preg_match('/^[\x{4e00}-\x{9fa5}\w\-\.@]+$/u', $username)) {
203
+                alert_back('用户名含有不允许的特殊字符!');
204
+            }
205
+
206
+            $data = array(
207
+                'username' => $username,
208
+                'realname' => $realname,
209
+                'update_user' => $username
210
+            );
211
+
212
+            // 如果有修改密码,则添加数据
213
+            if ($password) {
214
+                if ($password != $rpassword) {
215
+                    alert_back('确认密码不正确!');
216
+                }
217
+                $data['password'] = encrypt_string($password);
218
+                if ($data['password'] != '14e1b600b1fd579f47433b88e8d85291') {
219
+                    session('pwsecurity', true);
220
+                } else {
221
+                    session('pwsecurity', false);
222
+                }
223
+            }
224
+
225
+            // 检查现有密码
226
+            if ($this->model->checkUserPwd(encrypt_string($cpassword))) {
227
+                if ($this->model->modUserInfo($data)) {
228
+                    session('username', post('username'));
229
+                    session('realname', post('realname'));
230
+                    $this->log('用户资料成功!');
231
+                    success('用户资料修改成功!', -1);
232
+                }
233
+            } else {
234
+                $this->log('用户资料修改时当前密码错误!');
235
+                alert_location('当前密码错误!', -1);
236
+            }
237
+        }
238
+        $this->display('system/ucenter.html');
239
+    }
240
+
241
+    // 切换显示的数据区域
242
+    public function area()
243
+    {
244
+        if ($_POST) {
245
+            $acode = post('acode');
246
+            if (in_array($acode, session('acodes'))) {
247
+                session('acode', $acode);
248
+                cookie('lg', $acode); // 同步切换前台语言
249
+            }
250
+            location(url('admin/Index/home'));
251
+        }
252
+    }
253
+
254
+    // 清理缓存
255
+    public function clearCache()
256
+    {
257
+        if (get('delall')) {
258
+            $rs = path_delete(RUN_PATH);
259
+        } else {
260
+            $rs = (path_delete(RUN_PATH . '/cache') && path_delete(RUN_PATH . '/complile') && path_delete(RUN_PATH . '/config') && path_delete(RUN_PATH . '/upgrade'));
261
+        }
262
+        cache_config(); // 清理缓存后立即生成新的配置
263
+        if ($rs) {
264
+            if (extension_loaded('Zend OPcache')) {
265
+                opcache_reset(); // 在启用了OPcache加速器时同时清理
266
+            }
267
+            $this->log('清理缓存成功!');
268
+            alert_back('清理缓存成功!', 1);
269
+        } else {
270
+            $this->log('清理缓存失败!');
271
+            alert_back('清理缓存失败!', 0);
272
+        }
273
+    }
274
+	
275
+	// 清理系统缓存
276
+    public function clearOnlySysCache()
277
+    {
278
+        if (get('delall')) {
279
+            $rs = path_delete(RUN_PATH);
280
+        } else {
281
+            $rs = (path_delete(RUN_PATH . '/complile') && path_delete(RUN_PATH . '/config') && path_delete(RUN_PATH . '/upgrade'));
282
+        }
283
+        cache_config(); // 清理缓存后立即生成新的配置
284
+        if ($rs) {
285
+            if (extension_loaded('Zend OPcache')) {
286
+                opcache_reset(); // 在启用了OPcache加速器时同时清理
287
+            }
288
+            $this->log('清理缓存成功!');
289
+            alert_back('清理缓存成功!', 1);
290
+        } else {
291
+            $this->log('清理缓存失败!');
292
+            alert_back('清理缓存失败!', 0);
293
+        }
294
+    }
295
+	
296
+    // 清理会话
297
+    public function clearSession()
298
+    {
299
+        ignore_user_abort(true); // 后台运行
300
+        set_time_limit(7200);
301
+        ob_start();
302
+        $output['code'] = 1;
303
+        $output['data'] = '执行成功,后台自动清理中!';
304
+        $output['tourl'] = '';
305
+        echo json_encode($output);
306
+        ob_end_flush();
307
+        flush();
308
+        $rs = path_delete(RUN_PATH . '/session', false, array(
309
+            'sess_' . session_id()
310
+        ));
311
+    }
312
+
313
+    // 文件上传方法
314
+    public function upload()
315
+    {
316
+        $upload = upload('upload');
317
+        if (is_array($upload)) {
318
+            json(1, $upload);
319
+        } else {
320
+            json(0, $upload);
321
+        }
322
+    }
323
+
324
+    // 检查是否在黑名单
325
+    private function checkLoginBlack()
326
+    {
327
+        // 读取黑名单
328
+        $ip_black = RUN_PATH . '/data/' . md5('login_black') . '.php';
329
+        if (file_exists($ip_black)) {
330
+            $data = require $ip_black;
331
+            $user_ip = get_user_ip();
332
+            $lock_time = $this->config('lock_time') ?: 900;
333
+            $lock_count = $this->config('lock_count') ?: 5;
334
+            if (isset($data[$user_ip]) && $data[$user_ip]['count'] >= $lock_count && time() - $data[$user_ip]['time'] < $lock_time) {
335
+                return $lock_time - (time() - $data[$user_ip]['time']); // 返回剩余秒数
336
+            }
337
+        }
338
+        return false;
339
+    }
340
+
341
+    // 添加登录黑名单
342
+    private function setLoginBlack()
343
+    {
344
+        // 读取黑名单
345
+        $ip_black = RUN_PATH . '/data/' . md5('login_black') . '.php';
346
+        if (file_exists($ip_black)) {
347
+            $data = require $ip_black;
348
+        } else {
349
+            $data = array();
350
+        }
351
+
352
+        // 添加IP
353
+        $user_ip = get_user_ip();
354
+        $lock_time = $this->config('lock_time') ?: 900;
355
+        $lock_count = $this->config('lock_count') ?: 5;
356
+        if (isset($data[$user_ip]) && $data[$user_ip]['count'] < $lock_count && time() - $data[$user_ip]['time'] < $lock_time) {
357
+            $data[$user_ip] = array(
358
+                'time' => time(),
359
+                'count' => $data[get_user_ip()]['count'] + 1
360
+            );
361
+        } else {
362
+            $data[$user_ip] = array(
363
+                'time' => time(),
364
+                'count' => 1
365
+            );
366
+        }
367
+
368
+        // 写入黑名单
369
+        check_file($ip_black, true);
370
+        return file_put_contents($ip_black, "<?php\nreturn " . var_export($data, true) . ";");
371
+    }
372
+
373
+    // 修改数据库名称
374
+    private function modDB()
375
+    {
376
+        $file = CONF_PATH . '/database.php';
377
+        $sname = $this->config('database.dbname');
378
+        $dname = '/data/' . get_uniqid() . '.db';
379
+        $sconfig = file_get_contents($file);
380
+        $dconfig = str_replace($sname, $dname, $sconfig);
381
+        if (file_put_contents($file, $dconfig)) {
382
+            if (!copy(ROOT_PATH . $sname, ROOT_PATH . $dname)) {
383
+                file_put_contents($file, $sconfig); // 回滚配置
384
+            } else {
385
+                session('deldb', $sname);
386
+                return true;
387
+            }
388
+        }
389
+        return false;
390
+    }
391
+}

+ 70
- 0
apps/admin/controller/content/CompanyController.php View File

@@ -0,0 +1,70 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年04月17日
7
+ *  公司设置控制器 
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\CompanyModel;
13
+
14
+class CompanyController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new CompanyModel();
22
+    }
23
+
24
+    // 显示公司设置
25
+    public function index()
26
+    {
27
+        // 获取公司配置
28
+        $this->assign('companys', $this->model->getList());
29
+        $this->display('content/company.html');
30
+    }
31
+
32
+    // 修改公司设置
33
+    public function mod()
34
+    {
35
+        if (! $_POST) {
36
+            return;
37
+        }
38
+        $data = array(
39
+            'name' => post('name'),
40
+            'address' => post('address'),
41
+            'postcode' => post('postcode'),
42
+            'contact' => post('contact'),
43
+            'mobile' => post('mobile'),
44
+            'phone' => post('phone'),
45
+            'fax' => post('fax'),
46
+            'email' => post('email'),
47
+            'qq' => post('qq'),
48
+            'weixin' => post('weixin'),
49
+            'blicense' => post('blicense'),
50
+            'other' => post('other')
51
+        );
52
+        
53
+        if ($this->model->checkCompany()) {
54
+            if ($this->model->modCompany($data)) {
55
+                $this->log('修改公司信息成功!');
56
+                success('修改成功!', - 1);
57
+            } else {
58
+                location(- 1);
59
+            }
60
+        } else {
61
+            $data['acode'] = session('acode');
62
+            if ($this->model->addCompany($data)) {
63
+                $this->log('修改公司信息成功!');
64
+                success('修改成功!', - 1);
65
+            } else {
66
+                location(- 1);
67
+            }
68
+        }
69
+    }
70
+}

+ 563
- 0
apps/admin/controller/content/ContentController.php View File

@@ -0,0 +1,563 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date  2017年12月15日
7
+ *  文章控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\ContentModel;
13
+
14
+class ContentController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    private $blank;
20
+
21
+    public function __construct()
22
+    {
23
+        $this->model = new ContentModel();
24
+    }
25
+
26
+    // 文章列表
27
+    public function index()
28
+    {
29
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getContent($id)) {
30
+            $this->assign('more', true);
31
+            $this->assign('content', $result);
32
+        } else {
33
+            $this->assign('list', true);
34
+            if (! $mcode = get('mcode', 'var')) {
35
+                error('传递的模型编码参数有误,请核对后重试!');
36
+            }
37
+            
38
+            if (isset($_GET['keyword'])) {
39
+                if (! ! $scode = get('scode', 'var')) {
40
+                    $result = $this->model->findContent($mcode, $scode, get('keyword', 'vars'));
41
+                } else {
42
+                    $result = $this->model->findContentAll($mcode, get('keyword', 'vars'));
43
+                }
44
+            } elseif (! ! $scode = get('scode', 'int')) {
45
+                $result = $this->model->findContent($mcode, $scode, '');
46
+            } else {
47
+                $result = $this->model->getList($mcode);
48
+            }
49
+            $this->assign('contents', $result);
50
+            
51
+            // 文章分类下拉列表
52
+            $sort_model = model('admin.content.ContentSort');
53
+            $sort_select = $sort_model->getListSelect($mcode);
54
+            $this->assign('search_select', $this->makeSortSelect($sort_select, get('scode')));
55
+            $this->assign('sort_select', $this->makeSortSelect($sort_select, session('addscode')));
56
+            $this->assign('subsort_select', $this->makeSortSelect($sort_select));
57
+            
58
+            // 模型名称
59
+            $this->assign('model_name', model('admin.content.Model')->getName($mcode));
60
+            
61
+            // 扩展字段
62
+            $this->assign('extfield', model('admin.content.ExtField')->getModelField($mcode));
63
+            
64
+            $this->assign('baidu_zz_token', $this->config('baidu_zz_token'));
65
+            $this->assign('baidu_ks_token', $this->config('baidu_ks_token'));
66
+            
67
+            // 前端地址连接符判断
68
+            $url_break_char = $this->config('url_break_char') ?: '_';
69
+            $this->assign('url_break_char', $url_break_char);
70
+            
71
+            // 获取会员分组
72
+            $this->assign('groups', model('admin.member.MemberGroup')->getSelect());
73
+        }
74
+        
75
+        $this->display('content/content.html');
76
+    }
77
+
78
+    // 文章增加
79
+    public function add()
80
+    {
81
+        if ($_POST) {
82
+            
83
+            // 获取数据
84
+            $scode = post('scode');
85
+            $subscode = post('subscode');
86
+            $title = post('title');
87
+            $titlecolor = post('titlecolor');
88
+            $subtitle = post('subtitle');
89
+            $filename = trim(post('filename'), '/');
90
+            $author = post('author');
91
+            $source = post('source');
92
+            $outlink = post('outlink');
93
+            $date = post('date');
94
+            $ico = post('ico');
95
+            $pics = post('pics');
96
+            
97
+            // 获取多图标题
98
+            $picstitle = post('picstitle');
99
+            if ($picstitle) {
100
+                $picstitle = implode(',', $picstitle);
101
+            }
102
+            
103
+            $content = post('content');
104
+            $tags = str_replace(',', ',', post('tags'));
105
+            $enclosure = post('enclosure');
106
+            $keywords = post('keywords');
107
+            $description = post('description');
108
+            $status = post('status', 'int');
109
+            $istop = post('istop', 'int', '', '', 0);
110
+            $isrecommend = post('isrecommend', 'int', '', '', 0);
111
+            $isheadline = post('isheadline', 'int', '', '', 0);
112
+            
113
+            $gid = post('gid', 'int') ?: 0;
114
+            $gtype = post('gtype', 'int') ?: 4;
115
+            $gnote = post('gnote');
116
+            
117
+            if (! $scode) {
118
+                alert_back('内容分类不能为空!');
119
+            }
120
+            
121
+            if (! $title) {
122
+                alert_back('文章标题不能为空!');
123
+            }
124
+            
125
+            if ($filename && ! preg_match('/^[a-zA-Z0-9\-_\/]+$/', $filename)) {
126
+                alert_back('内容URL名称只允许字母、数字、横线、下划线组成!');
127
+            }
128
+            
129
+            // 自动提起前一百个字符为描述
130
+            if (! $description && isset($_POST['content'])) {
131
+                $description = escape_string(clear_html_blank(substr_both(strip_tags($_POST['content']), 0, 150)));
132
+            }
133
+            
134
+            // 无缩略图时,自动提取文章第一张图为缩略图
135
+            if (! $ico && preg_match('/<img\s+.*?src=\s?[\'|\"](.*?(\.gif|\.jpg|\.png|\.jpeg))[\'|\"].*?[\/]?>/i', decode_string($content), $srcs) && isset($srcs[1])) {
136
+                $ico = $srcs[1];
137
+            }
138
+            
139
+            // 缩放缩略图
140
+            if ($ico) {
141
+                resize_img(ROOT_PATH . $ico, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
142
+            }
143
+            
144
+            // 检查自定义URL名称
145
+            if ($filename) {
146
+                while ($this->model->checkFilename($filename)) {
147
+                    $filename = $filename . '-' . mt_rand(1, 20);
148
+                }
149
+            }
150
+            
151
+            // 记住新增栏目
152
+            session('addscode', $scode);
153
+            
154
+            // 构建数据
155
+            $data = array(
156
+                'acode' => session('acode'),
157
+                'scode' => $scode,
158
+                'subscode' => $subscode,
159
+                'title' => $title,
160
+                'titlecolor' => $titlecolor,
161
+                'subtitle' => $subtitle,
162
+                'filename' => $filename,
163
+                'author' => $author,
164
+                'source' => $source,
165
+                'outlink' => $outlink,
166
+                'date' => $date,
167
+                'ico' => $ico,
168
+                'pics' => $pics,
169
+                'picstitle' => $picstitle,
170
+                'content' => $content,
171
+                'tags' => $tags,
172
+                'enclosure' => $enclosure,
173
+                'keywords' => $keywords,
174
+                'description' => clear_html_blank($description),
175
+                'sorting' => 255,
176
+                'status' => $status,
177
+                'istop' => $istop,
178
+                'isrecommend' => $isrecommend,
179
+                'isheadline' => $isheadline,
180
+                'gid' => $gid,
181
+                'gtype' => $gtype,
182
+                'gnote' => $gnote,
183
+                'visits' => 0,
184
+                'likes' => 0,
185
+                'oppose' => 0,
186
+                'create_user' => session('username'),
187
+                'update_user' => session('username')
188
+            );
189
+            
190
+            // 执行添加
191
+            if (! ! $id = $this->model->addContent($data)) {
192
+                // 扩展内容添加
193
+                foreach ($_POST as $key => $value) {
194
+                    if (preg_match('/^ext_[\w\-]+$/', $key)) {
195
+                        if (! isset($data2['contentid'])) {
196
+                            $data2['contentid'] = $id;
197
+                        }
198
+                        $temp = post($key);
199
+                        if (is_array($temp)) {
200
+                            $data2[$key] = implode(',', $temp);
201
+                        } else {
202
+                            $data2[$key] = str_replace("\r\n", '<br>', $temp);
203
+                        }
204
+                    }
205
+                }
206
+                if (isset($data2)) {
207
+                    if (! $this->model->addContentExt($data2)) {
208
+                        $this->model->delContent($id);
209
+                        $this->log('新增文章失败!');
210
+                        error('新增失败!', - 1);
211
+                    }
212
+                }
213
+                
214
+                $this->log('新增文章成功!');
215
+                if (! ! $backurl = get('backurl')) {
216
+                    success('新增成功!', base64_decode($backurl));
217
+                } else {
218
+                    success('新增成功!', url('/admin/Content/index/mcode/' . get('mcode')));
219
+                }
220
+            } else {
221
+                $this->log('新增文章失败!');
222
+                error('新增失败!', - 1);
223
+            }
224
+        }
225
+    }
226
+
227
+    // 生成分类选择
228
+    private function makeSortSelect($tree, $selectid = null)
229
+    {
230
+        $list_html = '';
231
+        foreach ($tree as $value) {
232
+            // 默认选择项
233
+            if ($selectid == $value->scode) {
234
+                $select = "selected='selected'";
235
+            } else {
236
+                $select = '';
237
+            }
238
+            $list_html .= "<option value='{$value->scode}' $select>{$this->blank}{$value->name}";
239
+            // 子菜单处理
240
+            if ($value->son) {
241
+                $this->blank .= '  ';
242
+                $list_html .= $this->makeSortSelect($value->son, $selectid);
243
+            }
244
+        }
245
+        // 循环完后回归位置
246
+        $this->blank = substr($this->blank, 0, - 6);
247
+        return $list_html;
248
+    }
249
+
250
+    // 文章删除
251
+    public function del()
252
+    {
253
+        // 执行批量删除
254
+        if ($_POST) {
255
+            if (! ! $list = post('list')) {
256
+                if ($this->model->delContentList($list)) {
257
+                    $this->model->delContentExtList($list);
258
+                    $this->log('批量删除文章成功!');
259
+                    success('批量删除成功!', - 1);
260
+                } else {
261
+                    $this->log('批量删除文章失败!');
262
+                    error('批量删除失败!', - 1);
263
+                }
264
+            } else {
265
+                alert_back('请选择要删除的内容!');
266
+            }
267
+        }
268
+        
269
+        if (! $id = get('id', 'int')) {
270
+            error('传递的参数值错误!', - 1);
271
+        }
272
+        
273
+        if ($this->model->delContent($id)) {
274
+            $this->model->delContentExt($id);
275
+            $this->log('删除文章' . $id . '成功!');
276
+            success('删除成功!', - 1);
277
+        } else {
278
+            $this->log('删除文章' . $id . '失败!');
279
+            error('删除失败!', - 1);
280
+        }
281
+    }
282
+
283
+    // 文章修改
284
+    public function mod()
285
+    {
286
+        if (! ! $submit = post('submit')) {
287
+            switch ($submit) {
288
+                case 'sorting': // 修改列表排序
289
+                    $listall = post('listall');
290
+                    if ($listall) {
291
+                        $sorting = post('sorting');
292
+                        foreach ($listall as $key => $value) {
293
+                            if ($sorting[$key] === '' || ! is_numeric($sorting[$key]))
294
+                                $sorting[$key] = 255;
295
+                            $this->model->modContent($value, "sorting=" . $sorting[$key]);
296
+                        }
297
+                        $this->log('修改内容排序成功!');
298
+                        success('修改成功!', - 1);
299
+                    } else {
300
+                        alert_back('排序失败,无任何内容!');
301
+                    }
302
+                    break;
303
+                case 'copy':
304
+                    $list = post('list');
305
+                    $scode = post('scode');
306
+                    if (! $list) {
307
+                        alert_back('请选择要复制的内容!');
308
+                    }
309
+                    if (! $scode) {
310
+                        alert_back('请选择目标栏目!');
311
+                    }
312
+                    if ($this->model->copyContent($list, $scode)) {
313
+                        $this->log('复制内容成功!');
314
+                        success('复制内容成功!', - 1);
315
+                    } else {
316
+                        alert_back('复制内容失败!');
317
+                    }
318
+                    break;
319
+                case 'move':
320
+                    $list = post('list');
321
+                    $scode = post('scode');
322
+                    if (! $list) {
323
+                        alert_back('请选择要移动的内容!');
324
+                    }
325
+                    if (! $scode) {
326
+                        alert_back('请选择目标栏目!');
327
+                    }
328
+                    
329
+                    if ($this->model->modContent($list, "scode='" . $scode . "'")) {
330
+                        $this->log('移动内容成功!');
331
+                        success('移动内容成功!', - 1);
332
+                    } else {
333
+                        alert_back('移动内容失败!');
334
+                    }
335
+                    break;
336
+                case 'baiduzz':
337
+                    $list = post('list');
338
+                    $urls = post('urls');
339
+                    if (! $list) {
340
+                        alert_back('请选择要推送的内容!');
341
+                    }
342
+                    // 依次推送
343
+                    $domain = get_http_url();
344
+                    if (! $token = $this->config('baidu_zz_token')) {
345
+                        alert_back('请先到系统配置中填写百度普通收录推送token值!');
346
+                    }
347
+                    $api = "http://data.zz.baidu.com/urls?site=$domain&token=$token";
348
+                    foreach ($list as $key => $value) {
349
+                        $url = $domain . $urls[$value];
350
+                        $this->log('百度普通收录推送:' . $url);
351
+                        $post_urls[] = $url;
352
+                    }
353
+                    $result = post_baidu($api, $post_urls);
354
+                    if (isset($result->error)) {
355
+                        alert_back('百度普通收录推送发生错误:' . $result->message);
356
+                    } elseif (isset($result->success)) {
357
+                        alert_back('成功推送' . $result->success . '条,今天剩余可推送' . $result->remain . '条数!');
358
+                    } else {
359
+                        alert_back('发生未知错误!');
360
+                    }
361
+                case 'baiduks':
362
+                    $list = post('list');
363
+                    $urls = post('urls');
364
+                    if (! $list) {
365
+                        alert_back('请选择要推送的内容!');
366
+                    }
367
+                    // 依次推送
368
+                    $domain = get_http_url();
369
+                    if (! $token = $this->config('baidu_ks_token')) {
370
+                        alert_back('请先到系统配置中填写百度快速收录推送token值!');
371
+                    }
372
+                    $api = "http://data.zz.baidu.com/urls?site=$domain&token=$token&type=daily";
373
+                    foreach ($list as $key => $value) {
374
+                        $url = $domain . $urls[$value];
375
+                        $this->log('百度快速收录推送:' . $url);
376
+                        $post_urls[] = $url;
377
+                    }
378
+                    $result = post_baidu($api, $post_urls);
379
+                    if (isset($result->error)) {
380
+                        alert_back('百度快速收录推送发生错误:' . $result->message);
381
+                    } elseif (isset($result->success_daily)) {
382
+                        alert_back('成功推送' . $result->success_daily . '条,今天剩余可推送' . $result->remain_daily . '条数!');
383
+                    } else {
384
+                        alert_back('发生未知错误!');
385
+                    }
386
+            }
387
+        }
388
+        
389
+        if (! $id = get('id', 'int')) {
390
+            error('传递的参数值错误!', - 1);
391
+        }
392
+        
393
+        // 单独修改状态
394
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
395
+            if ($this->model->modContent($id, "$field='$value',update_user='" . session('username') . "'")) {
396
+                location(- 1);
397
+            } else {
398
+                alert_back('修改失败!');
399
+            }
400
+        }
401
+        
402
+        // 修改操作
403
+        if ($_POST) {
404
+            
405
+            // 获取数据
406
+            $scode = post('scode');
407
+            $subscode = post('subscode');
408
+            $title = post('title');
409
+            $titlecolor = post('titlecolor');
410
+            $subtitle = post('subtitle');
411
+            $filename = trim(post('filename'), '/');
412
+            $author = post('author');
413
+            $source = post('source');
414
+            $outlink = post('outlink');
415
+            $date = post('date');
416
+            $ico = post('ico');
417
+            $pics = post('pics');
418
+            
419
+            // 获取多图标题
420
+            $picstitle = post('picstitle');
421
+            if ($picstitle) {
422
+                $picstitle = implode(',', $picstitle);
423
+            }
424
+            
425
+            $content = post('content');
426
+            $tags = str_replace(',', ',', post('tags'));
427
+            $enclosure = post('enclosure');
428
+            $keywords = post('keywords');
429
+            $description = post('description');
430
+            $status = post('status', 'int');
431
+            $istop = post('istop', 'int', '', '', 0);
432
+            $isrecommend = post('isrecommend', 'int', '', '', 0);
433
+            $isheadline = post('isheadline', 'int', '', '', 0);
434
+            
435
+            $gid = post('gid', 'int') ?: 0;
436
+            $gtype = post('gtype', 'int') ?: 4;
437
+            $gnote = post('gnote');
438
+            
439
+            if (! $scode) {
440
+                alert_back('内容分类不能为空!');
441
+            }
442
+            
443
+            if (! $title) {
444
+                alert_back('文章标题不能为空!');
445
+            }
446
+            
447
+            if ($filename && ! preg_match('/^[a-zA-Z0-9\-_\/]+$/', $filename)) {
448
+                alert_back('内容URL名称只允许字母、数字、横线、下划线组成!');
449
+            }
450
+            
451
+            // 自动提起前一百个字符为描述
452
+            if (! $description && isset($_POST['content'])) {
453
+                $description = escape_string(clear_html_blank(substr_both(strip_tags($_POST['content']), 0, 150)));
454
+            }
455
+            
456
+            // 无缩略图时,自动提取文章第一张图为缩略图
457
+            if (! $ico && preg_match('/<img\s+.*?src=\s?[\'|\"](.*?(\.gif|\.jpg|\.png|\.jpeg))[\'|\"].*?[\/]?>/i', decode_string($content), $srcs) && isset($srcs[1])) {
458
+                $ico = $srcs[1];
459
+            }
460
+            
461
+            // 缩放缩略图
462
+            if ($ico) {
463
+                resize_img(ROOT_PATH . $ico, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
464
+            }
465
+            
466
+            if ($filename) {
467
+                while ($this->model->checkFilename($filename, "id<>$id")) {
468
+                    $filename = $filename . '-' . mt_rand(1, 20);
469
+                }
470
+            }
471
+            
472
+            // 构建数据
473
+            $data = array(
474
+                'scode' => $scode,
475
+                'subscode' => $subscode,
476
+                'title' => $title,
477
+                'titlecolor' => $titlecolor,
478
+                'subtitle' => $subtitle,
479
+                'filename' => $filename,
480
+                'author' => $author,
481
+                'source' => $source,
482
+                'outlink' => $outlink,
483
+                'date' => $date,
484
+                'ico' => $ico,
485
+                'pics' => $pics,
486
+                'picstitle' => $picstitle,
487
+                'content' => $content,
488
+                'tags' => $tags,
489
+                'enclosure' => $enclosure,
490
+                'keywords' => $keywords,
491
+                'description' => clear_html_blank($description),
492
+                'status' => $status,
493
+                'istop' => $istop,
494
+                'isrecommend' => $isrecommend,
495
+                'isheadline' => $isheadline,
496
+                'gid' => $gid,
497
+                'gtype' => $gtype,
498
+                'gnote' => $gnote,
499
+                'update_user' => session('username')
500
+            );
501
+            
502
+            // 执行添加
503
+            if ($this->model->modContent($id, $data)) {
504
+                // 扩展内容修改
505
+                foreach ($_POST as $key => $value) {
506
+                    if (preg_match('/^ext_[\w\-]+$/', $key)) {
507
+                        $temp = post($key);
508
+                        if (is_array($temp)) {
509
+                            $data2[$key] = implode(',', $temp);
510
+                        } else {
511
+                            $data2[$key] = str_replace("\r\n", '<br>', $temp);
512
+                        }
513
+                    }
514
+                }
515
+                if (isset($data2)) {
516
+                    if ($this->model->findContentExt($id)) {
517
+                        $this->model->modContentExt($id, $data2);
518
+                    } else {
519
+                        $data2['contentid'] = $id;
520
+                        $this->model->addContentExt($data2);
521
+                    }
522
+                }
523
+                
524
+                $this->log('修改文章' . $id . '成功!');
525
+                if (! ! $backurl = get('backurl')) {
526
+                    success('修改成功!', base64_decode($backurl));
527
+                } else {
528
+                    success('修改成功!', url('/admin/Content/index/mcode/2'));
529
+                }
530
+            } else {
531
+                location(- 1);
532
+            }
533
+        } else {
534
+            // 调取修改内容
535
+            $this->assign('mod', true);
536
+            if (! $result = $this->model->getContent($id)) {
537
+                error('编辑的内容已经不存在!', - 1);
538
+            }
539
+            $this->assign('content', $result);
540
+            
541
+            if (! $mcode = get('mcode', 'var')) {
542
+                error('传递的模型编码参数有误,请核对后重试!');
543
+            }
544
+            
545
+            // 文章分类
546
+            $sort_model = model('admin.content.ContentSort');
547
+            $sort_select = $sort_model->getListSelect($mcode);
548
+            $this->assign('sort_select', $this->makeSortSelect($sort_select, $result->scode));
549
+            $this->assign('subsort_select', $this->makeSortSelect($sort_select, $result->subscode));
550
+            
551
+            // 模型名称
552
+            $this->assign('model_name', model('admin.content.Model')->getName($mcode));
553
+            
554
+            // 扩展字段
555
+            $this->assign('extfield', model('admin.content.ExtField')->getModelField($mcode));
556
+            
557
+            // 获取会员分组
558
+            $this->assign('groups', model('admin.member.MemberGroup')->getSelect());
559
+            
560
+            $this->display('content/content.html');
561
+        }
562
+    }
563
+}

+ 537
- 0
apps/admin/controller/content/ContentSortController.php View File

@@ -0,0 +1,537 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年12月26日
7
+ *  内容栏目控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\ContentSortModel;
13
+
14
+class ContentSortController extends Controller
15
+{
16
+
17
+    private $count;
18
+
19
+    private $blank;
20
+
21
+    private $outData = array();
22
+
23
+    private $model;
24
+
25
+    public function __construct()
26
+    {
27
+        $this->model = new ContentSortModel();
28
+    }
29
+
30
+    // 内容栏目列表
31
+    public function index()
32
+    {
33
+        $this->assign('list', true);
34
+        $tree = $this->model->getList();
35
+        $sorts = $this->makeSortList($tree);
36
+        $this->assign('sorts', $sorts);
37
+        
38
+        // 内容模型
39
+        $models = model('admin.content.Model');
40
+        $this->assign('allmodels', $models->getSelectAll());
41
+        $this->assign('models', $models->getSelect());
42
+        
43
+        // 内容栏目下拉表
44
+        $sort_tree = $this->model->getSelect();
45
+        $sort_select = $this->makeSortSelect($sort_tree);
46
+        $this->assign('sort_select', $sort_select);
47
+        
48
+        // 模板文件
49
+        $htmldir = $this->config('tpl_html_dir') ? '/' . $this->config('tpl_html_dir') : '';
50
+        $this->assign('tpls', file_list(ROOT_PATH . current($this->config('tpl_dir')) . '/' . $this->model->getTheme() . $htmldir));
51
+        
52
+        // 前端地址连接符判断
53
+        $url_break_char = $this->config('url_break_char') ?: '_';
54
+        $this->assign('url_break_char', $url_break_char);
55
+        
56
+        // 获取会员分组
57
+        $this->assign('groups', model('admin.member.MemberGroup')->getSelect());
58
+        
59
+        $this->display('content/contentsort.html');
60
+    }
61
+
62
+    // 生成无限级内容栏目列表
63
+    private function makeSortList($tree)
64
+    {
65
+        // 循环生成
66
+        foreach ($tree as $value) {
67
+            $this->count ++;
68
+            $this->outData[$this->count] = new \stdClass();
69
+            foreach ($value as $k => $v) {
70
+                $this->outData[$this->count]->$k = $v;
71
+            }
72
+            
73
+            if ($value->son) {
74
+                $this->outData[$this->count]->son = true;
75
+            } else {
76
+                $this->outData[$this->count]->son = false;
77
+            }
78
+            
79
+            // 子菜单处理
80
+            if ($value->son) {
81
+                $this->blank .= '  ';
82
+                $this->makeSortList($value->son);
83
+            }
84
+        }
85
+        
86
+        // 循环完后回归缩进位置
87
+        $this->blank = substr($this->blank, 6);
88
+        return $this->outData;
89
+    }
90
+
91
+    // 内容栏目增加
92
+    public function add()
93
+    {
94
+        if ($_POST) {
95
+            if (! ! $multiplename = post('multiplename')) {
96
+                $multiplename = str_replace(',', ',', $multiplename);
97
+                $pcode = post('pcode', 'var');
98
+                $type = post('type');
99
+                $mcode = post('mcode');
100
+                $listtpl = basename(post('listtpl'));
101
+                $contenttpl = basename(post('contenttpl'));
102
+                $status = post('status');
103
+                
104
+                if (! $pcode) { // 父编码默认为0
105
+                    $pcode = 0;
106
+                }
107
+                
108
+                if (! $mcode) {
109
+                    alert_back('栏目模型必须选择!');
110
+                }
111
+                
112
+                if (! $type) {
113
+                    alert_back('栏目类型不能为空!');
114
+                }
115
+                
116
+                $names = explode(',', $multiplename);
117
+                $lastcode = $this->model->getLastCode();
118
+                $scode = get_auto_code($lastcode);
119
+                foreach ($names as $key => $value) {
120
+                    $data[] = array(
121
+                        'acode' => session('acode'),
122
+                        'pcode' => $pcode,
123
+                        'scode' => $scode,
124
+                        'name' => $value,
125
+                        'mcode' => $mcode,
126
+                        'listtpl' => $listtpl,
127
+                        'contenttpl' => $contenttpl,
128
+                        'status' => $status,
129
+                        'gid' => 0,
130
+                        'gtype' => 4,
131
+                        'subname' => '',
132
+                        'filename' => '',
133
+                        'outlink' => '',
134
+                        'ico' => '',
135
+                        'pic' => '',
136
+                        'title' => '',
137
+                        'keywords' => '',
138
+                        'description' => '',
139
+                        'sorting' => 255,
140
+                        'create_user' => session('username'),
141
+                        'update_user' => session('username')
142
+                    );
143
+                    $scode = get_auto_code($scode);
144
+                }
145
+            } else {
146
+                // 获取数据
147
+                $scode = get_auto_code($this->model->getLastCode()); // 自动编码;
148
+                $pcode = post('pcode', 'var');
149
+                $name = post('name');
150
+                $type = post('type');
151
+                $mcode = post('mcode');
152
+                $listtpl = basename(post('listtpl'));
153
+                $contenttpl = basename(post('contenttpl'));
154
+                $status = post('status');
155
+                $subname = post('subname');
156
+                $filename = trim(post('filename'), '/');
157
+                $outlink = post('outlink');
158
+                $ico = post('ico');
159
+                $pic = post('pic');
160
+                $title = post('title');
161
+                $keywords = post('keywords');
162
+                $description = post('description');
163
+                
164
+                $gid = post('gid', 'int') ?: 0;
165
+                $gtype = post('gtype', 'int') ?: 4;
166
+                $gnote = post('gnote');
167
+                
168
+                $def1 = post('def1');
169
+                $def2 = post('def2');
170
+                $def3 = post('def3');
171
+                
172
+                if (! $scode) {
173
+                    alert_back('编码不能为空!');
174
+                }
175
+                
176
+                if (! $pcode) { // 父编码默认为0
177
+                    $pcode = 0;
178
+                }
179
+                
180
+                if (! $name) {
181
+                    alert_back('栏目名不能为空!');
182
+                }
183
+                
184
+                if (! $mcode) {
185
+                    alert_back('栏目模型必须选择!');
186
+                }
187
+                
188
+                if (! $type) {
189
+                    alert_back('栏目类型不能为空!');
190
+                }
191
+                
192
+                if ($filename && ! preg_match('/^[a-zA-Z0-9\-\/]+$/', $filename)) {
193
+                    alert_back('URL名称只允许字母、数字、横线、斜线组成!');
194
+                }
195
+                
196
+                if ($filename && $this->model->checkUrlname($filename)) {
197
+                    alert_back('URL名称与模型URL名称冲突,请换一个名称!');
198
+                }
199
+                
200
+                // 缩放缩略图
201
+                if ($ico) {
202
+                    resize_img(ROOT_PATH . $ico, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
203
+                }
204
+                
205
+                // 检查编码
206
+                if ($this->model->checkSort("scode='$scode'")) {
207
+                    alert_back('该内容栏目编号已经存在,不能再使用!');
208
+                }
209
+                
210
+                // 检查自定义URL名称
211
+                if ($filename) {
212
+                    while ($this->model->checkFilename($filename)) {
213
+                        $filename = $filename . '_' . mt_rand(1, 20);
214
+                    }
215
+                }
216
+                
217
+                // 构建数据
218
+                $data = array(
219
+                    'acode' => session('acode'),
220
+                    'pcode' => $pcode,
221
+                    'scode' => $scode,
222
+                    'name' => $name,
223
+                    'mcode' => $mcode,
224
+                    'listtpl' => $listtpl,
225
+                    'contenttpl' => $contenttpl,
226
+                    'status' => $status,
227
+                    'gid' => $gid,
228
+                    'gtype' => $gtype,
229
+                    'gnote' => $gnote,
230
+                    'subname' => $subname,
231
+                    'def1' => $def1,
232
+                    'def2' => $def2,
233
+                    'def3' => $def3,
234
+                    'filename' => $filename,
235
+                    'outlink' => $outlink,
236
+                    'ico' => $ico,
237
+                    'pic' => $pic,
238
+                    'title' => $title,
239
+                    'keywords' => $keywords,
240
+                    'description' => $description,
241
+                    'sorting' => 255,
242
+                    'create_user' => session('username'),
243
+                    'update_user' => session('username')
244
+                );
245
+            }
246
+            
247
+            // 执行添加
248
+            if ($this->model->addSort($data)) {
249
+                if ($type == 1 && ! $outlink) { // 在填写了外链时不生成单页
250
+                    if ($multiplename) {
251
+                        foreach ($data as $key => $value) {
252
+                            $this->addSingle($value['scode'], $value['name']);
253
+                        }
254
+                    } else {
255
+                        $this->addSingle($scode, $name);
256
+                    }
257
+                }
258
+                $this->log('新增数据内容栏目' . $scode . '成功!');
259
+                success('新增成功!', url('/admin/ContentSort/index'));
260
+            } else {
261
+                $this->log('新增数据内容栏目' . $scode . '失败!');
262
+                error('新增失败!', - 1);
263
+            }
264
+        }
265
+    }
266
+
267
+    // 生成内容栏目下拉选择
268
+    private function makeSortSelect($tree, $selectid = null)
269
+    {
270
+        $list_html = '';
271
+        foreach ($tree as $value) {
272
+            // 默认选择项
273
+            if ($selectid == $value->scode) {
274
+                $select = "selected='selected'";
275
+            } else {
276
+                $select = '';
277
+            }
278
+            if (get('scode') != $value->scode) { // 不显示本身,避免出现自身为自己的父节点
279
+                $list_html .= "<option value='{$value->scode}' $select>{$this->blank}{$value->name}</option>";
280
+            }
281
+            // 子菜单处理
282
+            if ($value->son) {
283
+                $this->blank .= '  ';
284
+                $list_html .= $this->makeSortSelect($value->son, $selectid);
285
+            }
286
+        }
287
+        // 循环完后回归位置
288
+        $this->blank = substr($this->blank, 0, - 6);
289
+        return $list_html;
290
+    }
291
+
292
+    // 内容栏目删除
293
+    public function del()
294
+    {
295
+        // 执行批量删除
296
+        if ($_POST) {
297
+            if (! ! $list = post('list')) {
298
+                if ($this->model->delSortList($list)) {
299
+                    $this->log('批量删除栏目成功!');
300
+                    success('批量删除成功!', - 1);
301
+                } else {
302
+                    $this->log('批量删除栏目失败!');
303
+                    error('批量删除失败!', - 1);
304
+                }
305
+            } else {
306
+                alert_back('请选择要删除的栏目!');
307
+            }
308
+        }
309
+        
310
+        if (! $scode = get('scode', 'var')) {
311
+            error('传递的参数值错误!', - 1);
312
+        }
313
+        if ($this->model->delSort($scode)) {
314
+            $this->log('删除数据内容栏目' . $scode . '成功!');
315
+            success('删除成功!', - 1);
316
+        } else {
317
+            $this->log('删除数据内容栏目' . $scode . '失败!');
318
+            error('删除失败!', - 1);
319
+        }
320
+    }
321
+
322
+    // 内容栏目修改
323
+    public function mod()
324
+    {
325
+        if (! ! $submit = post('submit')) {
326
+            switch ($submit) {
327
+                case 'sorting': // 修改列表排序
328
+                    $listall = post('listall');
329
+                    if ($listall) {
330
+                        $sorting = post('sorting');
331
+                        foreach ($listall as $key => $value) {
332
+                            if ($sorting[$key] === '' || ! is_numeric($sorting[$key]))
333
+                                $sorting[$key] = 255;
334
+                            $this->model->modSortSorting($value, "sorting=" . $sorting[$key]);
335
+                        }
336
+                        $this->log('批量修改栏目排序成功!');
337
+                        success('修改成功!', - 1);
338
+                    } else {
339
+                        alert_back('排序失败,无任何内容!');
340
+                    }
341
+                    break;
342
+            }
343
+        }
344
+        
345
+        if (! $scode = get('scode', 'var')) {
346
+            error('传递的参数值错误!', - 1);
347
+        }
348
+        
349
+        // 单独修改状态
350
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
351
+            if ($this->model->modSort($scode, "$field='$value',update_user='" . session('username') . "'")) {
352
+                $this->log('修改数据内容栏目' . $scode . '状态' . $value . '成功!');
353
+                location(- 1);
354
+            } else {
355
+                $this->log('修改数据内容栏目' . $scode . '状态' . $value . '失败!');
356
+                alert_back('修改失败!');
357
+            }
358
+        }
359
+        
360
+        // 修改操作
361
+        if ($_POST) {
362
+            
363
+            // 获取数据
364
+            $pcode = post('pcode', 'var');
365
+            $name = post('name');
366
+            $mcode = post('mcode');
367
+            $type = post('type');
368
+            $listtpl = basename(post('listtpl'));
369
+            $contenttpl = basename(post('contenttpl'));
370
+            $status = post('status');
371
+            $subname = post('subname');
372
+            $filename = trim(post('filename'), '/');
373
+            $outlink = post('outlink');
374
+            $ico = post('ico');
375
+            $pic = post('pic');
376
+            $title = post('title');
377
+            $keywords = post('keywords');
378
+            $description = post('description');
379
+            $modsub = post('modsub', 'int');
380
+            
381
+            $gid = post('gid', 'int') ?: 0;
382
+            $gtype = post('gtype', 'int') ?: 4;
383
+            $gnote = post('gnote');
384
+            
385
+            $def1 = post('def1');
386
+            $def2 = post('def2');
387
+            $def3 = post('def3');
388
+            
389
+            if (! $pcode) { // 父编码默认为0
390
+                $pcode = 0;
391
+            }
392
+            
393
+            if (! $name) {
394
+                alert_back('栏目名不能为空!');
395
+            }
396
+            
397
+            if (! $mcode) {
398
+                alert_back('栏目模型必须选择!');
399
+            }
400
+            
401
+            if (! $type) {
402
+                alert_back('栏目类型不能为空!');
403
+            }
404
+            
405
+            if ($filename && ! preg_match('/^[a-zA-Z0-9\-\/]+$/', $filename)) {
406
+                alert_back('URL名称只允许字母、数字、横线、斜线组成!');
407
+            }
408
+            
409
+            if ($filename && $this->model->checkUrlname($filename)) {
410
+                alert_back('URL名称与模型URL名称冲突,请换一个名称!');
411
+            }
412
+            
413
+            // 缩放缩略图
414
+            if ($ico) {
415
+                resize_img(ROOT_PATH . $ico, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
416
+            }
417
+            
418
+            if ($filename) {
419
+                while ($this->model->checkFilename($filename, "scode<>'$scode'")) {
420
+                    $filename = $filename . '-' . mt_rand(1, 20);
421
+                }
422
+            }
423
+            
424
+            // 构建数据
425
+            $data = array(
426
+                'pcode' => $pcode,
427
+                'name' => $name,
428
+                'mcode' => $mcode,
429
+                'listtpl' => $listtpl,
430
+                'contenttpl' => $contenttpl,
431
+                'status' => $status,
432
+                'gid' => $gid,
433
+                'gtype' => $gtype,
434
+                'gnote' => $gnote,
435
+                'subname' => $subname,
436
+                'def1' => $def1,
437
+                'def2' => $def2,
438
+                'def3' => $def3,
439
+                'filename' => $filename,
440
+                'outlink' => $outlink,
441
+                'ico' => $ico,
442
+                'pic' => $pic,
443
+                'title' => $title,
444
+                'keywords' => $keywords,
445
+                'description' => $description,
446
+                'update_user' => session('username')
447
+            );
448
+            
449
+            // 执行添加
450
+            if ($this->model->modSort($scode, $data, $modsub)) {
451
+                // 如果修改为单页并且跳转,则删除单页内容,否则判断是否存在内容,不存在则添加
452
+                if ($type == 1 && $outlink) {
453
+                    $this->model->delContent($scode);
454
+                } elseif ($type == 1 && ! $this->model->findContent($scode)) {
455
+                    $this->addSingle($scode, $name);
456
+                }
457
+                
458
+                $this->log('修改数据内容栏目' . $scode . '成功!');
459
+                success('修改成功!', url('/admin/ContentSort/index'));
460
+            } else {
461
+                location(- 1);
462
+            }
463
+        } else { // 调取修改内容
464
+            $this->assign('mod', true);
465
+            
466
+            $sort = $this->model->getSort($scode);
467
+            if (! $sort) {
468
+                error('编辑的内容已经不存在!', - 1);
469
+            }
470
+            $this->assign('sort', $sort);
471
+            
472
+            // 父编码下拉选择
473
+            $sort_tree = $this->model->getSelect();
474
+            $sort_select = $this->makeSortSelect($sort_tree, $sort->pcode);
475
+            $this->assign('sort_select', $sort_select);
476
+            
477
+            // 模板文件
478
+            $htmldir = $this->config('tpl_html_dir') ? '/' . $this->config('tpl_html_dir') : '';
479
+            $this->assign('tpls', file_list(ROOT_PATH . current($this->config('tpl_dir')) . '/' . $this->model->getTheme() . $htmldir));
480
+            
481
+            // 内容模型
482
+            $models = model('admin.content.Model');
483
+            $this->assign('models', $models->getSelect());
484
+            
485
+            // 获取会员分组
486
+            $this->assign('groups', model('admin.member.MemberGroup')->getSelect());
487
+            
488
+            $this->display('content/contentsort.html');
489
+        }
490
+    }
491
+
492
+    // 添加栏目时执行单页内容增加
493
+    public function addSingle($scode, $title)
494
+    {
495
+        // 构建数据
496
+        $data = array(
497
+            'acode' => session('acode'),
498
+            'scode' => $scode,
499
+            'subscode' => '',
500
+            'title' => $title,
501
+            'titlecolor' => '#333333',
502
+            'subtitle' => '',
503
+            'filename' => '',
504
+            'author' => session('realname'),
505
+            'source' => '本站',
506
+            'outlink' => '',
507
+            'date' => date('Y-m-d H:i:s'),
508
+            'ico' => '',
509
+            'pics' => '',
510
+            'content' => '',
511
+            'tags' => '',
512
+            'enclosure' => '',
513
+            'keywords' => '',
514
+            'description' => '',
515
+            'sorting' => 255,
516
+            'status' => 1,
517
+            'istop' => 0,
518
+            'isrecommend' => 0,
519
+            'isheadline' => 0,
520
+            'gid' => 0,
521
+            'gtype' => 4,
522
+            'gnote' => '',
523
+            'visits' => 0,
524
+            'likes' => 0,
525
+            'oppose' => 0,
526
+            'create_user' => session('username'),
527
+            'update_user' => session('username')
528
+        );
529
+        
530
+        // 执行添加
531
+        if ($this->model->addSingle($data)) {
532
+            return true;
533
+        } else {
534
+            return false;
535
+        }
536
+    }
537
+}

+ 224
- 0
apps/admin/controller/content/DeleCacheController.php View File

@@ -0,0 +1,224 @@
1
+<?php
2
+/**
3
+ * @author xsh
4
+ * @email hnxsh@foxmail.com
5
+ * @date 2021年10月31日
6
+ *
7
+ */
8
+namespace app\admin\controller\content;
9
+
10
+use core\basic\Controller;
11
+use app\home\controller\GetPageController;
12
+use core\basic\Config;
13
+
14
+class DeleCacheController extends GetPageController
15
+{
16
+
17
+    public function index($type = null, $data = null)
18
+    {
19
+        if ($type || ! ! $type = get('type', 'int')) {
20
+                        
21
+            // 设置基础信息
22
+            $this->setinfo();
23
+            
24
+            // 执行更新过程
25
+            switch ($type) {
26
+                case '1':
27
+                    $this->deleIndex();
28
+					$this->deleSort("0");
29
+                    json(1, '更新更新首页和栏目成功');
30
+                    break;
31
+                case '2':
32
+                    $this->deleSortAll("0");
33
+                    json(1, '更新全部栏目分页成功');
34
+                    break;
35
+				case '3':
36
+                    $this->deleContont($data);
37
+                    json(1, '更新内容成功');
38
+                    break;
39
+                default:
40
+                    json(0, '传递参数错误');
41
+            }
42
+        } else {
43
+            $sort_model = model('admin.content.ContentSort');
44
+            $sort_tree = $sort_model->getSelect();
45
+            $this->assign('sort_select', $this->makeSortSelect($sort_tree));
46
+            $this->assign('sort_select2', $this->makeSortSelect($sort_tree, true));
47
+            $this->display('content/delecache.html');
48
+        }
49
+    }
50
+
51
+    // 删除首页缓存
52
+    private function deleIndex()
53
+    {
54
+        $path = '/';
55
+		$lg = cookie('lg');
56
+		$wap = '';
57
+		$cacheFile = RUN_PATH . '/cache/' . md5(get_http_url() . $path . $lg . $wap) . '.html';
58
+		unlink($cacheFile);
59
+		if (Config::get('open_wap')){
60
+		$wap = 'wap';
61
+		$cacheFilewap = RUN_PATH . '/cache/' . md5(get_http_url() . $path . $lg . $wap) . '.html';
62
+		unlink($cacheFilewap);
63
+		}
64
+    }
65
+
66
+    // 删除栏目首页缓存
67
+    private function deleSort($scode = null)
68
+    {
69
+		$lg = cookie('lg');
70
+		$wap = '';
71
+        $scode = $scode ?: get('scode', 'var');
72
+        if (! $scode) {
73
+            $scodes = $this->model->getScodes('1,2');
74
+        } else {
75
+            $scodes = $this->model->getSubScodes($scode);
76
+        }
77
+        
78
+        $err = '';
79
+        foreach ($scodes as $value) {
80
+            $sort = $this->model->getSort($value);
81
+            if ($sort) {
82
+                if ($sort->type == 1) {
83
+					$link = $this->parser->parserLink($sort->type, $sort->urlname, 'list', $sort->scode, $sort->filename, '', '');
84
+					$cacheFile = RUN_PATH . '/cache/' . md5(get_http_url() . $link . $lg . $wap) . '.html';
85
+					unlink($cacheFile);
86
+					if (Config::get('open_wap')){
87
+							$wap = 'wap';
88
+							$cacheFilewap = RUN_PATH . '/cache/' . md5(get_http_url() . $link . $lg . $wap) . '.html';
89
+							unlink($cacheFilewap);
90
+						}
91
+                } else {
92
+                    $pagelink = $this->parser->parserLink($sort->type, $sort->urlname, 'list', $sort->scode, $sort->filename, '', '');
93
+                    $page = 10;
94
+                    for ($i = 1; $i <= $page; $i ++) {
95
+                        if ($i > 1) {
96
+                            $path = rtrim($pagelink, '/') . '_' . $i . '/';
97
+                        } else {
98
+                            $path = $pagelink;
99
+                        }						
100
+						$cacheFile = RUN_PATH . '/cache/' . md5(get_http_url() . $path . $lg . $wap) . '.html';
101
+						if (Config::get('open_wap')){
102
+							$wap = 'wap';
103
+							$cacheFilewap = RUN_PATH . '/cache/' . md5(get_http_url() . $path . $lg . $wap) . '.html';
104
+							unlink($cacheFilewap);
105
+						}
106
+						unlink($cacheFile);
107
+                    }
108
+                }
109
+            }
110
+        }
111
+    }
112
+	// 删除全部栏目缓存
113
+	private function deleSortAll($scode = null)
114
+    {
115
+		$lg = cookie('lg');
116
+		$wap = '';
117
+        $scode = $scode ?: get('scode', 'var');
118
+        if (! $scode) {
119
+            $scodes = $this->model->getScodes('1,2');
120
+        } else {
121
+            $scodes = $this->model->getSubScodes($scode);
122
+        }
123
+        
124
+        $err = '';
125
+        foreach ($scodes as $value) {
126
+            $sort = $this->model->getSort($value);
127
+            if ($sort) {
128
+                if ($sort->type == 1) {
129
+					$link = $this->parser->parserLink($sort->type, $sort->urlname, 'list', $sort->scode, $sort->filename, '', '');
130
+					$cacheFile = RUN_PATH . '/cache/' . md5(get_http_url() . $link . $lg . $wap) . '.html';
131
+					unlink($cacheFile);
132
+					if (Config::get('open_wap')){
133
+							$wap = 'wap';
134
+							$cacheFilewap = RUN_PATH . '/cache/' . md5(get_http_url() . $link . $lg . $wap) . '.html';
135
+							unlink($cacheFilewap);
136
+						}
137
+                } else {
138
+                    $pagelink = $this->parser->parserLink($sort->type, $sort->urlname, 'list', $sort->scode, $sort->filename, '', '');
139
+                    $page = 5000;
140
+					$jishu = 1;
141
+                    for ($i = 2; $i <= $page; $i ++) {
142
+                        if ($i > 1) {
143
+                            $path = rtrim($pagelink, '/') . '_' . $i . '/';
144
+                        } else {
145
+                            $path = $pagelink;
146
+                        }
147
+						
148
+						$cacheFile = RUN_PATH . '/cache/' . md5(get_http_url() . $path . $lg . $wap) . '.html';
149
+						if(!file_exists($cacheFile)){
150
+							$jishu ++;
151
+							if($jishu > 100){
152
+							break;
153
+							}
154
+						}
155
+						if (Config::get('open_wap')){
156
+							$wap = 'wap';
157
+							$cacheFilewap = RUN_PATH . '/cache/' . md5(get_http_url() . $path . $lg . $wap) . '.html';
158
+							unlink($cacheFilewap);
159
+						}
160
+						unlink($cacheFile);
161
+                    }
162
+                }
163
+            }
164
+        }
165
+    }
166
+
167
+
168
+    // 删除详情页面缓存
169
+    private function deleContont()
170
+    {		$lg = cookie('lg');
171
+			$wap = '';
172
+		    $idzuixiao = get('idzuixiao', 'var');
173
+			$idzuida = get('idzuida', 'var');
174
+			for($i=$idzuixiao;$i<=$idzuida;$i++){
175
+			$data = $this->model->getContent($i);
176
+            if ($data) {
177
+                $path = $this->parser->parserLink($data->type, $data->urlname, 'content', $data->scode, $data->sortfilename, $data->id, $data->filename);
178
+				$cacheFile = RUN_PATH . '/cache/' . md5(get_http_url() . $path . $lg . $wap) . '.html';
179
+				unlink($cacheFile);
180
+				if (Config::get('open_wap')){
181
+					$wap = 'wap';
182
+					$cacheFilewap = RUN_PATH . '/cache/' . md5(get_http_url() . $path . $lg . $wap) . '.html';
183
+					unlink($cacheFilewap);
184
+				}
185
+            }	
186
+			}
187
+    }
188
+
189
+    // 更新内容栏目下拉选择
190
+    private function makeSortSelect($tree, $ext_about = false)
191
+    {
192
+        $list_html = '';
193
+        foreach ($tree as $value) {
194
+            if (get('scode') != $value->scode) { // 不显示本身,避免出现自身为自己的父节点
195
+                if (($ext_about && $value->type == 1) || $value->outlink != '') {
196
+                    $list_html .= "<option value='{$value->scode}' disabled='disabled'>{$this->blank}{$value->name}</option>";
197
+                } else {
198
+                    $list_html .= "<option value='{$value->scode}' >{$this->blank}{$value->name}</option>";
199
+                }
200
+            }
201
+            // 子菜单处理
202
+            if ($value->son) {
203
+                $this->blank .= '  ';
204
+                $list_html .= $this->makeSortSelect($value->son, $ext_about);
205
+            }
206
+        }
207
+        // 循环完后回归位置
208
+        $this->blank = substr($this->blank, 0, - 6);
209
+        return $list_html;
210
+    }
211
+
212
+    // 设置公共信息
213
+    private function setinfo()
214
+    {
215
+        // 设置前台模板路径,避免后端调用问题
216
+        if (($tpl_dir = Config::get('tpl_dir')) && array_key_exists('home', $tpl_dir)) {
217
+            $this->assign('tplpath', ROOT_PATH . $tpl_dir['home']);
218
+        } else {
219
+            $this->assign('tplpath', APP_PATH . '/home/view');
220
+        }
221
+        // 定义当前操作为更新静态,后期动作判断
222
+        define('DeleCache', true);
223
+    }
224
+}

+ 244
- 0
apps/admin/controller/content/ExtFieldController.php View File

@@ -0,0 +1,244 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年3月1日
7
+ *  扩展字段控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\ExtFieldModel;
13
+
14
+class ExtFieldController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new ExtFieldModel();
22
+    }
23
+
24
+    // 扩展字段列表
25
+    public function index()
26
+    {
27
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getExtField($id)) {
28
+            $this->assign('more', true);
29
+            $this->assign('extfield', $result);
30
+        } else {
31
+            $this->assign('list', true);
32
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
33
+                $result = $this->model->findExtField($field, $keyword);
34
+            } else {
35
+                $result = $this->model->getList();
36
+            }
37
+            
38
+            // 内容模型
39
+            $models = model('admin.content.Model');
40
+            $this->assign('models', $models->getSelect());
41
+            
42
+            $this->assign('extfields', $result);
43
+        }
44
+        $this->display('content/extfield.html');
45
+    }
46
+
47
+    // 扩展字段增加
48
+    public function add()
49
+    {
50
+        if ($_POST) {
51
+            // 获取数据
52
+            $mcode = post('mcode');
53
+            $name = post('name', 'var');
54
+            $type = post('type', 'int');
55
+            if (! ! $value = post('value')) {
56
+                $value = str_replace("\r\n", ",", $value); // 替换回车
57
+                $value = str_replace(",", ",", $value); // 替换中文逗号分割符
58
+            }
59
+            $description = post('description');
60
+            $sorting = post('sorting', 'int');
61
+            
62
+            if (! $mcode) {
63
+                alert_back('内容模型不能为空!');
64
+            }
65
+            
66
+            if (! $name) {
67
+                alert_back('字段名称不能为空!');
68
+            } else {
69
+                $name = "ext_" . $name;
70
+            }
71
+            
72
+            if (! $type) {
73
+                alert_back('字段类型不能为空!');
74
+            }
75
+            
76
+            if (! $description) {
77
+                alert_back('字段描述不能为空!');
78
+            }
79
+            
80
+            // 构建数据
81
+            $data = array(
82
+                'mcode' => $mcode,
83
+                'name' => $name,
84
+                'type' => $type,
85
+                'value' => $value,
86
+                'description' => $description,
87
+                'sorting' => $sorting
88
+            );
89
+            
90
+            // 字段类型及长度
91
+            switch ($type) {
92
+                case '2': // 多行
93
+                    $mysql = 'varchar(1000)';
94
+                    $sqlite = 'TEXT(1000)';
95
+                    break;
96
+                case '7': // 时间日期
97
+                    $mysql = 'datetime';
98
+                    $sqlite = 'TEXT';
99
+                    break;
100
+                case '8': // 编辑器
101
+                    $mysql = 'TEXT';
102
+                    $sqlite = 'TEXT(10000)';
103
+                    break;
104
+                case '10': // 多图
105
+                    $mysql = 'varchar(1000)';
106
+                    $sqlite = 'TEXT(1000)';
107
+                    break;
108
+                default:
109
+                    $mysql = 'varchar(200)';
110
+                    $sqlite = 'TEXT(200)';
111
+            }
112
+            
113
+            // 字段不存在时创建
114
+            if (! $this->model->isExistField($name)) {
115
+                if (get_db_type() == 'sqlite') {
116
+                    $result = $this->model->amd("ALTER TABLE ay_content_ext ADD COLUMN $name $sqlite NULL");
117
+                } else {
118
+                    $result = $this->model->amd("ALTER TABLE ay_content_ext ADD $name $mysql NULL COMMENT '$description'");
119
+                    //添加索引
120
+                    $this->model->amd("create index ay_content_{$name}_index on ay_content_ext ($name)");
121
+                }
122
+            } elseif ($this->model->checkExtField($name)) { // 字段存在且已使用则 报错
123
+                alert_back('字段已经存在,不能重复添加!');
124
+            }
125
+            
126
+            // 执行扩展字段记录添加
127
+            if ($this->model->addExtField($data)) {
128
+                $this->log('新增扩展字段成功!');
129
+                if (! ! $backurl = get('backurl')) {
130
+                    success('新增成功!', base64_decode($backurl));
131
+                } else {
132
+                    success('新增成功!', url('/admin/ExtField/index'));
133
+                }
134
+            } else {
135
+                $this->log('新增扩展字段失败!');
136
+                error('新增失败!', - 1);
137
+            }
138
+        }
139
+    }
140
+
141
+    // 扩展字段删除
142
+    public function del()
143
+    {
144
+        if (! $id = get('id', 'int')) {
145
+            error('传递的参数值错误!', - 1);
146
+        }
147
+        
148
+        $name = $this->model->getExtFieldName($id);
149
+        if ($this->model->delExtField($id)) {
150
+            // mysql数据库执行字段删除,sqlite暂时不支持
151
+            if (! ! $name) {
152
+                if (get_db_type() == 'mysql') {
153
+                    $result = $this->model->amd("ALTER TABLE ay_content_ext DROP COLUMN $name");
154
+                    //删除索引(如果有)
155
+                    $contentExt = $this->model->checkExtIndex();
156
+                    foreach ($contentExt as $items){
157
+                        if($items[2] == "ay_content_{$name}_index"){
158
+                            $this->model->amd("ALTER table ay_content_ext drop key ay_content_{$name}_index");
159
+                        }
160
+                    }
161
+                }
162
+            }
163
+            $this->log('删除扩展字段' . $id . '成功!');
164
+            success('删除成功!', - 1);
165
+        } else {
166
+            $this->log('删除扩展字段' . $id . '失败!');
167
+            error('删除失败!', - 1);
168
+        }
169
+    }
170
+
171
+    // 扩展字段修改
172
+    public function mod()
173
+    {
174
+        if (! $id = get('id', 'int')) {
175
+            error('传递的参数值错误!', - 1);
176
+        }
177
+        
178
+        // 单独修改状态
179
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
180
+            if ($this->model->modExtField($id, "$field='$value',update_user='" . session('username') . "'")) {
181
+                location(- 1);
182
+            } else {
183
+                alert_back('修改失败!');
184
+            }
185
+        }
186
+        
187
+        // 修改操作
188
+        if ($_POST) {
189
+            
190
+            // 获取数据
191
+            $mcode = post('mcode');
192
+            $type = post('type');
193
+            if (! ! $value = post('value')) {
194
+                $value = str_replace("\r\n", ",", $value); // 替换回车
195
+                $value = str_replace(",", ",", $value); // 替换中文逗号分割符
196
+            }
197
+            $description = post('description');
198
+            $sorting = post('sorting', 'int');
199
+            
200
+            if (! $mcode) {
201
+                alert_back('内容模型不能为空!');
202
+            }
203
+            
204
+            if (! $description) {
205
+                alert_back('字段描述不能为空!');
206
+            }
207
+            
208
+            // 构建数据
209
+            $data = array(
210
+                'mcode' => $mcode,
211
+                'type' => $type,
212
+                'value' => $value,
213
+                'description' => $description,
214
+                'sorting' => $sorting
215
+            );
216
+            
217
+            // 执行修改
218
+            if ($this->model->modExtField($id, $data)) {
219
+                $this->log('修改扩展字段' . $id . '成功!');
220
+                if (! ! $backurl = get('backurl')) {
221
+                    success('修改成功!', base64_decode($backurl));
222
+                } else {
223
+                    success('修改成功!', url('/admin/ExtField/index'));
224
+                }
225
+            } else {
226
+                location(- 1);
227
+            }
228
+        } else {
229
+            
230
+            // 调取修改内容
231
+            $this->assign('mod', true);
232
+            if (! $result = $this->model->getExtField($id)) {
233
+                error('编辑的内容已经不存在!', - 1);
234
+            }
235
+            
236
+            // 内容模型
237
+            $models = model('admin.content.Model');
238
+            $this->assign('models', $models->getSelect());
239
+            
240
+            $this->assign('extfield', $result);
241
+            $this->display('content/extfield.html');
242
+        }
243
+    }
244
+}

+ 354
- 0
apps/admin/controller/content/FormController.php View File

@@ -0,0 +1,354 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年5月28日 
7
+ *  自定义表单控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\FormModel;
13
+
14
+class FormController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new FormModel();
22
+    }
23
+
24
+    // 自定义表单列表
25
+    public function index()
26
+    {
27
+        if ((! ! $fcode = get('fcode', 'var')) && $form = $this->model->getFormByCode($fcode)) {
28
+            $this->assign('form', $form);
29
+            if (get('action') == 'showdata') {
30
+                $this->assign('showdata', true);
31
+                $this->assign('fields', $this->model->getFormFieldByCode($fcode)); // 获取字段
32
+                $table = $this->model->getFormTableByCode($fcode);
33
+                if (get('export')) {
34
+                    $this->assign('formdata', $this->model->getFormData($table, false));
35
+                    header('Content-Type:application/vnd.ms-excel');
36
+                    header('Cache-Control: max-age=0');
37
+                    header("Content-Disposition:filename=" . $form->form_name . "-" . date("YmdHis") . ".xls");
38
+                    $this->display('content/exform.html');
39
+                } else {
40
+                    $this->assign('formdata', $this->model->getFormData($table, true));
41
+                }
42
+            }
43
+            if (get('action') == 'showfield') {
44
+                $this->assign('showfield', true);
45
+                $this->assign('fields', $this->model->getFormFieldByCode($fcode));
46
+            }
47
+        } else {
48
+            $this->assign('list', true);
49
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
50
+                $result = $this->model->findForm($field, $keyword);
51
+            } else {
52
+                $result = $this->model->getList();
53
+            }
54
+            
55
+            $this->assign('forms', $result);
56
+        }
57
+        $this->display('content/form.html');
58
+    }
59
+
60
+    // 自定义表单增加
61
+    public function add()
62
+    {
63
+        if ($_POST) {
64
+            if (get('action') == 'addform') {
65
+                $fcode = get_auto_code($this->model->getLastCode());
66
+                $form_name = post('form_name');
67
+                $table_name = 'ay_diy_' . post('table_name', 'var');
68
+                
69
+                if (! $form_name) {
70
+                    alert_back('表单名称不能为空!');
71
+                }
72
+                
73
+                if (! $table_name) {
74
+                    alert_back('表单数据表不能为空!');
75
+                }
76
+                
77
+                $data = array(
78
+                    'fcode' => $fcode,
79
+                    'form_name' => $form_name,
80
+                    'table_name' => $table_name,
81
+                    'create_user' => session('username'),
82
+                    'update_user' => session('username')
83
+                );
84
+                
85
+                if (get_db_type() == 'sqlite') {
86
+                    $result = $this->model->amd("CREATE TABLE `$table_name` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,`create_time` TEXT NOT NULL)");
87
+                } else {
88
+                    $result = $this->model->amd("CREATE TABLE `$table_name` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT,`create_time` datetime NOT NULL,PRIMARY KEY (`id`))ENGINE=MyISAM DEFAULT CHARSET=utf8");
89
+                }
90
+                
91
+                if ($this->model->addForm($data)) {
92
+                    $this->log('新增自定义表单成功!');
93
+                    if (! ! $backurl = get('backurl')) {
94
+                        success('新增成功!', base64_decode($backurl));
95
+                    } else {
96
+                        success('新增成功!', url('/admin/Form/index'));
97
+                    }
98
+                } else {
99
+                    $this->log('新增自定义表单失败!');
100
+                    error('新增失败!', - 1);
101
+                }
102
+            } else {
103
+                // 获取数据
104
+                $fcode = post('fcode', 'var');
105
+                $name = post('name', 'var');
106
+                $length = post('length', 'int') ?: 20;
107
+                $required = post('required', 'int') ?: 0;
108
+                $description = post('description');
109
+                $sorting = post('sorting', 'int') ?: 255;
110
+                
111
+                if (! $fcode) {
112
+                    alert_back('表单编码不能为空!');
113
+                }
114
+                
115
+                if (! $name) {
116
+                    alert_back('字段名称不能为空!');
117
+                }
118
+                
119
+                if (! $description) {
120
+                    alert_back('字段描述不能为空!');
121
+                }
122
+                
123
+                // 构建数据
124
+                $data = array(
125
+                    'fcode' => $fcode,
126
+                    'name' => $name,
127
+                    'length' => $length,
128
+                    'required' => $required,
129
+                    'description' => $description,
130
+                    'sorting' => $sorting,
131
+                    'create_user' => session('username'),
132
+                    'update_user' => session('username')
133
+                );
134
+                
135
+                // 获取表名称
136
+                $table = $this->model->getFormTableByCode($fcode);
137
+                
138
+                // 字段类型及长度
139
+                $mysql = "varchar($length)";
140
+                $sqlite = "TEXT($length)";
141
+                
142
+                // 字段不存在时创建
143
+                if (! $this->model->isExistField($table, $name)) {
144
+                    if (get_db_type() == 'sqlite') {
145
+                        $result = $this->model->amd("ALTER TABLE $table ADD COLUMN $name $sqlite NULL");
146
+                    } else {
147
+                        $result = $this->model->amd("ALTER TABLE $table ADD $name $mysql NULL COMMENT '$description'");
148
+                    }
149
+                } elseif ($this->model->checkFormField($fcode, $name)) {
150
+                    alert_back('字段已经存在,不能重复添加!');
151
+                }
152
+                
153
+                // 执行自定义表单记录添加
154
+                if ($this->model->addFormField($data)) {
155
+                    $this->log('新增表单字段成功!');
156
+                    if (! ! $backurl = get('backurl')) {
157
+                        success('新增成功!', base64_decode($backurl));
158
+                    } else {
159
+                        success('新增成功!', url('/admin/Form/index/fcode/' . $fcode . '/action/showfield'));
160
+                    }
161
+                } else {
162
+                    $this->log('新增表单字段失败!');
163
+                    error('新增失败!', - 1);
164
+                }
165
+            }
166
+        }
167
+    }
168
+
169
+    // 自定义表单删除
170
+    public function del()
171
+    {
172
+        if (! $id = get('id', 'int')) {
173
+            error('传递的参数值错误!', - 1);
174
+        }
175
+        
176
+        // 删除表单
177
+        if (get('action') == 'delform') {
178
+            if ($id == 1) {
179
+                alert_back('留言表单不允许删除');
180
+            }
181
+            $table = $this->model->getFormTable($id);
182
+            $fcode = $this->model->getFormCode($id);
183
+            if ($this->model->delForm($id)) {
184
+                $this->model->delFormFieldByCode($fcode); // 删除字段记录
185
+                $this->model->amd("DROP TABLE IF EXISTS $table"); // 删除表
186
+                $this->log('删除自定义表单' . $id . '成功!');
187
+                success('删除成功!', - 1);
188
+            } else {
189
+                $this->log('删除自定义表单' . $id . '失败!');
190
+                error('删除失败!', - 1);
191
+            }
192
+        } elseif (get('action') == 'deldata') {
193
+            // 获取表单
194
+            if (! $fcode = get('fcode', 'var')) {
195
+                error('传递的参数值fcode错误!', - 1);
196
+            }
197
+            $table = $this->model->getFormTableByCode($fcode);
198
+            if ($this->model->delFormData($table, $id)) {
199
+                $this->log('删除表单数据' . $id . '成功!');
200
+                success('删除成功!', - 1);
201
+            } else {
202
+                $this->log('删除表单数据' . $id . '失败!');
203
+                error('删除失败!', - 1);
204
+            }
205
+        } else {
206
+            
207
+            // 获取表单
208
+            if (! $fcode = get('fcode', 'var')) {
209
+                error('传递的参数值fcode错误!', - 1);
210
+            }
211
+            
212
+            // 获取操作表
213
+            $table = $this->model->getFormTableByCode($fcode);
214
+            $name = $this->model->getFormFieldName($id);
215
+            
216
+            if ($this->model->delFormField($id)) {
217
+                // mysql数据库执行字段删除,sqlite暂时不支持
218
+                if (! ! $name) {
219
+                    if (get_db_type() == 'mysql') {
220
+                        $result = $this->model->amd("ALTER TABLE $table DROP COLUMN $name");
221
+                    }
222
+                }
223
+                $this->log('删除自定义表单' . $id . '成功!');
224
+                success('删除成功!', - 1);
225
+            } else {
226
+                $this->log('删除自定义表单' . $id . '失败!');
227
+                error('删除失败!', - 1);
228
+            }
229
+        }
230
+    }
231
+
232
+    // 自定义表单修改
233
+    public function mod()
234
+    {
235
+        if (! $id = get('id', 'int')) {
236
+            error('传递的参数值错误!', - 1);
237
+        }
238
+        
239
+        // 单独修改状态
240
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
241
+            if ($this->model->modFormField($id, "$field='$value',update_user='" . session('username') . "'")) {
242
+                location(- 1);
243
+            } else {
244
+                alert_back('修改失败!');
245
+            }
246
+        }
247
+        
248
+        if (get('action') == 'addmenu') {
249
+            if ($this->model->addFormMenu($id)) {
250
+                $this->log('添加自定义表单' . $id . '到菜单成功!');
251
+                if (! ! $backurl = get('backurl')) {
252
+                    success('添加成功!', base64_decode($backurl));
253
+                } else {
254
+                    success('添加成功!', url('/admin/Form/index'));
255
+                }
256
+            } else {
257
+                location(- 1);
258
+            }
259
+        }
260
+        
261
+        // 修改操作
262
+        if ($_POST) {
263
+            
264
+            // 修改表单
265
+            if (get('action') == 'modform') {
266
+                $form_name = post('form_name');
267
+                
268
+                if (! $form_name) {
269
+                    alert_back('表单名称不能为空!');
270
+                }
271
+                $data = array(
272
+                    'form_name' => $form_name,
273
+                    'update_user' => session('username')
274
+                );
275
+                
276
+                // 执行修改
277
+                if ($this->model->modForm($id, $data)) {
278
+                    $this->log('修改自定义表单' . $id . '成功!');
279
+                    if (! ! $backurl = get('backurl')) {
280
+                        success('修改成功!', base64_decode($backurl));
281
+                    } else {
282
+                        success('修改成功!', url('/admin/Form/index'));
283
+                    }
284
+                } else {
285
+                    location(- 1);
286
+                }
287
+            } else {
288
+                
289
+                // 获取数据
290
+                $description = post('description');
291
+                $required = post('required', 'int') ?: 0;
292
+                $sorting = post('sorting', 'int') ?: 255;
293
+                
294
+                if (! $description) {
295
+                    alert_back('字段描述不能为空!');
296
+                }
297
+                
298
+                // 构建数据
299
+                $data = array(
300
+                    'description' => $description,
301
+                    'required' => $required,
302
+                    'sorting' => $sorting,
303
+                    'update_user' => session('username')
304
+                );
305
+                
306
+                // 执行修改
307
+                if ($this->model->modFormField($id, $data)) {
308
+                    $this->log('修改表单字段' . $id . '成功!');
309
+                    if (! ! $backurl = get('backurl')) {
310
+                        success('修改成功!', base64_decode($backurl));
311
+                    } else {
312
+                        success('修改成功!', url('/admin/Form/index'));
313
+                    }
314
+                } else {
315
+                    location(- 1);
316
+                }
317
+            }
318
+        } else {
319
+            
320
+            // 调取修改内容
321
+            $this->assign('mod', true);
322
+            
323
+            if (get('action') == 'modform') {
324
+                if (! $result = $this->model->getForm($id)) {
325
+                    error('编辑的内容已经不存在!', - 1);
326
+                }
327
+                
328
+                $this->assign('form', $result);
329
+            } else {
330
+                if (! $result = $this->model->getFormField($id)) {
331
+                    error('编辑的内容已经不存在!', - 1);
332
+                }
333
+                $this->assign('field', $result);
334
+            }
335
+            $this->display('content/form.html');
336
+        }
337
+    }
338
+
339
+    // 清空
340
+    public function clear()
341
+    {
342
+        // 获取表单
343
+        if (! $fcode = get('fcode', 'var')) {
344
+            error('传递的参数值fcode错误!', - 1);
345
+        }
346
+        $table = $this->model->getFormTableByCode($fcode);
347
+        
348
+        if ($this->model->clearFormData($table)) {
349
+            alert_location('清空成功!', - 1);
350
+        } else {
351
+            alert_location('清空失败!', - 1);
352
+        }
353
+    }
354
+}

+ 175
- 0
apps/admin/controller/content/LabelController.php View File

@@ -0,0 +1,175 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年03月23日
7
+ *  自定义标签控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\LabelModel;
13
+
14
+class LabelController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new LabelModel();
22
+    }
23
+
24
+    // 自定义标签列表
25
+    public function index()
26
+    {
27
+        // 修改参数配置
28
+        if ($_POST) {
29
+            foreach ($_POST as $key => $value) {
30
+                if (preg_match('/^[\w\-]+$/', $key)) { // 带有违规字符时不带入查询
31
+                    $data = post($key);
32
+                    $data = str_replace("\r\n", "<br>", $data); // 多行文本时替换回车
33
+                    $this->model->modValue($key, $data);
34
+                }
35
+            }
36
+            success('修改成功!', url('admin/Label/index'));
37
+        }
38
+        $this->assign('list', true);
39
+        $this->assign('labels', $this->model->getList());
40
+        $this->display('content/label.html');
41
+    }
42
+
43
+    // 自定义标签字段增加
44
+    public function add()
45
+    {
46
+        if ($_POST) {
47
+            // 获取数据
48
+            $name = post('name', 'var');
49
+            $description = post('description');
50
+            $type = post('type');
51
+            
52
+            if (! $name) {
53
+                alert_back('标签名称不能为空!');
54
+            }
55
+
56
+            if ($name && ! preg_match('/^[a-zA-Z0-9\_\/]+$/', $name)) {
57
+                alert_back('标签名称只允许字母、数字、下划线组成!');
58
+            }
59
+
60
+            if (! $description) {
61
+                alert_back('标题描述不能为空!');
62
+            }
63
+            
64
+            if (! $type) {
65
+                alert_back('标签类型不能为空!');
66
+            }
67
+            
68
+            // 检查标签名称
69
+            if ($this->model->checkLabel("name='$name'")) {
70
+                alert_back('该自定义标签称已经存在,不能再使用!');
71
+            }
72
+            
73
+            // 构建数据
74
+            $data = array(
75
+                'name' => $name,
76
+                'description' => $description,
77
+                'value' => '', // 添加时设置为空
78
+                'type' => $type,
79
+                'create_user' => session('username'),
80
+                'update_user' => session('username')
81
+            );
82
+            
83
+            // 执行添加
84
+            if ($this->model->addLabel($data)) {
85
+                $this->log('修改自定义标签' . $name . '成功!');
86
+                if (! ! $backurl = get('backurl')) {
87
+                    success('新增成功!', base64_decode($backurl));
88
+                } else {
89
+                    success('新增成功!', url('admin/Label/index' . get_tab('t2'), false));
90
+                }
91
+            } else {
92
+                $this->log('新增自定义标签' . $name . '失败!');
93
+                error('新增失败!', url('admin/Label/index' . get_tab('t2'), false));
94
+            }
95
+        }
96
+    }
97
+
98
+    // 自定义标签字段删除
99
+    public function del()
100
+    {
101
+        if (! $id = get('id', 'int')) {
102
+            error('传递的参数值错误!', - 1);
103
+        }
104
+        if ($this->model->delLabel($id)) {
105
+            $this->log('删除自定义标签' . $id . '成功!');
106
+            success('删除成功!', url('admin/Label/index' . get_tab('t2'), false));
107
+        } else {
108
+            $this->log('删除自定义标签' . $id . '失败!');
109
+            error('删除失败!', - 1);
110
+        }
111
+    }
112
+
113
+    // 自定义标签字段修改
114
+    public function mod()
115
+    {
116
+        if (! $id = get('id', 'int')) {
117
+            error('传递的参数值错误!', - 1);
118
+        }
119
+        
120
+        // 修改操作
121
+        if ($_POST) {
122
+            // 获取数据
123
+            $name = post('name', 'var');
124
+            $description = post('description');
125
+            $type = post('type');
126
+            if (! $name) {
127
+                alert_back('标签名称不能为空!');
128
+            }
129
+
130
+            if ($name && ! preg_match('/^[a-zA-Z0-9\_\/]+$/', $name)) {
131
+                alert_back('标签名称只允许字母、数字、下划线组成!');
132
+            }
133
+
134
+            if (! $description) {
135
+                alert_back('标签描述不能为空!');
136
+            }
137
+            
138
+            if (! $type) {
139
+                alert_back('标签类型不能为空!');
140
+            }
141
+            
142
+            // 检查标签名称
143
+            if ($this->model->checkLabel("name='$name' AND id<>$id")) {
144
+                alert_back('该自定义标签名称已经存在,不能再使用!');
145
+            }
146
+            
147
+            // 构建数据
148
+            $data = array(
149
+                'name' => $name,
150
+                'description' => $description,
151
+                'type' => $type,
152
+                'update_user' => session('username')
153
+            );
154
+            
155
+            // 执行添加
156
+            if ($this->model->modLabel($id, $data)) {
157
+                $this->log('修改自定义标签字段' . $id . '成功!');
158
+                success('修改成功!', url('admin/Label/index' . get_tab('t2'), false));
159
+            } else {
160
+                location(- 1);
161
+            }
162
+        } else {
163
+            $this->assign('mod', true);
164
+            
165
+            // 调取修改内容
166
+            $result = $this->model->getLabel($id);
167
+            if (! $result) {
168
+                error('编辑的内容已经不存在!', - 1);
169
+            }
170
+            $this->assign('label', $result);
171
+            
172
+            $this->display('content/label.html');
173
+        }
174
+    }
175
+}

+ 213
- 0
apps/admin/controller/content/LinkController.php View File

@@ -0,0 +1,213 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年3月1日
7
+ *  友情链接控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\LinkModel;
13
+
14
+class LinkController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new LinkModel();
22
+    }
23
+
24
+    // 友情链接列表
25
+    public function index()
26
+    {
27
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getLink($id)) {
28
+            $this->assign('more', true);
29
+            $this->assign('link', $result);
30
+        } else {
31
+            $this->assign('list', true);
32
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
33
+                $result = $this->model->findLink($field, $keyword);
34
+            } else {
35
+                $result = $this->model->getList();
36
+            }
37
+            $this->assign('gids', $this->model->getGid());
38
+            $this->assign('links', $result);
39
+        }
40
+        $this->display('content/link.html');
41
+    }
42
+
43
+    // 友情链接增加
44
+    public function add()
45
+    {
46
+        if ($_POST) {
47
+            // 获取数据
48
+            $gid = post('gid', 'int');
49
+            $name = post('name');
50
+            $link = post('link');
51
+            $logo = post('logo');
52
+            $sorting = post('sorting');
53
+            
54
+            if (! $gid) {
55
+                $gid = $this->model->getMaxGid() + 1;
56
+            }
57
+            
58
+            if (! $name) {
59
+                alert_back('名称不能为空!');
60
+            }
61
+            
62
+            if (! $link) {
63
+                alert_back('链接不能为空!');
64
+            }
65
+            
66
+            if (! $sorting) {
67
+                $sorting = 255;
68
+            }
69
+            
70
+            // logo图缩放
71
+            if ($logo) {
72
+                resize_img(ROOT_PATH . $logo, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
73
+            }
74
+            
75
+            // 构建数据
76
+            $data = array(
77
+                'acode' => session('acode'),
78
+                'gid' => $gid,
79
+                'name' => $name,
80
+                'link' => $link,
81
+                'logo' => $logo,
82
+                'sorting' => $sorting,
83
+                'create_user' => session('username'),
84
+                'update_user' => session('username')
85
+            );
86
+            
87
+            // 执行添加
88
+            if ($this->model->addLink($data)) {
89
+                $this->log('新增友情链接成功!');
90
+                if (! ! $backurl = get('backurl')) {
91
+                    success('新增成功!', base64_decode($backurl));
92
+                } else {
93
+                    success('新增成功!', url('/admin/Link/index'));
94
+                }
95
+            } else {
96
+                $this->log('新增友情链接失败!');
97
+                error('新增失败!', - 1);
98
+            }
99
+        }
100
+    }
101
+
102
+    // 友情链接删除
103
+    public function del()
104
+    {
105
+        if (! $id = get('id', 'int')) {
106
+            error('传递的参数值错误!', - 1);
107
+        }
108
+        
109
+        if ($this->model->delLink($id)) {
110
+            $this->log('删除友情链接' . $id . '成功!');
111
+            success('删除成功!', - 1);
112
+        } else {
113
+            $this->log('删除友情链接' . $id . '失败!');
114
+            error('删除失败!', - 1);
115
+        }
116
+    }
117
+
118
+    // 友情链接修改
119
+    public function mod()
120
+    {
121
+        if (! ! $submit = post('submit')) {
122
+            switch ($submit) {
123
+                case 'sorting': // 修改列表排序
124
+                    $listall = post('listall');
125
+                    if ($listall) {
126
+                        $sorting = post('sorting');
127
+                        foreach ($listall as $key => $value) {
128
+                            if ($sorting[$key] === '' || ! is_numeric($sorting[$key]))
129
+                                $sorting[$key] = 255;
130
+                            $this->model->modLink($value, "sorting=" . $sorting[$key]);
131
+                        }
132
+                        $this->log('批量修改链接排序成功!');
133
+                        success('修改成功!', - 1);
134
+                    } else {
135
+                        alert_back('排序失败,无任何内容!');
136
+                    }
137
+                    break;
138
+            }
139
+        }
140
+        
141
+        if (! $id = get('id', 'int')) {
142
+            error('传递的参数值错误!', - 1);
143
+        }
144
+        
145
+        // 单独修改状态
146
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
147
+            if ($this->model->modLink($id, "$field='$value',update_user='" . session('username') . "'")) {
148
+                location(- 1);
149
+            } else {
150
+                alert_back('修改失败!');
151
+            }
152
+        }
153
+        
154
+        // 修改操作
155
+        if ($_POST) {
156
+            
157
+            // 获取数据
158
+            $gid = post('gid', 'int');
159
+            $name = post('name');
160
+            $link = post('link');
161
+            $logo = post('logo');
162
+            $sorting = post('sorting');
163
+            
164
+            if (! $gid) {
165
+                $gid = $this->model->getMaxGid() + 1;
166
+            }
167
+            
168
+            if (! $name) {
169
+                alert_back('名称不能为空!');
170
+            }
171
+            
172
+            if (! $link) {
173
+                alert_back('链接不能为空!');
174
+            }
175
+            
176
+            // logo图缩放
177
+            if ($logo) {
178
+                resize_img(ROOT_PATH . $logo, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
179
+            }
180
+            
181
+            // 构建数据
182
+            $data = array(
183
+                'gid' => $gid,
184
+                'name' => $name,
185
+                'link' => $link,
186
+                'logo' => $logo,
187
+                'sorting' => $sorting,
188
+                'update_user' => session('username')
189
+            );
190
+            
191
+            // 执行添加
192
+            if ($this->model->modLink($id, $data)) {
193
+                $this->log('修改友情链接' . $id . '成功!');
194
+                if (! ! $backurl = get('backurl')) {
195
+                    success('修改成功!', base64_decode($backurl));
196
+                } else {
197
+                    success('修改成功!', url('/admin/Link/index'));
198
+                }
199
+            } else {
200
+                location(- 1);
201
+            }
202
+        } else {
203
+            // 调取修改内容
204
+            $this->assign('mod', true);
205
+            if (! $result = $this->model->getLink($id)) {
206
+                error('编辑的内容已经不存在!', - 1);
207
+            }
208
+            $this->assign('gids', $this->model->getGid());
209
+            $this->assign('link', $result);
210
+            $this->display('content/link.html');
211
+        }
212
+    }
213
+}

+ 128
- 0
apps/admin/controller/content/MessageController.php View File

@@ -0,0 +1,128 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年3月29日
7
+ *  留言控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\MessageModel;
13
+
14
+class MessageController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new MessageModel();
22
+    }
23
+
24
+    // 列表
25
+    public function index()
26
+    {
27
+        $this->assign('list', true);
28
+        $this->assign('fields', $this->model->getFormFieldByCode(1)); // 获取字段
29
+        
30
+        if (get('export')) {
31
+            $this->assign('messages', $this->model->getList(false));
32
+            header("Content-Type:application/vnd.ms-excel");
33
+            header('Cache-Control: max-age=0');
34
+            header("Content-Disposition:filename=留言记录-" . date("YmdHis") . ".xls");
35
+            $this->display('content/exmessage.html');
36
+        } else {
37
+            $this->assign('messages', $this->model->getList(true));
38
+            $this->display('content/message.html');
39
+        }
40
+    }
41
+
42
+    // 删除
43
+    public function del()
44
+    {
45
+        if (! $id = get('id', 'int')) {
46
+            error('传递的参数值错误!', - 1);
47
+        }
48
+        
49
+        if ($this->model->delMessage($id)) {
50
+            $this->log('删除留言' . $id . '成功!');
51
+            success('删除成功!', - 1);
52
+        } else {
53
+            $this->log('删除留言' . $id . '失败!');
54
+            error('删除失败!', - 1);
55
+        }
56
+    }
57
+
58
+    // 修改
59
+    public function mod()
60
+    {
61
+        if (! $id = get('id', 'int')) {
62
+            error('传递的参数值错误!', - 1);
63
+        }
64
+        
65
+        // 单独修改状态
66
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
67
+            if ($this->model->modMessage($id, "$field='$value',update_user='" . session('username') . "'")) {
68
+                location(- 1);
69
+            } else {
70
+                alert_back('修改失败!');
71
+            }
72
+        }
73
+        
74
+        // 修改操作
75
+        if ($_POST) {
76
+            // 获取数据
77
+            $recontent = post('recontent');
78
+            $status = post('status');
79
+            
80
+            // 构建数据
81
+            $data = array(
82
+                'recontent' => $recontent,
83
+                'status' => $status,
84
+                'update_user' => session('username')
85
+            );
86
+            
87
+            // 执行修改
88
+            if ($this->model->modMessage($id, $data)) {
89
+                $this->log('修改留言' . $id . '成功!');
90
+                if (! ! $backurl = get('backurl')) {
91
+                    success('修改成功!', base64_decode($backurl));
92
+                } else {
93
+                    success('修改成功!', url('/admin/Message/index'));
94
+                }
95
+            } else {
96
+                location(- 1);
97
+            }
98
+        } else {
99
+            // 调取修改内容
100
+            $this->assign('mod', true);
101
+            if (! $result = $this->model->getMessage($id)) {
102
+                error('编辑的内容已经不存在!', - 1);
103
+            }
104
+            $this->assign('message', $result);
105
+            
106
+            $this->display('content/message.html');
107
+        }
108
+    }
109
+
110
+    // 清空
111
+    public function clear()
112
+    {
113
+        if($_GET['ids']){
114
+            $idList = implode("," , explode("and",$_GET['ids']));
115
+        } else {
116
+            $idList = null;
117
+        }
118
+        if ($this->model->clearMessage($idList)){
119
+            alert_location('删除成功!', url('/admin/Message/index'));
120
+        } else {
121
+            alert_location('删除失败!', url('/admin/Message/index'));
122
+        }
123
+
124
+
125
+
126
+
127
+    }
128
+}

+ 207
- 0
apps/admin/controller/content/ModelController.php View File

@@ -0,0 +1,207 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年3月1日
7
+ *  内容模型控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\ModelModel;
13
+
14
+class ModelController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new ModelModel();
22
+    }
23
+
24
+    // 内容模型列表
25
+    public function index()
26
+    {
27
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getModel($id)) {
28
+            $this->assign('more', true);
29
+            $this->assign('model', $result);
30
+        } else {
31
+            $this->assign('list', true);
32
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
33
+                $result = $this->model->findModel($field, $keyword);
34
+            } else {
35
+                $result = $this->model->getList();
36
+            }
37
+            $this->assign('models', $result);
38
+        }
39
+        $this->display('content/model.html');
40
+    }
41
+
42
+    // 内容模型增加
43
+    public function add()
44
+    {
45
+        if ($_POST) {
46
+            // 获取数据
47
+            $mcode = get_auto_code($this->model->getLastCode());
48
+            $name = post('name');
49
+            $type = post('type');
50
+            $urlname = post('urlname');
51
+            $listtpl = basename(post('listtpl'));
52
+            $contenttpl = basename(post('contenttpl'));
53
+            $status = post('status');
54
+            
55
+            if (! $name) {
56
+                alert_back('模型名称不能为空!');
57
+            }
58
+            
59
+            if ($type == 1) {
60
+                if (! $urlname)
61
+                    $urlname = 'about';
62
+            } else {
63
+                if (! $urlname)
64
+                    $urlname = 'list';
65
+            }
66
+            
67
+            if ($urlname && ! preg_match('/^[a-zA-Z0-9\-]+$/', $urlname)) {
68
+                alert_back('模型URL名称只允许字母、数字、横线组成!');
69
+            }
70
+            
71
+            if ($this->model->checkUrlname($urlname, $type)) {
72
+                alert_back('模型URL名称与其他模型冲突,请换一个名称!');
73
+            }
74
+            
75
+            if ($this->model->checkSortFilename($urlname)) {
76
+                alert_back('模型URL名称与栏目URL名称冲突,请换一个名称!');
77
+            }
78
+            
79
+            // 构建数据
80
+            $data = array(
81
+                'mcode' => $mcode,
82
+                'name' => $name,
83
+                'type' => $type,
84
+                'urlname' => $urlname,
85
+                'listtpl' => $listtpl,
86
+                'contenttpl' => $contenttpl,
87
+                'status' => $status,
88
+                'issystem' => 0,
89
+                'create_user' => session('username'),
90
+                'update_user' => session('username')
91
+            );
92
+            
93
+            // 执行添加
94
+            if ($this->model->addModel($data)) {
95
+                $this->log('新增内容模型成功!');
96
+                if (! ! $backurl = get('backurl')) {
97
+                    success('新增成功!', base64_decode($backurl));
98
+                } else {
99
+                    success('新增成功!', url('/admin/Model/index'));
100
+                }
101
+            } else {
102
+                $this->log('新增内容模型失败!');
103
+                error('新增失败!', - 1);
104
+            }
105
+        }
106
+    }
107
+
108
+    // 内容模型删除
109
+    public function del()
110
+    {
111
+        if (! $id = get('id', 'int')) {
112
+            error('传递的参数值错误!', - 1);
113
+        }
114
+        
115
+        if ($this->model->delModel($id)) {
116
+            $this->log('删除内容模型' . $id . '成功!');
117
+            success('删除成功!', - 1);
118
+        } else {
119
+            $this->log('删除内容模型' . $id . '失败!');
120
+            error('删除失败!', - 1);
121
+        }
122
+    }
123
+
124
+    // 内容模型修改
125
+    public function mod()
126
+    {
127
+        if (! $id = get('id', 'int')) {
128
+            error('传递的参数值错误!', - 1);
129
+        }
130
+        
131
+        // 单独修改状态
132
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
133
+            if ($this->model->modModel($id, "$field='$value',update_user='" . session('username') . "'")) {
134
+                location(- 1);
135
+            } else {
136
+                alert_back('修改失败!');
137
+            }
138
+        }
139
+        
140
+        // 修改操作
141
+        if ($_POST) {
142
+            
143
+            // 获取数据
144
+            $name = post('name');
145
+            $type = post('type');
146
+            $urlname = post('urlname');
147
+            $listtpl = basename(post('listtpl'));
148
+            $contenttpl = basename(post('contenttpl'));
149
+            $status = post('status');
150
+            
151
+            if (! $name) {
152
+                alert_back('模型名称不能为空!');
153
+            }
154
+            
155
+            if ($type == 1) {
156
+                if (! $urlname)
157
+                    $urlname = 'about';
158
+            } else {
159
+                if (! $urlname)
160
+                    $urlname = 'list';
161
+            }
162
+            
163
+            if ($urlname && ! preg_match('/^[a-zA-Z0-9\-]+$/', $urlname)) {
164
+                alert_back('模型URL名称只允许字母、数字、横线组成!');
165
+            }
166
+            
167
+            if ($this->model->checkUrlname($urlname, $type, "id<>$id")) {
168
+                alert_back('模型URL名称与其他模型冲突,请换一个名称!');
169
+            }
170
+            
171
+            if ($this->model->checkSortFilename($urlname)) {
172
+                alert_back('模型URL名称与栏目URL名称冲突,请换一个名称!');
173
+            }
174
+            
175
+            // 构建数据
176
+            $data = array(
177
+                'name' => $name,
178
+                'type' => $type,
179
+                'urlname' => $urlname,
180
+                'listtpl' => $listtpl,
181
+                'contenttpl' => $contenttpl,
182
+                'status' => $status,
183
+                'update_user' => session('username')
184
+            );
185
+            
186
+            // 执行添加
187
+            if ($this->model->modModel($id, $data)) {
188
+                $this->log('修改内容模型' . $id . '成功!');
189
+                if (! ! $backurl = get('backurl')) {
190
+                    success('修改成功!', base64_decode($backurl));
191
+                } else {
192
+                    success('修改成功!', url('/admin/Model/index'));
193
+                }
194
+            } else {
195
+                location(- 1);
196
+            }
197
+        } else {
198
+            // 调取修改内容
199
+            $this->assign('mod', true);
200
+            if (! $result = $this->model->getModel($id)) {
201
+                error('编辑的内容已经不存在!', - 1);
202
+            }
203
+            $this->assign('model', $result);
204
+            $this->display('content/model.html');
205
+        }
206
+    }
207
+}

+ 271
- 0
apps/admin/controller/content/SingleController.php View File

@@ -0,0 +1,271 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date  2017年12月15日
7
+ *  单页内容控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\SingleModel;
13
+
14
+class SingleController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    private $blank;
20
+
21
+    public function __construct()
22
+    {
23
+        $this->model = new SingleModel();
24
+    }
25
+
26
+    // 单页内容列表
27
+    public function index()
28
+    {
29
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getSingle($id)) {
30
+            $this->assign('more', true);
31
+            $this->assign('content', $result);
32
+        } else {
33
+            $this->assign('list', true);
34
+            if (! $mcode = get('mcode', 'var')) {
35
+                error('传递的模型编码参数有误,请核对后重试!');
36
+            }
37
+            
38
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
39
+                $result = $this->model->findSingle($mcode, $field, $keyword);
40
+            } else {
41
+                $result = $this->model->getList($mcode);
42
+            }
43
+            $this->assign('baidu_zz_token', $this->config('baidu_zz_token'));
44
+            $this->assign('baidu_ks_token', $this->config('baidu_ks_token'));
45
+            
46
+            // 模型名称
47
+            $this->assign('model_name', model('admin.content.Model')->getName($mcode));
48
+            
49
+            // 前端地址连接符判断
50
+            $url_break_char = $this->config('url_break_char') ?: '_';
51
+            $this->assign('url_break_char', $url_break_char);
52
+            
53
+            $this->assign('contents', $result);
54
+        }
55
+        $this->display('content/single.html');
56
+    }
57
+
58
+    // 单页内容删除
59
+    public function del()
60
+    {
61
+        if (! $id = get('id', 'int')) {
62
+            error('传递的参数值错误!', - 1);
63
+        }
64
+        
65
+        if ($this->model->delSingle($id)) {
66
+            $this->log('删除单页内容' . $id . '成功!');
67
+            success('删除成功!', - 1);
68
+        } else {
69
+            $this->log('删除单页内容' . $id . '失败!');
70
+            error('删除失败!', - 1);
71
+        }
72
+    }
73
+
74
+    // 单页内容修改
75
+    public function mod()
76
+    {
77
+        // 前端地址连接符判断
78
+        if (get('baiduzz') || get('baiduxzh')) {
79
+            $url_break_char = $this->config('url_break_char') ?: '_';
80
+            $url_rule_sort_suffix = $this->config('url_rule_sort_suffix') ? true : false;
81
+        }
82
+        
83
+        // 站长普通推送
84
+        if (! ! $id = get('baiduzz')) {
85
+            $domain = get_http_url();
86
+            if (! $token = $this->config('baidu_zz_token')) {
87
+                alert_back('请先到系统配置中填写百度普通收录推送token值!');
88
+            }
89
+            
90
+            $api = "http://data.zz.baidu.com/urls?site=$domain&token=$token";
91
+            $data = $this->model->getSingle($id);
92
+            $data->urlname = $data->urlname ?: 'about';
93
+            if ($data->outlink) {
94
+                alert_back('链接类型不允许推送!');
95
+            }
96
+            if ($data->filename) {
97
+                $urls[] = $domain . homeurl('/home/Index/' . $data->filename, $url_rule_sort_suffix);
98
+            } else {
99
+                $urls[] = $domain . homeurl('/home/Index/' . $data->urlname . $url_break_char . $data->scode, $url_rule_sort_suffix);
100
+            }
101
+            $result = post_baidu($api, $urls);
102
+            if (isset($result->error)) {
103
+                $this->log('百度普通收录推送失败:' . $urls[0]);
104
+                alert_back('推送发生错误:' . $result->message);
105
+            } elseif (isset($result->success)) {
106
+                $this->log('百度普通收录推送成功:' . $urls[0]);
107
+                alert_back('成功推送' . $result->success . '条,今天剩余可推送' . $result->remain . '条数!');
108
+            } else {
109
+                alert_back('发生未知错误!');
110
+            }
111
+        }
112
+        
113
+        // 站长快速推送
114
+        if (! ! $id = get('baiduks')) {
115
+            $domain = get_http_url();
116
+            if (! $token = $this->config('baidu_ks_token')) {
117
+                alert_back('请先到系统配置中填写百度快速收录推送token值!');
118
+            }
119
+            
120
+            $api = "http://data.zz.baidu.com/urls?site=$domain&token=$token&type=daily";
121
+            $data = $this->model->getSingle($id);
122
+            $data->urlname = $data->urlname ?: 'about';
123
+            if ($data->outlink) {
124
+                alert_back('链接类型不允许推送!');
125
+            }
126
+            if ($data->filename) {
127
+                $urls[] = $domain . homeurl('/home/Index/' . $data->filename, $url_rule_sort_suffix);
128
+            } else {
129
+                $urls[] = $domain . homeurl('/home/Index/' . $data->urlname . $url_break_char . $data->scode, $url_rule_sort_suffix);
130
+            }
131
+            $result = post_baidu($api, $urls);
132
+            if (isset($result->error)) {
133
+                $this->log('百度快速收录推送失败:' . $urls[0]);
134
+                alert_back('推送发生错误:' . $result->message);
135
+            } elseif (isset($result->success_daily)) {
136
+                $this->log('百度快速收录推送成功:' . $urls[0]);
137
+                alert_back('成功推送' . $result->success_daily . '条,今天剩余可推送' . $result->remain_daily . '条数!');
138
+            } else {
139
+                alert_back('发生未知错误!');
140
+            }
141
+        }
142
+        
143
+        if (! $id = get('id', 'int')) {
144
+            error('传递的参数值错误!', - 1);
145
+        }
146
+        
147
+        // 单独修改状态
148
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
149
+            if ($this->model->modSingle($id, "$field='$value',update_user='" . session('username') . "'")) {
150
+                location(- 1);
151
+            } else {
152
+                alert_back('修改失败!');
153
+            }
154
+        }
155
+        
156
+        // 修改操作
157
+        if ($_POST) {
158
+            
159
+            // 获取数据
160
+            $title = post('title');
161
+            $author = post('author');
162
+            $source = post('source');
163
+            $ico = post('ico');
164
+            $pics = post('pics');
165
+            $content = post('content');
166
+            $tags = str_replace(',', ',', post('tags'));
167
+            $titlecolor = post('titlecolor');
168
+            $subtitle = post('subtitle');
169
+            $outlink = post('outlink');
170
+            $date = post('date');
171
+            $enclosure = post('enclosure');
172
+            $keywords = post('keywords');
173
+            $description = post('description');
174
+            $status = post('status', 'int');
175
+            
176
+            // 获取多图标题
177
+            $picstitle = post('picstitle');
178
+            if ($picstitle) {
179
+                $picstitle = implode(',', $picstitle);
180
+            }
181
+            
182
+            if (! $title) {
183
+                alert_back('单页内容标题不能为空!');
184
+            }
185
+            
186
+            // 自动提起前一百个字符为描述
187
+            if (! $description && isset($_POST['content'])) {
188
+                $description = escape_string(clear_html_blank(substr_both(strip_tags($_POST['content']), 0, 150)));
189
+            }
190
+            
191
+            // 无缩略图时,自动提取文章第一张图为缩略图
192
+            if (! $ico && preg_match('/<img\s+.*?src=\s?[\'|\"](.*?(\.gif|\.jpg|\.png|\.jpeg))[\'|\"].*?[\/]?>/i', decode_string($content), $srcs) && isset($srcs[1])) {
193
+                $ico = $srcs[1];
194
+            }
195
+            
196
+            // 缩放缩略图
197
+            if ($ico) {
198
+                resize_img(ROOT_PATH . $ico, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
199
+            }
200
+            
201
+            // 构建数据
202
+            $data = array(
203
+                'title' => $title,
204
+                'content' => $content,
205
+                'tags' => $tags,
206
+                'author' => $author,
207
+                'source' => $source,
208
+                'ico' => $ico,
209
+                'pics' => $pics,
210
+                'picstitle' => $picstitle,
211
+                'titlecolor' => $titlecolor,
212
+                'subtitle' => $subtitle,
213
+                'outlink' => $outlink,
214
+                'date' => $date,
215
+                'enclosure' => $enclosure,
216
+                'keywords' => $keywords,
217
+                'description' => clear_html_blank($description),
218
+                'status' => $status,
219
+                'update_user' => session('username')
220
+            );
221
+            
222
+            // 执行添加
223
+            if ($this->model->modSingle($id, $data)) {
224
+                
225
+                // 扩展内容修改
226
+                foreach ($_POST as $key => $value) {
227
+                    if (preg_match('/^ext_[\w\-]+$/', $key)) {
228
+                        $temp = post($key);
229
+                        if (is_array($temp)) {
230
+                            $data2[$key] = implode(',', $temp);
231
+                        } else {
232
+                            $data2[$key] = str_replace("\r\n", '<br>', $temp);
233
+                        }
234
+                    }
235
+                }
236
+                if (isset($data2)) {
237
+                    if ($this->model->findContentExt($id)) {
238
+                        $this->model->modContentExt($id, $data2);
239
+                    } else {
240
+                        $data2['contentid'] = $id;
241
+                        $this->model->addContentExt($data2);
242
+                    }
243
+                }
244
+                
245
+                $this->log('修改单页内容' . $id . '成功!');
246
+                if (! ! $backurl = get('backurl')) {
247
+                    success('修改成功!', base64_decode($backurl));
248
+                } else {
249
+                    success('修改成功!', url('/admin/Single/index/mcode/1'));
250
+                }
251
+            } else {
252
+                location(- 1);
253
+            }
254
+        } else {
255
+            // 调取修改内容
256
+            $this->assign('mod', true);
257
+            if (! $result = $this->model->getSingle($id)) {
258
+                error('编辑的内容已经不存在!', - 1);
259
+            }
260
+            $this->assign('content', $result);
261
+            
262
+            // 扩展字段
263
+            if (! $mcode = get('mcode', 'var')) {
264
+                error('传递的模型编码参数有误,请核对后重试!');
265
+            }
266
+            $this->assign('extfield', model('admin.content.ExtField')->getModelField($mcode));
267
+            
268
+            $this->display('content/single.html');
269
+        }
270
+    }
271
+}

+ 82
- 0
apps/admin/controller/content/SiteController.php View File

@@ -0,0 +1,82 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年3月21日
7
+ *  站点设置控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\SiteModel;
13
+
14
+class SiteController extends Controller
15
+{
16
+
17
+    public function __construct()
18
+    {
19
+        $this->model = new SiteModel();
20
+    }
21
+
22
+    // 显示站点信息
23
+    public function index()
24
+    {
25
+        // 获取主题列表
26
+        $themes = dir_list(ROOT_PATH . current($this->config('tpl_dir')));
27
+        $this->assign('themes', $themes);
28
+        
29
+        // 获取系统配置
30
+        $this->assign('sites', $this->model->getList());
31
+        
32
+        // 显示
33
+        $this->display('content/site.html');
34
+    }
35
+
36
+    // 修改站点信息
37
+    public function mod()
38
+    {
39
+        if (! $_POST) {
40
+            return;
41
+        }
42
+        
43
+        $data = array(
44
+            'title' => post('title'),
45
+            'subtitle' => post('subtitle'),
46
+            'domain' => post('domain'),
47
+            'logo' => post('logo'),
48
+            'keywords' => post('keywords'),
49
+            'description' => post('description'),
50
+            'icp' => post('icp'),
51
+            'theme' => basename(post('theme')) ?: 'default',
52
+            'statistical' => post('statistical'),
53
+            'copyright' => post('copyright')
54
+        );
55
+        
56
+        path_delete(RUN_PATH . '/config'); // 清理缓存的配置文件
57
+        if ($this->model->checkSite()) {
58
+            if ($this->model->modSite($data)) {
59
+                $this->log('修改站点信息成功!');
60
+                success('修改成功!', - 1);
61
+            } else {
62
+                location(- 1);
63
+            }
64
+        } else {
65
+            $data['acode'] = session('acode');
66
+            if ($this->model->addSite($data)) {
67
+                $this->log('修改站点信息成功!');
68
+                success('修改成功!', - 1);
69
+            } else {
70
+                location(- 1);
71
+            }
72
+        }
73
+    }
74
+
75
+    // 服务器基础信息
76
+    public function server()
77
+    {
78
+        $this->assign('server', get_server_info());
79
+        $this->display('system/server.html');
80
+    }
81
+}
82
+

+ 195
- 0
apps/admin/controller/content/SlideController.php View File

@@ -0,0 +1,195 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年3月1日
7
+ *  轮播图控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\SlideModel;
13
+
14
+class SlideController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new SlideModel();
22
+    }
23
+
24
+    // 轮播图列表
25
+    public function index()
26
+    {
27
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getSlide($id)) {
28
+            $this->assign('more', true);
29
+            $this->assign('slide', $result);
30
+        } else {
31
+            $this->assign('list', true);
32
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
33
+                $result = $this->model->findSlide($field, $keyword);
34
+            } else {
35
+                $result = $this->model->getList();
36
+            }
37
+            $this->assign('gids', $this->model->getGid());
38
+            $this->assign('slides', $result);
39
+        }
40
+        $this->display('content/slide.html');
41
+    }
42
+
43
+    // 轮播图增加
44
+    public function add()
45
+    {
46
+        if ($_POST) {
47
+            // 获取数据
48
+            $gid = post('gid', 'int');
49
+            $pic = post('pic');
50
+            $link = post('link');
51
+            $title = post('title');
52
+            $subtitle = post('subtitle');
53
+            $sorting = post('sorting', 'int');
54
+            
55
+            if (! $gid) {
56
+                $gid = $this->model->getMaxGid() + 1;
57
+            }
58
+            
59
+            if (! $pic) {
60
+                alert_back('图片不能为空!');
61
+            }
62
+            
63
+            // 构建数据
64
+            $data = array(
65
+                'acode' => session('acode'),
66
+                'gid' => $gid,
67
+                'pic' => $pic,
68
+                'link' => $link,
69
+                'title' => $title,
70
+                'subtitle' => $subtitle,
71
+                'sorting' => $sorting,
72
+                'create_user' => session('username'),
73
+                'update_user' => session('username')
74
+            );
75
+            
76
+            // 执行添加
77
+            if ($this->model->addSlide($data)) {
78
+                $this->log('新增轮播图成功!');
79
+                if (! ! $backurl = get('backurl')) {
80
+                    success('新增成功!', base64_decode($backurl));
81
+                } else {
82
+                    success('新增成功!', url('/admin/Slide/index'));
83
+                }
84
+            } else {
85
+                $this->log('新增轮播图失败!');
86
+                error('新增失败!', - 1);
87
+            }
88
+        }
89
+    }
90
+
91
+    // 轮播图删除
92
+    public function del()
93
+    {
94
+        if (! $id = get('id', 'int')) {
95
+            error('传递的参数值错误!', - 1);
96
+        }
97
+        
98
+        if ($this->model->delSlide($id)) {
99
+            $this->log('删除轮播图' . $id . '成功!');
100
+            success('删除成功!', - 1);
101
+        } else {
102
+            $this->log('删除轮播图' . $id . '失败!');
103
+            error('删除失败!', - 1);
104
+        }
105
+    }
106
+
107
+    // 轮播图修改
108
+    public function mod()
109
+    {
110
+        if (! ! $submit = post('submit')) {
111
+            switch ($submit) {
112
+                case 'sorting': // 修改列表排序
113
+                    $listall = post('listall');
114
+                    if ($listall) {
115
+                        $sorting = post('sorting');
116
+                        foreach ($listall as $key => $value) {
117
+                            if ($sorting[$key] === '' || ! is_numeric($sorting[$key]))
118
+                                $sorting[$key] = 255;
119
+                            $this->model->modSlide($value, "sorting=" . $sorting[$key]);
120
+                        }
121
+                        $this->log('批量修改轮播图排序成功!');
122
+                        success('修改成功!', - 1);
123
+                    } else {
124
+                        alert_back('排序失败,无任何内容!');
125
+                    }
126
+                    break;
127
+            }
128
+        }
129
+        
130
+        if (! $id = get('id', 'int')) {
131
+            error('传递的参数值错误!', - 1);
132
+        }
133
+        
134
+        // 单独修改状态
135
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
136
+            if ($this->model->modSlide($id, "$field='$value',update_user='" . session('username') . "'")) {
137
+                location(- 1);
138
+            } else {
139
+                alert_back('修改失败!');
140
+            }
141
+        }
142
+        
143
+        // 修改操作
144
+        if ($_POST) {
145
+            
146
+            // 获取数据
147
+            $gid = post('gid', 'int');
148
+            $pic = post('pic');
149
+            $link = post('link');
150
+            $title = post('title');
151
+            $subtitle = post('subtitle');
152
+            $sorting = post('sorting', 'int');
153
+            
154
+            if (! $gid) {
155
+                $gid = $this->model->getMaxGid() + 1;
156
+            }
157
+            
158
+            if (! $pic) {
159
+                alert_back('图片不能为空!');
160
+            }
161
+            
162
+            // 构建数据
163
+            $data = array(
164
+                'gid' => $gid,
165
+                'pic' => $pic,
166
+                'link' => $link,
167
+                'title' => $title,
168
+                'subtitle' => $subtitle,
169
+                'sorting' => $sorting,
170
+                'update_user' => session('username')
171
+            );
172
+            
173
+            // 执行添加
174
+            if ($this->model->modSlide($id, $data)) {
175
+                $this->log('修改轮播图' . $id . '成功!');
176
+                if (! ! $backurl = get('backurl')) {
177
+                    success('修改成功!', base64_decode($backurl));
178
+                } else {
179
+                    success('修改成功!', url('/admin/Slide/index'));
180
+                }
181
+            } else {
182
+                location(- 1);
183
+            }
184
+        } else {
185
+            // 调取修改内容
186
+            $this->assign('mod', true);
187
+            if (! $result = $this->model->getSlide($id)) {
188
+                error('编辑的内容已经不存在!', - 1);
189
+            }
190
+            $this->assign('gids', $this->model->getGid());
191
+            $this->assign('slide', $result);
192
+            $this->display('content/slide.html');
193
+        }
194
+    }
195
+}

+ 157
- 0
apps/admin/controller/content/TagsController.php View File

@@ -0,0 +1,157 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2019年07月12日
7
+ *  内链链接控制器
8
+ */
9
+namespace app\admin\controller\content;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\content\TagsModel;
13
+
14
+class TagsController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new TagsModel();
22
+    }
23
+
24
+    // 文章内链列表
25
+    public function index()
26
+    {
27
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getTags($id)) {
28
+            $this->assign('more', true);
29
+            $this->assign('tags', $result);
30
+        } else {
31
+            $this->assign('list', true);
32
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
33
+                $result = $this->model->findTags($field, $keyword);
34
+            } else {
35
+                $result = $this->model->getList();
36
+            }
37
+            $this->assign('tags', $result);
38
+        }
39
+        $this->display('content/tags.html');
40
+    }
41
+
42
+    // 文章内链增加
43
+    public function add()
44
+    {
45
+        if ($_POST) {
46
+            // 获取数据
47
+            $name = post('name');
48
+            $link = post('link');
49
+            
50
+            if (! $name) {
51
+                alert_back('名称不能为空!');
52
+            }
53
+            
54
+            if (! $link) {
55
+                alert_back('链接不能为空!');
56
+            }
57
+            
58
+            // 构建数据
59
+            $data = array(
60
+                'acode' => session('acode'),
61
+                'name' => $name,
62
+                'link' => $link,
63
+                'create_user' => session('username'),
64
+                'update_user' => session('username')
65
+            );
66
+            
67
+            // 执行添加
68
+            if ($this->model->addTags($data)) {
69
+                $this->log('新增文章内链成功!');
70
+                if (! ! $backurl = get('backurl')) {
71
+                    success('新增成功!', base64_decode($backurl));
72
+                } else {
73
+                    success('新增成功!', url('/admin/Tags/index'));
74
+                }
75
+            } else {
76
+                $this->log('新增文章内链失败!');
77
+                error('新增失败!', - 1);
78
+            }
79
+        }
80
+    }
81
+
82
+    // 文章内链删除
83
+    public function del()
84
+    {
85
+        if (! $id = get('id', 'int')) {
86
+            error('传递的参数值错误!', - 1);
87
+        }
88
+        
89
+        if ($this->model->delTags($id)) {
90
+            $this->log('删除文章内链' . $id . '成功!');
91
+            success('删除成功!', - 1);
92
+        } else {
93
+            $this->log('删除文章内链' . $id . '失败!');
94
+            error('删除失败!', - 1);
95
+        }
96
+    }
97
+
98
+    // 文章内链修改
99
+    public function mod()
100
+    {
101
+        if (! $id = get('id', 'int')) {
102
+            error('传递的参数值错误!', - 1);
103
+        }
104
+        
105
+        // 单独修改状态
106
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
107
+            if ($this->model->modTags($id, "$field='$value',update_user='" . session('username') . "'")) {
108
+                location(- 1);
109
+            } else {
110
+                alert_back('修改失败!');
111
+            }
112
+        }
113
+        
114
+        // 修改操作
115
+        if ($_POST) {
116
+            
117
+            // 获取数据
118
+            $name = post('name');
119
+            $link = post('link');
120
+            
121
+            if (! $name) {
122
+                alert_back('名称不能为空!');
123
+            }
124
+            
125
+            if (! $link) {
126
+                alert_back('链接不能为空!');
127
+            }
128
+            
129
+            // 构建数据
130
+            $data = array(
131
+                'name' => $name,
132
+                'link' => $link,
133
+                'update_user' => session('username')
134
+            );
135
+            
136
+            // 执行添加
137
+            if ($this->model->modTags($id, $data)) {
138
+                $this->log('修改文章内链' . $id . '成功!');
139
+                if (! ! $backurl = get('backurl')) {
140
+                    success('修改成功!', base64_decode($backurl));
141
+                } else {
142
+                    success('修改成功!', url('/admin/Tags/index'));
143
+                }
144
+            } else {
145
+                location(- 1);
146
+            }
147
+        } else {
148
+            // 调取修改内容
149
+            $this->assign('mod', true);
150
+            if (! $result = $this->model->getTags($id)) {
151
+                error('编辑的内容已经不存在!', - 1);
152
+            }
153
+            $this->assign('tags', $result);
154
+            $this->display('content/tags.html');
155
+        }
156
+    }
157
+}

+ 118
- 0
apps/admin/controller/member/MemberCommentController.php View File

@@ -0,0 +1,118 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2020年06月27日
7
+ *  文章评论控制器
8
+ */
9
+namespace app\admin\controller\member;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\member\MemberCommentModel;
13
+
14
+class MemberCommentController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new MemberCommentModel();
22
+    }
23
+
24
+    // 文章评论列表
25
+    public function index()
26
+    {
27
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getComment($id)) {
28
+            $this->assign('more', true);
29
+            $this->assign('comment', $result);
30
+        } else {
31
+            $this->assign('list', true);
32
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
33
+                $result = $this->model->findComment($field, $keyword);
34
+            } else {
35
+                $result = $this->model->getList();
36
+            }
37
+            $this->assign('comments', $result);
38
+        }
39
+        $this->display('member/comment.html');
40
+    }
41
+
42
+    // 文章评论删除
43
+    public function del()
44
+    {
45
+        // 执行批量删除
46
+        if ($_POST) {
47
+            if (! ! $list = post('list')) {
48
+                if ($this->model->delCommentList($list)) {
49
+                    $this->log('批量删除评论成功!');
50
+                    success('删除成功!', - 1);
51
+                } else {
52
+                    $this->log('批量删除评论失败!');
53
+                    error('删除失败!', - 1);
54
+                }
55
+            } else {
56
+                alert_back('请选择要删除的评论!');
57
+            }
58
+        }
59
+        
60
+        if (! $id = get('id', 'int')) {
61
+            error('传递的参数值错误!', - 1);
62
+        }
63
+        
64
+        if ($this->model->delComment($id)) {
65
+            $this->log('删除文章评论' . $id . '成功!');
66
+            success('删除成功!', - 1);
67
+        } else {
68
+            $this->log('删除文章评论' . $id . '失败!');
69
+            error('删除失败!', - 1);
70
+        }
71
+    }
72
+
73
+    // 字段修改
74
+    public function mod()
75
+    {
76
+        if (! ! $submit = post('submit')) {
77
+            switch ($submit) {
78
+                case 'verify1':
79
+                    $list = post('list');
80
+                    if (! $list) {
81
+                        alert_back('请选择要操作的评论!');
82
+                    }
83
+                    if ($this->model->modCommentList($list, "status=1")) {
84
+                        $this->log('评论批量审核成功!');
85
+                        success('审核成功!', - 1);
86
+                    } else {
87
+                        alert_back('审核失败!');
88
+                    }
89
+                    break;
90
+                case 'verify0':
91
+                    $list = post('list');
92
+                    if (! $list) {
93
+                        alert_back('请选择要操作的评论!');
94
+                    }
95
+                    if ($this->model->modCommentList($list, "status=0")) {
96
+                        $this->log('评论批量禁用成功!');
97
+                        success('禁用成功!', - 1);
98
+                    } else {
99
+                        alert_back('禁用失败!');
100
+                    }
101
+                    break;
102
+            }
103
+        }
104
+        
105
+        if (! $id = get('id', 'int')) {
106
+            error('传递的参数值错误!', - 1);
107
+        }
108
+        
109
+        // 单独修改状态
110
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
111
+            if ($this->model->modComment($id, "$field='$value',update_user='" . session('username') . "'")) {
112
+                location(- 1);
113
+            } else {
114
+                alert_back('修改失败!');
115
+            }
116
+        }
117
+    }
118
+}

+ 292
- 0
apps/admin/controller/member/MemberController.php View File

@@ -0,0 +1,292 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2019年10月05日
7
+ *  会员控制器
8
+ */
9
+namespace app\admin\controller\member;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\member\MemberModel;
13
+
14
+class MemberController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new MemberModel();
22
+    }
23
+
24
+    // 会员列表
25
+    public function index()
26
+    {
27
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getMember($id)) {
28
+            $this->assign('more', true);
29
+            $this->assign('fields', $this->model->getFields());
30
+            $this->assign('member', $result);
31
+        } else {
32
+            $this->assign('list', true);
33
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
34
+                $result = $this->model->findMember($field, $keyword);
35
+            } else {
36
+                $result = $this->model->getList();
37
+            }
38
+            
39
+            // 会员等级
40
+            $this->assign('groups', model('admin.member.MemberGroup')->getSelect());
41
+            $this->assign('members', $result);
42
+        }
43
+        $this->display('member/member.html');
44
+    }
45
+
46
+    // 会员增加
47
+    public function add()
48
+    {
49
+        if ($_POST) {
50
+            // 获取数据
51
+            $ucode = get_auto_code($this->model->getLastCode(), 1);
52
+            $username = post('username');
53
+            $useremail = post('useremail');
54
+            $usermobile = post('usermobile');
55
+            $nickname = post('nickname');
56
+            $password = post('password');
57
+            $headpic = post('headpic');
58
+            $status = post('status') ?: 1;
59
+            $gid = post('gid');
60
+            $score = post('score');
61
+            $register_time = get_datetime();
62
+            
63
+            if (! $username) {
64
+                alert_back('用户账号不能为空!');
65
+            }
66
+            
67
+            if (! preg_match('/^[\w\@\.]+$/', $username)) {
68
+                alert_back('用户账号含有不允许的特殊字符!');
69
+            }
70
+            
71
+            if ($useremail && ! preg_match('/^[\w]+@[\w\.]+\.[a-zA-Z]+$/', $useremail)) {
72
+                alert_back('邮箱账号格式不正确!');
73
+            }
74
+            
75
+            if ($usermobile && ! preg_match('/^1[0-9]{10}$/', $usermobile)) {
76
+                alert_back('手机号码格式不正确!');
77
+            }
78
+            
79
+            if ($username && $this->model->checkMember("username='$username' OR useremail='$username' OR usermobile='$username'")) {
80
+                alert_back('用户名已经存在!');
81
+            }
82
+            
83
+            if ($useremail && $this->model->checkMember("username='$useremail' OR useremail='$useremail' OR usermobile='$useremail'")) {
84
+                alert_back('邮箱账号已经存在!');
85
+            }
86
+            
87
+            if ($usermobile && $this->model->checkMember("username='$usermobile' OR useremail='$usermobile' OR usermobile='$usermobile'")) {
88
+                alert_back('手机号码已经存在!');
89
+            }
90
+            
91
+            if (! $password) {
92
+                alert_back('密码不能为空!');
93
+            } else {
94
+                $password = md5(md5($password));
95
+            }
96
+            
97
+            // 构建数据
98
+            $data = array(
99
+                'ucode' => $ucode,
100
+                'username' => $username,
101
+                'useremail' => $useremail,
102
+                'usermobile' => $usermobile,
103
+                'nickname' => $nickname,
104
+                'password' => $password,
105
+                'headpic' => $headpic,
106
+                'status' => $status,
107
+                'gid' => $gid,
108
+                'wxid' => '',
109
+                'qqid' => '',
110
+                'wbid' => '',
111
+                'activation' => 1,
112
+                'score' => $score,
113
+                'register_time' => $register_time,
114
+                'login_count' => 0,
115
+                'last_login_ip' => 0,
116
+                'last_login_time' => 0
117
+            );
118
+            
119
+            // 执行添加
120
+            if ($this->model->addMember($data)) {
121
+                $this->log('新增会员成功!');
122
+                if (! ! $backurl = get('backurl')) {
123
+                    success('新增成功!', base64_decode($backurl));
124
+                } else {
125
+                    success('新增成功!', url('/admin/Member/index'));
126
+                }
127
+            } else {
128
+                $this->log('新增会员失败!');
129
+                error('新增失败!', - 1);
130
+            }
131
+        }
132
+    }
133
+
134
+    // 会员删除
135
+    public function del()
136
+    {
137
+        // 执行批量删除
138
+        if ($_POST) {
139
+            if (! ! $list = post('list')) {
140
+                if ($this->model->delMemberList($list)) {
141
+                    $this->log('批量删除会员成功!');
142
+                    success('删除成功!', - 1);
143
+                } else {
144
+                    $this->log('批量删除会员失败!');
145
+                    error('删除失败!', - 1);
146
+                }
147
+            } else {
148
+                alert_back('请选择要删除的会员!');
149
+            }
150
+        }
151
+        
152
+        if (! $id = get('id', 'int')) {
153
+            error('传递的参数值错误!', - 1);
154
+        }
155
+        
156
+        if ($this->model->delMember($id)) {
157
+            $this->log('删除会员' . $id . '成功!');
158
+            success('删除成功!', - 1);
159
+        } else {
160
+            $this->log('删除会员' . $id . '失败!');
161
+            error('删除失败!', - 1);
162
+        }
163
+    }
164
+
165
+    // 会员修改
166
+    public function mod()
167
+    {
168
+        if (! ! $submit = post('submit')) {
169
+            switch ($submit) {
170
+                case 'verify1':
171
+                    $list = post('list');
172
+                    if (! $list) {
173
+                        alert_back('请选择要操作的会员!');
174
+                    }
175
+                    if ($this->model->modMemberList($list, "status=1")) {
176
+                        $this->log('会员批量启用成功!');
177
+                        success('启用成功!', - 1);
178
+                    } else {
179
+                        alert_back('启用失败!');
180
+                    }
181
+                    break;
182
+                case 'verify0':
183
+                    $list = post('list');
184
+                    if (! $list) {
185
+                        alert_back('请选择要操作的会员!');
186
+                    }
187
+                    if ($this->model->modMemberList($list, "status=0")) {
188
+                        $this->log('会员批量禁用成功!');
189
+                        success('禁用成功!', - 1);
190
+                    } else {
191
+                        alert_back('禁用失败!');
192
+                    }
193
+                    break;
194
+            }
195
+        }
196
+        
197
+        if (! $id = get('id', 'int')) {
198
+            error('传递的参数值错误!', - 1);
199
+        }
200
+        
201
+        // 单独修改状态
202
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
203
+            if ($this->model->modMember($id, "$field='$value'")) {
204
+                location(- 1);
205
+            } else {
206
+                alert_back('修改失败!');
207
+            }
208
+        }
209
+        
210
+        // 修改操作
211
+        if ($_POST) {
212
+            
213
+            // 获取数据
214
+            $username = post('username');
215
+            $useremail = post('useremail');
216
+            $usermobile = post('usermobile');
217
+            $nickname = post('nickname');
218
+            $password = post('password');
219
+            $headpic = post('headpic');
220
+            $status = post('status') ?: 1;
221
+            $gid = post('gid');
222
+            $score = post('score');
223
+            
224
+            if (! $username) {
225
+                alert_back('用户账号不能为空!');
226
+            }
227
+            
228
+            if (! preg_match('/^[\w\@\.]+$/', $username)) {
229
+                alert_back('用户账号含有不允许的特殊字符!');
230
+            }
231
+            
232
+            if ($useremail && ! preg_match('/^[\w]+@[\w\.]+\.[a-zA-Z]+$/', $useremail)) {
233
+                alert_back('邮箱账号格式不正确!');
234
+            }
235
+            
236
+            if ($usermobile && ! preg_match('/^1[0-9]{10}$/', $usermobile)) {
237
+                alert_back('手机号码格式不正确!');
238
+            }
239
+            
240
+            if ($username && $this->model->checkMember("(username='$username' OR useremail='$username' OR usermobile='$username') AND id<>$id")) {
241
+                alert_back('用户名已经存在!');
242
+            }
243
+            
244
+            if ($useremail && $this->model->checkMember("(username='$useremail' OR useremail='$useremail' OR usermobile='$useremail') AND id<>$id")) {
245
+                alert_back('邮箱账号已经存在!');
246
+            }
247
+            
248
+            if ($usermobile && $this->model->checkMember("(username='$usermobile' OR useremail='$usermobile' OR usermobile='$usermobile') AND id<>$id")) {
249
+                alert_back('手机号码已经存在!');
250
+            }
251
+            
252
+            // 构建数据
253
+            $data = array(
254
+                'username' => $username,
255
+                'useremail' => $useremail,
256
+                'usermobile' => $usermobile,
257
+                'nickname' => $nickname,
258
+                'headpic' => $headpic,
259
+                'status' => $status,
260
+                'gid' => $gid,
261
+                'score' => $score
262
+            );
263
+            
264
+            if ($password) {
265
+                $data['password'] = md5(md5($password));
266
+            }
267
+            
268
+            // 执行添加
269
+            if ($this->model->modMember($id, $data)) {
270
+                $this->log('修改会员成功!');
271
+                if (! ! $backurl = get('backurl')) {
272
+                    success('修改成功!', base64_decode($backurl));
273
+                } else {
274
+                    success('修改成功!', url('/admin/Member/index'));
275
+                }
276
+            } else {
277
+                $this->log('修改会员失败!');
278
+                error('修改失败!', - 1);
279
+            }
280
+        } else {
281
+            // 调取修改内容
282
+            $this->assign('mod', true);
283
+            if (! $result = $this->model->getMember($id)) {
284
+                error('编辑的内容已经不存在!', - 1);
285
+            }
286
+            // 会员等级
287
+            $this->assign('groups', model('admin.member.MemberGroup')->getSelect());
288
+            $this->assign('member', $result);
289
+            $this->display('member/member.html');
290
+        }
291
+    }
292
+}

+ 193
- 0
apps/admin/controller/member/MemberFieldController.php View File

@@ -0,0 +1,193 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2020年06月25日
7
+ *  会员字段控制器
8
+ */
9
+namespace app\admin\controller\member;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\member\MemberFieldModel;
13
+
14
+class MemberFieldController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new MemberFieldModel();
22
+    }
23
+
24
+    // 会员字段列表
25
+    public function index()
26
+    {
27
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getField($id)) {
28
+            $this->assign('more', true);
29
+            $this->assign('field', $result);
30
+        } else {
31
+            $this->assign('list', true);
32
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
33
+                $result = $this->model->findField($field, $keyword);
34
+            } else {
35
+                $result = $this->model->getList();
36
+            }
37
+            $this->assign('fields', $result);
38
+        }
39
+        $this->display('member/field.html');
40
+    }
41
+
42
+    // 会员字段增加
43
+    public function add()
44
+    {
45
+        if ($_POST) {
46
+            
47
+            // 获取数据
48
+            $name = post('name', 'var');
49
+            $length = post('length', 'int') ?: 20;
50
+            $required = post('required', 'int') ?: 0;
51
+            $description = post('description');
52
+            $sorting = post('sorting', 'int') ?: 255;
53
+            $status = post('status') ?: 1;
54
+            
55
+            if (! $name) {
56
+                alert_back('字段名称不能为空!');
57
+            }
58
+            
59
+            if (! preg_match('/^[a-zA-Z][\w]+$/', $name)) {
60
+                alert_back('字段名称必须以字母开头!');
61
+            }
62
+            
63
+            if (! $description) {
64
+                alert_back('字段描述不能为空!');
65
+            }
66
+            
67
+            // 构建数据
68
+            $data = array(
69
+                'name' => $name,
70
+                'length' => $length,
71
+                'required' => $required,
72
+                'description' => $description,
73
+                'sorting' => $sorting,
74
+                'status' => $status,
75
+                'create_user' => session('username'),
76
+                'update_user' => session('username')
77
+            );
78
+            
79
+            // 字段类型及长度
80
+            $mysql = "varchar($length)";
81
+            $sqlite = "TEXT($length)";
82
+            
83
+            // 字段不存在时创建
84
+            if (! $this->model->isExistField($name)) {
85
+                if (get_db_type() == 'sqlite') {
86
+                    $result = $this->model->amd("ALTER TABLE ay_member ADD COLUMN $name $sqlite NULL");
87
+                } else {
88
+                    $result = $this->model->amd("ALTER TABLE ay_member ADD $name $mysql NULL COMMENT '$description'");
89
+                }
90
+            } elseif ($this->model->checkField($name)) { // 字段存在且已使用则报错
91
+                alert_back('字段已经存在,不能重复添加!');
92
+            }
93
+            
94
+            // 执行会员字段添加
95
+            if ($this->model->addField($data)) {
96
+                $this->log('新增会员字段成功!');
97
+                if (! ! $backurl = get('backurl')) {
98
+                    success('新增成功!', base64_decode($backurl));
99
+                } else {
100
+                    success('新增成功!', url('/admin/MemberField/index'));
101
+                }
102
+            } else {
103
+                $this->log('新增会员字段失败!');
104
+                error('新增失败!', - 1);
105
+            }
106
+        }
107
+    }
108
+
109
+    // 会员字段删除
110
+    public function del()
111
+    {
112
+        if (! $id = get('id', 'int')) {
113
+            error('传递的参数值错误!', - 1);
114
+        }
115
+        
116
+        $name = $this->model->getFieldName($id);
117
+        if ($this->model->delField($id)) {
118
+            // mysql数据库执行字段删除,sqlite暂时不支持
119
+            if (! ! $name) {
120
+                if (get_db_type() == 'mysql') {
121
+                    $result = $this->model->amd("ALTER TABLE ay_member DROP COLUMN $name");
122
+                }
123
+            }
124
+            $this->log('删除会员字段' . $id . '成功!');
125
+            success('删除成功!', - 1);
126
+        } else {
127
+            $this->log('删除会员字段' . $id . '失败!');
128
+            error('删除失败!', - 1);
129
+        }
130
+    }
131
+
132
+    // 会员字段修改
133
+    public function mod()
134
+    {
135
+        if (! $id = get('id', 'int')) {
136
+            error('传递的参数值错误!', - 1);
137
+        }
138
+        
139
+        // 单独修改状态
140
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
141
+            if ($this->model->modField($id, "$field='$value',update_user='" . session('username') . "'")) {
142
+                location(- 1);
143
+            } else {
144
+                alert_back('修改失败!');
145
+            }
146
+        }
147
+        
148
+        // 修改操作
149
+        if ($_POST) {
150
+            
151
+            // 获取数据
152
+            $required = post('required', 'int') ?: 0;
153
+            $description = post('description');
154
+            $sorting = post('sorting', 'int') ?: 255;
155
+            $status = post('status') ?: 1;
156
+            
157
+            if (! $description) {
158
+                alert_back('字段描述不能为空!');
159
+            }
160
+            
161
+            // 构建数据
162
+            $data = array(
163
+                'required' => $required,
164
+                'description' => $description,
165
+                'sorting' => $sorting,
166
+                'status' => $status,
167
+                'update_user' => session('username')
168
+            );
169
+            
170
+            // 执行会员字段修改
171
+            if ($this->model->modField($id, $data)) {
172
+                $this->log('修改会员字段成功!');
173
+                if (! ! $backurl = get('backurl')) {
174
+                    success('修改成功!', base64_decode($backurl));
175
+                } else {
176
+                    success('修改成功!', url('/admin/MemberField/index'));
177
+                }
178
+            } else {
179
+                $this->log('修改会员字段失败!');
180
+                error('修改失败!', - 1);
181
+            }
182
+        } else {
183
+            // 调取修改内容
184
+            $this->assign('mod', true);
185
+            if (! $result = $this->model->getField($id)) {
186
+                error('编辑的内容已经不存在!', - 1);
187
+            }
188
+            
189
+            $this->assign('field', $result);
190
+            $this->display('member/field.html');
191
+        }
192
+    }
193
+}

+ 187
- 0
apps/admin/controller/member/MemberGroupController.php View File

@@ -0,0 +1,187 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2020年06月25日
7
+ *  会员等级控制器
8
+ */
9
+namespace app\admin\controller\member;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\member\MemberGroupModel;
13
+
14
+class MemberGroupController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new MemberGroupModel();
22
+    }
23
+
24
+    // 会员等级列表
25
+    public function index()
26
+    {
27
+        if ((! ! $id = get('id', 'int')) && $result = $this->model->getGroup($id)) {
28
+            $this->assign('more', true);
29
+            $this->assign('group', $result);
30
+        } else {
31
+            $this->assign('list', true);
32
+            if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
33
+                $result = $this->model->findGroup($field, $keyword);
34
+            } else {
35
+                $result = $this->model->getList();
36
+            }
37
+            $this->assign('groups', $result);
38
+        }
39
+        $this->display('member/group.html');
40
+    }
41
+
42
+    // 会员等级增加
43
+    public function add()
44
+    {
45
+        if ($_POST) {
46
+            
47
+            // 获取数据
48
+            $gcode = post('gcode', 'int') ?: get_auto_code($this->model->getLastGid(), 1);
49
+            $gname = post('gname');
50
+            $description = post('description');
51
+            $status = post('status') ?: 1;
52
+            $lscore = post('lscore', 'int') ?: 0;
53
+            $uscore = post('uscore', 'int') ?: 9999999999;
54
+            
55
+            if (! $gcode) {
56
+                alert_back('等级编号不能为空!');
57
+            }
58
+            
59
+            if (! $gname) {
60
+                alert_back('等级名称不能为空!');
61
+            }
62
+            
63
+            if ($this->model->findGroupCode($gcode)) {
64
+                alert_back('等级编码不能重复!');
65
+            }
66
+            
67
+            // 构建数据
68
+            $data = array(
69
+                'gcode' => $gcode,
70
+                'gname' => $gname,
71
+                'description' => $description,
72
+                'status' => $status,
73
+                'lscore' => $lscore,
74
+                'uscore' => $uscore,
75
+                'create_user' => session('username'),
76
+                'update_user' => session('username')
77
+            );
78
+            
79
+            // 执行会员等级添加
80
+            if ($this->model->addGroup($data)) {
81
+                $this->log('新增会员等级成功!');
82
+                if (! ! $backurl = get('backurl')) {
83
+                    success('新增成功!', base64_decode($backurl));
84
+                } else {
85
+                    success('新增成功!', url('/admin/MemberGroup/index'));
86
+                }
87
+            } else {
88
+                $this->log('新增会员等级失败!');
89
+                error('新增失败!', - 1);
90
+            }
91
+        }
92
+    }
93
+
94
+    // 会员等级删除
95
+    public function del()
96
+    {
97
+        if (! $id = get('id', 'int')) {
98
+            error('传递的参数值错误!', - 1);
99
+        }
100
+        
101
+        if ($this->model->findGroupUser($id)) {
102
+            error('会员等级下存在用户,无法直接删除!', - 1);
103
+        }
104
+        
105
+        if ($this->model->delGroup($id)) {
106
+            $this->log('删除会员等级' . $id . '成功!');
107
+            success('删除成功!', - 1);
108
+        } else {
109
+            $this->log('删除会员等级' . $id . '失败!');
110
+            error('删除失败!', - 1);
111
+        }
112
+    }
113
+
114
+    // 会员等级修改
115
+    public function mod()
116
+    {
117
+        if (! $id = get('id', 'int')) {
118
+            error('传递的参数值错误!', - 1);
119
+        }
120
+        
121
+        // 单独修改状态
122
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
123
+            if ($this->model->modGroup($id, "$field='$value',update_user='" . session('username') . "'")) {
124
+                location(- 1);
125
+            } else {
126
+                alert_back('修改失败!');
127
+            }
128
+        }
129
+        
130
+        // 修改操作
131
+        if ($_POST) {
132
+            
133
+            // 获取数据
134
+            $gcode = post('gcode', 'int') ?: get_auto_code($this->model->getLastGid(), 1);
135
+            $gname = post('gname');
136
+            $description = post('description');
137
+            $status = post('status') ?: 1;
138
+            $lscore = post('lscore', 'int') ?: 0;
139
+            $uscore = post('uscore', 'int') ?: 9999999999;
140
+            
141
+            if (! $gcode) {
142
+                alert_back('等级编号不能为空!');
143
+            }
144
+            
145
+            if (! $gname) {
146
+                alert_back('等级名称不能为空!');
147
+            }
148
+            
149
+            if ($this->model->findGroupCode($gcode, $id)) {
150
+                alert_back('等级编码不能重复!');
151
+            }
152
+            
153
+            // 构建数据
154
+            $data = array(
155
+                'gcode' => $gcode,
156
+                'gname' => $gname,
157
+                'description' => $description,
158
+                'status' => $status,
159
+                'lscore' => $lscore,
160
+                'uscore' => $uscore,
161
+                'update_user' => session('username')
162
+            );
163
+            
164
+            // 执行会员等级修改
165
+            if ($this->model->modGroup($id, $data)) {
166
+                $this->log('修改会员等级成功!');
167
+                if (! ! $backurl = get('backurl')) {
168
+                    success('修改成功!', base64_decode($backurl));
169
+                } else {
170
+                    success('修改成功!', url('/admin/MemberGroup/index'));
171
+                }
172
+            } else {
173
+                $this->log('修改会员等级失败!');
174
+                error('修改失败!', - 1);
175
+            }
176
+        } else {
177
+            // 调取修改内容
178
+            $this->assign('mod', true);
179
+            if (! $result = $this->model->getGroup($id)) {
180
+                error('编辑的内容已经不存在!', - 1);
181
+            }
182
+            
183
+            $this->assign('group', $result);
184
+            $this->display('member/group.html');
185
+        }
186
+    }
187
+}

+ 303
- 0
apps/admin/controller/system/AreaController.php View File

@@ -0,0 +1,303 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年4月3日
7
+ *  区域控制器
8
+ */
9
+namespace app\admin\controller\system;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\system\AreaModel;
13
+
14
+class AreaController extends Controller
15
+{
16
+
17
+    private $count;
18
+
19
+    private $blank;
20
+
21
+    private $outData = array();
22
+
23
+    private $model;
24
+
25
+    public function __construct()
26
+    {
27
+        $this->model = new AreaModel();
28
+    }
29
+
30
+    // 区域列表
31
+    public function index()
32
+    {
33
+        $this->assign('list', true);
34
+        $area_tree = $this->model->getList();
35
+        $areas = $this->makeAreaList($area_tree);
36
+        $this->assign('areas', $areas);
37
+        
38
+        // 区域下拉表
39
+        $area_tree = $this->model->getSelect();
40
+        $area_select = $this->makeAreaSelect($area_tree);
41
+        $this->assign('area_select', $area_select);
42
+        
43
+        $this->display('system/area.html');
44
+    }
45
+
46
+    // 生成无限级区域列表
47
+    private function makeAreaList($tree)
48
+    {
49
+        // 循环生成
50
+        foreach ($tree as $value) {
51
+            $this->count ++;
52
+            $this->outData[$this->count] = new \stdClass();
53
+            $this->outData[$this->count]->id = $value->id;
54
+            $this->outData[$this->count]->blank = $this->blank;
55
+            $this->outData[$this->count]->name = $value->name;
56
+            $this->outData[$this->count]->domain = $value->domain;
57
+            $this->outData[$this->count]->acode = $value->acode;
58
+            $this->outData[$this->count]->pcode = $value->pcode;
59
+            $this->outData[$this->count]->is_default = $value->is_default;
60
+            $this->outData[$this->count]->create_user = $value->create_user;
61
+            $this->outData[$this->count]->update_user = $value->update_user;
62
+            $this->outData[$this->count]->create_time = $value->create_time;
63
+            $this->outData[$this->count]->update_time = $value->update_time;
64
+            
65
+            if ($value->son) {
66
+                $this->outData[$this->count]->son = true;
67
+            } else {
68
+                $this->outData[$this->count]->son = false;
69
+            }
70
+            
71
+            // 子菜单处理
72
+            if ($value->son) {
73
+                $this->blank .= '  ';
74
+                $this->makeAreaList($value->son);
75
+            }
76
+        }
77
+        
78
+        // 循环完后回归缩进位置
79
+        $this->blank = substr($this->blank, 6);
80
+        return $this->outData;
81
+    }
82
+
83
+    // 区域增加
84
+    public function add()
85
+    {
86
+        if ($_POST) {
87
+            // 获取数据
88
+            $acode = post('acode', 'var');
89
+            $pcode = post('pcode', 'var');
90
+            $name = post('name');
91
+            $domain = post('domain');
92
+            $is_default = post('is_default');
93
+            
94
+            if (! $acode) {
95
+                alert_back('编码不能为空!');
96
+            }
97
+            
98
+            if (! $pcode) { // 父编码默认为0
99
+                $pcode = 0;
100
+            }
101
+            
102
+            if (! $name) {
103
+                alert_back('区域名称不能为空!');
104
+            }
105
+            
106
+            if ($domain) {
107
+                $reg = '{^(https://|http://)?([\w\-.]+)([\/]+)?$}';
108
+                if (preg_match($reg, $domain)) {
109
+                    $domain = preg_replace($reg, '$2', $domain);
110
+                } else {
111
+                    alert_back('要绑定的域名输入有错!');
112
+                }
113
+                
114
+                // 检查绑定
115
+                if ($this->model->checkArea("domain='$domain'")) {
116
+                    alert_back('该域名已经绑定其他区域,不能再使用!');
117
+                }
118
+            }
119
+            
120
+            // 检查编码
121
+            if ($this->model->checkArea("acode='$acode'")) {
122
+                alert_back('该区域编号已经存在,不能再使用!');
123
+            }
124
+            
125
+            // 构建数据
126
+            $data = array(
127
+                'acode' => $acode,
128
+                'pcode' => $pcode,
129
+                'name' => $name,
130
+                'domain' => $domain,
131
+                'is_default' => $is_default,
132
+                'create_user' => session('username'),
133
+                'update_user' => session('username')
134
+            );
135
+            
136
+            // 执行添加
137
+            if ($this->model->addArea($data)) {
138
+                if (session('ucode') == '10001') {
139
+                    $acodes = session('acodes');
140
+                    $acodes[] = $acode;
141
+                    session('acodes', $acodes); // 更新管理员管理区域
142
+                    $model = model('Index');
143
+                    $areas = $model->getAreas();
144
+                    session('area_map', get_mapping($areas, 'name', 'acode')); // 更新区域代码名称映射表
145
+                    session('area_tree', $model->getUserAreaTree($areas, 0, 'acode', 'pcode', 'son', $acodes)); // 更新当前用户的区域树
146
+                }
147
+                $this->log('新增数据区域' . $acode . '成功!');
148
+                path_delete(RUN_PATH . '/config'); // 清理缓存的配置文件
149
+                if (! ! $backurl = get('backurl')) {
150
+                    success('新增成功!', base64_decode($backurl));
151
+                } else {
152
+                    success('新增成功!', url('/admin/Area/index'));
153
+                }
154
+            } else {
155
+                $this->log('新增数据区域' . $acode . '失败!');
156
+                error('新增失败!', - 1);
157
+            }
158
+        }
159
+    }
160
+
161
+    // 生成区域选择
162
+    private function makeAreaSelect($tree, $selectid = null)
163
+    {
164
+        $list_html = '';
165
+        foreach ($tree as $value) {
166
+            // 默认选择项
167
+            if ($selectid == $value->acode) {
168
+                $select = "selected='selected'";
169
+            } else {
170
+                $select = '';
171
+            }
172
+            if (get('acode') != $value->acode) { // 不显示本身,避免出现自身为自己的父节点
173
+                $list_html .= "<option value='{$value->acode}' $select>{$this->blank}{$value->acode} {$value->name}</option>";
174
+            }
175
+            // 子菜单处理
176
+            if ($value->son) {
177
+                $this->blank .= '  ';
178
+                $list_html .= $this->makeAreaSelect($value->son, $selectid);
179
+            }
180
+        }
181
+        // 循环完后回归位置
182
+        $this->blank = substr($this->blank, 0, - 6);
183
+        return $list_html;
184
+    }
185
+
186
+    // 区域删除
187
+    public function del()
188
+    {
189
+        if (! $acode = get('acode', 'var')) {
190
+            error('传递的参数值错误!', - 1);
191
+        }
192
+        
193
+        if ($acode == 'cn') {
194
+            error('系统内置区域不允许删除!', - 1);
195
+        }
196
+        
197
+        if ($this->model->delArea($acode)) {
198
+            path_delete(RUN_PATH . '/config'); // 清理缓存的配置文件
199
+            $this->log('删除数据区域' . $acode . '成功!');
200
+            session_unset();
201
+            success('删除成功,请重新登录', url('/admin/Index/index'));
202
+        } else {
203
+            $this->log('删除数据区域' . $acode . '失败!');
204
+            error('删除失败,请核对是否为默认区域!', - 1);
205
+        }
206
+    }
207
+
208
+    // 区域修改
209
+    public function mod()
210
+    {
211
+        if (! $acode = get('acode', 'var')) {
212
+            error('传递的参数值错误!', - 1);
213
+        }
214
+        
215
+        // 修改操作
216
+        if ($_POST) {
217
+            // 获取数据
218
+            $acode_new = post('acode', 'var');
219
+            $pcode = post('pcode', 'var');
220
+            $name = post('name');
221
+            $domain = post('domain');
222
+            $is_default = post('is_default');
223
+            
224
+            if (! $acode_new) {
225
+                alert_back('编码不能为空!');
226
+            }
227
+            
228
+            if (! $pcode) { // 父编码默认为0
229
+                $pcode = 0;
230
+            }
231
+            
232
+            if (! $name) {
233
+                alert_back('区域名称不能为空!');
234
+            }
235
+            
236
+            if ($domain) {
237
+                $reg = '{^(https://|http://)?([\w\-.]+)([\/]+)?$}';
238
+                if (preg_match($reg, $domain)) {
239
+                    $domain = preg_replace($reg, '$2', $domain);
240
+                } else {
241
+                    alert_back('要绑定的域名输入有错!');
242
+                }
243
+                
244
+                // 检查绑定
245
+                if ($this->model->checkArea("domain='$domain' AND acode<>'$acode'")) {
246
+                    alert_back('该域名已经绑定其他区域,不能再使用!');
247
+                }
248
+            }
249
+            
250
+            // 检查编码
251
+            if ($this->model->checkArea("acode='$acode_new' AND acode<>'$acode'")) {
252
+                alert_back('该区域编号已经存在,不能再使用!');
253
+            }
254
+            
255
+            // 构建数据
256
+            $data = array(
257
+                'acode' => $acode_new,
258
+                'pcode' => $pcode,
259
+                'name' => $name,
260
+                'domain' => $domain,
261
+                'is_default' => $is_default,
262
+                'update_user' => session('username')
263
+            );
264
+            
265
+            // 执行添加
266
+            if ($this->model->modArea($acode, $data)) {
267
+                if (session('ucode') == '10001') {
268
+                    $acodes = session('acodes');
269
+                    $acodes[] = $acode_new;
270
+                    session('acodes', $acodes); // 更新管理员管理区域
271
+                    $model = model('Index');
272
+                    $areas = $model->getAreas();
273
+                    session('area_map', get_mapping($areas, 'name', 'acode')); // 更新区域代码名称映射表
274
+                    session('area_tree', $model->getUserAreaTree($areas, 0, 'acode', 'pcode', 'son', $acodes)); // 更新当前用户的区域树
275
+                }
276
+                $this->log('修改数据区域' . $acode . '成功!');
277
+                path_delete(RUN_PATH . '/config'); // 清理缓存的配置文件
278
+                if (! ! $backurl = get('backurl')) {
279
+                    success('修改成功!', base64_decode($backurl));
280
+                } else {
281
+                    success('修改成功!', url('/admin/Area/index'));
282
+                }
283
+            } else {
284
+                location(- 1);
285
+            }
286
+        } else { // 调取修改内容
287
+            $this->assign('mod', true);
288
+            
289
+            $area = $this->model->getArea($acode);
290
+            if (! $area) {
291
+                error('编辑的内容已经不存在!', - 1);
292
+            }
293
+            $this->assign('area', $area);
294
+            
295
+            // 父编码下拉选择
296
+            $area_tree = $this->model->getSelect();
297
+            $area_select = $this->makeAreaSelect($area_tree, $area->pcode);
298
+            $this->assign('area_select', $area_select);
299
+            
300
+            $this->display('system/area.html');
301
+        }
302
+    }
303
+}

+ 321
- 0
apps/admin/controller/system/CityController.php View File

@@ -0,0 +1,321 @@
1
+<?php
2
+/**
3
+ *  城市分站控制器
4
+ */
5
+namespace app\admin\controller\system;
6
+
7
+use core\basic\Controller;
8
+use app\admin\model\system\CityModel;
9
+
10
+class CityController extends Controller
11
+{
12
+
13
+    private $count;
14
+
15
+    private $blank;
16
+
17
+    private $outData = array();
18
+
19
+    private $model;
20
+
21
+    public function __construct()
22
+    {
23
+        $this->model = new CityModel();
24
+        $lockFile = ROOT_PATH . '/data/city.lock';
25
+        //如果不存在插件锁,则创建数据表
26
+        if(!file_exists($lockFile)){
27
+            $this->createTabkle();
28
+        }
29
+    }
30
+
31
+    // 创建数据表
32
+    public function createTabkle(){
33
+        if (get_db_type() == 'sqlite') {
34
+            $sql = file_get_contents(ROOT_PATH . '/city_sqlite_update.sql');
35
+            $result = $this->model->amd($sql);
36
+        } else {
37
+            $sql = file_get_contents(ROOT_PATH . '/city_mysql_update.sql');
38
+            //分割sql语句
39
+            $sqlArr = explode(';', $sql);
40
+            foreach ($sqlArr as $v) {
41
+                if( $v!=='' ){
42
+                    $this->model->amd($v);
43
+                }
44
+            }
45
+            $result = true;
46
+        }
47
+        if($result){
48
+            file_put_contents(ROOT_PATH . '/data/city.lock', get_datetime());
49
+        }
50
+    }
51
+
52
+    // 地区列表
53
+    public function index()
54
+    {
55
+        $this->assign('list', true);
56
+        $pid = 0;
57
+        $cur_city = '顶级';
58
+        if( get('pid') ){
59
+            $pid = get('pid');
60
+            $cur_city = $this->model->findCity($pid)->title;
61
+        }
62
+        $this->assign('pid', $pid);
63
+        $this->assign('cur_city', $cur_city);
64
+        $lists = $this->model->getList($pid);
65
+        $this->assign('lists', $lists);
66
+        $city_select = $lists;
67
+        $this->assign('city_select', $city_select);
68
+        $this->display('system/city.html');
69
+    }
70
+
71
+    // 内容栏目增加
72
+    public function add()
73
+    {
74
+        // 修改操作
75
+        if ($_POST) {
76
+            if (! ! $mutititle = post('mutititle')) {
77
+                $mutititle = str_replace(',', ',', $mutititle);    //批量城市名
78
+                $mutietitle = post('mutietitle');
79
+                $mutietitle = str_replace(',', ',', $mutietitle);
80
+                $pid = post('pid', 'int');
81
+                if (! $mutititle) {
82
+                    alert_back('城市名称不能为空!');
83
+                }
84
+                if (! $mutietitle) {
85
+                    alert_back('英文名称不能为空!');
86
+                }
87
+                $titles = explode(',', $mutititle);
88
+                $etitles = explode(',', $mutietitle);
89
+                foreach ($titles as $key => $value) {
90
+                    // 检查名称
91
+                    if ($this->model->checkName("title='$value' or etitle='$etitles[$key]'")) {
92
+                        alert_back('城市名称已经存在,不能再使用!');
93
+                    }
94
+                    $data[] = array(
95
+                        'pid' => $pid,
96
+                        'title' => $value,
97
+                        'etitle' => $etitles[$key],
98
+                        'isurl' => '',
99
+                        'status' => 1,
100
+                        'sorting' => 255,
101
+                        'istop' => 0,
102
+                        'seo_title' => '',
103
+                        'seo_keywords' => '',
104
+                        'seo_description' => '',
105
+                        'contact' => '',
106
+                        'mobile' => '',
107
+                        'phone' => '',
108
+                        'fax' => '',
109
+                        'email' => '',
110
+                        'qq' => '',
111
+                        'address' => '',
112
+                    );
113
+                }
114
+            }else{
115
+                // 获取数据
116
+                $title = post('title');
117
+                $etitle = post('etitle');
118
+                $isurl = post('isurl');
119
+                $pid = post('pid', 'int');
120
+                $status = post('status', 'int');
121
+                $istop = post('istop', 'int', '', '', 0);
122
+                $seo_title = post('seo_title');
123
+                $seo_keywords = post('seo_keywords');
124
+                $seo_description = post('seo_description');
125
+
126
+                $contact = post('contact');
127
+                $mobile = post('mobile');
128
+                $phone = post('phone');
129
+                $fax = post('fax');
130
+                $email = post('email');
131
+                $qq = post('qq');
132
+                $address = post('address');
133
+
134
+                if (! $title) {
135
+                    alert_back('名称不能为空!');
136
+                }
137
+                if (! $etitle) {
138
+                    alert_back('英文名不能为空!');
139
+                }
140
+                // 检查名称
141
+                if ($this->model->checkName("title='$title' or etitle='$etitle'")) {
142
+                    alert_back('名称已经存在,不能再使用!');
143
+                }
144
+                // 构建数据
145
+                $data = array(
146
+                    'pid' => $pid,
147
+                    'title' => $title,
148
+                    'etitle' => $etitle,
149
+                    'isurl' => $isurl,
150
+                    'status' => $status,
151
+                    'sorting' => 255,
152
+                    'istop' => $istop,
153
+                    'seo_title' => $seo_title,
154
+                    'seo_keywords' => $seo_keywords,
155
+                    'seo_description' => $seo_description,
156
+                    'contact' => $contact,
157
+                    'mobile' => $mobile,
158
+                    'phone' => $phone,
159
+                    'fax' => $fax,
160
+                    'email' => $email,
161
+                    'qq' => $qq,
162
+                    'address' => $address
163
+                );
164
+            }
165
+            // 执行添加
166
+            if ($this->model->addCity($data)) {
167
+                $this->log('新增地区' . $id . '成功!');
168
+                $url = $pid?'/pid/'.$pid:'';
169
+                success('新增成功!', url('/admin/City/index'.$url));
170
+            } else {
171
+                location(- 1);
172
+            }
173
+        }
174
+    }
175
+
176
+    // 修改
177
+    public function mod()
178
+    {
179
+        // 批量修改排序
180
+        if (! ! $submit = post('submit')) {
181
+            switch ($submit) {
182
+                case 'sorting': // 修改列表排序
183
+                    $listall = post('listall');
184
+                    if ($listall) {
185
+                        $sorting = post('sorting');
186
+                        foreach ($listall as $key => $value) {
187
+                            if ($sorting[$key] === '' || ! is_numeric($sorting[$key]))
188
+                                $sorting[$key] = 255;
189
+                            $this->model->modCity($value, "sorting=" . $sorting[$key]);
190
+                        }
191
+                        $this->log('批量修改排序成功!');
192
+                        success('修改成功!', - 1);
193
+                    } else {
194
+                        alert_back('排序失败,无任何内容!');
195
+                    }
196
+                    break;
197
+            }
198
+        }
199
+        if (! $id = get('id', 'int')) {
200
+            error('传递的参数值错误!', - 1);
201
+        }
202
+        // 单独修改状态
203
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
204
+            if ($this->model->modCity($id, "$field='$value'")) {
205
+                $this->log('修改地区' . $id . '状态' . $value . '成功!');
206
+                location(- 1);
207
+            } else {
208
+                $this->log('修改地区' . $id . '状态' . $value . '失败!');
209
+                alert_back('修改失败!');
210
+            }
211
+        }
212
+        // 修改操作
213
+        if ($_POST) {
214
+            // 获取数据
215
+            $title = post('title');
216
+            $etitle = post('etitle');
217
+            $isurl = post('isurl');
218
+            $pid = post('pid', 'int');
219
+            $status = post('status', 'int');
220
+            $istop = post('istop', 'int', '', '', 0);
221
+            $seo_title = post('seo_title');
222
+            $seo_keywords = post('seo_keywords');
223
+            $seo_description = post('seo_description');
224
+
225
+            $contact = post('contact');
226
+            $mobile = post('mobile');
227
+            $phone = post('phone');
228
+            $fax = post('fax');
229
+            $email = post('email');
230
+            $qq = post('qq');
231
+            $address = post('address');
232
+
233
+            if($id==$pid){
234
+                alert_back('区域混乱啦!');
235
+            }
236
+            if (! $title) {
237
+                alert_back('名称不能为空!');
238
+            }
239
+            if (! $etitle) {
240
+                alert_back('英文名不能为空!');
241
+            }
242
+            // 构建数据
243
+            $data = array(
244
+                'pid' => $pid,
245
+                'title' => $title,
246
+                'etitle' => $etitle,
247
+                'isurl' => $isurl,
248
+                'status' => $status,
249
+                'istop' => $istop,
250
+                'seo_title' => $seo_title,
251
+                'seo_keywords' => $seo_keywords,
252
+                'seo_description' => $seo_description,
253
+                'contact' => $contact,
254
+                'mobile' => $mobile,
255
+                'phone' => $phone,
256
+                'fax' => $fax,
257
+                'email' => $email,
258
+                'qq' => $qq,
259
+                'address' => $address
260
+            );
261
+            // 执行添加
262
+            if ($this->model->modCity($id, $data)) {
263
+                $this->log('修改地区' . $id . '成功!');
264
+                $url = $pid?'/pid/'.$pid:'';
265
+                success('修改成功!', url('/admin/City/index'.$url));
266
+            } else {
267
+                location(- 1);
268
+            }
269
+        } else { // 调取修改内容
270
+            $this->assign('mod', true);
271
+            $city = $this->model->findCity($id);
272
+            if (! $city) {
273
+                error('编辑的内容已经不存在!', - 1);
274
+            }
275
+            if( $city->pid==0 ){
276
+                $pid = 0;
277
+                $cur_city = '顶级';
278
+            }else{
279
+                $parent_city = $this->model->findCity($city->pid);
280
+                $pid = $parent_city->pid;
281
+                $cur_city = $parent_city->title;
282
+            }
283
+            $this->assign('pid', $pid);
284
+            $this->assign('cur_city', $cur_city);
285
+            $city_select = $this->model->getList($parent_city->pid);
286
+            $this->assign('city_select', $city_select);
287
+            $this->assign('city', $city);
288
+            $this->display('system/city.html');
289
+        }
290
+    }
291
+
292
+    // 地区删除
293
+    public function del(){
294
+        // 执行批量删除
295
+        if ($_POST) {
296
+            if (! ! $list = post('list')) {
297
+                if ($this->model->delCityList($list)) {
298
+                    $this->log('批量删除地区成功!');
299
+                    success('批量删除成功!', - 1);
300
+                } else {
301
+                    $this->log('批量删除地区失败!');
302
+                    error('批量删除失败!', - 1);
303
+                }
304
+            } else {
305
+                alert_back('请选择要删除的内容!');
306
+            }
307
+        }
308
+        if (! $id = get('id', 'int')) {
309
+            error('传递的参数值错误!', - 1);
310
+        }
311
+        if ($this->model->delCity($id)) {
312
+            $this->log('删除地区' . $id . '成功!');
313
+            success('删除成功!', - 1);
314
+        } else {
315
+            $this->log('删除地区' . $id . '失败!');
316
+            error('删除失败!', - 1);
317
+        }
318
+    }
319
+
320
+
321
+}

+ 231
- 0
apps/admin/controller/system/ConfigController.php View File

@@ -0,0 +1,231 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年01月03日
7
+ *  应用配置控制器
8
+ */
9
+namespace app\admin\controller\system;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\system\ConfigModel;
13
+use core\basic\Config;
14
+
15
+class ConfigController extends Controller
16
+{
17
+
18
+    private $model;
19
+
20
+    public function __construct()
21
+    {
22
+        $this->model = new ConfigModel();
23
+    }
24
+
25
+    // 应用配置列表
26
+    public function index()
27
+    {
28
+        if (! ! $action = get('action')) {
29
+            switch ($action) {
30
+                case 'sendemail':
31
+                    $rs = sendmail($this->config(), get('to'), '【' . CMSNAME . '】测试邮件', '欢迎您使用' . CMSNAME . '网站开发管理系统!');
32
+                    if ($rs === true) {
33
+                        alert_back('测试邮件发送成功!');
34
+                    } else {
35
+                        error('发送失败:' . $rs);
36
+                    }
37
+                    break;
38
+            }
39
+        }
40
+        
41
+        // 修改参数配置
42
+        if ($_POST) {
43
+            unset($_POST['upload']); // 去除上传组件
44
+            if (isset($_POST['sn'])) {
45
+                $_POST['licensecode'] = base64_encode(post('sn') . '/' . post('sn_user')) . substr(post('sn'), 1, 1);
46
+            }
47
+            foreach ($_POST as $key => $value) {
48
+                if (! preg_match('/^[\w\-]+$/', $key)) {
49
+                    continue;
50
+                }
51
+                $config = array(
52
+                    'debug',
53
+                    // 'sn',
54
+                    // 'sn_user',
55
+                    'pagenum',
56
+                    'tpl_html_cache',
57
+                    'tpl_html_cache_time',
58
+                    'session_in_sitepath'
59
+                );
60
+                if (in_array($key, $config)) {
61
+                    if ($key == 'tpl_html_cache_time' && ! $value) {
62
+                        $value = 900;
63
+                    } else {
64
+                        $value = post($key);
65
+                    }
66
+                    $this->modConfig($key, $value);
67
+                } else {
68
+                    $this->modDbConfig($key);
69
+                }
70
+            }
71
+            
72
+            $this->log('修改参数配置成功!');
73
+            path_delete(RUN_PATH . '/config'); // 清理缓存的配置文件
74
+            
75
+            switch (post('submit')) {
76
+                case 'email':
77
+                    success('修改成功!', url('/admin/Config/index' . get_tab('t2'), false));
78
+                    break;
79
+                case 'baidu':
80
+                    success('修改成功!', url('/admin/Config/index' . get_tab('t3'), false));
81
+                    break;
82
+                case 'api':
83
+                    success('修改成功!', url('/admin/Config/index' . get_tab('t4'), false));
84
+                    break;
85
+                case 'watermark':
86
+                    success('修改成功!', url('/admin/Config/index' . get_tab('t5'), false));
87
+                    break;
88
+                case 'security':
89
+                    success('修改成功!', url('/admin/Config/index' . get_tab('t6'), false));
90
+                    break;
91
+                case 'urlrule':
92
+                    success('修改成功!', url('/admin/Config/index' . get_tab('t7'), false));
93
+                    break;
94
+                case 'pagetitle':
95
+                    success('修改成功!', url('/admin/Config/index' . get_tab('t8'), false));
96
+                    break;
97
+                case 'member':
98
+                    success('修改成功!', url('/admin/Config/index' . get_tab('t9'), false));
99
+                    break;
100
+                case 'upgrade':
101
+                    success('修改成功!', url('/admin/Upgrade/index' . get_tab('t2'), false));
102
+                    break;
103
+                default:
104
+                    success('修改成功!', url('/admin/Config/index', false));
105
+            }
106
+        }
107
+        $configs = $this->model->getList();
108
+        $configs['debug']['value'] = $this->config('debug');
109
+        if (! $configs['sn']['value']) {
110
+            $configs['sn']['value'] = $this->config('sn');
111
+            $configs['sn_user']['value'] = $this->config('sn_user');
112
+        }
113
+        $configs['session_in_sitepath']['value'] = $this->config('session_in_sitepath');
114
+        $configs['pagenum']['value'] = $this->config('pagenum');
115
+        $configs['url_type']['value'] = $this->config('url_type');
116
+        $configs['tpl_html_cache']['value'] = $this->config('tpl_html_cache');
117
+        $configs['tpl_html_cache_time']['value'] = $this->config('tpl_html_cache_time');
118
+        $this->assign('configs', $configs);
119
+        
120
+        $this->assign('groups', model('admin.member.MemberGroup')->getSelect());
121
+        
122
+        $this->display('system/config.html');
123
+    }
124
+
125
+    // 修改配置文件
126
+    private function modConfig($key, $value)
127
+    {
128
+        $value = str_replace(' ', '', $value); // 去除空格
129
+        $value = str_replace(',', ',', $value); // 转换可能输入的中文逗号
130
+        if (! preg_match('/^[\w\s\,\-]+$/', $value)) {
131
+            return;
132
+        }
133
+        
134
+        $config = file_get_contents(CONF_PATH . '/config.php');
135
+        if (preg_match("'$key'", $config)) {
136
+            if (preg_match('/^[0-9]+$/', $value)) {
137
+                $config = preg_replace('/(\'' . $key . '\'([\s]+)?=>([\s]+)?)[\w\'\"\s,]+,/', '${1}' . $value . ',', $config);
138
+            } else {
139
+                $config = preg_replace('/(\'' . $key . '\'([\s]+)?=>([\s]+)?)[\w\'\"\s,]+,/', '${1}\'' . $value . '\',', $config);
140
+            }
141
+        } else {
142
+            $config = preg_replace('/(return array\()/', "$1\r\n\r\n\t'$key' => '$value',", $config); // 自动新增配置
143
+        }
144
+        return file_put_contents(CONF_PATH . '/config.php', $config);
145
+    }
146
+
147
+    // 修改数据库配置
148
+    private function modDbConfig($key)
149
+    {
150
+        $value = post($key);
151
+        
152
+        // 如果开启伪静态时自动拷贝文件
153
+        if ($key == 'url_rule_type' && $value == 2) {
154
+            $soft = get_server_soft();
155
+            if ($soft == 'iis') {
156
+                if (! file_exists(ROOT_PATH . '/web.config')) {
157
+                    copy(ROOT_PATH . '/rewrite/web.config', ROOT_PATH . '/web.config');
158
+                }
159
+            } elseif ($soft == 'apache') {
160
+                if (! file_exists(ROOT_PATH . '/web.config')) {
161
+                    copy(ROOT_PATH . '/rewrite/.htaccess', ROOT_PATH . '/.htaccess');
162
+                }
163
+            }
164
+        }
165
+        
166
+        // 模板目录修改
167
+        if (($key == 'tpl_html_dir') && $value) {
168
+            
169
+            // 不允许特殊字符
170
+            if (! preg_match('/^\w+$/', $value)) {
171
+                return;
172
+            }
173
+            
174
+            $value = basename($value);
175
+            $htmldir = $this->config('tpl_html_dir');
176
+            $tpl_path = ROOT_PATH . current($this->config('tpl_dir')) . '/' . model('admin.content.ContentSort')->getTheme();
177
+            
178
+            if (! $htmldir || ! file_exists($tpl_path . '/' . $htmldir)) {
179
+                if (! check_dir($tpl_path . '/' . $value, true)) {
180
+                    return;
181
+                } // 原来没有目录时只创建目录,创建失败时直接不修改
182
+            } else {
183
+                if ($value != $htmldir) {
184
+                    if (file_exists($tpl_path . '/' . $value)) {
185
+                        if (dir_copy($tpl_path . '/' . $htmldir, $tpl_path . '/' . $value)) {
186
+                            path_delete($tpl_path . '/' . $htmldir, true); // 删除原来的
187
+                        } else {
188
+                            return; // 修改失败
189
+                        }
190
+                    } else {
191
+                        if (! rename($tpl_path . '/' . $htmldir, $tpl_path . '/' . $value)) {
192
+                            return; // 修改失败
193
+                        }
194
+                    }
195
+                }
196
+            }
197
+        }
198
+        
199
+        if ($key == 'home_upload_ext') {
200
+            // 不允许特殊扩展
201
+            if (preg_match('/(php|jsp|asp|exe|sh|cmd|vb|vbs|phtml)/i', $value)) {
202
+                return;
203
+            }
204
+        }
205
+        
206
+        // 数据分割处理
207
+        $hander = array(
208
+            'content_keyword_replace',
209
+            'ip_deny',
210
+            'ip_allow'
211
+        );
212
+        if (in_array($key, $hander) && $value) {
213
+            $value = str_replace("\r\n", ",", $value); // 替换回车
214
+            $value = str_replace(",", ",", $value); // 替换中文逗号分割符
215
+        }
216
+        
217
+        if ($this->model->checkConfig("name='$key'")) {
218
+            $this->model->modValue($key, $value);
219
+        } elseif ($key != 'submit' && $key != 'formcheck') {
220
+            // 自动新增配置项
221
+            $data = array(
222
+                'name' => $key,
223
+                'value' => $value,
224
+                'type' => 2,
225
+                'sorting' => 255,
226
+                'description' => ''
227
+            );
228
+            return $this->model->addConfig($data);
229
+        }
230
+    }
231
+}

+ 248
- 0
apps/admin/controller/system/DatabaseController.php View File

@@ -0,0 +1,248 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年5月9日
7
+ *  数据库管理,只支持MySQL
8
+ */
9
+namespace app\admin\controller\system;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\system\DatabaseModel;
13
+
14
+class DatabaseController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    private $dbauth;
20
+
21
+    function __construct()
22
+    {
23
+        $this->model = new DatabaseModel();
24
+        $this->dbauth = $this->config('database');
25
+    }
26
+
27
+    // 数据库管理
28
+    public function index()
29
+    {
30
+        switch ($this->dbauth['type']) {
31
+            case 'mysqli':
32
+            case 'pdo_mysql':
33
+                $this->assign('db', 'mysql');
34
+                $this->assign('tables', $this->model->getList());
35
+                break;
36
+            case 'sqlite':
37
+            case 'pdo_sqlite':
38
+                $this->assign('db', 'sqlite');
39
+                break;
40
+            default:
41
+                error('当前配置的数据库类型不支持在线管理!');
42
+        }
43
+        $this->display('system/database.html');
44
+    }
45
+
46
+    // 数据库修改
47
+    public function mod()
48
+    {
49
+        if (! $_POST) {
50
+            alert_back('非法访问!', - 1);
51
+        }
52
+        
53
+        $submit = post('submit', 'letter', true);
54
+        
55
+        switch ($submit) {
56
+            case 'yh':
57
+                $tables = self::getTableList();
58
+                if (! $tables)
59
+                    alert_back('请选择数据表!');
60
+                if ($this->model->optimize(implode(',', $tables))) {
61
+                    // $this->log('优化数据库表成功!');
62
+                    success('优化成功!', - 1);
63
+                } else {
64
+                    // $this->log('优化数据库表失败!');
65
+                    error('优化失败!', - 1);
66
+                }
67
+                break;
68
+            case 'xf':
69
+                $tables = self::getTableList();
70
+                if (! $tables)
71
+                    alert_back('请选择数据表!');
72
+                if ($this->model->repair(implode(',', $tables))) {
73
+                    // $this->log('修复数据库表成功!');
74
+                    success('修复成功!', - 1);
75
+                } else {
76
+                    // $this->log('修复数据库表失败!');
77
+                    error('修复失败!', - 1);
78
+                }
79
+                break;
80
+            case 'bf':
81
+                $tables = self::getTableList();
82
+                if (! $tables)
83
+                    alert_back('请选择数据表!');
84
+                if ($this->backupTable($tables)) {
85
+                    $this->log('备份数据库表成功!');
86
+                    success('备份表成功!', - 1);
87
+                } else {
88
+                    $this->log('备份数据库表失败!');
89
+                    error('备份失败!', - 1);
90
+                }
91
+                break;
92
+            case 'bfdb':
93
+                if ($this->backupDB()) {
94
+                    $this->log('备份数据库成功!');
95
+                    success('备份数据库成功!', - 1);
96
+                } else {
97
+                    $this->log('备份数据库失败!');
98
+                    error('备份失败!', - 1);
99
+                }
100
+                break;
101
+            case 'bfsqlite':
102
+                if (copy(DOC_PATH . $this->dbauth['dbname'], DOC_PATH . STATIC_DIR . '/backup/sql/' . get_uniqid() . '_' . date('YmdHis') . '.db')) {
103
+                    $this->log('备份数据库成功!');
104
+                    success('备份数据库成功!', - 1);
105
+                } else {
106
+                    $this->log('备份数据库失败!');
107
+                    error('备份失败!', - 1);
108
+                }
109
+                break;
110
+        }
111
+    }
112
+
113
+    // 备份数据表
114
+    public function backupTable($tables)
115
+    {
116
+        $backdir = date('YmdHis');
117
+        foreach ($tables as $table) {
118
+            $sql = '';
119
+            $sql .= $this->header(); // 备份文件头部说明
120
+            $sql .= $this->tableSql($table); // 表结构信息
121
+            $fields = $this->model->getFields($table); // 表字段
122
+            $field_num = $this->model->getFieldNum($table); // 字段数量
123
+            $all_data = $this->model->getAll($table); // 读取全部数据
124
+            $sql .= $this->dataSql($table, $fields, $field_num, $all_data); // 生成语句
125
+            $filename = $backdir . "/" . get_uniqid() . "_" . $backdir . "_" . $table . '.sql'; // 写入文件
126
+            $result = $this->writeFile($filename, $sql);
127
+        }
128
+        return $result;
129
+    }
130
+
131
+    // 备份整个数据库
132
+    public function backupDB()
133
+    {
134
+        $sql = '';
135
+        $sql .= $this->header(); // 备份文件头部说明
136
+        $sql .= $this->dbSql(); // 数据库创建语句
137
+        
138
+        $tables = $this->model->getTables(); // 获取所有表
139
+        foreach ($tables as $table) { // 表结构及数据
140
+            $sql .= $this->tableSql($table); // 表结构信息
141
+            $fields = $this->model->getFields($table); // 表字段
142
+            $field_num = $this->model->getFieldNum($table); // 字段数量
143
+            $all_data = $this->model->getAll($table); // 读取全部数据
144
+            if ($all_data) {
145
+                $sql .= $this->dataSql($table, $fields, $field_num, $all_data); // 生成数据语句
146
+            }
147
+            $sql .= '-- --------------------------------------------------------' . PHP_EOL . PHP_EOL;
148
+        }
149
+        // 写入文件
150
+        $filename = get_uniqid() . '_' . date('YmdHis') . '_' . $this->dbauth['dbname'] . '.sql';
151
+        return $this->writeFile($filename, $sql);
152
+    }
153
+
154
+    // 插入数据库备份基础信息
155
+    private function header()
156
+    {
157
+        $sql = '-- Online Database Management SQL Dump' . PHP_EOL;
158
+        $sql .= '-- 数据库名: ' . $this->dbauth['dbname'] . PHP_EOL;
159
+        $sql .= '-- 生成日期: ' . date('Y-m-d H:i:s') . PHP_EOL;
160
+        $sql .= '-- PHP 版本: ' . phpversion() . PHP_EOL . PHP_EOL;
161
+        
162
+        $sql .= 'SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";' . PHP_EOL;
163
+        $sql .= 'SET time_zone = "+08:00";' . PHP_EOL;
164
+        $sql .= 'SET NAMES utf8;' . PHP_EOL . PHP_EOL;
165
+        
166
+        $sql .= '-- --------------------------------------------------------' . PHP_EOL . PHP_EOL;
167
+        return $sql;
168
+    }
169
+
170
+    // 数据库创建语句
171
+    private function dbSql()
172
+    {
173
+        $sql = '';
174
+        $sql .= "--" . PHP_EOL;
175
+        $sql .= "-- 数据库名 `" . $this->dbauth['dbname'] . '`' . PHP_EOL;
176
+        $sql .= "--" . PHP_EOL . PHP_EOL;
177
+        
178
+        // 如果数据库不存在则创建
179
+        $sql .= "CREATE DATABASE IF NOT EXISTS `" . $this->dbauth['dbname'] . '` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;' . PHP_EOL;
180
+        // 选择数据库
181
+        $sql .= "USE `" . $this->dbauth['dbname'] . "`;" . PHP_EOL . PHP_EOL;
182
+        $sql .= '-- --------------------------------------------------------' . PHP_EOL . PHP_EOL;
183
+        return $sql;
184
+    }
185
+
186
+    // 表结构语句
187
+    private function tableSql($table)
188
+    {
189
+        $sql = '';
190
+        $sql .= "--" . PHP_EOL;
191
+        $sql .= "-- 表的结构 `" . $table . '`' . PHP_EOL;
192
+        $sql .= "--" . PHP_EOL . PHP_EOL;
193
+        
194
+        $sql .= $this->model->tableStru($table); // 表创建语句
195
+        return $sql;
196
+    }
197
+
198
+    // 数据语句
199
+    private function dataSql($table, $fields, $fieldNnum, $data)
200
+    {
201
+        if (! $data)
202
+            return;
203
+        $sql = '';
204
+        $sql .= "--" . PHP_EOL;
205
+        $sql .= "-- 转存表中的数据 `" . $table . "`" . PHP_EOL;
206
+        $sql .= "--" . PHP_EOL;
207
+        $sql .= PHP_EOL;
208
+        
209
+        // 循环每个字段下面的内容
210
+        
211
+        $sql .= "INSERT INTO `" . $table . "` (" . implode(',', $fields) . ") VALUES" . PHP_EOL;
212
+        $brackets = "(";
213
+        foreach ($data as $value) {
214
+            $sql .= $brackets;
215
+            $comma = "";
216
+            for ($i = 0; $i < $fieldNnum; $i ++) {
217
+                $sql .= ($comma . "'" . addslashes(decode_string($value[$i])) . "'");
218
+                $comma = ",";
219
+            }
220
+            $sql .= ")";
221
+            $brackets = "," . PHP_EOL . "(";
222
+        }
223
+        $sql .= ';' . PHP_EOL . PHP_EOL;
224
+        return $sql;
225
+    }
226
+
227
+    // 写入文件
228
+    private function writeFile($filename, $content)
229
+    {
230
+        $sqlfile = DOC_PATH . STATIC_DIR . '/backup/sql/' . $filename;
231
+        check_file($sqlfile, true);
232
+        if (file_put_contents($sqlfile, $content)) {
233
+            return true;
234
+        }
235
+    }
236
+
237
+    // 获取并检查表名称
238
+    private function getTableList()
239
+    {
240
+        $list = post('list');
241
+        foreach ($list as $key => $value) {
242
+            if (! preg_match('/^[\w]+$/', $value)) {
243
+                unset($list[$key]);
244
+            }
245
+        }
246
+        return $list;
247
+    }
248
+}

+ 152
- 0
apps/admin/controller/system/ImageExtController.php View File

@@ -0,0 +1,152 @@
1
+<?php
2
+
3
+namespace app\admin\controller\system;
4
+
5
+use app\admin\model\content\CompanyModel;
6
+use app\admin\model\content\ContentModel;
7
+use app\admin\model\content\ContentSortModel;
8
+use app\admin\model\content\LinkModel;
9
+use app\admin\model\content\SiteModel;
10
+use app\admin\model\content\SlideModel;
11
+use app\admin\model\content\LabelModel;
12
+use app\home\model\MemberModel;
13
+use core\basic\Controller;
14
+
15
+class ImageExtController extends Controller
16
+{
17
+    private $companyModel;
18
+    private $contentSortModel;
19
+    private $contentModel;
20
+    private $linkModel;
21
+    private $memberModel;
22
+    private $siteModel;
23
+    private $slideModel;
24
+	private $LabelModel;
25
+
26
+    public function __construct()
27
+    {
28
+        $this->companyModel = new CompanyModel();
29
+        $this->contentSortModel = new ContentSortModel();
30
+        $this->contentModel = new ContentModel();
31
+        $this->linkModel = new LinkModel();
32
+        $this->memberModel = new MemberModel();
33
+        $this->siteModel = new SiteModel();
34
+        $this->slideModel = new SlideModel();
35
+		$this->LabelModel = new LabelModel();
36
+    }
37
+
38
+    public function index()
39
+    {
40
+        $this->display('system/extimage.html');
41
+    }
42
+
43
+    public function checkDataFile()
44
+    {
45
+        $count = 30;
46
+        $page = get('page') ? get('page') : 1;
47
+        $start = ($page - 1) * $count;
48
+        $dataArr = [];
49
+        $company = $this->companyModel->getImage();
50
+        $contentSort = $this->contentSortModel->getImage();
51
+        $content = $this->contentModel->getImage();
52
+        $link = $this->linkModel->getImage();
53
+        $member = $this->memberModel->getImage();
54
+        $site = $this->siteModel->getImage();
55
+        $slide = $this->slideModel->getImage();
56
+		$label = $this->LabelModel->getImage();
57
+        $resArr = array_merge_recursive($company, $contentSort, $content, $link, $member, $site, $slide, $label);
58
+        array_walk_recursive($resArr, function ($key1) use (&$dataArr) {
59
+            if (!empty($key1)) {
60
+                $dataArr[] = DOC_PATH . SITE_DIR .$key1;
61
+            }
62
+            return $dataArr;
63
+        });
64
+        $dataArr = array_unique($dataArr);
65
+        //获取上传的文件
66
+        $Filepath = DOC_PATH . STATIC_DIR . '/upload';
67
+        $fileList = get_dir($Filepath);
68
+        $fileArr = [];
69
+        array_walk_recursive($fileList, function ($key) use (&$fileArr) {
70
+            $fileArr[] = $key;
71
+            return $fileArr;
72
+        });
73
+
74
+        //对比文件
75
+        $difference = array_diff($fileArr, $dataArr);
76
+        $pageList = array_slice($difference, $start, $count);
77
+        $http = is_https() ? 'https://' : 'http://';
78
+        foreach ($pageList as &$value) {
79
+            $value = [
80
+                'real_path' => $value,
81
+                'static_path' => $http . $_SERVER['SERVER_NAME'] . str_replace(DOC_PATH, '', $value),
82
+                'update_time' => date('Y-m-d H:i:s', filemtime($value))
83
+            ];
84
+        }
85
+        $jsonData = ['code' => 0,'msg'=> '', 'count' => count($difference),'data' => $pageList];
86
+        return json_encode($jsonData);
87
+
88
+    }
89
+
90
+    public function do_ext()
91
+    {
92
+        $type = post('type');
93
+        $list = post('list');
94
+
95
+        $movePath = DOC_PATH . STATIC_DIR . '/backup/ImageExt';
96
+        check_dir($movePath, true);
97
+
98
+        switch ($type){
99
+            case 0:
100
+                //清理所选文件
101
+                foreach ($list as $value){
102
+                    $fileName = substr(strrchr($value['real_path'], "/"), 1);
103
+                    $filePath = strstr($value['real_path'],'/static');
104
+                    $fileDir = str_replace($fileName,'',$filePath);
105
+                    check_dir($movePath . $fileDir, true);
106
+                    rename($value['real_path'], $movePath . $filePath);
107
+                }
108
+                break;
109
+            case 1:
110
+                //清理所有冗余文件
111
+                //获取上传的文件
112
+                $Filepath = DOC_PATH . STATIC_DIR . '/upload';
113
+                $fileList = get_dir($Filepath);
114
+                $fileArr = [];
115
+                array_walk_recursive($fileList, function ($key) use (&$fileArr) {
116
+                    $fileArr[] = $key;
117
+                    return $fileArr;
118
+                });
119
+                //查询数据
120
+                $dataArr = [];
121
+                $company = $this->companyModel->getImage();
122
+                $contentSort = $this->contentSortModel->getImage();
123
+                $content = $this->contentModel->getImage();
124
+                $link = $this->linkModel->getImage();
125
+                $member = $this->memberModel->getImage();
126
+                $site = $this->siteModel->getImage();
127
+                $slide = $this->slideModel->getImage();
128
+				$Label = $this->LabelModel->getImage();
129
+                $resArr = array_merge_recursive($company, $contentSort, $content, $link, $member, $site, $slide, $Label);
130
+                array_walk_recursive($resArr, function ($key1) use (&$dataArr) {
131
+                    if (!empty($key1)) {
132
+                        $dataArr[] = DOC_PATH . SITE_DIR .$key1;
133
+                    }
134
+                    return $dataArr;
135
+                });
136
+                $dataArr = array_unique($dataArr);
137
+                //对比文件并执行文件迁移
138
+                $difference = array_diff($fileArr, $dataArr);
139
+                $movePath = DOC_PATH . STATIC_DIR . '/backup/ImageExt/';
140
+                check_dir($movePath, true);
141
+                foreach ($difference as $path) {
142
+                    $fileName = substr(strrchr($path, "/"), 1);
143
+                    $filePath = strstr($path,'/static');
144
+                    $fileDir = str_replace($fileName,'',$filePath);
145
+                    check_dir($movePath . $fileDir, true);
146
+                    rename($path, $movePath . $filePath);
147
+                }
148
+                break;
149
+        }
150
+        json(1,'');
151
+    }
152
+}

+ 275
- 0
apps/admin/controller/system/MenuController.php View File

@@ -0,0 +1,275 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年4月3日
7
+ *  菜单控制器 
8
+ */
9
+namespace app\admin\controller\system;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\system\MenuModel;
13
+
14
+class MenuController extends Controller
15
+{
16
+
17
+    private $count;
18
+
19
+    private $blank;
20
+
21
+    private $outData = array();
22
+
23
+    private $model;
24
+
25
+    public function __construct()
26
+    {
27
+        $this->model = new MenuModel();
28
+    }
29
+
30
+    // 菜单列表
31
+    public function index()
32
+    {
33
+        $this->assign('list', true);
34
+        $menus = $this->model->getList();
35
+        $this->assign('menus', $this->makeMenuList($menus));
36
+        
37
+        // 菜单下拉列表
38
+        $menus = $this->model->getSelect();
39
+        $this->assign('menu_select', $this->makeMenuSelect($menus));
40
+        
41
+        // 获取菜单按钮
42
+        $this->assign('actions', get_type('T101'));
43
+        
44
+        $this->display('system/menu.html');
45
+    }
46
+
47
+    // 生成无限级菜单管理列表
48
+    private function makeMenuList($tree)
49
+    {
50
+        // 循环生成
51
+        foreach ($tree as $value) {
52
+            $this->count ++;
53
+            $this->outData[$this->count] = new \stdClass();
54
+            $this->outData[$this->count]->id = $value->id;
55
+            $this->outData[$this->count]->blank = $this->blank;
56
+            $this->outData[$this->count]->name = $value->name;
57
+            $this->outData[$this->count]->mcode = $value->mcode;
58
+            $this->outData[$this->count]->pcode = $value->pcode;
59
+            $this->outData[$this->count]->sorting = $value->sorting;
60
+            $this->outData[$this->count]->url = $value->url;
61
+            $this->outData[$this->count]->status = $value->status;
62
+            $this->outData[$this->count]->shortcut = $value->shortcut;
63
+            $this->outData[$this->count]->ico = $value->ico;
64
+            $this->outData[$this->count]->create_user = $value->create_user;
65
+            $this->outData[$this->count]->update_user = $value->update_user;
66
+            $this->outData[$this->count]->create_time = $value->create_time;
67
+            $this->outData[$this->count]->update_time = $value->update_time;
68
+            
69
+            if ($value->son) {
70
+                $this->outData[$this->count]->son = true;
71
+            } else {
72
+                $this->outData[$this->count]->son = false;
73
+            }
74
+            // 子菜单处理
75
+            if ($value->son) {
76
+                $this->blank .= '  ';
77
+                $this->makeMenuList($value->son);
78
+            }
79
+        }
80
+        // 循环完后回归缩进位置
81
+        $this->blank = substr($this->blank, 0, - 6);
82
+        return $this->outData;
83
+    }
84
+
85
+    // 菜单增加
86
+    public function add()
87
+    {
88
+        if ($_POST) {
89
+            // 获取数据
90
+            $mcode = get_auto_code($this->model->getLastCode()); // 自动编码
91
+            $pcode = post('pcode', 'var');
92
+            $name = post('name');
93
+            $url = post('url');
94
+            $sorting = post('sorting', 'int');
95
+            $status = post('status', 'int');
96
+            $shortcut = post('shortcut', 'int');
97
+            $ico = post('ico');
98
+            $actions = post('actions', 'array', false, '菜单按钮', array());
99
+            
100
+            if (! $mcode) {
101
+                alert_back('编码不能为空!');
102
+            }
103
+            if (! $pcode) {
104
+                $pcode = 0; // 父编码默认为0
105
+            }
106
+            if (! $name) {
107
+                alert_back('菜单名称不能为空!');
108
+            }
109
+            
110
+            if ($this->model->checkMenu("mcode='$mcode'")) {
111
+                alert_back('该菜单编号已经存在,不能再使用!');
112
+            }
113
+            
114
+            // 菜单地址自动填充
115
+            if (! $url) {
116
+                $url = '/' . M . '/' . $mcode . '/index';
117
+            }
118
+            
119
+            // 构建数据
120
+            $data = array(
121
+                'mcode' => $mcode,
122
+                'pcode' => $pcode,
123
+                'name' => $name,
124
+                'url' => $url,
125
+                'sorting' => $sorting,
126
+                'status' => $status,
127
+                'shortcut' => $shortcut,
128
+                'ico' => $ico,
129
+                'create_user' => session('username'),
130
+                'update_user' => session('username')
131
+            );
132
+            
133
+            // 执行添加
134
+            if ($this->model->addMenu($data, $actions)) {
135
+                $this->log('新增菜单' . $mcode . '成功!');
136
+                if (! ! $backurl = get('backurl')) {
137
+                    success('新增成功!', base64_decode($backurl));
138
+                } else {
139
+                    success('新增成功!', url('admin/Menu/index'));
140
+                }
141
+            } else {
142
+                $this->log('新增菜单' . $mcode . '失败!');
143
+                error('新增失败!', - 1);
144
+            }
145
+        }
146
+    }
147
+
148
+    // 生成菜单下拉列表
149
+    private function makeMenuSelect($tree, $selectid = null)
150
+    {
151
+        // 初始化
152
+        $menu_html = '';
153
+        // 循环生成
154
+        foreach ($tree as $value) {
155
+            // 默认选择项
156
+            if ($selectid == $value->mcode) {
157
+                $select = "selected='selected'";
158
+            } else {
159
+                $select = '';
160
+            }
161
+            if (get('mcode') != $value->mcode) { // 不显示本身,避免出现自身为自己的父节点
162
+                $menu_html .= "<option value='{$value->mcode}' $select />{$this->blank}{$value->mcode} {$value->name}";
163
+            }
164
+            // 子菜单处理
165
+            if ($value->son) {
166
+                $this->blank .= '  ';
167
+                $menu_html .= $this->makeMenuSelect($value->son, $selectid);
168
+            }
169
+        }
170
+        // 循环完后回归位置
171
+        $this->blank = substr($this->blank, 0, - 6);
172
+        return $menu_html;
173
+    }
174
+
175
+    // 菜单删除
176
+    public function del()
177
+    {
178
+        if (! $mcode = get('mcode', 'var')) {
179
+            error('传递的参数值错误!', - 1);
180
+        }
181
+        if ($this->model->delMenu($mcode)) {
182
+            $this->log('删除菜单' . $mcode . '成功!');
183
+            success('删除成功!', - 1);
184
+        } else {
185
+            $this->log('删除菜单' . $mcode . '失败!');
186
+            error('删除失败!', - 1);
187
+        }
188
+    }
189
+
190
+    // 菜单修改
191
+    public function mod()
192
+    {
193
+        if (! $mcode = get('mcode', 'var')) {
194
+            error('传递的参数值错误!', - 1);
195
+        }
196
+        
197
+        // 单独修改状态
198
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
199
+            if ($this->model->modMenu($mcode, "$field='$value',update_user='" . session('username') . "'")) {
200
+                $this->log('修改菜单' . $mcode . '状态' . $value . '成功!');
201
+                location(- 1);
202
+            } else {
203
+                $this->log('修改菜单' . $mcode . '状态' . $value . '失败!');
204
+                alert_back('修改失败!');
205
+            }
206
+        }
207
+        
208
+        // 修改操作
209
+        if ($_POST) {
210
+            // 获取数据
211
+            $pcode = post('pcode', 'var');
212
+            $name = post('name');
213
+            $sorting = post('sorting', 'int');
214
+            $url = post('url');
215
+            $status = post('status', 'int');
216
+            $shortcut = post('shortcut', 'int');
217
+            $ico = post('ico');
218
+            $actions = post('actions', 'array', false, '菜单按钮', array());
219
+            
220
+            if (! $pcode) {
221
+                $pcode = 0; // 父编码默认为0
222
+            }
223
+            if (! $name) {
224
+                alert_back('菜单名称不能为空!');
225
+            }
226
+            // 菜单地址自动填充
227
+            if (! $url) {
228
+                $url = '/' . M . '/' . $mcode . '/index';
229
+            }
230
+            
231
+            // 构建数据
232
+            $data = array(
233
+                'pcode' => $pcode,
234
+                'name' => $name,
235
+                'sorting' => $sorting,
236
+                'url' => $url,
237
+                'status' => $status,
238
+                'shortcut' => $shortcut,
239
+                'ico' => $ico,
240
+                'update_user' => session('username')
241
+            );
242
+            
243
+            // 执行修改
244
+            if ($this->model->modMenu($mcode, $data, $actions)) {
245
+                $this->log('修改菜单' . $mcode . '成功!');
246
+                if (! ! $backurl = get('backurl')) {
247
+                    success('修改成功!', base64_decode($backurl));
248
+                } else {
249
+                    success('修改成功!', url('admin/Menu/index'));
250
+                }
251
+            } else {
252
+                location(- 1);
253
+            }
254
+        } else { // 调取修改内容
255
+            
256
+            $this->assign('mod', true);
257
+            
258
+            $result = $this->model->getMenu($mcode);
259
+            if (! $result) {
260
+                error('编辑的内容已经不存在!', - 1);
261
+            }
262
+            $this->assign('menu', $result); // 菜单信息
263
+                                            
264
+            // 获取菜单按钮组
265
+            $this->assign('actions', get_type('T101'));
266
+            
267
+            // 菜单下拉列表
268
+            $menus = $this->model->getSelect();
269
+            $this->assign('menu_select', $this->makeMenuSelect($menus, $result->pcode));
270
+            
271
+            // 显示
272
+            $this->display('system/menu.html');
273
+        }
274
+    }
275
+}

+ 249
- 0
apps/admin/controller/system/RoleController.php View File

@@ -0,0 +1,249 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年4月3日
7
+ *  角色控制器
8
+ */
9
+namespace app\admin\controller\system;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\system\RoleModel;
13
+
14
+class RoleController extends Controller
15
+{
16
+
17
+    private $blank;
18
+
19
+    private $model;
20
+
21
+    public function __construct()
22
+    {
23
+        $this->model = new RoleModel();
24
+    }
25
+
26
+    // 角色列表
27
+    public function index()
28
+    {
29
+        $this->assign('list', true);
30
+        $this->assign('roles', $this->model->getList());
31
+        
32
+        // 数据区域选择
33
+        $area_model = model('admin.system.Area');
34
+        $area_tree = $area_model->getSelect();
35
+        $area_checkbox = $this->makeAreaCheckbox($area_tree);
36
+        $this->assign('area_checkbox', $area_checkbox);
37
+        
38
+        // 菜单权限表
39
+        $menu_model = model('admin.system.Menu');
40
+        $menu_level = $menu_model->getMenuLevel();
41
+        $menus = $menu_model->getSelect();
42
+        $menu_list = $this->makeLevelList($menus, $menu_level);
43
+        $this->assign('menu_list', $menu_list);
44
+        
45
+        $this->display('system/role.html');
46
+    }
47
+
48
+    // 角色增加
49
+    public function add()
50
+    {
51
+        if ($_POST) {
52
+            // 获取数据
53
+            $rcode = get_auto_code($this->model->getLastCode()); // 自动编码
54
+            $name = post('name');
55
+            $description = post('description');
56
+            $acodes = post('acodes', 'array', false, '角色数据区域', array()); // 区域
57
+            $levels = post('levels', 'array', false, '角色权限', array()); // 权限
58
+            
59
+            if (! $rcode) {
60
+                alert_back('编码不能为空!');
61
+            }
62
+            
63
+            if (! $name) {
64
+                alert_back('角色名不能为空!');
65
+            }
66
+            
67
+            // 检查编码
68
+            if ($this->model->checkRole("rcode='$rcode'")) {
69
+                alert_back('该角色编号已经存在,不能再使用!');
70
+            }
71
+            
72
+            // 构建数据
73
+            $data = array(
74
+                'rcode' => $rcode,
75
+                'name' => $name,
76
+                'description' => $description,
77
+                'create_user' => session('username'),
78
+                'update_user' => session('username')
79
+            );
80
+            
81
+            // 执行添加
82
+            if ($this->model->addRole($data, $acodes, $levels)) {
83
+                $this->log('修改角色' . $rcode . '成功!');
84
+                if (! ! $backurl = get('backurl')) {
85
+                    success('新增成功!', base64_decode($backurl));
86
+                } else {
87
+                    success('新增成功!', url('admin/Role/index'));
88
+                }
89
+            } else {
90
+                $this->log('修改角色' . $rcode . '失败!');
91
+                error('新增失败!', - 1);
92
+            }
93
+        }
94
+    }
95
+
96
+    // 生成区域选择,无限制
97
+    private function makeAreaCheckbox($tree, $checkeds = array())
98
+    {
99
+        $list_html = '';
100
+        foreach ($tree as $values) {
101
+            if (in_array($values->acode, $checkeds)) {
102
+                $checked = 'checked="checked"';
103
+            } else {
104
+                $checked = '';
105
+            }
106
+            if (! $values->son) { // 没有子类才显示选择框
107
+                $list_html .= "<input type='checkbox' $checked name='acodes[]' value='{$values->acode}' title='{$values->acode}-{$values->name}'>";
108
+            } else {
109
+                $list_html .= $this->makeAreaCheckbox($values->son, $checkeds);
110
+            }
111
+        }
112
+        return $list_html;
113
+    }
114
+
115
+    // 生成无限级菜单权限列表
116
+    private function makeLevelList($menus, $menu_level, $checkeds = array())
117
+    {
118
+        $menu_html = '';
119
+        foreach ($menus as $value) {
120
+            $string = '';
121
+            // 根据是否有子栏目生成图标
122
+            if ($value->son) {
123
+                $ico = "<i class='fa fa-folder-open-o' aria-hidden='true'></i>";
124
+            } else {
125
+                $ico = "<i class='fa fa-folder-o' aria-hidden='true'></i>";
126
+            }
127
+            
128
+            // 选中状态
129
+            if (in_array($value->url, $checkeds)) {
130
+                $checked = 'checked="checked"';
131
+            } else {
132
+                $checked = '';
133
+            }
134
+            
135
+            // 获取模块及控制器路径
136
+            if ($value->url) {
137
+                $pre_url = substr($value->url, 0, get_strpos($value->url, '/', 3) + 1);
138
+            } else {
139
+                error('"' . $value->name . '"菜单地址为空,请核对!');
140
+            }
141
+            
142
+            $string = "<input type='checkbox' $checked class='checkbox' lay-skin='primary'  name='levels[]' value='" . $value->url . "' title='浏览'>";
143
+            $mcode = $value->mcode;
144
+            if (array_key_exists($mcode, $menu_level)) {
145
+                foreach ($menu_level[$mcode] as $key2 => $value2) {
146
+                    $url = $pre_url . $value2->value;
147
+                    if (in_array($url, $checkeds)) {
148
+                        $checked = 'checked="checked"';
149
+                    } else {
150
+                        $checked = '';
151
+                    }
152
+                    $string .= "<input type='checkbox' $checked class='checkbox'lay-skin='primary' name='levels[]' value='$url' title='{$value2->item}'>";
153
+                }
154
+            }
155
+            
156
+            // 生成菜单html
157
+            $menu_html .= "<div class='layui-row'><div class='layui-col-md3 layui-col-lg2' style='margin-top:10px;'>{$this->blank} $ico {$value->name}</div><div class='layui-col-md9'>$string</div></div>";
158
+            
159
+            // 子菜单处理
160
+            if ($value->son) {
161
+                $this->blank .= '  ';
162
+                $menu_html .= $this->makeLevelList($value->son, $menu_level, $checkeds);
163
+            }
164
+        }
165
+        
166
+        // 循环完后回归缩进位置
167
+        $this->blank = substr($this->blank, 0, - 6);
168
+        return $menu_html;
169
+    }
170
+
171
+    // 角色删除
172
+    public function del()
173
+    {
174
+        if (! $rcode = get('rcode', 'var')) {
175
+            error('传递的参数值错误!', - 1);
176
+        }
177
+        if ($this->model->delRole($rcode)) {
178
+            $this->log('删除角色' . $rcode . '成功!');
179
+            success('删除成功!', - 1);
180
+        } else {
181
+            $this->log('删除角色' . $rcode . '失败!');
182
+            error('删除失败!', - 1);
183
+        }
184
+    }
185
+
186
+    // 角色修改
187
+    public function mod()
188
+    {
189
+        if (! $rcode = get('rcode', 'var')) {
190
+            error('传递的参数值错误!', - 1);
191
+        }
192
+        
193
+        // 修改操作
194
+        if ($_POST) {
195
+            // 获取数据
196
+            $name = post('name');
197
+            $description = post('description');
198
+            $acodes = post('acodes', 'array', false, '角色数据区域', array()); // 区域
199
+            $levels = post('levels', 'array', false, '角色权限', array()); // 权限
200
+            
201
+            if (! $name) {
202
+                alert_back('角色名不能为空!');
203
+            }
204
+            
205
+            // 构建数据
206
+            $data = array(
207
+                'name' => $name,
208
+                'description' => $description,
209
+                'update_user' => session('username')
210
+            );
211
+            
212
+            // 执行修改
213
+            if ($this->model->modRole($rcode, $data, $acodes, $levels)) {
214
+                $this->log('修改角色' . $rcode . '成功!');
215
+                if (! ! $backurl = get('backurl')) {
216
+                    success('修改成功!', base64_decode($backurl));
217
+                } else {
218
+                    success('修改成功!', url('admin/Role/index'));
219
+                }
220
+            } else {
221
+                location(- 1);
222
+            }
223
+        } else {
224
+            $this->assign('mod', true);
225
+            
226
+            // 调取修改内容
227
+            $result = $this->model->getRole($rcode);
228
+            if (! $result) {
229
+                error('编辑的内容已经不存在!', - 1);
230
+            }
231
+            $this->assign('role', $result);
232
+            
233
+            // 数据区域选择
234
+            $area_model = model('admin.system.Area');
235
+            $area_tree = $area_model->getSelect();
236
+            $area_checkbox = $this->makeAreaCheckbox($area_tree, $result->acodes);
237
+            $this->assign('area_checkbox', $area_checkbox);
238
+            
239
+            // 菜单权限表
240
+            $menu_model = model('admin.system.Menu');
241
+            $menu_level = $menu_model->getMenuLevel();
242
+            $menus = $menu_model->getSelect();
243
+            $menu_list = $this->makeLevelList($menus, $menu_level, $result->levels);
244
+            $this->assign('menu_list', $menu_list);
245
+            
246
+            $this->display('system/role.html');
247
+        }
248
+    }
249
+}

+ 40
- 0
apps/admin/controller/system/SyslogController.php View File

@@ -0,0 +1,40 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年3月29日
7
+ *  系统日志控制器
8
+ */
9
+namespace app\admin\controller\system;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\system\SyslogModel;
13
+
14
+class SyslogController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new SyslogModel();
22
+    }
23
+
24
+    // 日志列表
25
+    public function index()
26
+    {
27
+        $this->assign('syslogs', $this->model->getList());
28
+        $this->display('system/syslog.html');
29
+    }
30
+
31
+    // 清理日志
32
+    public function clear()
33
+    {
34
+        if ($this->model->clearLog()) {
35
+            alert_location('清空成功!', url('/admin/Syslog/index'));
36
+        } else {
37
+            alert_location('清空失败!', url('/admin/Syslog/index'));
38
+        }
39
+    }
40
+}

+ 172
- 0
apps/admin/controller/system/TypeController.php View File

@@ -0,0 +1,172 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年4月13日
7
+ *  类型控制器
8
+ */
9
+namespace app\admin\controller\system;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\system\TypeModel;
13
+
14
+class TypeController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new TypeModel();
22
+    }
23
+
24
+    // 类型列表
25
+    public function index()
26
+    {
27
+        $this->assign('list', true);
28
+        if (! ! ($field = get('field', 'var')) && ! ! ($keyword = get('keyword', 'vars'))) {
29
+            $result = $this->model->findType($field, $keyword);
30
+        } else {
31
+            $result = $this->model->getList();
32
+        }
33
+        
34
+        $this->assign('types', $result);
35
+        
36
+        // 类型选择
37
+        $this->assign('type_select', $this->model->getSelect());
38
+        
39
+        $this->display('system/type.html');
40
+    }
41
+
42
+    // 类型增加
43
+    public function add()
44
+    {
45
+        if ($_POST) {
46
+            // 获取数据
47
+            $tcode = post('tcode', 'var');
48
+            $name = post('name');
49
+            $item = post('item');
50
+            $value = post('value', 'var');
51
+            $sorting = post('sorting', 'int');
52
+            
53
+            if (! $tcode) {
54
+                $tcode = get_auto_code($this->model->getLastCode()); // 自动编码
55
+            }
56
+            
57
+            if (! $name) {
58
+                alert_back('类型名不能为空!');
59
+            }
60
+            
61
+            if (! $item) {
62
+                alert_back('类型项名称不能为空!');
63
+            }
64
+            
65
+            if (is_null($value)) {
66
+                alert_back('类型项值不能为空!');
67
+            }
68
+            
69
+            // 构建数据
70
+            $data = array(
71
+                'tcode' => $tcode,
72
+                'name' => $name,
73
+                'item' => $item,
74
+                'value' => $value,
75
+                'sorting' => $sorting,
76
+                'create_user' => session('username'),
77
+                'update_user' => session('username')
78
+            );
79
+            
80
+            // 执行添加
81
+            if ($this->model->addType($data)) {
82
+                $this->log('新增类型' . $tcode . '-' . $item . '成功!');
83
+                if (! ! $backurl = get('backurl')) {
84
+                    success('新增成功!', base64_decode($backurl));
85
+                } else {
86
+                    success('新增成功!', url('/admin/Type/index'));
87
+                }
88
+            } else {
89
+                $this->log('新增类型' . $tcode . '-' . $item . '失败!');
90
+                error('新增失败!', - 1);
91
+            }
92
+        }
93
+    }
94
+
95
+    // 类型删除
96
+    public function del()
97
+    {
98
+        if (! $id = get('id', 'int')) {
99
+            error('传递的参数值错误!', - 1);
100
+        }
101
+        if ($id < 7) {
102
+            alert_back('该类型不允许删除!');
103
+        }
104
+        
105
+        if ($this->model->delType($id)) {
106
+            $this->log('删除类型项' . $id . '成功!');
107
+            success('删除成功!', - 1);
108
+        } else {
109
+            $this->log('删除类型项' . $id . '失败!');
110
+            error('删除失败!', - 1);
111
+        }
112
+    }
113
+
114
+    // 类型修改
115
+    public function mod()
116
+    {
117
+        if (! $id = get('id', 'int')) {
118
+            error('传递的参数值错误!', - 1);
119
+        }
120
+        
121
+        // 修改操作
122
+        if ($_POST) {
123
+            // 获取数据
124
+            $name = post('name');
125
+            $item = post('item');
126
+            $value = post('value', 'var');
127
+            $sorting = post('sorting', 'int');
128
+            
129
+            if (! $name) {
130
+                alert_back('类型名不能为空!');
131
+            }
132
+            
133
+            if (! $item) {
134
+                alert_back('类型项名称不能为空!');
135
+            }
136
+            
137
+            if (is_null($value)) {
138
+                alert_back('类型项值不能为空!');
139
+            }
140
+            
141
+            // 构建数据
142
+            $data = array(
143
+                'name' => $name,
144
+                'item' => $item,
145
+                'value' => $value,
146
+                'sorting' => $sorting,
147
+                'update_user' => session('username')
148
+            );
149
+            
150
+            // 执行添加
151
+            if ($this->model->modType($id, $data)) {
152
+                $this->log('修改类型项' . $id . '成功!');
153
+                if (! ! $backurl = get('backurl')) {
154
+                    success('修改成功!', base64_decode($backurl));
155
+                } else {
156
+                    success('修改成功!', url('/admin/Type/index'));
157
+                }
158
+            } else {
159
+                location(- 1);
160
+            }
161
+        } else {
162
+            // 调取修改内容
163
+            $this->assign('mod', true);
164
+            
165
+            if (! $result = $this->model->getType($id)) {
166
+                error('编辑的内容已经不存在!', - 1);
167
+            }
168
+            $this->assign('type', $result);
169
+            $this->display('system/type.html');
170
+        }
171
+    }
172
+}

+ 408
- 0
apps/admin/controller/system/UpgradeController.php View File

@@ -0,0 +1,408 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年8月14日
7
+ *  在线更新
8
+ */
9
+namespace app\admin\controller\system;
10
+
11
+use core\basic\Controller;
12
+use core\basic\Model;
13
+
14
+class UpgradeController extends Controller
15
+{
16
+
17
+    // 服务器地址
18
+    private $server = 'https://www.pbootcms.com';
19
+
20
+    // 更新分支
21
+    private $branch;
22
+
23
+    // 强制同步文件
24
+    private $force;
25
+
26
+    // 修改版本
27
+    private $revise;
28
+
29
+    // 文件列表
30
+    public $files = array();
31
+
32
+    public function __construct()
33
+    {
34
+        error_reporting(0);
35
+        $this->branch = $this->config('upgrade_branch') == '3.X.dev' ? '3.X.dev' : '3.X';
36
+        $this->force = $this->config('upgrade_force') ?: 0;
37
+        $this->revise = $this->config('revise_version') ?: 0;
38
+    }
39
+
40
+    public function index()
41
+    {
42
+        switch (get('action')) {
43
+            case 'local':
44
+                $upfile = $this->local();
45
+                break;
46
+            default:
47
+                $upfile = array();
48
+        }
49
+        $this->assign('upfile', $upfile);
50
+        $this->assign('branch', $this->branch);
51
+        $this->assign('force', $this->force);
52
+        $this->assign('revise', $this->revise);
53
+        $this->assign('snuser', $this->config('sn_user') ?: 0);
54
+        $this->assign('site', get_http_url());
55
+        $this->display('system/upgrade.html');
56
+    }
57
+
58
+    public function checkCache(){
59
+        $now = time();
60
+        $cache = $_SESSION['check_cache'];
61
+        if(!$cache){
62
+            $_SESSION['check_cache'] = time();
63
+            json(1,'');
64
+        }else{
65
+            $sub = $now - $cache;
66
+            if($sub > 3600){
67
+                $_SESSION['check_cache'] = time();
68
+                json(1,'');
69
+            }else{
70
+                json(0,'');
71
+            }
72
+        }
73
+    }
74
+
75
+    // 检查更新
76
+    public function check()
77
+    {
78
+        // 清理目录,检查下载目录及备份目录
79
+        path_delete(RUN_PATH . '/upgrade', true);
80
+        if (! check_dir(RUN_PATH . '/upgrade', true)) {
81
+            json(0, '目录写入权限不足,无法正常升级!' . RUN_PATH . '/upgrade');
82
+        }
83
+        check_dir(DOC_PATH . STATIC_DIR . '/backup/upgrade', true);
84
+        
85
+        $files = $this->getServerList();
86
+        $db = get_db_type();
87
+        foreach ($files as $key => $value) {
88
+            // 过滤掉相对路径
89
+            $value->path = preg_replace_r('{\.\.(\/|\\\\)}', '', $value->path);
90
+            $file = ROOT_PATH . $value->path;
91
+            if (@md5_file($file) != $value->md5) {
92
+                // 筛选数据库更新脚本
93
+                if (preg_match('/([\w]+)-([\w\.]+)-update\.sql/i', $file, $matches)) {
94
+                    if ($matches[1] != $db || ! $this->compareVersion($matches[2], APP_VERSION . '.' . RELEASE_TIME . '.' . $this->revise)) {
95
+                        continue;
96
+                    }
97
+                }
98
+                if (file_exists($file)) {
99
+                    $files[$key]->type = '<span style="color:Red">覆盖</span>';
100
+                    $files[$key]->ltime = date('Y-m-d H:i:s', filemtime($file));
101
+                } else {
102
+                    $files[$key]->type = '新增';
103
+                    $files[$key]->ltime = '无';
104
+                }
105
+                $files[$key]->ctime = date('Y-m-d H:i:s', $files[$key]->ctime);
106
+                $upfile[] = $files[$key];
107
+            }
108
+        }
109
+        if (! $upfile) {
110
+            json(1, '您的系统无任何文件需要更新!');
111
+        } else {
112
+            json(1, $upfile);
113
+        }
114
+    }
115
+
116
+    // 执行下载
117
+    public function down()
118
+    {
119
+        if (! ! $list = get('list')) {
120
+            if (! is_array($list)) { // 单个文件转换为数组
121
+                $list = array(
122
+                    $list
123
+                );
124
+            }
125
+            $len = count($list) ?: 0;
126
+            foreach ($list as $value) {
127
+                // 过滤掉相对路径
128
+                $value = preg_replace_r('{\.\.(\/|\\\\)}', '', $value);
129
+                // 本地存储路径
130
+                $path = RUN_PATH . '/upgrade' . $value;
131
+                // 自动创建目录
132
+                if (! check_dir(dirname($path), true)) {
133
+                    json(0, '目录写入权限不足,无法下载升级文件!' . dirname($path));
134
+                }
135
+                
136
+                // 定义执行下载的类型
137
+                $types = '.zip|.rar|.doc|.docx|.ppt|.pptx|.xls|.xlsx|.chm|.ttf|.otf|';
138
+                $pathinfo = explode(".", basename($path));
139
+                $ext = end($pathinfo); // 获取扩展
140
+                if (preg_match('/\.' . $ext . '\|/i', $types)) {
141
+                    $result = $this->getServerDown('/release/' . $this->branch . $value, $path);
142
+                } else {
143
+                    $result = $this->getServerFile($value, $path);
144
+                }
145
+            }
146
+            if ($len == 1) {
147
+                json(1, "更新文件 " . basename($value) . " 下载成功!");
148
+            } else {
149
+                json(1, "更新文件" . basename($value) . "等文件全部下载成功!");
150
+            }
151
+        } else {
152
+            json(0, '请选择要下载的文件!');
153
+        }
154
+    }
155
+
156
+    // 执行更新
157
+    public function update()
158
+    {
159
+        if ($_POST) {
160
+            if (! ! $list = post('list')) {
161
+                $list = explode(',', $list);
162
+                $backdir = date('YmdHis');
163
+                
164
+                // 分离文件
165
+                foreach ($list as $value) {
166
+                    // 过滤掉相对路径
167
+                    $value = preg_replace_r('{\.\.(\/|\\\\)}', '', $value);
168
+                    
169
+                    if (stripos($value, '/script/') === 0 && preg_match('/\.sql$/i', $value)) {
170
+                        $sqls[] = $value;
171
+                    } else {
172
+                        $path = RUN_PATH . '/upgrade' . $value;
173
+                        $des_path = ROOT_PATH . $value;
174
+                        $back_path = DOC_PATH . STATIC_DIR . '/backup/upgrade/' . $backdir . $value;
175
+                        if (! check_dir(dirname($des_path), true)) {
176
+                            json(0, '目录写入权限不足,无法正常升级!' . dirname($des_path));
177
+                        }
178
+                        if (file_exists($des_path)) { // 文件存在时执行备份
179
+                            check_dir(dirname($back_path), true);
180
+                            copy($des_path, $back_path);
181
+                        }
182
+                        
183
+                        // 如果后台入口文件修改过名字,则自动适配
184
+                        if (stripos($path, 'admin.php') !== false && stripos($_SERVER['SCRIPT_FILENAME'], 'admin.php') === false) {
185
+                            if (file_exists($_SERVER['SCRIPT_FILENAME'])) {
186
+                                $des_path = $_SERVER['SCRIPT_FILENAME'];
187
+                            }
188
+                        }
189
+                        
190
+                        $files[] = array(
191
+                            'sfile' => $path,
192
+                            'dfile' => $des_path
193
+                        );
194
+                    }
195
+                }
196
+                
197
+                // 更新数据库
198
+                if (isset($sqls)) {
199
+                    $db = new DatabaseController();
200
+                    switch (get_db_type()) {
201
+                        case 'sqlite':
202
+                            copy(DOC_PATH . $this->config('database.dbname'), DOC_PATH . STATIC_DIR . '/backup/sql/' . date('YmdHis') . '_' . basename($this->config('database.dbname')));
203
+                            break;
204
+                        case 'mysql':
205
+                            $db->backupDB();
206
+                            break;
207
+                    }
208
+                    sort($sqls); // 排序
209
+                    foreach ($sqls as $value) {
210
+                        $path = RUN_PATH . '/upgrade' . $value;
211
+                        if (file_exists($path)) {
212
+                            $sql = file_get_contents($path);
213
+                            if (! $this->upsql($sql)) {
214
+                                $this->log("数据库 $value 更新失败!");
215
+                                json(0, "数据库" . basename($value) . " 更新失败!");
216
+                            }
217
+                        } else {
218
+                            json(0, "数据库文件" . basename($value) . "不存在!");
219
+                        }
220
+                    }
221
+                }
222
+                
223
+                // 替换文件
224
+                if (isset($files)) {
225
+                    foreach ($files as $value) {
226
+                        if (! copy($value['sfile'], $value['dfile'])) {
227
+                            $this->log("文件 " . $value['dfile'] . " 更新失败!");
228
+                            json(0, "文件 " . basename($value['dfile']) . " 更新失败,请重试!");
229
+                        }
230
+                    }
231
+                }
232
+                
233
+                // 清理缓存
234
+                path_delete(RUN_PATH . '/upgrade', true);
235
+                path_delete(RUN_PATH . '/cache');
236
+                path_delete(RUN_PATH . '/complite');
237
+                path_delete(RUN_PATH . '/config');
238
+                
239
+                $this->log("系统更新成功!");
240
+                json(1, '系统更新成功!');
241
+            } else {
242
+                json(0, '请选择要更新的文件!');
243
+            }
244
+        }
245
+    }
246
+
247
+    // 缓存文件
248
+    private function local()
249
+    {
250
+        $files = $this->getLoaclList(RUN_PATH . '/upgrade');
251
+        $files = json_decode(json_encode($files));
252
+        foreach ($files as $key => $value) {
253
+            $file = ROOT_PATH . $value->path;
254
+            if (file_exists($file)) {
255
+                $files[$key]->type = '<span style="color:Red">覆盖</span>';
256
+                $files[$key]->ltime = date('Y-m-d H:i:s', filemtime($file));
257
+            } else {
258
+                $files[$key]->type = '新增';
259
+                $files[$key]->ltime = '无';
260
+            }
261
+            $files[$key]->ctime = date('Y-m-d H:i:s', $files[$key]->ctime);
262
+            $upfile[] = $files[$key];
263
+        }
264
+        return $upfile;
265
+    }
266
+
267
+    // 执行更新数据库
268
+    private function upsql($sql)
269
+    {
270
+        $sql = explode(';', $sql);
271
+        $model = new Model();
272
+        foreach ($sql as $value) {
273
+            $value = trim($value);
274
+            if ($value) {
275
+                $model->amd($value);
276
+            }
277
+        }
278
+        return true;
279
+    }
280
+
281
+    // 获取列表
282
+    private function getServerList()
283
+    {
284
+        $param = array(
285
+            'version' => APP_VERSION . '.' . RELEASE_TIME . '.' . $this->revise,
286
+            'branch' => $this->branch,
287
+            'force' => $this->force,
288
+            'site' => get_http_url(),
289
+            'snuser' => $this->config('sn_user')
290
+        );
291
+        $url = $this->server . '/index.php?p=/upgrade/getlist&' . http_build_query($param);
292
+        if (! ! $rs = json_decode(get_url($url, '', '', true))) {
293
+            if ($rs->code) {
294
+                if (is_array($rs->data)) {
295
+                    return $rs->data;
296
+                } else {
297
+                    json(1, $rs->data);
298
+                }
299
+            } else {
300
+                json(0, $rs->data);
301
+            }
302
+        } else {
303
+            $this->log('连接更新服务器发生错误,请稍后再试!');
304
+            json(0, '连接更新服务器发生错误,请稍后再试!');
305
+        }
306
+    }
307
+
308
+    // 获取文件
309
+    private function getServerFile($source, $des)
310
+    {
311
+        $url = $this->server . '/index.php?p=/upgrade/getFile&branch=' . $this->branch;
312
+        $data['path'] = $source;
313
+        $file = basename($source);
314
+        if (! ! $rs = json_decode(get_url($url, $data, '', true))) {
315
+            if ($rs->code) {
316
+                if (! file_put_contents($des, base64_decode($rs->data))) {
317
+                    $this->log("更新文件  " . $file . " 下载失败!");
318
+                    json(0, "更新文件 " . $file . " 下载失败!");
319
+                } else {
320
+                    return true;
321
+                }
322
+            } else {
323
+                json(0, $rs->data);
324
+            }
325
+        } else {
326
+            $this->log("更新文件 " . $file . " 获取失败!");
327
+            json(0, "更新文件 " . $file . " 获取失败!");
328
+        }
329
+    }
330
+
331
+    // 获取非文本文件
332
+    private function getServerDown($source, $des)
333
+    {
334
+        $url = $this->server . $source;
335
+        $file = basename($source);
336
+        if (($sfile = fopen($url, "rb")) && ($dfile = fopen($des, "wb"))) {
337
+            while (! feof($sfile)) {
338
+                $fwrite = fwrite($dfile, fread($sfile, 1024 * 8), 1024 * 8);
339
+                if ($fwrite === false) {
340
+                    $this->log("更新文件 " . $file . " 下载失败!");
341
+                    json(0, "更新文件 " . $file . " 下载失败!");
342
+                }
343
+            }
344
+            if ($sfile) {
345
+                fclose($sfile);
346
+            }
347
+            if ($dfile) {
348
+                fclose($dfile);
349
+            }
350
+            return true;
351
+        } else {
352
+            $this->log("更新文件 " . $file . " 获取失败!");
353
+            json(0, "更新文件 " . $file . " 获取失败!");
354
+        }
355
+    }
356
+
357
+    // 获取文件列表
358
+    private function getLoaclList($path)
359
+    {
360
+        $files = scandir($path);
361
+        foreach ($files as $value) {
362
+            if ($value != '.' && $value != '..') {
363
+                if (is_dir($path . '/' . $value)) {
364
+                    $this->getLoaclList($path . '/' . $value);
365
+                } else {
366
+                    $file = $path . '/' . $value;
367
+                    
368
+                    // 避免中文乱码
369
+                    if (! mb_check_encoding($file, 'utf-8')) {
370
+                        $out_path = mb_convert_encoding($file, 'UTF-8', 'GBK');
371
+                    } else {
372
+                        $out_path = $file;
373
+                    }
374
+                    
375
+                    $out_path = str_replace(RUN_PATH . '/upgrade', '', $out_path);
376
+                    
377
+                    $this->files[] = array(
378
+                        'path' => $out_path,
379
+                        'md5' => md5_file($file),
380
+                        'ctime' => filemtime($file)
381
+                    );
382
+                }
383
+            }
384
+        }
385
+        return $this->files;
386
+    }
387
+
388
+    // 比较程序本号
389
+    private function compareVersion($sv, $cv)
390
+    {
391
+        if (empty($sv) || $sv == $cv) {
392
+            return 0;
393
+        }
394
+        $sv = explode('.', $sv);
395
+        $cv = explode('.', $cv);
396
+        $len = count($sv) > count($cv) ? count($sv) : count($cv);
397
+        for ($i = 0; $i < $len; $i ++) {
398
+            $n1 = $sv[$i] or 0;
399
+            $n2 = $cv[$i] or 0;
400
+            if ($n1 > $n2) {
401
+                return 1;
402
+            } elseif ($n1 < $n2) {
403
+                return 0;
404
+            }
405
+        }
406
+        return 0;
407
+    }
408
+}

+ 227
- 0
apps/admin/controller/system/UserController.php View File

@@ -0,0 +1,227 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年4月3日
7
+ *  用户控制器
8
+ */
9
+namespace app\admin\controller\system;
10
+
11
+use core\basic\Controller;
12
+use app\admin\model\system\UserModel;
13
+
14
+class UserController extends Controller
15
+{
16
+
17
+    private $model;
18
+
19
+    public function __construct()
20
+    {
21
+        $this->model = new UserModel();
22
+    }
23
+
24
+    // 用户列表
25
+    public function index()
26
+    {
27
+        $this->assign('list', true);
28
+        if ((! ! $field = get('field', 'var')) && (! ! $keyword = get('keyword', 'vars'))) {
29
+            $result = $this->model->findUser($field, $keyword);
30
+        } else {
31
+            $result = $this->model->getList();
32
+        }
33
+        $this->assign('users', $result);
34
+        // 角色列表
35
+        $role_model = model('admin.system.Role');
36
+        $this->assign('roles', $role_model->getSelect());
37
+        
38
+        $this->display('system/user.html');
39
+    }
40
+
41
+    // 用户新增
42
+    public function add()
43
+    {
44
+        if ($_POST) {
45
+            // 获取数据
46
+            $ucode = get_auto_code($this->model->getLastCode());
47
+            $username = post('username');
48
+            $realname = post('realname');
49
+            $password = post('password');
50
+            $rpassword = post('rpassword');
51
+            $status = post('status', 'int');
52
+            $roles = post('roles', 'array', true, '用户角色', array()); // 用户角色
53
+            
54
+            if (! $ucode) {
55
+                alert_back('编码不能为空!');
56
+            }
57
+            if (! $username) {
58
+                alert_back('用户名不能为空!');
59
+            }
60
+            if (! $realname) {
61
+                alert_back('真实名字不能为空!');
62
+            }
63
+            if (! $password) {
64
+                alert_back('密码不能为空!');
65
+            }
66
+            if (! $rpassword) {
67
+                alert_back('确认密码不能为空!');
68
+            }
69
+            if ($password != $rpassword) {
70
+                alert_back('确认密码不正确!');
71
+            }
72
+            
73
+            if (! preg_match('/^[\x{4e00}-\x{9fa5}\w\-\.@]+$/u', $username)) {
74
+                alert_back('用户名含有不允许的特殊字符!');
75
+            }
76
+            
77
+            // 检查编码重复
78
+            if ($this->model->checkUser("ucode='$ucode'")) {
79
+                alert_back('该用户编号已经存在,不能再使用!');
80
+            }
81
+            
82
+            // 检查用户名重复
83
+            if ($this->model->checkUser("username='$username'")) {
84
+                alert_back('该用户名已经存在,不能再使用!');
85
+            }
86
+            
87
+            // 构建数据
88
+            $data = array(
89
+                'ucode' => $ucode,
90
+                'username' => $username,
91
+                'realname' => $realname,
92
+                'password' => encrypt_string($password),
93
+                'status' => $status,
94
+                'login_count' => 0,
95
+                'last_login_ip' => 0,
96
+                'create_user' => session('username'),
97
+                'update_user' => session('username'),
98
+                'create_time' => get_datetime(),
99
+                'update_time' => '0000-00-00 00:00:00'
100
+            );
101
+            
102
+            // 执行添加
103
+            if ($this->model->addUser($data, $roles)) {
104
+                $this->log('新增用户' . $ucode . '成功!');
105
+                if (! ! $backurl = get('backurl')) {
106
+                    success('新增成功!', base64_decode($backurl));
107
+                } else {
108
+                    success('新增成功!', url('/admin/User/index'));
109
+                }
110
+            } else {
111
+                $this->log('新增用户' . $ucode . '失败!');
112
+                error('新增失败', - 1);
113
+            }
114
+        }
115
+    }
116
+
117
+    // 用户删除
118
+    public function del()
119
+    {
120
+        if (! $ucode = get('ucode', 'var')) {
121
+            error('传递的参数值错误!', - 1);
122
+        }
123
+        
124
+        if ($ucode == '10001') {
125
+            error('内置管理员不允许删除!', - 1);
126
+        }
127
+        
128
+        if ($this->model->delUser($ucode)) {
129
+            $this->log('删除用户' . $ucode . '成功!');
130
+            success('删除成功!', - 1);
131
+        } else {
132
+            $this->log('删除用户' . $ucode . '失败!');
133
+            error('删除失败', - 1);
134
+        }
135
+    }
136
+
137
+    // 用户修改
138
+    public function mod()
139
+    {
140
+        if (! $ucode = get('ucode', 'var')) {
141
+            error('传递的参数值错误!', - 1);
142
+        }
143
+        
144
+        if ($ucode == '10001') {
145
+            error('内置管理员不允许此操作!', - 1);
146
+        }
147
+        
148
+        // 单独修改状态
149
+        if (($field = get('field', 'var')) && ! is_null($value = get('value', 'var'))) {
150
+            if ($this->model->modUser($ucode, "$field='$value',update_user='" . session('username') . "'")) {
151
+                location(- 1);
152
+            } else {
153
+                alert_back('修改失败!');
154
+            }
155
+        }
156
+        
157
+        // 修改操作
158
+        if ($_POST) {
159
+            // 获取数据
160
+            $username = post('username');
161
+            $realname = post('realname');
162
+            $password = post('password');
163
+            $rpassword = post('rpassword');
164
+            $status = post('status', 'int');
165
+            $roles = post('roles', 'array', true, '用户角色', array()); // 用户角色
166
+            
167
+            if (! $username) {
168
+                alert_back('用户名不能为空!');
169
+            }
170
+            if (! $realname) {
171
+                alert_back('真实名字不能为空!');
172
+            }
173
+            
174
+            if (! preg_match('/^[\x{4e00}-\x{9fa5}\w\-\.@]+$/u', $username)) {
175
+                alert_back('用户名含有不允许的特殊字符!');
176
+            }
177
+            
178
+            // 检查用户名重复
179
+            if ($this->model->checkUser("username='$username' AND ucode<>'$ucode'")) {
180
+                alert_back('该用户名已经存在,不能再使用!');
181
+            }
182
+            
183
+            // 构建数据
184
+            $data = array(
185
+                'username' => $username,
186
+                'realname' => $realname,
187
+                'status' => $status,
188
+                'update_user' => session('username')
189
+            );
190
+            
191
+            if ($password) {
192
+                if (! $rpassword) {
193
+                    alert_back('确认密码不能为空!');
194
+                }
195
+                if ($password != $rpassword) {
196
+                    alert_back('确认密码不正确!');
197
+                }
198
+                $data['password'] = encrypt_string($password);
199
+            }
200
+            
201
+            // 执行添加
202
+            if ($this->model->modUser($ucode, $data, $roles)) {
203
+                $this->log('修改用户' . $ucode . '成功!');
204
+                if (! ! $backurl = get('backurl')) {
205
+                    success('修改成功!', base64_decode($backurl));
206
+                } else {
207
+                    success('修改成功!', url('/admin/User/index'));
208
+                }
209
+            } else {
210
+                location(- 1);
211
+            }
212
+        } else { // 调取修改内容
213
+            $this->assign('mod', true);
214
+            
215
+            $result = $this->model->getUser($ucode);
216
+            if (! $result) {
217
+                error('编辑的内容已经不存在!', - 1);
218
+            }
219
+            $this->assign('user', $result);
220
+            
221
+            // 角色列表
222
+            $role_model = model('admin.system.Role');
223
+            $this->assign('roles', $role_model->getSelect());
224
+            $this->display('system/user.html');
225
+        }
226
+    }
227
+}

+ 225
- 0
apps/admin/model/IndexModel.php View File

@@ -0,0 +1,225 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年3月13日
7
+ *  首页模型类
8
+ */
9
+namespace app\admin\model;
10
+
11
+use core\basic\Model;
12
+
13
+class IndexModel extends Model
14
+{
15
+
16
+    // 检查用户账号密码
17
+    public function login($where)
18
+    {
19
+        // 执行登录
20
+        $result = parent::table('ay_user')->field('id,ucode,username,realname')
21
+            ->where($where)
22
+            ->where('status=1')
23
+            ->find();
24
+        
25
+        if ($result) { // 登录成功
26
+            $this->updateLogin($where); // 执行更新登录记录
27
+            $menus = $this->getUserMenu($result->ucode); // 用户菜单
28
+            $result->menus = get_tree($menus, 0, 'mcode', 'pcode'); // 用户菜单树
29
+            $result->rcodes = $this->getUserRcode($result->ucode); // 用户角色
30
+            $result->levels = $this->getUserLevel($result->ucode); // 用户权限
31
+            
32
+            $acodes = $this->getUserAcode($result->ucode); // 获取用户区域
33
+            $areas = $this->getAreas();
34
+            $first_acode = $areas[0]->acode;
35
+            if (in_array($first_acode, $acodes)) {
36
+                array_unshift($acodes, $first_acode);
37
+                $acodes = array_unique($acodes);
38
+            }
39
+            $result->acodes = $acodes;
40
+            $result->area_map = get_mapping($areas, 'name', 'acode'); // 区域代码名称映射表
41
+            $result->area_tree = $this->getUserAreaTree($areas, 0, 'acode', 'pcode', 'son', $result->acodes); // 当前用户的区域树
42
+            return $result;
43
+        } else {
44
+            return false;
45
+        }
46
+    }
47
+
48
+    // 用户登录成功后更新登录信息
49
+    private function updateLogin($where)
50
+    {
51
+        $data = array(
52
+            'last_login_ip' => ip2long(get_user_ip()),
53
+            'login_count' => '+=1'
54
+        );
55
+        return parent::table('ay_user')->where($where)
56
+            ->autoTime()
57
+            ->update($data);
58
+    }
59
+
60
+    // 获取用户菜单列表
61
+    public function getUserMenu($ucode)
62
+    {
63
+        if ($ucode == '10001') { // 管理员获所有区域
64
+            $field = array(
65
+                'id',
66
+                'mcode',
67
+                'pcode',
68
+                'name',
69
+                'url',
70
+                'shortcut',
71
+                'ico',
72
+                'sorting',
73
+                'status'
74
+            );
75
+            $order = array(
76
+                'sorting',
77
+                'pcode',
78
+                'id'
79
+            );
80
+            $result = parent::table('ay_menu')->distinct()
81
+                ->field($field)
82
+                ->order($order)
83
+                ->select();
84
+        } else {
85
+            $table = array(
86
+                'ay_user',
87
+                'ay_user_role',
88
+                'ay_role',
89
+                'ay_role_level',
90
+                'ay_menu'
91
+            );
92
+            $field = array(
93
+                'ay_menu.id',
94
+                'ay_menu.mcode',
95
+                'ay_menu.pcode',
96
+                'ay_menu.name',
97
+                'ay_menu.url',
98
+                'ay_menu.shortcut',
99
+                'ay_menu.ico',
100
+                'ay_menu.sorting',
101
+                'ay_menu.status'
102
+            );
103
+            $where = array(
104
+                "ay_user.ucode='$ucode'",
105
+                "ay_user.ucode=ay_user_role.ucode",
106
+                "ay_role.rcode=ay_user_role.rcode",
107
+                "ay_role.rcode=ay_role_level.rcode",
108
+                "ay_menu.url=ay_role_level.level"
109
+            );
110
+            $order = array(
111
+                'ay_menu.sorting',
112
+                'ay_menu.pcode',
113
+                'ay_menu.id'
114
+            );
115
+            $result = parent::table($table)->distinct()
116
+                ->field($field)
117
+                ->where($where)
118
+                ->order($order)
119
+                ->select();
120
+        }
121
+        return $result;
122
+    }
123
+
124
+    // 获取用户的角色代码
125
+    public function getUserRcode($ucode)
126
+    {
127
+        return parent::table('ay_user_role')->where("ucode='$ucode'")->column('rcode');
128
+    }
129
+
130
+    // 获取用户权限列表
131
+    public function getUserLevel($ucode)
132
+    {
133
+        $table = array(
134
+            'ay_user',
135
+            'ay_user_role',
136
+            'ay_role',
137
+            'ay_role_level'
138
+        );
139
+        $where = array(
140
+            "ay_user.ucode='$ucode'",
141
+            "ay_user.ucode=ay_user_role.ucode",
142
+            "ay_role.rcode=ay_user_role.rcode",
143
+            "ay_role.rcode=ay_role_level.rcode"
144
+        );
145
+        return parent::table($table)->distinct()
146
+            ->where($where)
147
+            ->column('ay_role_level.level');
148
+    }
149
+
150
+    // 获取用户可管理的区域代码
151
+    public function getUserAcode($ucode)
152
+    {
153
+        if ($ucode == '10001') { // 管理员获所有区域
154
+            $result = parent::table('ay_area')->distinct()->column('acode');
155
+        } else {
156
+            $table = array(
157
+                'ay_user',
158
+                'ay_user_role',
159
+                'ay_role',
160
+                'ay_role_area',
161
+                'ay_area'
162
+            );
163
+            $where = array(
164
+                "ay_user.ucode = '$ucode'",
165
+                "ay_user.ucode=ay_user_role.ucode",
166
+                "ay_role.rcode=ay_user_role.rcode",
167
+                "ay_role.rcode=ay_role_area.rcode",
168
+                "ay_area.acode=ay_role_area.acode"
169
+            );
170
+            $result = parent::table($table)->distinct()
171
+                ->where($where)
172
+                ->column('ay_area.acode');
173
+        }
174
+        return $result;
175
+    }
176
+
177
+    // 获取区域列表
178
+    public function getAreas()
179
+    {
180
+        $result = parent::table('ay_area')->field('pcode,acode,name,is_default')
181
+            ->order('is_default DESC,pcode,acode')
182
+            ->select();
183
+        return $result;
184
+    }
185
+
186
+    // 生成授权的区域树
187
+    public function getUserAreaTree($data, $tid, $idField, $pidField, $sonName = 'son', $valid = array())
188
+    {
189
+        $tree = array();
190
+        foreach ($data as $key => $value) {
191
+            if ($value->$pidField == "$tid") { // 父亲找到儿子
192
+                $value->$sonName = $this->getUserAreaTree($data, $value->$idField, $idField, $pidField, $sonName, $valid);
193
+                if ($value->$sonName) {
194
+                    $tree[] = $value;
195
+                } elseif (in_array($value->$idField, $valid)) {
196
+                    $tree[] = $value;
197
+                }
198
+            }
199
+        }
200
+        return $tree;
201
+    }
202
+
203
+    // 检查当前用户密码
204
+    public function checkUserPwd($password)
205
+    {
206
+        return parent::table('ay_user')->field('id')
207
+            ->where("id=" . session('id') . " AND password='$password'")
208
+            ->find();
209
+    }
210
+
211
+    // 修改当前用户信息
212
+    public function modUserInfo($data)
213
+    {
214
+        return parent::table('ay_user')->where("id=" . session('id'))->update($data);
215
+    }
216
+
217
+    // 获取用户信息
218
+    public function getUserInfo($ucode)
219
+    {
220
+        $result = parent::table('ay_user')->field('id,ucode,username,realname,last_login_ip,update_time,login_count')
221
+            ->where("ucode='$ucode'")
222
+            ->find();
223
+        return $result;
224
+    }
225
+}

+ 44
- 0
apps/admin/model/content/CompanyModel.php View File

@@ -0,0 +1,44 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年3月24日
7
+ *  公司信息模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class CompanyModel extends Model
14
+{
15
+
16
+    // 获取公司信息
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_company')->where("acode='" . session('acode') . "'")->find();
20
+    }
21
+
22
+    // 检查公司信息
23
+    public function checkCompany()
24
+    {
25
+        return parent::table('ay_company')->where("acode='" . session('acode') . "'")->find();
26
+    }
27
+
28
+    // 增加公司信息
29
+    public function addCompany($data)
30
+    {
31
+        return parent::table('ay_company')->insert($data);
32
+    }
33
+
34
+    // 修改公司信息
35
+    public function modCompany($data)
36
+    {
37
+        return parent::table('ay_company')->where("acode='" . session('acode') . "'")->update($data);
38
+    }
39
+
40
+    public function getImage()
41
+    {
42
+        return parent::table('ay_company')->column('weixin');
43
+    }
44
+}

+ 346
- 0
apps/admin/model/content/ContentModel.php View File

@@ -0,0 +1,346 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年12月15日
7
+ *  列表文章模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Db;
12
+use core\basic\Model;
13
+
14
+class ContentModel extends Model
15
+{
16
+
17
+    protected $scodes = array();
18
+
19
+    // 获取文章列表
20
+    public function getList($mcode, $where = array())
21
+    {
22
+        $field = array(
23
+            'a.id',
24
+            'b.name as sortname',
25
+            'a.scode',
26
+            'c.name as subsortname',
27
+            'a.subscode',
28
+            'a.title',
29
+            'a.subtitle',
30
+            'a.date',
31
+            'a.sorting',
32
+            'a.status',
33
+            'a.istop',
34
+            'a.isrecommend',
35
+            'a.isheadline',
36
+            'a.visits',
37
+            'a.ico',
38
+            'a.pics',
39
+            'a.filename',
40
+            'a.outlink',
41
+            'd.urlname',
42
+            'b.filename as sortfilename'
43
+        );
44
+        $join = array(
45
+            array(
46
+                'ay_content_sort b',
47
+                'a.scode=b.scode',
48
+                'LEFT'
49
+            ),
50
+            array(
51
+                'ay_content_sort c',
52
+                'a.subscode=c.scode',
53
+                'LEFT'
54
+            ),
55
+            array(
56
+                'ay_model d',
57
+                'b.mcode=d.mcode',
58
+                'LEFT'
59
+            )
60
+        );
61
+        return parent::table('ay_content a')->field($field)
62
+            ->where("b.mcode='$mcode'")
63
+            ->where('d.type=2 OR d.type is null ')
64
+            ->where("a.acode='" . session('acode') . "'")
65
+            ->where($where)
66
+            ->join($join)
67
+            ->order('a.sorting ASC,a.id DESC')
68
+            ->page()
69
+            ->select();
70
+    }
71
+
72
+    // 查找指定分类及子类文章
73
+    public function findContent($mcode, $scode, $keyword)
74
+    {
75
+        $fields = array(
76
+            'a.id',
77
+            'b.name as sortname',
78
+            'a.scode',
79
+            'c.name as subsortname',
80
+            'a.subscode',
81
+            'a.title',
82
+            'a.subtitle',
83
+            'a.date',
84
+            'a.sorting',
85
+            'a.status',
86
+            'a.istop',
87
+            'a.isrecommend',
88
+            'a.isheadline',
89
+            'a.visits',
90
+            'a.ico',
91
+            'a.pics',
92
+            'a.filename',
93
+            'a.outlink',
94
+            'd.urlname',
95
+            'b.filename as sortfilename'
96
+        );
97
+        $join = array(
98
+            array(
99
+                'ay_content_sort b',
100
+                'a.scode=b.scode',
101
+                'LEFT'
102
+            ),
103
+            array(
104
+                'ay_content_sort c',
105
+                'a.subscode=c.scode',
106
+                'LEFT'
107
+            ),
108
+            array(
109
+                'ay_model d',
110
+                'b.mcode=d.mcode',
111
+                'LEFT'
112
+            )
113
+        );
114
+        $this->scodes = array(); // 先清空
115
+        $scodes = $this->getSubScodes($scode);
116
+        return parent::table('ay_content a')->field($fields)
117
+            ->where("b.mcode='$mcode'")
118
+            ->where('d.type=2 OR d.type is null ')
119
+            ->where("a.acode='" . session('acode') . "'")
120
+            ->in('a.scode', $scodes)
121
+            ->like('a.title', $keyword)
122
+            ->join($join)
123
+            ->order('a.sorting ASC,a.id DESC')
124
+            ->page()
125
+            ->select();
126
+    }
127
+
128
+    // 在全部栏目查找文章
129
+    public function findContentAll($mcode, $keyword)
130
+    {
131
+        $fields = array(
132
+            'a.id',
133
+            'b.name as sortname',
134
+            'a.scode',
135
+            'c.name as subsortname',
136
+            'a.subscode',
137
+            'a.title',
138
+            'a.subtitle',
139
+            'a.date',
140
+            'a.sorting',
141
+            'a.status',
142
+            'a.istop',
143
+            'a.isrecommend',
144
+            'a.isheadline',
145
+            'a.visits',
146
+            'a.ico',
147
+            'a.pics',
148
+            'a.filename',
149
+            'a.outlink',
150
+            'd.urlname',
151
+            'b.filename as sortfilename'
152
+        );
153
+        $join = array(
154
+            array(
155
+                'ay_content_sort b',
156
+                'a.scode=b.scode',
157
+                'LEFT'
158
+            ),
159
+            array(
160
+                'ay_content_sort c',
161
+                'a.subscode=c.scode',
162
+                'LEFT'
163
+            ),
164
+            array(
165
+                'ay_model d',
166
+                'b.mcode=d.mcode',
167
+                'LEFT'
168
+            )
169
+        );
170
+        return parent::table('ay_content a')->field($fields)
171
+            ->where("b.mcode='$mcode'")
172
+            ->where('d.type=2 OR d.type is null ')
173
+            ->where("a.acode='" . session('acode') . "'")
174
+            ->like('a.title', $keyword)
175
+            ->join($join)
176
+            ->order('a.sorting ASC,a.id DESC')
177
+            ->page()
178
+            ->select();
179
+    }
180
+
181
+    // 获取子栏目
182
+    public function getSubScodes($scode)
183
+    {
184
+        if (! $scode) {
185
+            return;
186
+        }
187
+        $this->scodes[] = $scode;
188
+        $subs = parent::table('ay_content_sort')->where("pcode='$scode'")->column('scode');
189
+        if ($subs) {
190
+            foreach ($subs as $value) {
191
+                $this->getSubScodes($value);
192
+            }
193
+        }
194
+        return $this->scodes;
195
+    }
196
+
197
+    // 检查文章
198
+    public function checkContent($where)
199
+    {
200
+        return parent::table('ay_content')->field('id')
201
+            ->where($where)
202
+            ->find();
203
+    }
204
+
205
+    // 获取文章详情
206
+    public function getContent($id)
207
+    {
208
+        $field = array(
209
+            'a.*',
210
+            'b.name as sortname',
211
+            'c.name as subsortname',
212
+            'd.*'
213
+        );
214
+        $join = array(
215
+            array(
216
+                'ay_content_sort b',
217
+                'a.scode=b.scode',
218
+                'LEFT'
219
+            ),
220
+            array(
221
+                'ay_content_sort c',
222
+                'a.subscode=c.scode',
223
+                'LEFT'
224
+            ),
225
+            array(
226
+                'ay_content_ext d',
227
+                'a.id=d.contentid',
228
+                'LEFT'
229
+            )
230
+        );
231
+        return parent::table('ay_content a')->field($field)
232
+            ->where("a.id=$id")
233
+            ->where("a.acode='" . session('acode') . "'")
234
+            ->join($join)
235
+            ->find();
236
+    }
237
+
238
+    // 添加文章
239
+    public function addContent(array $data)
240
+    {
241
+        return parent::table('ay_content')->autoTime()->insertGetId($data);
242
+    }
243
+
244
+    // 删除文章
245
+    public function delContent($id)
246
+    {
247
+        return parent::table('ay_content')->where("id=$id")
248
+            ->where("acode='" . session('acode') . "'")
249
+            ->delete();
250
+    }
251
+
252
+    // 删除文章
253
+    public function delContentList($ids)
254
+    {
255
+        return parent::table('ay_content')->where("acode='" . session('acode') . "'")->delete($ids);
256
+    }
257
+
258
+    // 修改文章
259
+    public function modContent($id, $data)
260
+    {
261
+        return parent::table('ay_content')->autoTime()
262
+            ->in('id', $id)
263
+            ->where("acode='" . session('acode') . "'")
264
+            ->update($data);
265
+    }
266
+
267
+    // 复制内容到指定栏目
268
+    public function copyContent($ids, $scode)
269
+    {
270
+        // 查找出要复制的主内容
271
+        $data = parent::table('ay_content')->in('id', $ids)->select(1);
272
+        
273
+        foreach ($data as $key => $value) {
274
+            // 查找扩展内容
275
+            $extdata = parent::table('ay_content_ext')->where('contentid=' . $value['id'])->find(1);
276
+            
277
+            // 去除主键并修改栏目
278
+            unset($value['id']);
279
+            $value['scode'] = $scode;
280
+            
281
+            // 插入主内容
282
+            $id = parent::table('ay_content')->insertGetId($value);
283
+            
284
+            // 插入扩展内容
285
+            if ($id && $extdata) {
286
+                unset($extdata['extid']);
287
+                $extdata['contentid'] = $id;
288
+                $result = parent::table('ay_content_ext')->insert($extdata);
289
+            } else {
290
+                $result = $id;
291
+            }
292
+        }
293
+        return $result;
294
+    }
295
+
296
+    // 查找文章扩展内容
297
+    public function findContentExt($id)
298
+    {
299
+        return parent::table('ay_content_ext')->where("contentid=$id")->find();
300
+    }
301
+
302
+    // 添加文章扩展内容
303
+    public function addContentExt(array $data)
304
+    {
305
+        return parent::table('ay_content_ext')->insert($data);
306
+    }
307
+
308
+    // 修改文章扩展内容
309
+    public function modContentExt($id, $data)
310
+    {
311
+        return parent::table('ay_content_ext')->where("contentid=$id")->update($data);
312
+    }
313
+
314
+    // 删除文章扩展内容
315
+    public function delContentExt($id)
316
+    {
317
+        return parent::table('ay_content_ext')->where("contentid=$id")->delete();
318
+    }
319
+
320
+    // 删除文章扩展内容
321
+    public function delContentExtList($ids)
322
+    {
323
+        return parent::table('ay_content_ext')->delete($ids, 'contentid');
324
+    }
325
+
326
+    // 检查自定义URL名称
327
+    public function checkFilename($filename, $where = array())
328
+    {
329
+        return parent::table('ay_content')->field('id')
330
+            ->where("filename='$filename'")
331
+            ->where($where)
332
+            ->find();
333
+    }
334
+
335
+    public function getImage()
336
+    {
337
+        $list = parent::table('ay_content')->limit(2000)->column('ico,pics,content');
338
+        foreach ($list as &$value){
339
+            preg_match_all('/<img\s+.*?src=\s?[\'|\"](.*?(\.gif|\.jpg|\.png|\.jpeg))[\'|\"].*?[\/]?>/i', decode_string($value['content']), $match);
340
+            $value['content_img'] = $match[1];
341
+            $value['pics'] = explode(',',$value['pics']);
342
+            unset($value['content']);
343
+        }
344
+        return $list;
345
+    }
346
+}

+ 267
- 0
apps/admin/model/content/ContentSortModel.php View File

@@ -0,0 +1,267 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年12月26日
7
+ *  内容栏目模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class ContentSortModel extends Model
14
+{
15
+
16
+    // 存储分类及子编码
17
+    protected $scodes = array();
18
+
19
+    // 获取内容栏目列表
20
+    public function getList()
21
+    {
22
+        $field = array(
23
+            'a.*',
24
+            'b.type',
25
+            'b.urlname',
26
+            '(select count(*) from ay_content c where c.scode=a.scode) wzcount'
27
+        );
28
+        $join = array(
29
+            'ay_model b',
30
+            'a.mcode=b.mcode',
31
+            'LEFT'
32
+        );
33
+        $result = parent::table('ay_content_sort a')->field($field)
34
+            ->where("a.acode='" . session('acode') . "'")
35
+            ->join($join)
36
+            ->order('a.pcode,a.sorting,a.id')
37
+            ->select();
38
+        $tree = get_tree($result, 0, 'scode', 'pcode');
39
+        return $tree;
40
+    }
41
+
42
+    // 获取内容栏目选择列表
43
+    public function getSelect()
44
+    {
45
+        $result = parent::table('ay_content_sort')->field('pcode,scode,name')
46
+            ->where("acode='" . session('acode') . "'")
47
+            ->order('pcode,sorting,id')
48
+            ->select();
49
+        $tree = get_tree($result, 0, 'scode', 'pcode');
50
+        return $tree;
51
+    }
52
+
53
+    // 获取单页内容栏目选择列表
54
+    public function getSingleSelect()
55
+    {
56
+        $field = array(
57
+            'a.pcode',
58
+            'a.scode',
59
+            'a.name',
60
+            'a.outlink'
61
+        );
62
+        $join = array(
63
+            'ay_model b',
64
+            'a.mcode=b.mcode',
65
+            'LEFT'
66
+        );
67
+        $result = parent::table('ay_content_sort a')->field($field)
68
+            ->where('b.type=1')
69
+            ->where("a.outlink=''")
70
+            ->where("a.acode='" . session('acode') . "'")
71
+            ->notIn('a.scode', 'select scode from ay_content')
72
+            ->join($join)
73
+            ->order('a.pcode,a.sorting,a.id')
74
+            ->select();
75
+        return $result;
76
+    }
77
+
78
+    // 获取列表内容栏目选择列表
79
+    public function getListSelect($mcode)
80
+    {
81
+        $field = array(
82
+            'a.pcode',
83
+            'a.scode',
84
+            'a.name',
85
+            'a.outlink'
86
+        );
87
+        $join = array(
88
+            'ay_model b',
89
+            'a.mcode=b.mcode',
90
+            'LEFT'
91
+        );
92
+        $result = parent::table('ay_content_sort a')->field($field)
93
+            ->where('b.type=2')
94
+            ->where("a.outlink=''")
95
+            ->where("a.mcode='$mcode'")
96
+            ->where("a.acode='" . session('acode') . "'")
97
+            ->join($join)
98
+            ->order('a.pcode,a.sorting,a.id')
99
+            ->select();
100
+        $tree = get_tree($result, 0, 'scode', 'pcode');
101
+        // 对于父栏目非列表的栏目进行追加到后面
102
+        foreach ($result as $value) {
103
+            if ($value->pcode != 0 && result_value_search($value->pcode, $result, 'scode') === false) {
104
+                $value->son = get_tree($result, $value->scode, 'scode', 'pcode');
105
+                $tree[] = $value;
106
+            }
107
+        }
108
+        return $tree;
109
+    }
110
+
111
+    // 检查内容栏目
112
+    public function checkSort($where)
113
+    {
114
+        return parent::table('ay_content_sort')->field('id')
115
+            ->where($where)
116
+            ->find();
117
+    }
118
+
119
+    // 获取内容栏目详情
120
+    public function getSort($scode)
121
+    {
122
+        $field = array(
123
+            'a.*',
124
+            'b.type'
125
+        );
126
+        $join = array(
127
+            'ay_model b',
128
+            'a.mcode=b.mcode',
129
+            'LEFT'
130
+        );
131
+        return parent::table('ay_content_sort a')->field($field)
132
+            ->where("a.scode='$scode'")
133
+            ->where("a.acode='" . session('acode') . "'")
134
+            ->join($join)
135
+            ->find();
136
+    }
137
+
138
+    // 获取最后一个code
139
+    public function getLastCode()
140
+    {
141
+        return parent::table('ay_content_sort')->order('id DESC')->value('scode');
142
+    }
143
+
144
+    // 添加内容栏目
145
+    public function addSort(array $data)
146
+    {
147
+        return parent::table('ay_content_sort')->autoTime()->insert($data);
148
+    }
149
+
150
+    // 删除内容栏目及内容
151
+    public function delSort($scode)
152
+    {
153
+        $this->scodes = array(); // 先清空
154
+        $scodes = $this->getSubScodes($scode); // 获取全部子类
155
+        $this->delContent($scodes);
156
+        return parent::table('ay_content_sort')->in('scode', $scodes)
157
+            ->where("acode='" . session('acode') . "'")
158
+            ->delete();
159
+    }
160
+
161
+    // 批量删除栏目及内容
162
+    public function delSortList($scodes)
163
+    {
164
+        $this->scodes = array(); // 先清空
165
+        foreach ($scodes as $value) {
166
+            $allscode = $this->getSubScodes($value); // 获取全部子类
167
+        }
168
+        $this->delContent($allscode);
169
+        return parent::table('ay_content_sort')->in('scode', $allscode)
170
+            ->where("acode='" . session('acode') . "'")
171
+            ->delete();
172
+    }
173
+
174
+    // 修改内容栏目资料
175
+    public function modSort($scode, $data, $modsub = false)
176
+    {
177
+        if ($modsub) {
178
+            // 同步修改子栏目模型及模板
179
+            $scodes = $this->getSubScodes($scode);
180
+            $subdata = array(
181
+                'mcode' => $data['mcode'],
182
+                'listtpl' => $data['listtpl'],
183
+                'contenttpl' => $data['contenttpl']
184
+            );
185
+            parent::table('ay_content_sort')->in('scode', $scodes)
186
+                ->where("acode='" . session('acode') . "'")
187
+                ->update($subdata);
188
+        }
189
+        $result = parent::table('ay_content_sort')->autoTime()
190
+            ->where("scode='$scode'")
191
+            ->where("acode='" . session('acode') . "'")
192
+            ->update($data);
193
+        return $result;
194
+    }
195
+
196
+    // 修改内容栏目排序
197
+    public function modSortSorting($id, $data)
198
+    {
199
+        $result = parent::table('ay_content_sort')->autoTime()
200
+            ->where("id='$id'")
201
+            ->where("acode='" . session('acode') . "'")
202
+            ->update($data);
203
+        return $result;
204
+    }
205
+
206
+    // 查找指定单页内容
207
+    public function findContent($scode)
208
+    {
209
+        return parent::table('ay_content')->where("scode='$scode'")->find();
210
+    }
211
+
212
+    // 添加单篇文章
213
+    public function addSingle(array $data)
214
+    {
215
+        return parent::table('ay_content')->autoTime()->insert($data);
216
+    }
217
+
218
+    // 删除指定栏目文章
219
+    public function delContent($scodes)
220
+    {
221
+        return parent::table('ay_content')->in('scode', $scodes)->delete();
222
+    }
223
+
224
+    // 分类子类集
225
+    private function getSubScodes($scode)
226
+    {
227
+        if (! $scode) {
228
+            return;
229
+        }
230
+        $this->scodes[] = $scode;
231
+        $subs = parent::table('ay_content_sort')->where("pcode='$scode'")->column('scode');
232
+        if ($subs) {
233
+            foreach ($subs as $value) {
234
+                $this->getSubScodes($value);
235
+            }
236
+        }
237
+        return $this->scodes;
238
+    }
239
+
240
+    // 检查自定义URL名称
241
+    public function checkFilename($filename, $where = array())
242
+    {
243
+        return parent::table('ay_content_sort')->field('id')
244
+            ->where("filename='$filename'")
245
+            ->where($where)
246
+            ->find();
247
+    }
248
+
249
+    // 检查URL名字冲突
250
+    public function checkUrlname($filename)
251
+    {
252
+        return parent::table('ay_model')->field('id')
253
+            ->where("urlname='$filename'")
254
+            ->find();
255
+    }
256
+
257
+    // 获取当前主题
258
+    public function getTheme()
259
+    {
260
+        return parent::table('ay_site')->where("acode='" . session('acode') . "'")->value('theme');
261
+    }
262
+
263
+    public function getImage()
264
+    {
265
+        return parent::table('ay_content_sort')->column('pic,ico');
266
+    }
267
+}

+ 93
- 0
apps/admin/model/content/ExtFieldModel.php View File

@@ -0,0 +1,93 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年4月7日
7
+ *  扩展字段模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class ExtFieldModel extends Model
14
+{
15
+
16
+    // 获取扩展字段列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_extfield')->order('mcode asc,sorting asc,id asc')
20
+            ->page()
21
+            ->select();
22
+    }
23
+
24
+    // 查找扩展字段
25
+    public function findExtField($field, $keyword)
26
+    {
27
+        return parent::table('ay_extfield')->like($field, $keyword)
28
+            ->order('mcode asc,sorting asc,id asc')
29
+            ->page()
30
+            ->select();
31
+    }
32
+
33
+    // 检查扩展字段
34
+    public function checkExtField($name)
35
+    {
36
+        return parent::table('ay_extfield')->where("name='$name'")->find();
37
+    }
38
+
39
+    // 获取模型字段
40
+    public function getModelField($mcode)
41
+    {
42
+        return parent::table('ay_extfield')->where("mcode='$mcode'")
43
+            ->order('sorting asc,id asc')
44
+            ->select();
45
+    }
46
+
47
+    // 获取扩展字段详情
48
+    public function getExtField($id)
49
+    {
50
+        return parent::table('ay_extfield')->where("id=$id")->find();
51
+    }
52
+
53
+    // 获取扩展字段名称
54
+    public function getExtFieldName($id)
55
+    {
56
+        return parent::table('ay_extfield')->where("id=$id")->value('name');
57
+    }
58
+
59
+    // 添加扩展字段
60
+    public function addExtField(array $data)
61
+    {
62
+        return parent::table('ay_extfield')->insert($data);
63
+    }
64
+
65
+    // 删除扩展字段
66
+    public function delExtField($id)
67
+    {
68
+        return parent::table('ay_extfield')->where("id=$id")->delete();
69
+    }
70
+
71
+    // 修改扩展字段
72
+    public function modExtField($id, $data)
73
+    {
74
+        return parent::table('ay_extfield')->where("id=$id")->update($data);
75
+    }
76
+
77
+    // 判断字段是否存在
78
+    public function isExistField($field)
79
+    {
80
+        $fields = parent::tableFields('ay_content_ext');
81
+        if (in_array($field, $fields)) {
82
+            return true;
83
+        } else {
84
+            return false;
85
+        }
86
+    }
87
+
88
+    //查询content_ext的索引
89
+    public function checkExtIndex(): array
90
+    {
91
+        return parent::table('ay_content_ext')->checkIndexSql();
92
+    }
93
+}

+ 238
- 0
apps/admin/model/content/FormModel.php View File

@@ -0,0 +1,238 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年5月28日
7
+ *  自定义表单模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class FormModel extends Model
14
+{
15
+
16
+    // 获取自定义表单列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_form')->page()->select();
20
+    }
21
+
22
+    // 查找自定义表单
23
+    public function findForm($field, $keyword)
24
+    {
25
+        return parent::table('ay_form')->like($field, $keyword)
26
+            ->page()
27
+            ->select();
28
+    }
29
+
30
+    // 获取最后一个code
31
+    public function getLastCode()
32
+    {
33
+        return parent::table('ay_form')->order('id DESC')->value('fcode');
34
+    }
35
+
36
+    // 获取自定义表单详情
37
+    public function getForm($id)
38
+    {
39
+        return parent::table('ay_form')->where("id=$id")->find();
40
+    }
41
+
42
+    // 获取自定义表单详情
43
+    public function getFormByCode($fcode)
44
+    {
45
+        return parent::table('ay_form')->where("fcode='$fcode'")->find();
46
+    }
47
+
48
+    // 获取自定义表单表
49
+    public function getFormTable($id)
50
+    {
51
+        return parent::table('ay_form')->where("id=$id")->value('table_name');
52
+    }
53
+
54
+    // 获取自定义表单表
55
+    public function getFormCode($id)
56
+    {
57
+        return parent::table('ay_form')->where("id=$id")->value('fcode');
58
+    }
59
+
60
+    // 获取自定义表单表
61
+    public function getFormTableByCode($fcode)
62
+    {
63
+        return parent::table('ay_form')->where("fcode='$fcode'")->value('table_name');
64
+    }
65
+
66
+    // 添加自定义表单
67
+    public function addForm(array $data)
68
+    {
69
+        return parent::table('ay_form')->autoTime()->insert($data);
70
+    }
71
+
72
+    // 删除自定义表单
73
+    public function delForm($id)
74
+    {
75
+        $form = parent::table('ay_form')->field('fcode,form_name')
76
+            ->where("id=$id")
77
+            ->find();
78
+        
79
+        // 删除可能存在的菜单
80
+        if (! ! $rs = parent::table('ay_menu')->like('url', '/Form/index/fcode/' . $form->fcode . '/action/showdata')->find()) {
81
+            parent::table('ay_menu')->where("mcode='" . $rs->mcode . "'")->delete();
82
+            $menu = session('menu_tree');
83
+            foreach ($menu as $key => $value) {
84
+                if (! ! $delkey = result_value_search($rs->mcode, $menu[$key]->son, 'mcode')) {
85
+                    unset($menu[$key]->son[$delkey]);
86
+                }
87
+            }
88
+        }
89
+        $result = parent::table('ay_form')->where("id=$id")->delete(); // 删除表单
90
+        return $result;
91
+    }
92
+
93
+    // 修改自定义表单
94
+    public function modForm($id, $data)
95
+    {
96
+        return parent::table('ay_form')->where("id=$id")
97
+            ->autoTime()
98
+            ->update($data);
99
+    }
100
+
101
+    // 获取表单字段
102
+    public function getFormFieldByCode($fcode)
103
+    {
104
+        return parent::table('ay_form_field')->where("fcode='$fcode'")
105
+            ->order('sorting ASC,id ASC')
106
+            ->select();
107
+    }
108
+
109
+    // 获取字段详情
110
+    public function getFormField($id)
111
+    {
112
+        return parent::table('ay_form_field')->where("id=$id")->find();
113
+    }
114
+
115
+    // 检查表单字段
116
+    public function checkFormField($fcode, $name)
117
+    {
118
+        return parent::table('ay_form_field')->where("fcode='$fcode' AND name='$name'")->find();
119
+    }
120
+
121
+    // 获取表单字段名称
122
+    public function getFormFieldName($id)
123
+    {
124
+        return parent::table('ay_form_field')->where("id=$id")->value('name');
125
+    }
126
+
127
+    // 新增表单字段
128
+    public function addFormField(array $data)
129
+    {
130
+        return parent::table('ay_form_field')->autoTime()->insert($data);
131
+    }
132
+
133
+    // 删除表单字段
134
+    public function delFormField($id)
135
+    {
136
+        return parent::table('ay_form_field')->where("id=$id")->delete();
137
+    }
138
+
139
+    // 删除表单字段
140
+    public function delFormFieldByCode($fcode)
141
+    {
142
+        return parent::table('ay_form_field')->where("fcode='$fcode'")->delete();
143
+    }
144
+
145
+    // 修改表单字段
146
+    public function modFormField($id, $data)
147
+    {
148
+        return parent::table('ay_form_field')->where("id=$id")
149
+            ->autoTime()
150
+            ->update($data);
151
+    }
152
+
153
+    // 判断字段是否存在
154
+    public function isExistField($table, $field)
155
+    {
156
+        $fields = parent::tableFields($table);
157
+        if (in_array($field, $fields)) {
158
+            return true;
159
+        } else {
160
+            return false;
161
+        }
162
+    }
163
+
164
+    // 获取表单数据
165
+    public function getFormData($table, $page = true)
166
+    {
167
+        return parent::table($table)->page($page)
168
+            ->order('id DESC')
169
+            ->select();
170
+    }
171
+
172
+    // 删除自定义表单数据
173
+    public function delFormData($table, $id)
174
+    {
175
+        return parent::table($table)->where("id=$id")->delete();
176
+    }
177
+
178
+    // 清空自定义表单数据
179
+    public function clearFormData($table)
180
+    {
181
+        return parent::table($table)->delete();
182
+    }
183
+
184
+    // 增加表单数据查看到菜单
185
+    public function addFormMenu($id)
186
+    {
187
+        $form = parent::table('ay_form')->field('fcode,form_name')
188
+            ->where("id=$id")
189
+            ->find();
190
+        
191
+        $menus = session('menu_tree');
192
+        
193
+        // 判断是否已经在菜单中
194
+        if (! ! $menu = parent::table('ay_menu')->like('url', '/Form/index/fcode/' . $form->fcode . '/action/showdata')->find()) {
195
+            if ($form->form_name != $menu->name) {
196
+                // 更新缓存菜单
197
+                parent::table('ay_menu')->where('mcode="' . $menu->mcode . '"')->update('name="' . $form->form_name . '"');
198
+                foreach ($menus as $key => $value) {
199
+                    if ($value->mcode == 'M157') {
200
+                        if (($skey = result_value_search($menu->mcode, $menus[$key]->son, 'mcode')) !== false) {
201
+                            $menus[$key]->son[$skey]->name = $form->form_name;
202
+                        }
203
+                        break;
204
+                    }
205
+                }
206
+            }
207
+            return false;
208
+        }
209
+        
210
+        // 构建数据
211
+        $lastmcode = parent::table('ay_menu')->order('mcode DESC')->value('mcode');
212
+        $mcode = get_auto_code($lastmcode);
213
+        $data = array(
214
+            'mcode' => $mcode,
215
+            'pcode' => 'M157',
216
+            'name' => $form->form_name,
217
+            'url' => '/Form/index/fcode/' . $form->fcode . '/action/showdata',
218
+            'sorting' => 599,
219
+            'status' => 1,
220
+            'shortcut' => 0,
221
+            'ico' => 'fa-plus-square-o',
222
+            'create_user' => session('username'),
223
+            'update_user' => session('username')
224
+        );
225
+        
226
+        // 加入菜单
227
+        foreach ($menus as $key => $value) {
228
+            if ($value->mcode == 'M157') {
229
+                // 未在缓存菜单中才执行添加
230
+                if (result_value_search($mcode, $menus[$key]->son, 'mcode') === false) {
231
+                    $menus[$key]->son[] = array_to_object($data);
232
+                    return parent::table('ay_menu')->autoTime()->insert($data); // 插入到数据库
233
+                }
234
+                break;
235
+            }
236
+        }
237
+    }
238
+}

+ 89
- 0
apps/admin/model/content/LabelModel.php View File

@@ -0,0 +1,89 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年03月23日
7
+ * 自定义标签模型类
8
+ */
9
+
10
+namespace app\admin\model\content;
11
+
12
+use core\basic\Model;
13
+
14
+class LabelModel extends Model
15
+{
16
+
17
+    // 获取自定义标签列表
18
+    public function getList()
19
+    {
20
+        return parent::table('ay_label')->select();
21
+    }
22
+
23
+    // 检查自定义标签
24
+    public function checkLabel($where)
25
+    {
26
+        return parent::table('ay_label')->field('id')
27
+            ->where($where)
28
+            ->find();
29
+    }
30
+
31
+    // 获取自定义标签详情
32
+    public function getLabel($id)
33
+    {
34
+        return parent::table('ay_label')->where("id=$id")->find();
35
+    }
36
+
37
+    // 添加自定义标签
38
+    public function addLabel(array $data)
39
+    {
40
+        return parent::table('ay_label')->autoTime()->insert($data);
41
+    }
42
+
43
+    // 删除自定义标签
44
+    public function delLabel($id)
45
+    {
46
+        return parent::table('ay_label')->where("id='$id'")->delete();
47
+    }
48
+
49
+    // 修改自定义标签
50
+    public function modLabel($id, $data)
51
+    {
52
+        return parent::table('ay_label')->where("id=$id")
53
+            ->autoTime()
54
+            ->update($data);
55
+    }
56
+
57
+    // 修改自定义标签值
58
+    public function modValue($name, $value)
59
+    {
60
+        return parent::table('ay_label')->where("name='$name'")
61
+            ->autoTime()
62
+            ->update("value='$value'");
63
+    }
64
+
65
+    // 获取配置参数
66
+    public function getValue()
67
+    {
68
+        return parent::table('ay_label')->column('value', 'name');
69
+    }
70
+
71
+    //获取标签图片
72
+    public function getImage()
73
+    {
74
+
75
+        $resArr = parent::table('ay_label')->column('value');
76
+        $setArr = [];
77
+        foreach ($resArr as $key => $content) {
78
+            $pattern = '/src=&quot;\/(.*?)&quot;/';
79
+            preg_match_all($pattern, $content, $matches);
80
+            if (!empty($matches[1])) {
81
+                unset($resArr[$key]);
82
+                $setArr = $matches[1];
83
+            }
84
+        }
85
+        return array_merge($resArr, $setArr);
86
+
87
+    }
88
+}
89
+

+ 85
- 0
apps/admin/model/content/LinkModel.php View File

@@ -0,0 +1,85 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年3月1日
7
+ *  友情链接模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class LinkModel extends Model
14
+{
15
+
16
+    // 获取友情链接列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_link')->where("acode='" . session('acode') . "'")
20
+            ->order('gid asc,sorting asc,id asc')
21
+            ->page()
22
+            ->select();
23
+    }
24
+
25
+    // 查找友情链接
26
+    public function findLink($field, $keyword)
27
+    {
28
+        return parent::table('ay_link')->where("acode='" . session('acode') . "'")
29
+            ->like($field, $keyword)
30
+            ->order('gid asc,sorting asc,id asc')
31
+            ->page()
32
+            ->select();
33
+    }
34
+
35
+    // 获取友情链接详情
36
+    public function getLink($id)
37
+    {
38
+        return parent::table('ay_link')->where("id=$id")
39
+            ->where("acode='" . session('acode') . "'")
40
+            ->find();
41
+    }
42
+
43
+    // 获取分组
44
+    public function getGid()
45
+    {
46
+        return parent::table('ay_link')->distinct()
47
+            ->where("acode='" . session('acode') . "'")
48
+            ->order('gid')
49
+            ->column('gid');
50
+    }
51
+
52
+    // 获取最大分组值
53
+    public function getMaxGid()
54
+    {
55
+        return parent::table('ay_link')->max('gid');
56
+    }
57
+
58
+    // 添加友情链接
59
+    public function addLink(array $data)
60
+    {
61
+        return parent::table('ay_link')->autoTime()->insert($data);
62
+    }
63
+
64
+    // 删除友情链接
65
+    public function delLink($id)
66
+    {
67
+        return parent::table('ay_link')->where("id=$id")
68
+            ->where("acode='" . session('acode') . "'")
69
+            ->delete();
70
+    }
71
+
72
+    // 修改友情链接
73
+    public function modLink($id, $data)
74
+    {
75
+        return parent::table('ay_link')->autoTime()
76
+            ->where("id=$id")
77
+            ->where("acode='" . session('acode') . "'")
78
+            ->update($data);
79
+    }
80
+
81
+    public function getImage()
82
+    {
83
+        return parent::table('ay_link')->column('logo');
84
+    }
85
+}

+ 103
- 0
apps/admin/model/content/MessageModel.php View File

@@ -0,0 +1,103 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年3月29日
7
+ *  留言模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class MessageModel extends Model
14
+{
15
+
16
+    // 获取列表
17
+    public function getList($page = true)
18
+    {
19
+        $field = array(
20
+            'a.*',
21
+            'b.username',
22
+            'b.nickname',
23
+            'b.headpic'
24
+        );
25
+        $join = array(
26
+            'ay_member b',
27
+            'a.uid=b.id',
28
+            'LEFT'
29
+        );
30
+        return parent::table('ay_message a')->field($field)
31
+            ->join($join)
32
+            ->where("a.acode='" . session('acode') . "'")
33
+            ->order('a.id DESC')
34
+            ->decode(false)
35
+            ->page($page)
36
+            ->select();
37
+    }
38
+
39
+    // 获取详情
40
+    public function getMessage($id)
41
+    {
42
+        $field = array(
43
+            'a.*',
44
+            'b.username',
45
+            'b.nickname',
46
+            'b.headpic'
47
+        );
48
+        $join = array(
49
+            'ay_member b',
50
+            'a.uid=b.id',
51
+            'LEFT'
52
+        );
53
+        return parent::table('ay_message a')->field($field)
54
+            ->join($join)
55
+            ->where("a.id=$id")
56
+            ->where("a.acode='" . session('acode') . "'")
57
+            ->find();
58
+    }
59
+
60
+    // 删除留言
61
+    public function delMessage($id)
62
+    {
63
+        return parent::table('ay_message')->where("id=$id")
64
+            ->where("acode='" . session('acode') . "'")
65
+            ->delete();
66
+    }
67
+
68
+    // 修改留言
69
+    public function modMessage($id, $data)
70
+    {
71
+        return parent::table('ay_message')->autoTime()
72
+            ->where("id=$id")
73
+            ->where("acode='" . session('acode') . "'")
74
+            ->update($data);
75
+    }
76
+
77
+    // 获取表单字段
78
+    public function getFormFieldByCode($fcode)
79
+    {
80
+        return parent::table('ay_form_field')->where("fcode='$fcode'")
81
+            ->order('sorting ASC,id ASC')
82
+            ->select();
83
+    }
84
+
85
+    // 获取留言数量
86
+    public function getCount()
87
+    {
88
+        $rs = parent::table('ay_message')->field('count(*) as count')
89
+            ->where("acode='" . session('acode') . "'")
90
+            ->find();
91
+        return $rs->count ?: 0;
92
+    }
93
+
94
+    // 删除留言
95
+    public function clearMessage($where)
96
+    {
97
+        if(!$where){
98
+            return parent::table('ay_message')->delete();
99
+        } else {
100
+            return parent::table('ay_message')->delete($where);
101
+        }
102
+    }
103
+}

+ 140
- 0
apps/admin/model/content/ModelModel.php View File

@@ -0,0 +1,140 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年3月25日
7
+ *  内容模型模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class ModelModel extends Model
14
+{
15
+
16
+    // 获取内容模型列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_model')->order('id ASC')
20
+            ->page()
21
+            ->select();
22
+    }
23
+
24
+    // 获取模型名称
25
+    public function getName($mcode)
26
+    {
27
+        return parent::table('ay_model')->where("mcode='$mcode'")->value('name');
28
+    }
29
+
30
+    // 获取内容模型选择
31
+    public function getSelectAll()
32
+    {
33
+        return parent::table('ay_model')->field('mcode,name,type,listtpl,contenttpl')
34
+            ->order('id ASC')
35
+            ->select();
36
+    }
37
+
38
+    // 获取内容模型选择
39
+    public function getModelMenu()
40
+    {
41
+        return parent::table('ay_model')->field('mcode,name,type')
42
+            ->where('status=1')
43
+            ->order('id ASC')
44
+            ->select();
45
+    }
46
+
47
+    // 获取模型内容数量
48
+    public function getModelCount($mcode)
49
+    {
50
+        $join = array(
51
+            array(
52
+                'ay_content_sort b',
53
+                'a.scode=b.scode',
54
+                'LEFT'
55
+            ),
56
+            array(
57
+                'ay_model d',
58
+                'b.mcode=d.mcode',
59
+                'LEFT'
60
+            )
61
+        );
62
+        return parent::table('ay_content a')->field('count(*) as count')
63
+            ->where("b.mcode='$mcode'")
64
+            ->where("a.acode='" . session('acode') . "'")
65
+            ->join($join)
66
+            ->find();
67
+    }
68
+
69
+    // 获取内容模型选择
70
+    public function getSelect()
71
+    {
72
+        return parent::table('ay_model')->field('mcode,name,type,listtpl,contenttpl')
73
+            ->where('status=1')
74
+            ->order('id ASC')
75
+            ->select();
76
+    }
77
+
78
+    // 查找内容模型
79
+    public function findModel($field, $keyword)
80
+    {
81
+        return parent::table('ay_model')->like($field, $keyword)
82
+            ->page()
83
+            ->select();
84
+    }
85
+
86
+    // 获取最后一个code
87
+    public function getLastCode()
88
+    {
89
+        return parent::table('ay_model')->order('id DESC')->value('mcode');
90
+    }
91
+
92
+    // 获取内容模型详情
93
+    public function getModel($id)
94
+    {
95
+        return parent::table('ay_model')->where("id=$id")->find();
96
+    }
97
+
98
+    // 添加内容模型
99
+    public function addModel(array $data)
100
+    {
101
+        return parent::table('ay_model')->autoTime()->insert($data);
102
+    }
103
+
104
+    // 删除内容模型
105
+    public function delModel($id)
106
+    {
107
+        $model = parent::table('ay_model')->where('id=' . $id)->find();
108
+        if (parent::table('ay_content_sort')->where("mcode='$model->mcode'")->find()) {
109
+            alert_back('模型下面有栏目,不允许直接删除!');
110
+        }
111
+        return parent::table('ay_model')->where("id=$id")
112
+            ->where("issystem=0")
113
+            ->delete();
114
+    }
115
+
116
+    // 修改内容模型
117
+    public function modModel($id, $data)
118
+    {
119
+        return parent::table('ay_model')->autoTime()
120
+            ->where("id=$id")
121
+            ->update($data);
122
+    }
123
+
124
+    // 检查URL名字冲突
125
+    public function checkUrlname($urlname, $type, $where = array())
126
+    {
127
+        return parent::table('ay_model')->field('id')
128
+            ->where("urlname='$urlname' AND type<>$type")
129
+            ->where($where)
130
+            ->find();
131
+    }
132
+
133
+    // 检查栏目名字冲突
134
+    public function checkSortFilename($urlname)
135
+    {
136
+        return parent::table('ay_content_sort')->field('id')
137
+            ->where("filename='$urlname'")
138
+            ->find();
139
+    }
140
+}

+ 196
- 0
apps/admin/model/content/SingleModel.php View File

@@ -0,0 +1,196 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年12月15日
7
+ *  单页文章模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class SingleModel extends Model
14
+{
15
+
16
+    // 获取文章列表
17
+    public function getList($mcode)
18
+    {
19
+        $field = array(
20
+            'a.id',
21
+            'a.scode',
22
+            'b.name as sortname',
23
+            'a.title',
24
+            'a.date',
25
+            'a.status',
26
+            'a.visits',
27
+            'b.mcode',
28
+            'a.ico',
29
+            'a.pics',
30
+            'a.outlink',
31
+            'b.filename',
32
+            'c.urlname'
33
+        );
34
+        $join = array(
35
+            array(
36
+                'ay_content_sort b',
37
+                'a.scode=b.scode',
38
+                'LEFT'
39
+            ),
40
+            array(
41
+                'ay_model c',
42
+                'b.mcode=c.mcode',
43
+                'LEFT'
44
+            )
45
+        );
46
+        return parent::table('ay_content a')->distinct()
47
+            ->field($field)
48
+            ->where("b.mcode='$mcode'")
49
+            ->where("a.acode='" . session('acode') . "'")
50
+            ->where('c.type=1')
51
+            ->join($join)
52
+            ->where('a.id IN(SELECT MAX(d.id) FROM ay_content d WHERE d.scode=a.scode)')
53
+            ->order('a.id DESC')
54
+            ->select();
55
+    }
56
+
57
+    // 查找文章
58
+    public function findSingle($mcode, $field, $keyword)
59
+    {
60
+        $fields = array(
61
+            'a.id',
62
+            'a.scode',
63
+            'b.name as sortname',
64
+            'a.title',
65
+            'a.date',
66
+            'a.status',
67
+            'a.visits',
68
+            'b.mcode',
69
+            'a.ico',
70
+            'a.pics',
71
+            'a.outlink',
72
+            'b.filename',
73
+            'c.urlname'
74
+        );
75
+        $join = array(
76
+            array(
77
+                'ay_content_sort b',
78
+                'a.scode=b.scode',
79
+                'LEFT'
80
+            ),
81
+            array(
82
+                'ay_model c',
83
+                'b.mcode=c.mcode',
84
+                'LEFT'
85
+            )
86
+        );
87
+        return parent::table('ay_content a')->distinct()
88
+            ->field($fields)
89
+            ->where("b.mcode='$mcode'")
90
+            ->where("a.acode='" . session('acode') . "'")
91
+            ->where('c.type=1')
92
+            ->like($field, $keyword)
93
+            ->join($join)
94
+            ->group('b.name')
95
+            ->order('a.id DESC')
96
+            ->select();
97
+    }
98
+
99
+    // 检查文章
100
+    public function checkSingle($where)
101
+    {
102
+        return parent::table('ay_content')->field('id')
103
+            ->where($where)
104
+            ->find();
105
+    }
106
+
107
+    // 获取文章详情
108
+    public function getSingle($id)
109
+    {
110
+        $field = array(
111
+            'a.*',
112
+            'b.name as sortname',
113
+            'c.*',
114
+            'b.filename',
115
+            'd.urlname'
116
+        );
117
+        $join = array(
118
+            array(
119
+                'ay_content_sort b',
120
+                'a.scode=b.scode',
121
+                'LEFT'
122
+            
123
+            ),
124
+            array(
125
+                'ay_content_ext c',
126
+                'a.id=c.contentid',
127
+                'LEFT'
128
+            ),
129
+            array(
130
+                'ay_model d',
131
+                'b.mcode=d.mcode',
132
+                'LEFT'
133
+            )
134
+        );
135
+        return parent::table('ay_content a')->field($field)
136
+            ->where("a.id=$id")
137
+            ->where("a.acode='" . session('acode') . "'")
138
+            ->join($join)
139
+            ->find();
140
+    }
141
+
142
+    // 添加文章
143
+    public function addSingle(array $data)
144
+    {
145
+        return parent::table('ay_content')->autoTime()->insert($data);
146
+    }
147
+
148
+    // 删除文章
149
+    public function delSingle($id)
150
+    {
151
+        return parent::table('ay_content')->where("id=$id")
152
+            ->where("acode='" . session('acode') . "'")
153
+            ->delete();
154
+    }
155
+
156
+    // 修改文章
157
+    public function modSingle($id, $data)
158
+    {
159
+        return parent::table('ay_content')->autoTime()
160
+            ->where("id=$id")
161
+            ->where("acode='" . session('acode') . "'")
162
+            ->update($data);
163
+    }
164
+
165
+    // 查找文章扩展内容
166
+    public function findContentExt($id)
167
+    {
168
+        return parent::table('ay_content_ext')->where("contentid=$id")->find();
169
+    }
170
+
171
+    // 添加文章扩展内容
172
+    public function addContentExt(array $data)
173
+    {
174
+        return parent::table('ay_content_ext')->insert($data);
175
+    }
176
+
177
+    // 修改文章扩展内容
178
+    public function modContentExt($id, $data)
179
+    {
180
+        return parent::table('ay_content_ext')->where("contentid=$id")->update($data);
181
+    }
182
+
183
+    // 删除文章扩展内容
184
+    public function delContentExt($id)
185
+    {
186
+        return parent::table('ay_content_ext')->where("contentid=$id")->delete();
187
+    }
188
+
189
+    // 检查自定义URL名称
190
+    public function checkFilename($where)
191
+    {
192
+        return parent::table('ay_content')->field('id')
193
+            ->where($where)
194
+            ->find();
195
+    }
196
+}

+ 50
- 0
apps/admin/model/content/SiteModel.php View File

@@ -0,0 +1,50 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年3月24日
7
+ *  站点配置模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class SiteModel extends Model
14
+{
15
+
16
+    // 获取系统配置信息
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_site')->where("acode='" . session('acode') . "'")->find();
20
+    }
21
+
22
+    // 检查系统配置信息
23
+    public function checkSite()
24
+    {
25
+        return parent::table('ay_site')->where("acode='" . session('acode') . "'")->find();
26
+    }
27
+
28
+    // 增加系统配置信息
29
+    public function addSite($data)
30
+    {
31
+        return parent::table('ay_site')->insert($data);
32
+    }
33
+
34
+    // 修改系统配置信息
35
+    public function modSite($data)
36
+    {
37
+        return parent::table('ay_site')->where("acode='" . session('acode') . "'")->update($data);
38
+    }
39
+
40
+    // 系统数据库版本
41
+    public function getMysql()
42
+    {
43
+        return parent::one('SELECT VERSION()', MYSQLI_NUM);
44
+    }
45
+
46
+    public function getImage()
47
+    {
48
+        return parent::table('ay_site')->column('logo');
49
+    }
50
+}

+ 85
- 0
apps/admin/model/content/SlideModel.php View File

@@ -0,0 +1,85 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年3月1日
7
+ *  轮播图模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class SlideModel extends Model
14
+{
15
+
16
+    // 获取轮播图列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_slide')->where("acode='" . session('acode') . "'")
20
+            ->order('gid asc,sorting asc,id asc')
21
+            ->page()
22
+            ->select();
23
+    }
24
+
25
+    // 查找轮播图
26
+    public function findSlide($field, $keyword)
27
+    {
28
+        return parent::table('ay_slide')->where("acode='" . session('acode') . "'")
29
+            ->like($field, $keyword)
30
+            ->order('gid asc,sorting asc,id asc')
31
+            ->page()
32
+            ->select();
33
+    }
34
+
35
+    // 获取轮播图详情
36
+    public function getSlide($id)
37
+    {
38
+        return parent::table('ay_slide')->where("id=$id")
39
+            ->where("acode='" . session('acode') . "'")
40
+            ->find();
41
+    }
42
+
43
+    // 获取分组
44
+    public function getGid()
45
+    {
46
+        return parent::table('ay_slide')->distinct()
47
+            ->where("acode='" . session('acode') . "'")
48
+            ->order('gid')
49
+            ->column('gid');
50
+    }
51
+
52
+    // 获取最大分组值
53
+    public function getMaxGid()
54
+    {
55
+        return parent::table('ay_slide')->max('gid');
56
+    }
57
+
58
+    // 添加轮播图
59
+    public function addSlide(array $data)
60
+    {
61
+        return parent::table('ay_slide')->autoTime()->insert($data);
62
+    }
63
+
64
+    // 删除轮播图
65
+    public function delSlide($id)
66
+    {
67
+        return parent::table('ay_slide')->where("id=$id")
68
+            ->where("acode='" . session('acode') . "'")
69
+            ->delete();
70
+    }
71
+
72
+    // 修改轮播图
73
+    public function modSlide($id, $data)
74
+    {
75
+        return parent::table('ay_slide')->autoTime()
76
+            ->where("id=$id")
77
+            ->where("acode='" . session('acode') . "'")
78
+            ->update($data);
79
+    }
80
+
81
+    public function getImage()
82
+    {
83
+        return parent::table('ay_slide')->column('pic');
84
+    }
85
+}

+ 65
- 0
apps/admin/model/content/TagsModel.php View File

@@ -0,0 +1,65 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2019年07月12日
7
+ *  内链链接模型类
8
+ */
9
+namespace app\admin\model\content;
10
+
11
+use core\basic\Model;
12
+
13
+class TagsModel extends Model
14
+{
15
+
16
+    // 获取文章内链列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_tags')->where("acode='" . session('acode') . "'")
20
+            ->order('id asc')
21
+            ->page()
22
+            ->select();
23
+    }
24
+
25
+    // 查找文章内链
26
+    public function findTags($field, $keyword)
27
+    {
28
+        return parent::table('ay_tags')->where("acode='" . session('acode') . "'")
29
+            ->like($field, $keyword)
30
+            ->order('id asc')
31
+            ->page()
32
+            ->select();
33
+    }
34
+
35
+    // 获取文章内链详情
36
+    public function getTags($id)
37
+    {
38
+        return parent::table('ay_tags')->where("id=$id")
39
+            ->where("acode='" . session('acode') . "'")
40
+            ->find();
41
+    }
42
+
43
+    // 添加文章内链
44
+    public function addTags(array $data)
45
+    {
46
+        return parent::table('ay_tags')->autoTime()->insert($data);
47
+    }
48
+
49
+    // 删除文章内链
50
+    public function delTags($id)
51
+    {
52
+        return parent::table('ay_tags')->where("id=$id")
53
+            ->where("acode='" . session('acode') . "'")
54
+            ->delete();
55
+    }
56
+
57
+    // 修改文章内链
58
+    public function modTags($id, $data)
59
+    {
60
+        return parent::table('ay_tags')->autoTime()
61
+            ->where("id=$id")
62
+            ->where("acode='" . session('acode') . "'")
63
+            ->update($data);
64
+    }
65
+}

+ 136
- 0
apps/admin/model/member/MemberCommentModel.php View File

@@ -0,0 +1,136 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2020年06月27日
7
+ *  文章评论模型类
8
+ */
9
+namespace app\admin\model\member;
10
+
11
+use core\basic\Model;
12
+
13
+class MemberCommentModel extends Model
14
+{
15
+
16
+    // 获取列表
17
+    public function getList()
18
+    {
19
+        $field = array(
20
+            'a.*',
21
+            'b.title',
22
+            'c.username',
23
+            'c.nickname',
24
+            'c.headpic'
25
+        );
26
+        $join = array(
27
+            array(
28
+                'ay_content b',
29
+                'a.contentid=b.id',
30
+                'LEFT'
31
+            ),
32
+            array(
33
+                'ay_member c',
34
+                'a.uid=c.id',
35
+                'LEFT'
36
+            )
37
+        );
38
+        return parent::table('ay_member_comment a')->field($field)
39
+            ->join($join)
40
+            ->order('a.id desc')
41
+            ->page()
42
+            ->select();
43
+    }
44
+
45
+    // 查找
46
+    public function findComment($field, $keyword)
47
+    {
48
+        $fields = array(
49
+            'a.*',
50
+            'b.title',
51
+            'c.username',
52
+            'c.nickname',
53
+            'c.headpic'
54
+        );
55
+        $join = array(
56
+            array(
57
+                'ay_content b',
58
+                'a.contentid=b.id',
59
+                'LEFT'
60
+            ),
61
+            array(
62
+                'ay_member c',
63
+                'a.uid=c.id',
64
+                'LEFT'
65
+            )
66
+        );
67
+        return parent::table('ay_member_comment a')->field($fields)
68
+            ->join($join)
69
+            ->like($field, $keyword)
70
+            ->order('a.id desc')
71
+            ->page()
72
+            ->select();
73
+    }
74
+
75
+    // 获取详情
76
+    public function getComment($id)
77
+    {
78
+        $field = array(
79
+            'a.*',
80
+            'b.title',
81
+            'c.username',
82
+            'c.nickname',
83
+            'c.headpic',
84
+            'd.username as pusername',
85
+            'd.nickname as pnickname'
86
+        );
87
+        $join = array(
88
+            array(
89
+                'ay_content b',
90
+                'a.contentid=b.id',
91
+                'LEFT'
92
+            ),
93
+            array(
94
+                'ay_member c',
95
+                'a.uid=c.id',
96
+                'LEFT'
97
+            ),
98
+            array(
99
+                'ay_member d',
100
+                'a.puid=d.id',
101
+                'LEFT'
102
+            )
103
+        );
104
+        
105
+        return parent::table('ay_member_comment a')->field($field)
106
+            ->join($join)
107
+            ->where("a.id=$id")
108
+            ->find();
109
+    }
110
+
111
+    // 删除
112
+    public function delComment($id)
113
+    {
114
+        return parent::table('ay_member_comment')->where("id=$id")->delete();
115
+    }
116
+
117
+    // 删除多个
118
+    public function delCommentList($ids)
119
+    {
120
+        return parent::table('ay_member_comment')->delete($ids);
121
+    }
122
+
123
+    // 修改
124
+    public function modComment($id, $data)
125
+    {
126
+        return parent::table('ay_member_comment')->where("id=$id")
127
+            ->autoTime()
128
+            ->update($data);
129
+    }
130
+
131
+    // 修改多个
132
+    public function modCommentList($ids, $data)
133
+    {
134
+        return parent::table('ay_member_comment')->in('id', $ids)->update($data);
135
+    }
136
+}

+ 79
- 0
apps/admin/model/member/MemberFieldModel.php View File

@@ -0,0 +1,79 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2020年06月25日
7
+ *  会员字段模型类
8
+ */
9
+namespace app\admin\model\member;
10
+
11
+use core\basic\Model;
12
+
13
+class MemberFieldModel extends Model
14
+{
15
+
16
+    // 获取会员字段列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_member_field')->order('sorting asc,id asc')
20
+            ->page()
21
+            ->select();
22
+    }
23
+
24
+    // 查找会员字段
25
+    public function findField($field, $keyword)
26
+    {
27
+        return parent::table('ay_member_field')->like($field, $keyword)
28
+            ->order('sorting asc,id asc')
29
+            ->page()
30
+            ->select();
31
+    }
32
+
33
+    // 检查会员字段
34
+    public function checkField($name)
35
+    {
36
+        return parent::table('ay_member_field')->where("name='$name'")->find();
37
+    }
38
+
39
+    // 获取会员字段详情
40
+    public function getField($id)
41
+    {
42
+        return parent::table('ay_member_field')->where("id=$id")->find();
43
+    }
44
+
45
+    // 获取会员字段名称
46
+    public function getFieldName($id)
47
+    {
48
+        return parent::table('ay_member_field')->where("id=$id")->value('name');
49
+    }
50
+
51
+    // 添加会员字段
52
+    public function addField(array $data)
53
+    {
54
+        return parent::table('ay_member_field')->autoTime()->insert($data);
55
+    }
56
+
57
+    // 删除会员字段
58
+    public function delField($id)
59
+    {
60
+        return parent::table('ay_member_field')->where("id=$id")->delete();
61
+    }
62
+
63
+    // 修改会员字段
64
+    public function modField($id, $data)
65
+    {
66
+        return parent::table('ay_member_field')->where("id=$id")->update($data);
67
+    }
68
+
69
+    // 判断字段是否存在
70
+    public function isExistField($field)
71
+    {
72
+        $fields = parent::tableFields('ay_member');
73
+        if (in_array($field, $fields)) {
74
+            return true;
75
+        } else {
76
+            return false;
77
+        }
78
+    }
79
+}

+ 98
- 0
apps/admin/model/member/MemberGroupModel.php View File

@@ -0,0 +1,98 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2020年06月25日
7
+ *  会员等级模型类
8
+ */
9
+namespace app\admin\model\member;
10
+
11
+use core\basic\Model;
12
+
13
+class MemberGroupModel extends Model
14
+{
15
+
16
+    // 获取会员等级列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_member_group')->order('gcode,id')
20
+            ->page()
21
+            ->select();
22
+    }
23
+
24
+    // 查找会员等级
25
+    public function findGroup($field, $keyword)
26
+    {
27
+        return parent::table('ay_member_group')->like($field, $keyword)
28
+            ->order('gcode,id')
29
+            ->page()
30
+            ->select();
31
+    }
32
+
33
+    // 获取最后一个code
34
+    public function getLastGid()
35
+    {
36
+        return parent::table('ay_member_group')->order('id DESC')->value('gcode');
37
+    }
38
+
39
+    // 获取等级选择列表
40
+    public function getSelect()
41
+    {
42
+        return parent::table('ay_member_group')->field('id,gcode,gname')
43
+            ->order('gcode,id')
44
+            ->select();
45
+    }
46
+
47
+    // 获取会员等级详情
48
+    public function getGroup($id)
49
+    {
50
+        return parent::table('ay_member_group')->where("id=$id")->find();
51
+    }
52
+
53
+    // 获取会员等级名称
54
+    public function getGroupName($id)
55
+    {
56
+        return parent::table('ay_member_group')->where("id=$id")->value('gname');
57
+    }
58
+
59
+    // 添加会员等级
60
+    public function addGroup(array $data)
61
+    {
62
+        return parent::table('ay_member_group')->autoTime()->insert($data);
63
+    }
64
+
65
+    // 删除会员等级
66
+    public function delGroup($id)
67
+    {
68
+        return parent::table('ay_member_group')->where("id=$id")->delete();
69
+    }
70
+
71
+    // 修改会员等级
72
+    public function modGroup($id, $data)
73
+    {
74
+        return parent::table('ay_member_group')->where("id=$id")->update($data);
75
+    }
76
+
77
+    // 查找等级下会员是否存在
78
+    public function findGroupUser($id)
79
+    {
80
+        return parent::table('ay_member')->field('id')
81
+            ->where("gid=$id")
82
+            ->find();
83
+    }
84
+
85
+    // 查找等级编号
86
+    public function findGroupCode($gcode, $id = null)
87
+    {
88
+        if ($id) {
89
+            return parent::table('ay_member_group')->field('id')
90
+                ->where("gcode='$gcode' and id<>$id")
91
+                ->find();
92
+        } else {
93
+            return parent::table('ay_member_group')->field('id')
94
+                ->where("gcode='$gcode'")
95
+                ->find();
96
+        }
97
+    }
98
+}

+ 122
- 0
apps/admin/model/member/MemberModel.php View File

@@ -0,0 +1,122 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2019年10月05日
7
+ *  会员模型类
8
+ */
9
+namespace app\admin\model\member;
10
+
11
+use core\basic\Model;
12
+
13
+class MemberModel extends Model
14
+{
15
+
16
+    // 获取会员列表
17
+    public function getList()
18
+    {
19
+        $field = array(
20
+            'a.*',
21
+            'b.gname'
22
+        );
23
+        $join = array(
24
+            'ay_member_group b',
25
+            'a.gid=b.id',
26
+            'LEFT'
27
+        );
28
+        return parent::table('ay_member a')->field($field)
29
+            ->join($join)
30
+            ->order('a.id desc')
31
+            ->page()
32
+            ->select();
33
+    }
34
+
35
+    // 查找会员
36
+    public function findMember($field, $keyword)
37
+    {
38
+        $fields = array(
39
+            'a.*',
40
+            'b.gname'
41
+        );
42
+        $join = array(
43
+            'ay_member_group b',
44
+            'a.gid=b.id',
45
+            'LEFT'
46
+        );
47
+        return parent::table('ay_member a')->field($fields)
48
+            ->join($join)
49
+            ->like($field, $keyword)
50
+            ->order('a.id desc')
51
+            ->page()
52
+            ->select();
53
+    }
54
+
55
+    // 检查会员
56
+    public function checkMember($where)
57
+    {
58
+        return parent::table('ay_member')->where($where)->find();
59
+    }
60
+
61
+    // 获取最后一个code
62
+    public function getLastCode()
63
+    {
64
+        return parent::table('ay_member')->order('id DESC')->value('ucode');
65
+    }
66
+
67
+    // 获取会员详情
68
+    public function getMember($id)
69
+    {
70
+        $field = array(
71
+            'a.*',
72
+            'b.gname'
73
+        );
74
+        $join = array(
75
+            'ay_member_group b',
76
+            'a.gid=b.id',
77
+            'LEFT'
78
+        );
79
+        return parent::table('ay_member a')->field($field)
80
+            ->join($join)
81
+            ->where("a.id=$id")
82
+            ->find();
83
+    }
84
+
85
+    // 添加会员
86
+    public function addMember(array $data)
87
+    {
88
+        return parent::table('ay_member')->insert($data);
89
+    }
90
+
91
+    // 删除会员
92
+    public function delMember($id)
93
+    {
94
+        return parent::table('ay_member')->where("id=$id")->delete();
95
+    }
96
+
97
+    // 删除会员
98
+    public function delMemberList($ids)
99
+    {
100
+        return parent::table('ay_member')->delete($ids);
101
+    }
102
+
103
+    // 修改会员
104
+    public function modMember($id, $data)
105
+    {
106
+        return parent::table('ay_member')->where("id=$id")->update($data);
107
+    }
108
+
109
+    // 修改会员
110
+    public function modMemberList($ids, $data)
111
+    {
112
+        return parent::table('ay_member')->in('id', $ids)->update($data);
113
+    }
114
+
115
+    // 会员字段
116
+    public function getFields()
117
+    {
118
+        return parent::table('ay_member_field')->where('status=1')
119
+            ->order('sorting')
120
+            ->select();
121
+    }
122
+}

+ 101
- 0
apps/admin/model/system/AreaModel.php View File

@@ -0,0 +1,101 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年04月07日
7
+ *  区域模型类
8
+ */
9
+namespace app\admin\model\system;
10
+
11
+use core\basic\Model;
12
+
13
+class AreaModel extends Model
14
+{
15
+
16
+    // 获取区域列表
17
+    public function getList()
18
+    {
19
+        $result = parent::table('ay_area')->order('pcode,acode')
20
+            ->page()
21
+            ->select();
22
+        $tree = get_tree($result, 0, 'acode', 'pcode');
23
+        return $tree;
24
+    }
25
+
26
+    // 获取区域选择列表
27
+    public function getSelect()
28
+    {
29
+        $result = parent::table('ay_area')->field('pcode,acode,name')
30
+            ->order('pcode,acode')
31
+            ->select();
32
+        $tree = get_tree($result, 0, 'acode', 'pcode');
33
+        return $tree;
34
+    }
35
+
36
+    // 检查区域
37
+    public function checkArea($where)
38
+    {
39
+        return parent::table('ay_area')->field('id')
40
+            ->where($where)
41
+            ->find();
42
+    }
43
+
44
+    // 获取区域详情
45
+    public function getArea($acode)
46
+    {
47
+        return parent::table('ay_area')->where("acode='$acode'")->find();
48
+    }
49
+
50
+    // 获取最后一个code
51
+    public function getLastCode()
52
+    {
53
+        return parent::table('ay_area')->order('id DESC')->value('acode');
54
+    }
55
+
56
+    // 添加区域
57
+    public function addArea(array $data)
58
+    {
59
+        if ($data['is_default']) {
60
+            $this->unsetDefault($data['acode']);
61
+        }
62
+        return parent::table('ay_area')->autoTime()->insert($data);
63
+    }
64
+
65
+    // 删除区域
66
+    public function delArea($acode)
67
+    {
68
+        return parent::table('ay_area')->where("acode='$acode' OR pcode='$acode'")
69
+            ->where('is_default=0')
70
+            ->delete();
71
+    }
72
+
73
+    // 修改区域资料
74
+    public function modArea($acode, $data)
75
+    {
76
+        $result = parent::table('ay_area')->autoTime()
77
+            ->where("acode='$acode'")
78
+            ->update($data);
79
+        if ($data['is_default']) {
80
+            $this->unsetDefault($data['acode']);
81
+        }
82
+        if ($result && array_key_exists('acode', $data) && $acode != $data['acode']) {
83
+            $this->modSubArea($acode, $data['acode']);
84
+        }
85
+        return $result;
86
+    }
87
+
88
+    // 当父编号改变时,修改子栏目的父编码
89
+    private function modSubArea($pcode, $pcodeNew)
90
+    {
91
+        return parent::table('ay_area')->where("pcode='$pcode'")
92
+            ->autoTime()
93
+            ->update("pcode='$pcodeNew'");
94
+    }
95
+
96
+    // 去除$acode以外的默认区域
97
+    private function unsetDefault($acode)
98
+    {
99
+        parent::table('ay_area')->where("acode<>'$acode'")->update('is_default=0');
100
+    }
101
+}

+ 62
- 0
apps/admin/model/system/CityModel.php View File

@@ -0,0 +1,62 @@
1
+<?php
2
+/**
3
+ *  分站模型类
4
+ */
5
+namespace app\admin\model\system;
6
+
7
+use core\basic\Model;
8
+
9
+class CityModel extends Model{
10
+    // 获取分站列表  -- 前端缓存城市用
11
+    public function getAllList(){
12
+        return parent::table('ay_city')->where('status=1')->order('sorting asc')->select(1);
13
+    }
14
+
15
+    // 获取分站列表
16
+    public function getList($pid=0){
17
+        $field = array(
18
+            'a.*',
19
+            "(select count(b.id) from ay_city b where b.pid=a.id) as count"
20
+        );
21
+        $where['pid']=$pid;
22
+        $result = parent::table('ay_city a')->field($field)->where($where)->order('a.sorting asc')->select();
23
+        return $result;
24
+    }
25
+
26
+    // 检查分站
27
+    public function checkName($where){
28
+        return parent::table('ay_city')->field('title,etitle')
29
+            ->where($where)
30
+            ->find();
31
+    }
32
+
33
+    // 添加分站
34
+    public function addCity($data){
35
+        return parent::table('ay_city')->insert($data);
36
+    }
37
+
38
+    // 查询分站
39
+    public function findCity($id){
40
+        return parent::table('ay_city')->where("id={$id}")->find();
41
+    }
42
+
43
+    // 删除分站
44
+    public function delCity($id){
45
+        return parent::table('ay_city')->where("id='$id' OR pid='$id'")->delete();
46
+    }
47
+
48
+    // 批量删除分站
49
+    public function delCityList($ids){
50
+        foreach($ids as $id){
51
+            $this->delCity($id);
52
+        }
53
+        return true;
54
+        //return parent::table('ay_city')->delete($ids);
55
+    }
56
+
57
+    // 修改分站资料
58
+    public function modCity($id, $data){
59
+        return parent::table('ay_city')->where("id='$id'")->update($data);
60
+    }
61
+
62
+}

+ 66
- 0
apps/admin/model/system/ConfigModel.php View File

@@ -0,0 +1,66 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2018年01月03日
7
+ * 应用配置模型类
8
+ */
9
+namespace app\admin\model\system;
10
+
11
+use core\basic\Model;
12
+
13
+class ConfigModel extends Model
14
+{
15
+
16
+    // 获取应用配置列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_config')->order('sorting,id')->column('name,value,type,description', 'name');
20
+    }
21
+
22
+    // 检查应用配置
23
+    public function checkConfig($where)
24
+    {
25
+        return parent::table('ay_config')->field('id')
26
+            ->where($where)
27
+            ->find();
28
+    }
29
+
30
+    // 添加应用配置字段
31
+    public function addConfig(array $data)
32
+    {
33
+        return parent::table('ay_config')->insert($data);
34
+    }
35
+
36
+    // 修改应用配置值
37
+    public function modValue($name, $value)
38
+    {
39
+        return parent::table('ay_config')->where("name='$name'")->update("value='$value'");
40
+    }
41
+
42
+    // 获取区域及主题
43
+    public function getAreaTheme()
44
+    {
45
+        $field = array(
46
+            'a.*',
47
+            'b.theme'
48
+        );
49
+        $join = array(
50
+            'ay_site b',
51
+            'a.acode=b.acode',
52
+            'LEFT'
53
+        );
54
+        return parent::table('ay_area a')->field($field)
55
+            ->join($join)
56
+            ->order('is_default DESC')
57
+            ->select(1);
58
+    }
59
+
60
+    // 获取配置参数
61
+    public function getConfig()
62
+    {
63
+        return parent::table('ay_config')->column('value', 'name');
64
+    }
65
+}
66
+

+ 102
- 0
apps/admin/model/system/DatabaseModel.php View File

@@ -0,0 +1,102 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年11月19日
7
+ *  数据库管理模型类,只兼容MySQL数据库
8
+ */
9
+namespace app\admin\model\system;
10
+
11
+use core\basic\Model;
12
+
13
+class DatabaseModel extends Model
14
+{
15
+
16
+    // 数据库表状态列表
17
+    public function getList()
18
+    {
19
+        return parent::all('SHOW TABLE STATUS');
20
+    }
21
+
22
+    // 获取全部表
23
+    public function getTables()
24
+    {
25
+        $result = parent::all('SHOW TABLES', 2);
26
+        foreach ($result as $value) {
27
+            $tables[] = $value[0];
28
+        }
29
+        return $tables;
30
+    }
31
+
32
+    // 获取表字段数量
33
+    public function getFieldNum($table)
34
+    {
35
+        return parent::fields($table);
36
+    }
37
+
38
+    // 获取表字段名
39
+    public function getFields($table)
40
+    {
41
+        $one_data = parent::one("SELECT * FROM " . $table); // 读取数据
42
+        $fields = array();
43
+        if ($one_data) {
44
+            foreach ($one_data as $key => $value) {
45
+                $fields[] = "`$key`";
46
+            }
47
+        }
48
+        return $fields;
49
+    }
50
+
51
+    // 获取一条数据
52
+    public function getOne($table)
53
+    {
54
+        return parent::one("SELECT * FROM " . $table);
55
+    }
56
+
57
+    // 获取全部数据
58
+    public function getAll($table)
59
+    {
60
+        return parent::all("SELECT * FROM " . $table, MYSQLI_NUM);
61
+    }
62
+
63
+    // 数据库表结构
64
+    public function tableStru($table)
65
+    {
66
+        $sql = "DROP TABLE IF EXISTS `" . $table . '`;' . PHP_EOL;
67
+        $result = parent::one('SHOW CREATE TABLE `' . $table . '`', MYSQLI_ASSOC);
68
+        return $sql . $result['Create Table'] . ';' . PHP_EOL . PHP_EOL;
69
+    }
70
+
71
+    // 数据库表优化
72
+    public function optimize($tables)
73
+    {
74
+        return parent::query("OPTIMIZE TABLE $tables");
75
+    }
76
+
77
+    // 数据库表修复
78
+    public function repair($tables)
79
+    {
80
+        return parent::query("REPAIR TABLE $tables");
81
+    }
82
+
83
+    // 锁定数据库表
84
+    public function lock($tablename, $op = "WRITE")
85
+    {
86
+        if (parent::query("lock tables " . $tablename . " " . $op)) {
87
+            return true;
88
+        } else {
89
+            return false;
90
+        }
91
+    }
92
+
93
+    // 解锁数据库标
94
+    public function unlock()
95
+    {
96
+        if (parent::query("unlock tables")) {
97
+            return true;
98
+        } else {
99
+            return false;
100
+        }
101
+    }
102
+}

+ 161
- 0
apps/admin/model/system/MenuModel.php View File

@@ -0,0 +1,161 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年4月3日
7
+ *  菜单管理模型类
8
+ */
9
+namespace app\admin\model\system;
10
+
11
+use core\basic\Model;
12
+
13
+class MenuModel extends Model
14
+{
15
+
16
+    // 获取菜单列表
17
+    public function getList()
18
+    {
19
+        $result = parent::table('ay_menu')->order('pcode,sorting,id')->select();
20
+        $tree = get_tree($result, 0, 'mcode', 'pcode');
21
+        return $tree;
22
+    }
23
+
24
+    // 获取菜单选择列表
25
+    public function getSelect()
26
+    {
27
+        $result = parent::table('ay_menu')->field('id,pcode,mcode,name,url,sorting')
28
+            ->order('pcode,sorting,id')
29
+            ->select();
30
+        $tree = get_tree($result, 0, 'mcode', 'pcode');
31
+        return $tree;
32
+    }
33
+
34
+    // 获取菜单详情
35
+    public function getMenu($mcode)
36
+    {
37
+        $result = parent::table('ay_menu')->where("mcode='$mcode'")->find();
38
+        if ($result)
39
+            $result->actions = $this->getMenuAction($result->mcode);
40
+        return $result;
41
+    }
42
+
43
+    // 检查是否存在
44
+    public function checkMenu($data)
45
+    {
46
+        return parent::table('ay_menu')->where($data)->find();
47
+    }
48
+
49
+    // 获取最后一个code
50
+    public function getLastCode()
51
+    {
52
+        return parent::table('ay_menu')->order('mcode DESC')->value('mcode');
53
+    }
54
+
55
+    // 新增菜单,$actions为菜单功能按钮数组
56
+    public function addMenu(array $data, array $actions = array())
57
+    {
58
+        $result = parent::table('ay_menu')->autoTime()->insert($data);
59
+        if ($result && $actions) {
60
+            $this->delMenuAction($data['mcode']);
61
+            $this->addMenuAction($data['mcode'], $actions);
62
+        }
63
+        return $result;
64
+    }
65
+
66
+    // 删除菜单
67
+    public function delMenu($mcode)
68
+    {
69
+        $result = parent::table('ay_menu')->where("mcode='$mcode' OR pcode='$mcode'")->delete();
70
+        if ($result) {
71
+            $this->delMenuAction($mcode);
72
+        }
73
+        return $result;
74
+    }
75
+
76
+    // 修改菜单
77
+    public function modMenu($mcode, $data, array $actions = null)
78
+    {
79
+        $result = parent::table('ay_menu')->where("mcode='$mcode'")
80
+            ->autoTime()
81
+            ->update($data);
82
+        if ($result) {
83
+            if (array_key_exists('mcode', $data) && $mcode != $data['mcode']) {
84
+                $this->modSubMenu($mcode, $data['mcode']);
85
+            }
86
+            if (is_array($actions)) {
87
+                $this->delMenuAction($mcode);
88
+            }
89
+            if ($actions) {
90
+                if (array_key_exists('mcode', $data)) {
91
+                    $mcode = $data['mcode'];
92
+                }
93
+                $this->addMenuAction($mcode, $actions);
94
+            }
95
+        }
96
+        return $result;
97
+    }
98
+
99
+    // 修改子菜单的父菜单
100
+    private function modSubMenu($mcode, $mcodeNew)
101
+    {
102
+        return parent::table('ay_menu')->where("pcode='$mcode'")->update("mcode='$mcodeNew'");
103
+    }
104
+
105
+    // 获取指定菜单的功能数据
106
+    private function getMenuAction($mcode)
107
+    {
108
+        return parent::table('ay_menu_action')->where("mcode='$mcode'")->column('action');
109
+    }
110
+
111
+    // 插入指定菜单功能关联数据
112
+    private function addMenuAction($mcode, array $actions)
113
+    {
114
+        return parent::table('ay_menu_action')->field('mcode,action')
115
+            ->relation($mcode, $actions)
116
+            ->insert();
117
+    }
118
+
119
+    // 删除指定菜单功能关联数据
120
+    private function delMenuAction($mcode)
121
+    {
122
+        return parent::table('ay_menu_action')->where("mcode='$mcode'")->delete();
123
+    }
124
+
125
+    // 获取菜单权限功能表
126
+    public function getMenuLevel()
127
+    {
128
+        $table = array(
129
+            'ay_menu',
130
+            'ay_menu_action',
131
+            'ay_type'
132
+        );
133
+        $field = array(
134
+            'ay_menu.mcode',
135
+            'ay_menu.name',
136
+            'ay_menu.url',
137
+            'ay_type.item',
138
+            'ay_type.value'
139
+        );
140
+        $where = array(
141
+            "ay_type.tcode='T101'",
142
+            "ay_menu.mcode=ay_menu_action.mcode",
143
+            "ay_type.value=ay_menu_action.action"
144
+        );
145
+        $order = array(
146
+            'ay_menu.mcode',
147
+            'ay_type.tcode',
148
+            'ay_type.sorting'
149
+        );
150
+        $result = parent::table($table)->field($field)
151
+            ->where($where)
152
+            ->order($order)
153
+            ->select();
154
+        $data = array();
155
+        foreach ($result as $key => $value) {
156
+            $data[$value->mcode][] = $value;
157
+        }
158
+        return $data;
159
+    }
160
+}
161
+

+ 169
- 0
apps/admin/model/system/RoleModel.php View File

@@ -0,0 +1,169 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年04月07日
7
+ *  角色管理模型类
8
+ */
9
+namespace app\admin\model\system;
10
+
11
+use core\basic\Model;
12
+
13
+class RoleModel extends Model
14
+{
15
+
16
+    // 获取角色列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_role')->order('rcode,id DESC')
20
+            ->page()
21
+            ->select();
22
+    }
23
+
24
+    // 获取角色选择列表
25
+    public function getSelect()
26
+    {
27
+        return parent::table('ay_role')->field('rcode,name')
28
+            ->order('rcode,id')
29
+            ->select();
30
+    }
31
+
32
+    // 检查角色
33
+    public function checkRole($where)
34
+    {
35
+        return parent::table('ay_role')->field('id')
36
+            ->where($where)
37
+            ->find();
38
+    }
39
+
40
+    // 获取角色详情
41
+    public function getRole($rcode)
42
+    {
43
+        $result = parent::table('ay_role')->where("rcode='$rcode'")->find();
44
+        if ($result) {
45
+            $result->acodes = $this->getRoleArea($rcode);
46
+            $result->levels = $this->getRoleLevel($rcode);
47
+        }
48
+        return $result;
49
+    }
50
+
51
+    // 获取最后一个code
52
+    public function getLastCode()
53
+    {
54
+        return parent::table('ay_role')->order('id DESC')->value('rcode');
55
+    }
56
+
57
+    // 添加角色
58
+    public function addRole(array $data, array $acodes, array $levels)
59
+    {
60
+        $result = parent::table('ay_role')->autoTime()->insert($data);
61
+        if ($result) {
62
+            if ($acodes) {
63
+                $this->delRoleArea($data['rcode']);
64
+                $this->addRoleArea($data['rcode'], $acodes);
65
+            }
66
+            if ($levels) {
67
+                $this->delRoleLevel($data['rcode']);
68
+                $this->addRoleLevel($data['rcode'], $levels);
69
+            }
70
+        }
71
+        return $result;
72
+    }
73
+
74
+    // 删除角色
75
+    public function delRole($rcode)
76
+    {
77
+        $result = parent::table('ay_role')->where("rcode='$rcode'")->delete();
78
+        if ($result) {
79
+            $this->delRoleArea($rcode);
80
+            $this->delRoleLevel($rcode);
81
+            $this->delUserRole($rcode);
82
+        }
83
+        return $result;
84
+    }
85
+
86
+    // 修改角色资料
87
+    public function modRole($rcode, $data, array $acodes = null, array $levels = null)
88
+    {
89
+        $result = parent::table('ay_role')->where("rcode='$rcode'")
90
+            ->autoTime()
91
+            ->update($data);
92
+        if ($result) {
93
+            if (is_array($acodes)) {
94
+                $this->delRoleArea($rcode);
95
+            }
96
+            
97
+            if (is_array($levels)) {
98
+                $this->delRoleLevel($rcode);
99
+            }
100
+            
101
+            if (array_key_exists('rcode', $data)) {
102
+                if ($rcode != $data['rcode']) {
103
+                    $this->modUserRole($rcode, "rcode='" . $data['rcode'] . "'");
104
+                    $rcode = $data['rcode'];
105
+                }
106
+            }
107
+            if ($acodes) {
108
+                $this->addRoleArea($rcode, $acodes);
109
+            }
110
+            if ($levels) {
111
+                $this->addRoleLevel($rcode, $levels);
112
+            }
113
+        }
114
+        return $result;
115
+    }
116
+
117
+    // 获取角色的区域数据
118
+    private function getRoleArea($rcode)
119
+    {
120
+        return parent::table('ay_role_area')->where("rcode='$rcode'")->column('acode');
121
+    }
122
+
123
+    // 插入角色区域关联数据
124
+    private function addRoleArea($rcode, array $acodes)
125
+    {
126
+        return parent::table('ay_role_area')->field('rcode,acode')
127
+            ->relation($rcode, $acodes)
128
+            ->insert();
129
+    }
130
+
131
+    // 删除角色区域关联数据
132
+    private function delRoleArea($rcode)
133
+    {
134
+        return parent::table('ay_role_area')->where("rcode='$rcode'")->delete();
135
+    }
136
+
137
+    // 获取角色的权限数据
138
+    private function getRoleLevel($rcode)
139
+    {
140
+        return parent::table('ay_role_level')->where("rcode='$rcode'")->column('level');
141
+    }
142
+
143
+    // 插入角色权限关联数据
144
+    private function addRoleLevel($rcode, array $levels)
145
+    {
146
+        return parent::table('ay_role_level')->field('rcode,level')
147
+            ->relation($rcode, $levels)
148
+            ->insert();
149
+    }
150
+
151
+    // 删除角色权限关联数据
152
+    private function delRoleLevel($rcode)
153
+    {
154
+        return parent::table('ay_role_level')->where("rcode='$rcode'")->delete();
155
+    }
156
+
157
+    // 删除角色用户关联数据
158
+    private function delUserRole($rcode)
159
+    {
160
+        return parent::table('ay_user_role')->where("rcode='$rcode'")->delete();
161
+    }
162
+
163
+    // 修改角色用户关联数据
164
+    private function modUserRole($rcode, $data)
165
+    {
166
+        return parent::table('ay_user_role')->where("rcode='$rcode'")->update($data);
167
+    }
168
+}
169
+

+ 29
- 0
apps/admin/model/system/SyslogModel.php View File

@@ -0,0 +1,29 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年3月29日
7
+ *  日志模型类
8
+ */
9
+namespace app\admin\model\system;
10
+
11
+use core\basic\Model;
12
+
13
+class SyslogModel extends Model
14
+{
15
+
16
+    // 获取日志列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_syslog')->order('id DESC')
20
+            ->page()
21
+            ->select();
22
+    }
23
+
24
+    // 删除全部
25
+    public function clearLog()
26
+    {
27
+        return parent::table('ay_syslog')->delete();
28
+    }
29
+}

+ 89
- 0
apps/admin/model/system/TypeModel.php View File

@@ -0,0 +1,89 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年04月07日
7
+ *  类型模型类
8
+ */
9
+namespace app\admin\model\system;
10
+
11
+use core\basic\Model;
12
+
13
+class TypeModel extends Model
14
+{
15
+
16
+    // 获取类型列表
17
+    public function getList()
18
+    {
19
+        return parent::table('ay_type')->order('tcode DESC,sorting')
20
+            ->page()
21
+            ->select();
22
+    }
23
+
24
+    // 查找类型
25
+    public function findType($field, $keyword)
26
+    {
27
+        return parent::table('ay_type')->like($field, $keyword)
28
+            ->order('tcode DESC,sorting')
29
+            ->page()
30
+            ->select();
31
+    }
32
+
33
+    // 获取类型编码选择
34
+    public function getSelect()
35
+    {
36
+        return parent::table('ay_type')->distinct()
37
+            ->field('tcode,name')
38
+            ->order('tcode')
39
+            ->select();
40
+    }
41
+
42
+    // 检查类型
43
+    public function checkType($where)
44
+    {
45
+        return parent::table('ay_type')->field('id')
46
+            ->where($where)
47
+            ->find();
48
+    }
49
+
50
+    // 获取类型详情
51
+    public function getType($id)
52
+    {
53
+        return parent::table('ay_type')->where("id=$id")->find();
54
+    }
55
+
56
+    // 获取指定分类项
57
+    public function getItem($tcode)
58
+    {
59
+        return parent::table('ay_type')->field('item,value')
60
+            ->where("tcode='$tcode'")
61
+            ->select();
62
+    }
63
+
64
+    // 获取最后一个code
65
+    public function getLastCode()
66
+    {
67
+        return parent::table('ay_type')->order('id DESC')->value('tcode');
68
+    }
69
+
70
+    // 添加类型
71
+    public function addType(array $data)
72
+    {
73
+        return parent::table('ay_type')->autoTime()->insert($data);
74
+    }
75
+
76
+    // 删除类型
77
+    public function delType($id)
78
+    {
79
+        return parent::table('ay_type')->where("id=$id")->delete();
80
+    }
81
+
82
+    // 修改类型资料
83
+    public function modType($id, $data)
84
+    {
85
+        return parent::table('ay_type')->where("id=$id")
86
+            ->autoTime()
87
+            ->update($data);
88
+    }
89
+}

+ 166
- 0
apps/admin/model/system/UserModel.php View File

@@ -0,0 +1,166 @@
1
+<?php
2
+/**
3
+ * @copyright (C)2016-2099 Hnaoyun Inc.
4
+ * @author XingMeng
5
+ * @email hnxsh@foxmail.com
6
+ * @date 2017年04月07日
7
+ *  用户模型类
8
+ */
9
+namespace app\admin\model\system;
10
+
11
+use core\basic\Model;
12
+
13
+class UserModel extends Model
14
+{
15
+
16
+    // 获取用户列表
17
+    public function getList()
18
+    {
19
+        $result = parent::table('ay_user')->page()
20
+            ->order('id DESC')
21
+            ->select();
22
+        // 获取每用户的第一角色
23
+        foreach ($result as $key => $value) {
24
+            if ($value->ucode == '10001') {
25
+                $value->rolename = '创始人';
26
+                continue;
27
+            }
28
+            $roles = $this->getUserRole($value->ucode);
29
+            if ($roles) {
30
+                $value->rolename = $roles[0]->name;
31
+            } else {
32
+                $value->rolename = '';
33
+            }
34
+        }
35
+        return $result;
36
+    }
37
+
38
+    // 查找用户资料
39
+    public function findUser($field, $keyword)
40
+    {
41
+        $result = parent::table('ay_user')->like($field, $keyword)
42
+            ->order('id DESC')
43
+            ->page()
44
+            ->select();
45
+        // 获取每用户的第一角色
46
+        foreach ($result as $key => $value) {
47
+            if ($value->ucode == '10001') {
48
+                $value->rolename = '创始人';
49
+                continue;
50
+            }
51
+            $roles = $this->getUserRole($value->ucode);
52
+            if ($roles) {
53
+                $value->rolename = $roles[0]->name;
54
+            } else {
55
+                $value->rolename = '';
56
+            }
57
+        }
58
+        return $result;
59
+    }
60
+
61
+    // 获取用户列表
62
+    public function getSelect()
63
+    {
64
+        return parent::table('ay_user')->field('ucode,username,realname')
65
+            ->order('id DESC')
66
+            ->select();
67
+    }
68
+
69
+    // 检查用户
70
+    public function checkUser($where)
71
+    {
72
+        return parent::table('ay_user')->field('id')
73
+            ->where($where)
74
+            ->find();
75
+    }
76
+
77
+    // 获取用户详情
78
+    public function getUser($ucode)
79
+    {
80
+        $result = parent::table('ay_user')->where("ucode='$ucode'")->find();
81
+        // 用户角色信息
82
+        if ($result) {
83
+            $roles = $this->getUserRole($ucode);
84
+            $result->roles = $roles;
85
+            $result->rcodes = get_mapping($roles, 'rcode');
86
+        }
87
+        return $result;
88
+    }
89
+
90
+    // 获取最后一个code
91
+    public function getLastCode()
92
+    {
93
+        return parent::table('ay_user')->order('id DESC')->value('ucode');
94
+    }
95
+
96
+    // 添加用户
97
+    public function addUser(array $data, array $roles)
98
+    {
99
+        $result = parent::table('ay_user')->insert($data);
100
+        if ($result && $roles) {
101
+            $this->addUserRole($data['ucode'], $roles);
102
+        }
103
+        return $result;
104
+    }
105
+
106
+    // 删除用户
107
+    public function delUser($ucode)
108
+    {
109
+        $result = parent::table('ay_user')->where("ucode='$ucode' AND ucode<>10001")->delete();
110
+        if ($result) {
111
+            $this->delUserRole($ucode);
112
+        }
113
+        return $result;
114
+    }
115
+
116
+    // 修改用户资料
117
+    public function modUser($ucode, $data, array $roles = null)
118
+    {
119
+        $result = parent::table('ay_user')->where("ucode='$ucode'")->update($data);
120
+        if (is_array($roles)) {
121
+            $result = $this->delUserRole($ucode);
122
+            if ($roles) {
123
+                if (array_key_exists('ucode', $data)) {
124
+                    $ucode = $data['ucode'];
125
+                }
126
+                if ($ucode != '10001')
127
+                    $result = $this->addUserRole($ucode, $roles);
128
+            }
129
+        }
130
+        return $result;
131
+    }
132
+
133
+    // 获取指定用户角色表
134
+    private function getUserRole($ucode)
135
+    {
136
+        $table = array(
137
+            'ay_role',
138
+            'ay_user_role'
139
+        );
140
+        $field = array(
141
+            'ay_role.rcode',
142
+            'ay_role.name'
143
+        );
144
+        $where = array(
145
+            "ay_user_role.ucode='$ucode'",
146
+            "ay_role.rcode=ay_user_role.rcode"
147
+        );
148
+        return parent::table($table)->field($field)
149
+            ->where($where)
150
+            ->select();
151
+    }
152
+
153
+    // 插入用户角色关联数据
154
+    private function addUserRole($ucode, array $roles)
155
+    {
156
+        return parent::table('ay_user_role')->field('ucode,rcode')
157
+            ->relation($ucode, $roles)
158
+            ->insert();
159
+    }
160
+
161
+    // 删除用户角色关联数据
162
+    private function delUserRole($ucode)
163
+    {
164
+        return parent::table('ay_user_role')->where("ucode='$ucode' AND ucode<>10001")->delete();
165
+    }
166
+}

+ 20
- 0
apps/admin/view/default/common/foot.html View File

@@ -0,0 +1,20 @@
1
+<input type="hidden" id="do_check" data-url="{url./admin/Upgrade/check}">
2
+<input type="hidden" id="do_down" data-url="{url./admin/Upgrade/down}">
3
+<input type="hidden" id="do_update" data-url="{url./admin/Upgrade/update}">
4
+<input type="hidden" id="check_version" data-url="/index.php?p=upgrade/check&version={APP_VERSION}.{RELEASE_TIME}.{$revise}&branch={$branch}&snuser={$snuser}&site={$site}">
5
+<input type="hidden" id="check_cache" data-url="{url./admin/Upgrade/checkCache}">
6
+</div>
7
+
8
+<script type="text/javascript" src="{APP_THEME_DIR}/layui/layui.all.js?v=v2.5.4"></script>
9
+<script type="text/javascript" src="{APP_THEME_DIR}/js/comm.js?v=v3.1.1"></script>
10
+<script type="text/javascript" src="{APP_THEME_DIR}/js/mylayui.js?v=v3.1.0"></script>
11
+
12
+<script type="text/javascript" src="https://www.pbootcms.com/res/v1/js/update.js?v=v3.1.3" ></script>
13
+<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
14
+<!--[if lt IE 9]>
15
+  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
16
+  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
17
+<![endif]-->
18
+
19
+</body>
20
+</html>

+ 136
- 0
apps/admin/view/default/common/head.html View File

@@ -0,0 +1,136 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+  <meta charset="utf-8">
5
+  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6
+  <meta name="renderer"  content="webkit">
7
+  <title>{CMSNAME}管理中心-V{APP_VERSION}-{RELEASE_TIME}</title>
8
+  <link rel="shortcut icon" href="{SITE_DIR}/favicon.ico" type="image/x-icon">
9
+  <link rel="stylesheet" href="{APP_THEME_DIR}/layui/css/layui.css?v=v2.5.4">
10
+  <link rel="stylesheet" href="{APP_THEME_DIR}/font-awesome/css/font-awesome.min.css?v=v4.7.0" type="text/css">
11
+  <link rel="stylesheet" href="{APP_THEME_DIR}/css/comm.css?v=v3.0.6">
12
+  <link href="{APP_THEME_DIR}/css/jquery.treetable.css" rel="stylesheet" type="text/css" />
13
+  <script type="text/javascript" src="{APP_THEME_DIR}/js/jquery-1.12.4.min.js"></script>
14
+  <script type="text/javascript" src="{APP_THEME_DIR}/js/jquery.treetable.js"></script>
15
+</head>
16
+
17
+<body class="layui-layout-body">
18
+
19
+<!--定义部分地址方便JS调用-->
20
+<div style="display: none">
21
+	<span id="controller" data-controller="{C}"></span>
22
+	<span id="url" data-url="{URL}"></span>
23
+	<span id="preurl" data-preurl="{fun=url('/admin',false)}"></span>
24
+	<span id="sitedir" data-sitedir="{SITE_DIR}"></span>
25
+	<span id="mcode" data-mcode="{$get.mcode}"></span>
26
+</div>
27
+
28
+<div class="layui-layout layui-layout-admin">
29
+  <div class="layui-header">
30
+    <div class="layui-logo">
31
+    <a href="{url./admin/Index/home}">
32
+    
33
+	    {CMSNAME} 控制台
34
+    </a>
35
+    </div>
36
+    
37
+    <ul class="menu">
38
+    	<li class="menu-ico" title="显示或隐藏侧边栏"><i class="fa fa-bars" aria-hidden="true"></i></li>
39
+	</ul>
40
+	{if(![$one_area])}
41
+	<form method="post" action="{url./admin/Index/area}" class="area-select">
42
+		<input type="hidden" name="formcheck" value="{$formcheck}" > 
43
+		<div class="layui-col-xs8">
44
+		   <select name="acode">
45
+		       {$area_html}
46
+		   </select>
47
+		</div>
48
+		<div class="layui-col-xs4">
49
+		 	<button type="submit" class="layui-btn layui-btn-sm">切换</button>
50
+		</div>
51
+   	</form>
52
+ 	{/if}
53
+
54
+    <ul class="layui-nav layui-layout-right">
55
+    
56
+       <li class="layui-nav-item layui-hide-xs">
57
+      	 <a href="{SITE_DIR}/" target="_blank"><i class="fa fa-home" aria-hidden="true"></i> 网站主页</a>
58
+       </li>
59
+       
60
+        <li class="layui-nav-item layui-hide-xs">
61
+      	 <a href="{url.//admin/City/index}"><i class="fa fa-university" aria-hidden="true"></i> 城市分站</a>
62
+       </li>
63
+
64
+       <li class="layui-nav-item layui-hide-xs">
65
+       		<a href="{url./admin/Index/clearCache}" class="ajaxlink"><i class="fa fa-trash-o" aria-hidden="true"></i> 清理缓存</a>
66
+       </li>
67
+       
68
+       <li class="layui-nav-item layui-hide-xs">
69
+	        <a href="javascript:;">
70
+	          <i class="fa fa-user-circle-o" aria-hidden="true"></i> {$session.realname}
71
+	        </a>
72
+	        <dl class="layui-nav-child">
73
+	          <dd><a href="{url./admin/Index/ucenter}"><i class="fa fa-address-card-o" aria-hidden="true"></i> 密码修改</a></dd>
74
+	          <dd><a href="{url./admin/Index/loginOut}"><i class="fa fa-sign-out" aria-hidden="true"></i> 退出登录</a></dd>
75
+	         <!-- {if(session('ucode')==10001)}
76
+	          	<dd><a href="{url./admin/Upgrade/index}"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 在线更新</a></dd>
77
+	          	<dd><a href="{url./admin/Index/clearSession}" class="ajaxlink"><i class="fa fa-trash-o" aria-hidden="true"></i> 清理会话</a></dd>
78
+	          {/if} -->
79
+	        </dl>
80
+      </li>
81
+    </ul>
82
+  </div>
83
+  
84
+  <div class="layui-side layui-bg-black">
85
+    <div class="layui-side-scroll">
86
+      <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
87
+      <ul class="layui-nav layui-nav-tree" id="nav" lay-shrink="all">
88
+	   {foreach $menu_tree(key,value)}
89
+        <li class="layui-nav-item nav-item {if([$primary_menu_url]==$value->url)}layui-nav-itemed{/if}">
90
+          <a class="" href="javascript:;"><i class="fa [value->ico]" aria-hidden="true"></i>[value->name]</a>
91
+          <dl class="layui-nav-child">
92
+			{if($value->mcode=='M130')}
93
+				 {foreach $menu_models(key3,value3,num3)}
94
+				 	{if($value3->type==1)}
95
+						<dd><a href="{url./admin/Single/index/mcode/'.$value3->mcode.'}"><i class="fa fa-file-text-o" aria-hidden="true"></i>[value3->name]内容</a></dd>
96
+					{/if}
97
+					{if($value3->type==2)}
98
+						<dd><a href="{url./admin/Content/index/mcode/'.$value3->mcode.'}"><i class="fa fa-file-text-o" aria-hidden="true"></i>[value3->name]内容</a></dd>
99
+					{/if}
100
+				 {/foreach}
101
+			{else}
102
+				{foreach $value->son(key2,value2,num2)}
103
+					{if(!isset($value2->status)|| $value2->status==1)}
104
+	            		<dd><a href="{url.'.$value2->url.'}"><i class="fa [value2->ico]" aria-hidden="true"></i>[value2->name]</a></dd>
105
+	            	{/if}
106
+				{/foreach}
107
+				
108
+			<!-- 	{if($value->mcode=='M101' && session('ucode')==10001)}
109
+					<dd><a href="{url./admin/Upgrade/index}"><i class="fa fa-cloud-upload" aria-hidden="true"></i>在线更新</a></dd>
110
+				{/if} -->
111
+		    {/if}
112
+          </dl>
113
+        </li>
114
+		{/foreach}
115
+		
116
+		<li style="height:1px;background:#666" class="layui-hide-sm"></li>
117
+		
118
+		<li class="layui-nav-item layui-hide-sm">
119
+		 <a href="{SITE_DIR}/" target="_blank"><i class="fa fa-home" aria-hidden="true"></i> 网站主页</a>
120
+		</li>
121
+		
122
+		<li class="layui-nav-item layui-hide-sm">
123
+          <a href="{url./admin/Index/ucenter}"><i class="fa fa-address-card-o" aria-hidden="true"></i> 资料修改</a>
124
+        </li>
125
+        
126
+        <li class="layui-nav-item layui-hide-sm">
127
+         <a href="{url./admin/Index/clearCache}"><i class="fa fa-trash-o" aria-hidden="true"></i> 清理缓存</a>
128
+        </li>
129
+        
130
+        <li class="layui-nav-item layui-hide-sm">
131
+         <a href="{url./admin/Index/loginOut}"><i class="fa fa-sign-out" aria-hidden="true"></i> 退出登录</a>
132
+        </li>
133
+
134
+      </ul>
135
+    </div>
136
+  </div>

+ 36
- 0
apps/admin/view/default/common/ueditor.html View File

@@ -0,0 +1,36 @@
1
+<!-- 引入编辑器文件 -->
2
+<script type="text/javascript" charset="utf-8" src="{CORE_DIR}/extend/ueditor/ueditor.config.js"></script>
3
+<script type="text/javascript" charset="utf-8" src="{CORE_DIR}/extend/ueditor/ueditor.all.js"> </script>
4
+<script type="text/javascript" charset="utf-8" src="{CORE_DIR}/extend/ueditor/lang/zh-cn/zh-cn.js"></script>
5
+<script>
6
+//初始化编辑器
7
+$(document).ready(function (e) {
8
+	var ue = UE.getEditor('editor',{
9
+		maximumWords:30000 
10
+	});
11
+})
12
+</script>
13
+
14
+
15
+<script type="text/javascript">
16
+   <!-- 解决源码模式无法保存 -->
17
+  function editor_init() {
18
+      $('#edit').submit(function () {
19
+          editor=UE.getEditor('editor');
20
+          if(editor.queryCommandState('source')==1) editor.execCommand('source');
21
+      })
22
+  }
23
+ 
24
+  <!-- 点击后添加到编辑器 -->
25
+  $(".addedit").on("click",'img',function(){
26
+	    editor=UE.getEditor('editor');
27
+		$img = $(this).attr("src");
28
+		editor.execCommand('inserthtml',"<img src='"+$img+"'>");
29
+   });
30
+
31
+</script>
32
+
33
+<script type="text/javascript">editor_init();</script>
34
+
35
+
36
+

+ 113
- 0
apps/admin/view/default/content/company.html View File

@@ -0,0 +1,113 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this">公司信息</li>
8
+	  </ul>
9
+	  <div class="layui-tab-content">
10
+	  	<div class="layui-tab-item layui-show">
11
+	  		<form action="{url./admin/Company/mod}" method="post">
12
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
13
+	  			<div class="layui-form-item">
14
+                     <label class="layui-form-label">公司名称</label>
15
+                     <div class="layui-input-block">
16
+                     	<input type="text" name="name" value="{$companys->name}" placeholder="请输入公司名称"  class="layui-input">
17
+                     </div>
18
+                </div>
19
+                
20
+	  			<div class="layui-form-item">
21
+                     <label class="layui-form-label">公司地址</label>
22
+                     <div class="layui-input-block">
23
+                     	<input type="text" name="address" value="{$companys->address}" placeholder="请输入公司地址"  class="layui-input">
24
+                     </div>
25
+                </div>
26
+                
27
+                <div class="layui-form-item">
28
+                     <label class="layui-form-label">邮政编码</label>
29
+                     <div class="layui-input-block">
30
+                     	<input type="text" name="postcode" value="{$companys->postcode}" placeholder="请输入邮政编码"  class="layui-input">
31
+                     </div>
32
+                </div>
33
+                
34
+                <div class="layui-form-item">
35
+                     <label class="layui-form-label">联系人</label>
36
+                     <div class="layui-input-block">
37
+                     	<input type="text" name="contact" value="{$companys->contact}" placeholder="请输入联系人"  class="layui-input">
38
+                     </div>
39
+                </div>
40
+                
41
+                <div class="layui-form-item">
42
+                     <label class="layui-form-label">手机号码</label>
43
+                     <div class="layui-input-block">
44
+                     	<input type="text" name="mobile" value="{$companys->mobile}" placeholder="请输入手机号码"  class="layui-input">
45
+                     </div>
46
+                </div>
47
+                
48
+                <div class="layui-form-item">
49
+                     <label class="layui-form-label">电话号码</label>
50
+                     <div class="layui-input-block">
51
+                     	<input type="text" name="phone" value="{$companys->phone}" placeholder="请输入电话号码"  class="layui-input">
52
+                     </div>
53
+                </div>
54
+                
55
+                <div class="layui-form-item">
56
+                     <label class="layui-form-label">传真号码</label>
57
+                     <div class="layui-input-block">
58
+                     	<input type="text" name="fax" value="{$companys->fax}" placeholder="请输入传真号码"  class="layui-input">
59
+                     </div>
60
+                </div>
61
+
62
+                <div class="layui-form-item">
63
+                     <label class="layui-form-label">电子邮箱</label>
64
+                     <div class="layui-input-block">
65
+                     	<input type="text" name="email" value="{$companys->email}" placeholder="请输入电子邮箱"  class="layui-input">
66
+                     </div>
67
+                </div>
68
+                
69
+                <div class="layui-form-item">
70
+                     <label class="layui-form-label">QQ号码</label>
71
+                     <div class="layui-input-block">
72
+                     	<input type="text" name="qq" value="{$companys->qq}" placeholder="请输入QQ号码"  class="layui-input">
73
+                     </div>
74
+                </div>
75
+
76
+                <div class="layui-form-item">
77
+                     <label class="layui-form-label">微信图标</label>
78
+                     <div class="layui-input-inline">
79
+                     	<input type="text" name="weixin" id="weixin" value="{$companys->weixin}" placeholder="请上传微信图标"  class="layui-input">
80
+                     </div>
81
+                     <button type="button" class="layui-btn upload" data-des="weixin">
82
+					 	 <i class="layui-icon">&#xe67c;</i>上传图片
83
+					 </button>
84
+					 <div id="weixin_box" class="pic"><dl><dt>{if(@[$companys->weixin])}<img src="{SITE_DIR}{$companys->weixin}" data-url="{$companys->weixin}"></dt><dd>删除</dd></dl>{/if}</div>
85
+                </div>
86
+                
87
+                <div class="layui-form-item">
88
+                     <label class="layui-form-label">营业执照代码</label>
89
+                     <div class="layui-input-block">
90
+                     	<input type="text" name="blicense" value="{$companys->blicense}" placeholder="请输入营业执照代码"  class="layui-input">
91
+                     </div>
92
+                </div>
93
+
94
+                <div class="layui-form-item">
95
+                     <label class="layui-form-label">其它信息</label>
96
+                     <div class="layui-input-block">
97
+                     	<input type="text" name="other" value="{$companys->other}" placeholder="请输入其它信息"  class="layui-input">
98
+                     </div>
99
+                </div>
100
+                
101
+                <div class="layui-form-item">
102
+					 <div class="layui-input-block">
103
+					    <button class="layui-btn" lay-submit>立即提交</button>
104
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
105
+					 </div>
106
+				</div>
107
+	  		</form>
108
+	  	</div>
109
+	  </div>
110
+	</div>
111
+</div>
112
+
113
+{include file='common/foot.html'}

+ 952
- 0
apps/admin/view/default/content/content.html View File

@@ -0,0 +1,952 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">{$model_name}内容</li>
8
+	    <li lay-id="t2">{$model_name}新增</li>
9
+	  </ul>
10
+	  <div class="layui-tab-content">
11
+	  	   <div class="layui-tab-item layui-show">
12
+	  	   		<form action="{url./admin/Content/index/mcode/'.get('mcode').'}" method="get" class="layui-form">
13
+		  	   		<div class="layui-form-item nospace">
14
+		  	   			<div class="layui-input-inline">
15
+		  	   				{$pathinfo}
16
+					       <select name="scode">
17
+	                          	<option value="">全部栏目</option>
18
+                                {$search_select}
19
+	                       </select>
20
+					    </div>
21
+	                     <div class="layui-input-inline">
22
+	                     	<input type="text" name="keyword"  value="{$get.keyword}"  placeholder="请输入搜索关键字" class="layui-input">
23
+	                     </div>
24
+	                     <div class="layui-input-inline">
25
+	                     	<button class="layui-btn" lay-submit>搜索</button>
26
+	                     	<a class="layui-btn layui-btn-primary"  href="{url./admin/Content/index/mcode/'.get('mcode').'}">清除搜索</a>
27
+	                     </div>
28
+	                </div>
29
+	                
30
+	               
31
+                </form>
32
+                
33
+	  	   		<form action="{url./admin/Content/mod}" method="post" id="contentForm" name="contentForm" class="layui-form" onkeydown="if(event.keyCode==13) return false;">
34
+		            <input type="hidden" name="formcheck" value="{$formcheck}" > 
35
+		            <table class="layui-table">
36
+		            	<thead>
37
+		                    <tr>
38
+		                    	<th><input type="checkbox" class="checkbox" lay-ignore id="checkall" title="全选"></th>
39
+		                    	<th>ID</th>
40
+		                        <th>栏目</th>
41
+		                        <th>标题</th>
42
+		                        <th>发布时间</th>
43
+		                        <th>排序</th>
44
+		                        <th>状态</th>
45
+		                        <th>置顶</th>
46
+		                        <th>推荐</th>
47
+		                        <th>访问量</th>
48
+		                        <th>操作</th>
49
+		                    </tr>
50
+		                </thead>
51
+		                <tbody>
52
+		                    {foreach $contents(key,value)}
53
+		                    <tr>
54
+		                    	<td>
55
+		                    		<input type="checkbox" class="checkbox checkitem" lay-ignore name="list[]" {if($value->outlink)}disabled{/if} value="[value->id]">
56
+		                    		<input type="hidden" name="listall[]" value="[value->id]">
57
+		                    	</td>
58
+		                    	<td>[value->id]</td>
59
+		                        <td title="[value->scode]">[value->sortname]</td>
60
+		                        <td title="[value->title]">
61
+		                        {fun=substr_both($value->title,0,15)}
62
+		                        {if($value->isheadline)}
63
+		                        	<span class="layui-badge layui-bg-blue">头</span>
64
+		                        {/if}
65
+		                        {if($value->ico)}
66
+		                        	<span class="layui-badge layui-bg-orange">缩</span>
67
+		                        {/if}
68
+		                        {if($value->pics)}
69
+		                        	<span class="layui-badge">图</span>
70
+		                        {/if}
71
+		                        {if($value->outlink)}
72
+	                            	<span class="layui-badge layui-bg-black">链</span>
73
+	                            {/if}
74
+		                        </td>
75
+		                        <td>[value->date]</td>
76
+		                        <td class="table-input"><input type="text" lay-ignore class="layui-input" name="sorting[]" value="[value->sorting]"></td>
77
+		                        <td>
78
+		                        {if($value->status)}
79
+			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/0}" class="switch"><i class='fa fa-toggle-on' title="点击关闭"></i></a>
80
+			                        {else}
81
+			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/1}" class="switch"><i class='fa fa-toggle-off' title="点击开启"></i></a>
82
+			                    {/if}
83
+			                    </td>
84
+			                    <td>
85
+		                        {if($value->istop)}
86
+			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/istop/value/0}" class="switch"><i class='fa fa-toggle-on' title="点击关闭"></i></a>
87
+			                        {else}
88
+			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/istop/value/1}" class="switch"><i class='fa fa-toggle-off' title="点击开启"></i></a>
89
+			                    {/if}
90
+			                    </td>
91
+			                    <td>
92
+		                        {if($value->isrecommend)}
93
+			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/isrecommend/value/0}" class="switch"><i class='fa fa-toggle-on' title="点击关闭"></i></a>
94
+			                        {else}
95
+			                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/isrecommend/value/1}" class="switch"><i class='fa fa-toggle-off' title="点击开启"></i></a>
96
+			                    {/if}
97
+			                    </td>
98
+			                    <td>[value->visits]</td>
99
+		                        <td>
100
+		                         	{if(!$value->outlink)}
101
+			                        	{php}
102
+			                        		$Parser=new app\home\controller\ParserController();
103
+			                        		$link=$Parser->parserLink(2,$value->urlname,'content',$value->scode,$value->sortfilename,$value->id,$value->filename);
104
+			                        	{/php}
105
+	
106
+			                        	<input type="hidden" name="urls[[value->id]]" value="{php}echo $link{/php}">
107
+			                        	<a href="{php}echo $link{/php}" class="layui-btn layui-btn-xs layui-btn-primary"  target="_blank">查看</a>
108
+		                        	{/if}
109
+		                            {fun=get_btn_del($value->id)}
110
+		                            {if(check_level('mod'))}
111
+		                            	<a href="{url./admin/Content/mod/mcode/'.get('mcode').'/id/'.$value->id.'}{$btnqs}" class="layui-btn layui-btn-xs" >修改</a>
112
+		                            {/if}
113
+		                        </td>
114
+		                    </tr>
115
+		                    {/foreach}
116
+		                </tbody>
117
+		            </table>
118
+			       
119
+			        
120
+			        <div class="layui-inline" style="float:right">
121
+			     		<select lay-filter="tourl" class="page-select" >
122
+							<option value="" selected="">每页显示数量</option>
123
+							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/pagesize/20}" {if(get('pagesize')==20)}selected{/if}>20条/页</option>
124
+							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/pagesize/30}" {if(get('pagesize')==30)}selected{/if}>30条/页</option>
125
+							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/pagesize/50}" {if(get('pagesize')==50)}selected{/if}>50条/页</option>
126
+							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/pagesize/60}" {if(get('pagesize')==60)}selected{/if}>60条/页</option>
127
+							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/pagesize/100}" {if(get('pagesize')==100)}selected{/if}>100条/页</option>
128
+							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/pagesize/150}" {if(get('pagesize')==150)}selected{/if}>150条/页</option>
129
+							<option value="{url./admin/Content/index/mcode/'.get('mcode').'/pagesize/200}" {if(get('pagesize')==200)}selected{/if}>200条/页</option>
130
+						</select>
131
+					</div>
132
+						
133
+			        <div class="layui-input-inline">
134
+				     	 <select name="scode">
135
+	                        	<option value="">请选择移动/复制到栏目</option>
136
+	                             {$search_select}
137
+	                     </select>
138
+                    </div>
139
+                    
140
+                    <div class="layui-btn-group">
141
+	                    {if(check_level('mod'))}
142
+	                    	<button type="submit" name="submit" value="copy" class="layui-btn layui-btn-sm">复制</button>
143
+	                    	<button type="submit" name="submit" value="move" class="layui-btn layui-btn-sm">移动</button>
144
+	                    {/if}
145
+	                    
146
+	                    {if(check_level('del'))}
147
+				     		<button type="submit" name="submit" onclick="return setDelAction();" class="layui-btn layui-btn-sm">批量删除</button>
148
+				     	{/if}
149
+				     	
150
+				     	{if(check_level('mod'))}
151
+				     		<button type="submit" name="submit" value="sorting" class="layui-btn layui-btn-sm">保存排序</button>
152
+					     	{if([$baidu_zz_token])}
153
+					     		<button type="submit" name="submit" value="baiduzz" class="layui-btn layui-btn-sm">百度普通推送</button>
154
+					     	{/if}
155
+					     	{if([$baidu_ks_token])}
156
+					     		<button type="submit" name="submit" value="baiduks" class="layui-btn layui-btn-sm">百度快速推送</button>
157
+					     	{/if}
158
+				     	 {/if}
159
+			     	 </div>
160
+			     	<script>
161
+			     		function setDelAction(){
162
+			     			document.contentForm.action = "{url./admin/Content/del}"; 
163
+			     			return confirm("您确定要删除选中的内容么?");
164
+			     		}
165
+			     	</script>
166
+			     	
167
+			     	<div class="page">
168
+			     		{$pagebar}
169
+			     		
170
+			     	</div>
171
+			      </form> 
172
+	  	   </div>
173
+	  	   
174
+	  	   <div class="layui-tab-item">
175
+	  	  		<form action="{url./admin/Content/add/mcode/'.get('mcode').'}" method="post" class="layui-form" lay-filter="content" id="edit">
176
+		  	     	<input type="hidden" name="formcheck" value="{$formcheck}" > 
177
+		  	     	<div class="layui-tab">
178
+					  <ul class="layui-tab-title">
179
+					    <li class="layui-this">基本内容</li>
180
+					    <li>高级内容</li>
181
+					  </ul>
182
+					  <div class="layui-tab-content">
183
+					    <div class="layui-tab-item layui-show">
184
+					    	<div class="layui-form-item">
185
+			                     <label class="layui-form-label">内容栏目   <span class="layui-text-red">*</span></label>
186
+			                     <div class="layui-input-block">
187
+			                     	<select name="scode" lay-verify="required">
188
+				                        <option value="">请选择内容栏目</option>
189
+			                        	{$sort_select}
190
+				                    </select>
191
+			                     </div>
192
+			                </div>
193
+			                
194
+			                <div class="layui-form-item">
195
+			                     <label class="layui-form-label">内容标题   <span class="layui-text-red">*</span></label>
196
+			                     <div class="layui-input-block">
197
+			                     	<input type="text" name="title" required lay-verify="required" placeholder="请输入内容标题" class="layui-input">
198
+			                     </div>
199
+			                </div>
200
+			                
201
+			                 {foreach $extfield(key,value)}
202
+			                	{if($value->type==1)} <!-- 单行文本 -->
203
+			                	<div class="layui-form-item">
204
+			                		<label class="layui-form-label">[value->description]</label>
205
+			                		<div class="layui-input-block">
206
+				                    	<input type="text" name="[value->name]"  placeholder="请输入[value->description]"  class="layui-input">
207
+				                	</div>
208
+				                </div>
209
+			                	{/if}
210
+			                	
211
+			                	{if($value->type==2)}<!-- 多行文本 -->
212
+			                	<div class="layui-form-item">
213
+			                		<label class="layui-form-label">[value->description]</label>
214
+			                		<div class="layui-input-block">
215
+				                		<textarea name="[value->name]" class="layui-textarea" placeholder="请输入[value->description]"></textarea>
216
+				                	</div>
217
+				                </div>
218
+			                	{/if}
219
+			                	
220
+			                    {if($value->type==3)}<!-- 单选 -->
221
+			                	<div class="layui-form-item">
222
+			                		<label class="layui-form-label">[value->description]</label>
223
+			                		<div class="layui-input-block">
224
+				                		<div>
225
+				                			{php}
226
+				                				$radios=explode(',',$value->value);
227
+				                				foreach ($radios as $value2) {
228
+	                								echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'">';
229
+	            								}
230
+	            						     {/php}
231
+					                    </div>
232
+				                	</div>
233
+				                </div>
234
+			                	{/if}
235
+			                	
236
+			                    {if($value->type==4)}<!-- 多选 -->
237
+			                	<div class="layui-form-item">
238
+			                		<label class="layui-form-label">[value->description]</label>
239
+			                		<div class="layui-input-block">
240
+				                		<div>
241
+				                			{php}
242
+				                				$checkboxs=explode(',',$value->value);
243
+				                				foreach ($checkboxs as $value2) {
244
+	            									echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'">';
245
+	            								}
246
+	            						     {/php}
247
+					                    </div>
248
+				                	</div>
249
+				                </div>
250
+			                	{/if}
251
+			                	
252
+			                	{if($value->type==5)}<!-- 图片 -->
253
+			                	<div class="layui-form-item">
254
+			                		<label class="layui-form-label">[value->description]</label>
255
+			                		<div class="layui-input-inline">
256
+				                     	<input type="text" name="[value->name]" id="[value->name]" placeholder="请上传[value->description]"  class="layui-input">
257
+				                     </div>
258
+				                     <button type="button" class="layui-btn upload watermark" data-des="[value->name]">
259
+									 	 <i class="layui-icon">&#xe67c;</i>上传图片
260
+									 </button>
261
+									 <div id="[value->name]_box" class="pic"></div>
262
+				                </div>
263
+			                	{/if}
264
+			                	
265
+			                	{if($value->type==10)}<!-- 多图片 -->
266
+			                	 <div class="layui-form-item">
267
+				                     <label class="layui-form-label">[value->description]</label>
268
+				                     <div class="layui-input-inline">
269
+				                     	<input type="text" name="[value->name]" id="[value->name]" placeholder="请上传[value->description]"  class="layui-input">
270
+				                     </div>
271
+				                     <button type="button" class="layui-btn uploads watermark" data-des="[value->name]">
272
+									 	 <i class="layui-icon">&#xe67c;</i>上传多图
273
+									 </button>
274
+									 <div id="[value->name]_box" class="pic addedit"><dl></dl> <!-- 规避空内容拖动bug --></div>
275
+				                </div>
276
+				                {/if}
277
+			                	
278
+			                	{if($value->type==6)}<!-- 文件 -->
279
+			                	<div class="layui-form-item">
280
+			                		<label class="layui-form-label">[value->description]</label>
281
+			                		<div class="layui-input-inline">
282
+				                     	<input type="text" name="[value->name]" id="[value->name]" placeholder="请上传[value->description]"  class="layui-input">
283
+				                     </div>
284
+				                     <button type="button" class="layui-btn file" data-des="[value->name]">
285
+									 	 <i class="layui-icon">&#xe67c;</i>上传文件
286
+									 </button>
287
+				                </div>
288
+			                	{/if}
289
+			                	
290
+			                	{if($value->type==7)}<!-- 日期 -->
291
+				                <div class="layui-form-item">
292
+				                     <label class="layui-form-label">[value->description]</label>
293
+				                     <div class="layui-input-block">
294
+				                     	<input type="text" name="[value->name]" readonly placeholder="请选择[value->description]"  class="layui-input datetime">
295
+				                     </div>
296
+				                </div>
297
+			                	{/if}
298
+			                	
299
+			                	{if($value->type==8)}<!-- 编辑器 -->
300
+			                	<div class="layui-form-item">
301
+			                		<label class="layui-form-label">[value->description]</label>
302
+			                		<div class="layui-input-block">
303
+				                		<script type="text/plain" id="editor_[value->name]" name="[value->name]" style="width:100%;height:240px;"></script>
304
+				                		<script>
305
+											//初始化编辑器
306
+											$(document).ready(function (e) {
307
+												var ue = UE.getEditor('editor_[value->name]',{
308
+													maximumWords:10000 
309
+												});
310
+											})
311
+										</script>
312
+				                	</div>
313
+				                </div>
314
+			                	{/if}
315
+			                	
316
+			                	{if($value->type==9)}<!-- 下拉 -->
317
+			                	<div class="layui-form-item">
318
+			                		<label class="layui-form-label">[value->description]</label>
319
+			                		<div class="layui-input-block">
320
+			                			<select name="[value->name]">
321
+			                				{php}
322
+				                				$selects=explode(',',$value->value);
323
+				                				foreach ($selects as $value2) {
324
+	                								echo '<option value="'.$value2.'">'.$value2.'</option>';
325
+	            								}
326
+	            						     {/php}
327
+			                			</select>
328
+				                	</div>
329
+				                 </div>
330
+			                	 {/if}
331
+			                	
332
+			                {/foreach}
333
+			                
334
+			                <div class="layui-form-item">
335
+			                     <label class="layui-form-label">内容</label>
336
+			                     <div class="layui-input-block">
337
+			                     	<script type="text/plain" id="editor" name="content" style="width:100%;height:240px;"></script>
338
+			                     </div>
339
+			                </div>
340
+			                
341
+			                <div class="layui-form-item">
342
+			                     <label class="layui-form-label">tags</label>
343
+			                     <div class="layui-input-block">
344
+			                     	<input type="text" name="tags" placeholder="请输入文章tag,英文逗号隔开" class="layui-input">
345
+			                     </div>
346
+			                </div>
347
+			                
348
+			                <div class="layui-form-item">
349
+			                     <label class="layui-form-label">作者</label>
350
+			                     <div class="layui-input-block">
351
+			                     	<input type="text" name="author" placeholder="请输入作者" value="{$session.realname}" class="layui-input">
352
+			                     </div>
353
+			                </div>
354
+			                
355
+			                <div class="layui-form-item">
356
+			                     <label class="layui-form-label">来源</label>
357
+			                     <div class="layui-input-block">
358
+			                     	<input type="text" name="source" placeholder="请输入来源" value="本站" class="layui-input">
359
+			                     </div>
360
+			                </div>
361
+			                
362
+			                <div class="layui-form-item">
363
+			                     <label class="layui-form-label">缩略图</label>
364
+			                     <div class="layui-input-inline">
365
+			                     	<input type="text" name="ico" id="ico" placeholder="请上传缩略图"  class="layui-input">
366
+			                     </div>
367
+			                     <button type="button" class="layui-btn upload watermark" data-des="ico">
368
+								 	 <i class="layui-icon">&#xe67c;</i>上传图片
369
+								 </button>
370
+								 <div id="ico_box" class="pic addedit"></div>
371
+			                </div>
372
+			                
373
+			                <div class="layui-form-item">
374
+			                     <label class="layui-form-label">轮播多图</label>
375
+			                     <div class="layui-input-inline">
376
+			                     	<input type="text" name="pics" id="pics" placeholder="请上传轮播多图"  class="layui-input">
377
+			                     </div>
378
+			                     <button type="button" class="layui-btn uploads watermark" data-des="pics">
379
+								 	 <i class="layui-icon">&#xe67c;</i>上传多图
380
+								 </button>
381
+								 <div id="pics_box" class="pic addedit"><dl></dl> <!-- 规避空内容拖动bug --></div>
382
+			                </div>
383
+			                
384
+			                <div class="layui-form-item">
385
+			                     <label class="layui-form-label">参数</label>
386
+			                     <div class="layui-input-block">
387
+									<input type="checkbox" name="istop" value="1" title="置顶">
388
+			                    	<input type="checkbox" name="isrecommend" value="1" title="推荐">
389
+			                    	<input type="checkbox" name="isheadline" value="1" title="头条">
390
+			                     </div>
391
+			                </div>
392
+			                
393
+			                <div class="layui-form-item">
394
+			                     <label class="layui-form-label">浏览权限</label>
395
+			                     <div class="layui-input-block">
396
+									<select name="gid">
397
+										<option value="">不限制</option>
398
+				                        {foreach $groups(key,value)}
399
+				                            <option value="[value->id]">[value->gname]</option>
400
+				                        {/foreach}
401
+				                    </select>
402
+			                     </div>
403
+			                </div>  
404
+			                
405
+			                <div class="layui-form-item">
406
+			                     <label class="layui-form-label">权限类型</label>
407
+			                     <div class="layui-input-block">
408
+			                     	<select name="gtype" id="gtype" >
409
+			                     		<option value="1">小于</option>
410
+			                     		<option value="2">小于等于</option>
411
+			                     		<option value="3">等于</option>
412
+			                     		<option value="4" selected>大于等于</option>
413
+			                     		<option value="5">大于</option>
414
+									</select>
415
+			                     </div>
416
+			                </div>  
417
+					    </div>
418
+					    
419
+					    <div class="layui-tab-item ">
420
+					    	<div class="layui-form-item">
421
+			                     <label class="layui-form-label">内容副栏目</label>
422
+			                     <div class="layui-input-block">
423
+			                     	<select name="subscode">
424
+				                        <option value="">请选择内容副栏目</option>
425
+			                        	{$subsort_select}
426
+				                    </select>
427
+			                     </div>
428
+			                </div>
429
+			                
430
+					   		 <div class="layui-form-item">
431
+			                     <label class="layui-form-label">标题颜色</label>
432
+			                     <div class="layui-input-inline">
433
+			                     	<input type="text" name="titlecolor" placeholder="请选择标题颜色" value="#333333" class="layui-input jscolor {hash:true}">
434
+			                     </div>
435
+			                 </div>
436
+			                 
437
+			                 <div class="layui-form-item">
438
+			                     <label class="layui-form-label">副标题</label>
439
+			                     <div class="layui-input-block">
440
+			                     	<input type="text" name="subtitle" placeholder="请输入副标题" class="layui-input">
441
+			                     </div>
442
+			                 </div>
443
+			                 
444
+			                 <div class="layui-form-item">
445
+			                     <label class="layui-form-label">URL名称</label>
446
+			                     <div class="layui-input-block">
447
+			                     	<input type="text" name="filename" placeholder="请输入URL名称,如:test,test/a/b" class="layui-input">
448
+			                     </div>
449
+			                 </div>
450
+			                 
451
+			                  <div class="layui-form-item">
452
+			                     <label class="layui-form-label">跳转外链接</label>
453
+			                     <div class="layui-input-block">
454
+			                     	<input type="text" name="outlink" placeholder="请输入跳转外链接" class="layui-input">
455
+			                     </div>
456
+			                 </div>
457
+			                 
458
+			                <div class="layui-form-item">
459
+			                     <label class="layui-form-label">权限不足提示</label>
460
+			                     <div class="layui-input-block">
461
+			                     	<input type="text" name="gnote" placeholder="请输入权限不足时提示文本"  class="layui-input">
462
+			                     </div>
463
+			                </div>
464
+			                 
465
+			                 <div class="layui-form-item">
466
+			                     <label class="layui-form-label">发布时间</label>
467
+			                     <div class="layui-input-inline">
468
+			                     	<input type="text" name="date" value="{fun=date('Y-m-d H:i:s')}" readonly placeholder="请选择发布时间"  class="layui-input datetime">
469
+			                     </div>
470
+			                     <div class="layui-form-mid layui-word-aux">温馨提示:设置未来时间可定时发布!</div>
471
+			                </div>
472
+			                
473
+			                <div class="layui-form-item">
474
+		                		<label class="layui-form-label">附件</label>
475
+		                		<div class="layui-input-inline">
476
+			                     	<input type="text" name="enclosure" id="enclosure" placeholder="请上传附件"  class="layui-input">
477
+			                     </div>
478
+			                     <button type="button" class="layui-btn file" data-des="enclosure">
479
+								 	 <i class="layui-icon">&#xe67c;</i>上传附件
480
+								 </button>
481
+			                </div>
482
+			                
483
+			                <div class="layui-form-item">
484
+			                     <label class="layui-form-label">SEO关键字</label>
485
+			                     <div class="layui-input-block">
486
+			                     	<input type="text" name="keywords" placeholder="请输入详情页SEO关键字" class="layui-input">
487
+			                     </div>
488
+			                </div>
489
+			                
490
+			                <div class="layui-form-item">
491
+			                     <label class="layui-form-label">SEO描述</label>
492
+			                     <div class="layui-input-block">
493
+			                     	<textarea name="description" placeholder="请输入详情页SEO描述" class="layui-textarea"></textarea>
494
+			                     </div>
495
+			                </div>
496
+			                
497
+			                <div class="layui-form-item">
498
+			                     <label class="layui-form-label">状态</label>
499
+			                     <div class="layui-input-block">
500
+			                     	<input type="radio" name="status" value="1" title="显示" checked>
501
+									<input type="radio" name="status" value="0" title="隐藏">
502
+			                     </div>
503
+			                </div>
504
+					    </div>
505
+					  </div>
506
+					</div>
507
+					<div class="layui-form-item">
508
+						 <div class="layui-input-block">
509
+						    <button class="layui-btn" lay-submit>立即提交</button>
510
+						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
511
+						 </div>
512
+					</div>
513
+			   </form>
514
+	  	   </div>
515
+	  </div>
516
+	 </div>
517
+	{/if} 
518
+	
519
+	{if([$mod])}
520
+	
521
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
522
+	  <ul class="layui-tab-title">
523
+	    <li class="layui-this">{$model_name}内容修改</li>
524
+	  </ul>
525
+	  <div class="layui-tab-content">
526
+	  	<div class="layui-tab-item layui-show">
527
+	  		<form action="{url./admin/Content/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form" id="edit">
528
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
529
+	  			<div class="layui-tab">
530
+					  <ul class="layui-tab-title">
531
+					    <li class="layui-this">基本内容</li>
532
+					    <li>高级内容</li>
533
+					  </ul>
534
+					  <div class="layui-tab-content">
535
+					    <div class="layui-tab-item layui-show">
536
+					    	<div class="layui-form-item">
537
+			                     <label class="layui-form-label">内容栏目   <span class="layui-text-red">*</span></label>
538
+			                     <div class="layui-input-block">
539
+			                     	<select name="scode" lay-verify="required">
540
+				                        <option value="">请选择内容栏目</option>
541
+			                        	{$sort_select}
542
+				                    </select>
543
+			                     </div>
544
+			                </div>
545
+			                
546
+			                <div class="layui-form-item">
547
+			                     <label class="layui-form-label">内容标题   <span class="layui-text-red">*</span></label>
548
+			                     <div class="layui-input-block">
549
+			                     	<input type="text" name="title" required lay-verify="required" value="{$content->title}" placeholder="请输入内容标题" class="layui-input">
550
+			                     </div>
551
+			                </div>
552
+			                
553
+			                 {foreach $extfield(key,value)}
554
+			                	{if($value->type==1)} <!-- 单行文本 -->
555
+			                	<div class="layui-form-item">
556
+			                		<label class="layui-form-label">[value->description]</label>
557
+			                		<div class="layui-input-block">
558
+				                    	<input type="text" name="[value->name]" value="{$content->{$value->name}}"  placeholder="请输入[value->description]"  class="layui-input">
559
+				                	</div>
560
+				                </div>
561
+			                	{/if}
562
+			                	
563
+			                	{if($value->type==2)}<!-- 多行文本 -->
564
+			                	<div class="layui-form-item">
565
+			                		<label class="layui-form-label">[value->description]</label>
566
+			                		<div class="layui-input-block">
567
+				                		<textarea name="[value->name]" class="layui-textarea" placeholder="请输入[value->description]">{php}$name=$value->name;echo str_replace('<br>', "\r\n",$this->vars['content']->$name);{/php}</textarea>
568
+				                	</div>
569
+				                </div>
570
+			                	{/if}
571
+			                	
572
+			                    {if($value->type==3)}<!-- 单选 -->
573
+			                	<div class="layui-form-item">
574
+			                		<label class="layui-form-label">[value->description]</label>
575
+			                		<div class="layui-input-block">
576
+				                		<div>
577
+	            						     {php}
578
+				                				$radios=explode(',',$value->value);
579
+				                				$name=$value->name;
580
+				                				foreach ($radios as $value2) {
581
+				                					if($this->vars['content']->$name==$value2){
582
+	                									echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'" checked>';
583
+	                								}else{
584
+	                									echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'">';
585
+	                								}
586
+	            								}
587
+	            						     {/php}
588
+					                    </div>
589
+				                	</div>
590
+				                </div>
591
+			                	{/if}
592
+			                	
593
+			                    {if($value->type==4)}<!-- 多选 -->
594
+			                	<div class="layui-form-item">
595
+			                		<label class="layui-form-label">[value->description]</label>
596
+			                		<div class="layui-input-block">
597
+				                		<div>
598
+				                			
599
+	            						     {php}
600
+				                				$checkboxs=explode(',',$value->value);
601
+				                				$name=$value->name;
602
+				                				echo '<input name="'.$value->name.'" type="hidden">';//占位清空
603
+				                				$values=explode(',',$this->vars['content']->$name);
604
+				                				foreach ($checkboxs as $value2) {
605
+				                					if(in_array($value2,$values)){
606
+	            										echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'" checked>';
607
+	            									}else{
608
+	            										echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'">';
609
+	            									}
610
+	            								}
611
+	            						     {/php}
612
+					                    </div>
613
+				                	</div>
614
+				                </div>
615
+			                	{/if}
616
+			                	
617
+			                	{if($value->type==5)}<!-- 图片 -->
618
+			                	<div class="layui-form-item">
619
+			                		<label class="layui-form-label">[value->description]</label>
620
+			                		<div class="layui-input-inline">
621
+				                     	<input type="text" name="[value->name]" id="[value->name]" value="{$content->{$value->name}}" placeholder="请上传[value->description]"  class="layui-input">
622
+				                     </div>
623
+				                     <button type="button" class="layui-btn upload watermark" data-des="[value->name]">
624
+									 	 <i class="layui-icon">&#xe67c;</i>上传图片
625
+									 </button>
626
+									 {php}$name=$value->name; {/php}
627
+									 <div id="[value->name]_box" class="pic"><dl><dt>{if([$content]->$name)}<img src='{SITE_DIR}{$content->{$value->name}}' data-url="{$content->{$value->name}}"></dt><dd>删除</dd></dl>{/if}</div>
628
+				                </div>
629
+			                	{/if}
630
+			                	
631
+			                	{if($value->type==10)}<!-- 多图 -->
632
+			                	 <div class="layui-form-item">
633
+				                     <label class="layui-form-label">[value->description]</label>
634
+				                     <div class="layui-input-inline">
635
+				                     	<input type="text" name="[value->name]" id="[value->name]" value="{$content->{$value->name}}" placeholder="请上传[value->description]"  class="layui-input">
636
+				                     </div>
637
+				                     <button type="button" class="layui-btn uploads watermark" data-des="[value->name]">
638
+									 	 <i class="layui-icon">&#xe67c;</i>上传多图
639
+									 </button>
640
+									 <div id="[value->name]_box" class="pic addedit">
641
+									 	 <dl></dl> <!-- 规避空内容拖动bug -->
642
+										 {php}
643
+										 	$name=$value->name;
644
+										    if([$content->$name]){
645
+			                					$pics=explode(',',[$content->$name]);
646
+			                				}else{
647
+			                					$pics = array();
648
+			                				}
649
+			                				foreach ($pics as $key=>$value) {
650
+			                					//需要留一个空,不然被解析为标签了
651
+			                					echo "<dl><dt><img src='".SITE_DIR.$value."' data-url='".$value."'></dt><dd>删除</dd></dl>";
652
+		          							}
653
+		         						 {/php}
654
+	         						 </div>
655
+				                </div>
656
+			                	
657
+			                	{/if}
658
+			                	
659
+			                	{if($value->type==6)}<!-- 文件 -->
660
+			                	<div class="layui-form-item">
661
+			                		<label class="layui-form-label">[value->description]</label>
662
+			                		<div class="layui-input-inline">
663
+				                     	<input type="text" name="[value->name]" id="[value->name]" value="{$content->{$value->name}}" placeholder="请上传[value->description]"  class="layui-input">
664
+				                     </div>
665
+				                     <button type="button" class="layui-btn file" data-des="[value->name]">
666
+									 	 <i class="layui-icon">&#xe67c;</i>上传文件
667
+									 </button>
668
+				                </div>
669
+			                	{/if}
670
+			                	
671
+			                	{if($value->type==7)}<!-- 日期 -->
672
+				                <div class="layui-form-item">
673
+				                     <label class="layui-form-label">[value->description]</label>
674
+				                     <div class="layui-input-block">
675
+				                     	<input type="text" name="[value->name]" value="{$content->{$value->name}}" readonly placeholder="请选择[value->description]"  class="layui-input datetime">
676
+				                     </div>
677
+				                </div>
678
+			                	{/if}
679
+			                	
680
+			                	{if($value->type==8)}<!-- 编辑器 -->
681
+			                	<div class="layui-form-item">
682
+			                		<label class="layui-form-label">[value->description]</label>
683
+			                		<div class="layui-input-block">
684
+			                			{php}
685
+			                				$name=@$value->name;
686
+			                			{/php}
687
+				                		<script type="text/plain" id="editor_[value->name]" name="[value->name]" style="width:100%;height:240px;">{fun=decode_string([$content->$name])}</script>
688
+				                		<script>
689
+											//初始化编辑器
690
+											$(document).ready(function (e) {
691
+												var ue = UE.getEditor('editor_[value->name]',{
692
+													maximumWords:10000 
693
+												});
694
+											})
695
+										</script>
696
+				                	</div>
697
+				                </div>
698
+			                	{/if}
699
+			                	
700
+			                	{if($value->type==9)}<!-- 下拉 -->
701
+			                	<div class="layui-form-item">
702
+			                		<label class="layui-form-label">[value->description]</label>
703
+			                		<div class="layui-input-block">
704
+			                			<select name="[value->name]">
705
+			                				{php}
706
+				                				$selects=explode(',',$value->value);
707
+				                				$name=$value->name;
708
+				                				foreach ($selects as $value2) {
709
+				                					if($this->vars['content']->$name==$value2){
710
+				                						echo '<option value="'.$value2.'" selected>'.$value2.'</option>';
711
+	                								}else{
712
+	                									echo '<option value="'.$value2.'">'.$value2.'</option>';
713
+	                								}
714
+	            								}
715
+	            						    {/php}
716
+			                			</select>
717
+				                	</div>
718
+				                 </div>
719
+			                	 {/if}
720
+			                	
721
+			                {/foreach}
722
+			                
723
+			                <div class="layui-form-item">
724
+			                     <label class="layui-form-label">内容</label>
725
+			                     <div class="layui-input-block">
726
+			                     	<script type="text/plain" id="editor" name="content" style="width:100%;height:240px;">{fun=decode_string([$content->content])}</script>
727
+			                     </div>
728
+			                </div>
729
+			                
730
+			                <div class="layui-form-item">
731
+			                     <label class="layui-form-label">tags</label>
732
+			                     <div class="layui-input-block">
733
+			                     	<input type="text" name="tags" placeholder="请输入文章tag,英文逗号隔开" value="{$content->tags}" class="layui-input">
734
+			                     </div>
735
+			                </div>
736
+			                
737
+			                <div class="layui-form-item">
738
+			                     <label class="layui-form-label">作者</label>
739
+			                     <div class="layui-input-block">
740
+			                     	<input type="text" name="author" placeholder="请输入作者" value="{$content->author}" class="layui-input">
741
+			                     </div>
742
+			                </div>
743
+			                
744
+			                <div class="layui-form-item">
745
+			                     <label class="layui-form-label">来源</label>
746
+			                     <div class="layui-input-block">
747
+			                     	<input type="text" name="source" placeholder="请输入来源" value="{$content->source}" class="layui-input">
748
+			                     </div>
749
+			                </div>
750
+			                
751
+			                <div class="layui-form-item">
752
+			                     <label class="layui-form-label">缩略图</label>
753
+			                     <div class="layui-input-inline">
754
+			                     	<input type="text" name="ico" id="ico" value="{$content->ico}" placeholder="请上传缩略图"  class="layui-input">
755
+			                     </div>
756
+			                     <button type="button" class="layui-btn upload watermark" data-des="ico">
757
+								 	 <i class="layui-icon">&#xe67c;</i>上传图片
758
+								 </button>
759
+								 <div id="ico_box" class="pic addedit">{if([$content->ico])}<dl><dt><img src="{SITE_DIR}{$content->ico}" data-url="{$content->ico}"></dt><dd>删除</dd></dl>{/if}</div>
760
+			                </div>
761
+			                
762
+			                <div class="layui-form-item">
763
+			                     <label class="layui-form-label">轮播多图</label>
764
+			                     <div class="layui-input-inline">
765
+			                     	<input type="text" name="pics" id="pics" value="{$content->pics}" placeholder="请上传轮播多图"  class="layui-input">
766
+			                     </div>
767
+			                     <button type="button" class="layui-btn uploads watermark" data-des="pics">
768
+								 	 <i class="layui-icon">&#xe67c;</i>上传多图
769
+								 </button>
770
+								 <div id="pics_box" class="pic addedit">
771
+								 	 <dl></dl> <!-- 规避空内容拖动bug -->
772
+									 {php}
773
+									    if([$content->pics]){
774
+		                					$pics=explode(',',[$content->pics]);
775
+		                				}else{
776
+		                					$pics = array();
777
+		                				}
778
+		                				if([$content->picstitle]){
779
+		                					$picstitle=explode(',',[$content->picstitle]);
780
+		                				}else{
781
+		                					$picstitle = array();
782
+		                				}
783
+		                				foreach ($pics as $key=>$value) {
784
+		                					//需要留一个空,不然被解析为标签了
785
+		                					echo "<dl><dt><img src='".SITE_DIR.$value."' data-url='".$value."'></dt><dd>删除</dd><dt><input type='text' value='".$picstitle[$key ]."' name='picstitle[]' style='width:95%' /></dt></dl>";
786
+	          							}
787
+	         						 {/php}
788
+         						 </div>
789
+			                </div>
790
+			                
791
+			                <div class="layui-form-item">
792
+			                     <label class="layui-form-label">状态</label>
793
+			                     <div class="layui-input-block">
794
+									<input type="checkbox" name="istop" value="1" title="置顶" {if([$content->istop]==1)}checked{/if}>
795
+			                    	<input type="checkbox" name="isrecommend" value="1" title="推荐" {if([$content->isrecommend]==1)}checked{/if}>
796
+			                    	<input type="checkbox" name="isheadline" value="1" title="头条" {if([$content->isheadline]==1)}checked{/if}>
797
+			                     </div>
798
+			                </div>
799
+			                
800
+			                 <div class="layui-form-item">
801
+			                     <label class="layui-form-label">浏览权限</label>
802
+			                     <div class="layui-input-block">
803
+									<select name="gid">
804
+										<option value="">不限制</option>
805
+				                        {foreach $groups(key,value)}
806
+				                            <option value="[value->id]" {if([$content->gid]==$value->id)}selected="selected"{/if}>[value->gname]</option>
807
+				                        {/foreach}
808
+				                    </select>
809
+			                     </div>
810
+			                </div>  
811
+			                
812
+			                <div class="layui-form-item">
813
+			                     <label class="layui-form-label">权限类型</label>
814
+			                     <div class="layui-input-block">
815
+			                     	<select name="gtype" id="gtype" >
816
+			                     		<option value="1" {if([$content->gtype]==1)}selected="selected"{/if}>小于</option>
817
+			                     		<option value="2" {if([$content->gtype]==2)}selected="selected"{/if}>小于等于</option>
818
+			                     		<option value="3" {if([$content->gtype]==3)}selected="selected"{/if}>等于</option>
819
+			                     		<option value="4" {if([$content->gtype]==4||(![$sort->gtype]))}selected="selected"{/if}>大于等于</option>
820
+			                     		<option value="5" {if([$content->gtype]==5)}selected="selected"{/if}>大于</option>
821
+									</select>
822
+			                     </div>
823
+			                </div> 
824
+			                
825
+					    </div>
826
+					    
827
+					    <div class="layui-tab-item ">
828
+					    	<div class="layui-form-item">
829
+			                     <label class="layui-form-label">内容副栏目</label>
830
+			                     <div class="layui-input-block">
831
+			                     	<select name="subscode">
832
+				                        <option value="">请选择内容副栏目</option>
833
+			                        	{$subsort_select}
834
+				                    </select>
835
+			                     </div>
836
+			                </div>
837
+			                
838
+					   		 <div class="layui-form-item">
839
+			                     <label class="layui-form-label">标题颜色</label>
840
+			                     <div class="layui-input-inline">
841
+			                     	<input type="text" name="titlecolor" value="{$content->titlecolor}" placeholder="请选择标题颜色"  class="layui-input jscolor {hash:true}">
842
+			                     </div>
843
+			                 </div>
844
+			                 
845
+			                 <div class="layui-form-item">
846
+			                     <label class="layui-form-label">副标题</label>
847
+			                     <div class="layui-input-block">
848
+			                     	<input type="text" name="subtitle" value="{$content->subtitle}" placeholder="请输入副标题" class="layui-input">
849
+			                     </div>
850
+			                 </div>
851
+			                 
852
+			                 <div class="layui-form-item">
853
+			                     <label class="layui-form-label">URL名称</label>
854
+			                     <div class="layui-input-block">
855
+			                     	<input type="text" name="filename" value="{$content->filename}" placeholder="请输入URL名称,如:test,test/a/b" class="layui-input">
856
+			                     </div>
857
+			                 </div>
858
+			                 
859
+			                  <div class="layui-form-item">
860
+			                     <label class="layui-form-label">跳转外链接</label>
861
+			                     <div class="layui-input-block">
862
+			                     	<input type="text" name="outlink" value="{$content->outlink}" placeholder="请输入跳转外链接" class="layui-input">
863
+			                     </div>
864
+			                 </div>
865
+			                 
866
+			                <div class="layui-form-item">
867
+			                     <label class="layui-form-label">权限不足提示</label>
868
+			                     <div class="layui-input-block">
869
+			                     	<input type="text" name="gnote" value="{$content->gnote}"  placeholder="请输入权限不足时提示文本"  class="layui-input">
870
+			                     </div>
871
+			                </div>
872
+			                 
873
+			                 <div class="layui-form-item">
874
+			                     <label class="layui-form-label">发布时间</label>
875
+			                     <div class="layui-input-inline">
876
+			                     	<input type="text" name="date" value="{$content->date}" readonly placeholder="请选择发布时间"  class="layui-input datetime">
877
+			                     </div>
878
+			                     <div class="layui-form-mid layui-word-aux">温馨提示:设置未来时间可定时发布!</div>
879
+			                </div>
880
+			                
881
+			                <div class="layui-form-item">
882
+		                		<label class="layui-form-label">附件</label>
883
+		                		<div class="layui-input-inline">
884
+			                     	<input type="text" name="enclosure" id="enclosure" value="{$content->enclosure}" placeholder="请上传附件"  class="layui-input">
885
+			                     </div>
886
+			                     <button type="button" class="layui-btn file" data-des="enclosure">
887
+								 	 <i class="layui-icon">&#xe67c;</i>上传附件
888
+								 </button>
889
+			                </div>
890
+			                
891
+			                <div class="layui-form-item">
892
+			                     <label class="layui-form-label">SEO关键字</label>
893
+			                     <div class="layui-input-block">
894
+			                     	<input type="text" name="keywords" value="{$content->keywords}"  placeholder="请输入详情页SEO关键字" class="layui-input">
895
+			                     </div>
896
+			                </div>
897
+			                
898
+			                <div class="layui-form-item">
899
+			                     <label class="layui-form-label">SEO描述</label>
900
+			                     <div class="layui-input-block">
901
+			                     	<textarea name="description" placeholder="请输入详情页SEO描述" class="layui-textarea">{$content->description}</textarea>
902
+			                     </div>
903
+			                </div>
904
+			                
905
+			                <div class="layui-form-item">
906
+			                     <label class="layui-form-label">状态</label>
907
+			                     <div class="layui-input-block">
908
+			                     	<input type="radio" name="status" value="1" title="显示" {if([$content->status]==1)} checked="checked"{/if}>
909
+									<input type="radio" name="status" value="0" title="隐藏" {if([$content->status]==0)} checked="checked"{/if}>
910
+			                     </div>
911
+			                </div>
912
+					    </div>
913
+					  </div>
914
+					</div>
915
+					<div class="layui-form-item">
916
+						 <div class="layui-input-block">
917
+						    <button class="layui-btn" lay-submit>立即提交</button>
918
+						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
919
+						    {fun=get_btn_back()}
920
+						 </div>
921
+					</div>
922
+	  		</form>
923
+	  	</div>
924
+	  </div>
925
+	</div>
926
+	{/if} 
927
+
928
+</div>
929
+
930
+<style>.placeHolder {border:dashed 2px gray; }</style>
931
+<script type="text/javascript" src="{APP_THEME_DIR}/js/jquery.dragsort-0.5.2.min.js"></script>
932
+<script type="text/javascript">
933
+$("#pics_box").dragsort({
934
+	dragSelector: "dl",
935
+	dragSelectorExclude: "input,textarea,dd",
936
+	dragBetween: false,
937
+	dragEnd: saveOrder,
938
+	placeHolderTemplate: "<dl class='placeHolder'><dt></dt></dl>"
939
+});
940
+
941
+function saveOrder() {
942
+	var data = $("#pics_box dl dt img").map(function() {
943
+		return $(this).data("url");
944
+	}).get();
945
+	$("input[name=pics]").val(data.join(","))
946
+};
947
+
948
+</script>
949
+<script type="text/javascript" src="{APP_THEME_DIR}/js/jscolor.js"></script>
950
+
951
+{include file='common/ueditor.html'}
952
+{include file='common/foot.html'}

+ 615
- 0
apps/admin/view/default/content/contentsort.html View File

@@ -0,0 +1,615 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">栏目列表</li>
8
+	    <li lay-id="t2">栏目新增</li>
9
+	    <li lay-id="t3">批量新增</li>
10
+	  </ul>
11
+	  <div class="layui-tab-content">
12
+	  	   <div class="layui-tab-item layui-show">
13
+	  	   		 <form action="{url./admin/ContentSort/mod}" method="post" id="sortForm" name="sortForm">
14
+	  	   		 <input type="hidden" name="formcheck" value="{$formcheck}" > 
15
+	  	   		 <table class="layui-table" id="sortTable">
16
+	  	   		 	  <thead>
17
+		                    <tr>
18
+		                        <th><input type="checkbox" lay-ignore id="checkall" title="全选"></th>
19
+		                        <th>栏目名称</th>
20
+		                        <th>编码</th>
21
+		                        <th>URL名称</th>
22
+		                        <th>模型</th>
23
+		                        <th>列表页模板</th>
24
+		                        <th>详情页模板</th>
25
+		                        <th>排序</th>
26
+		                        <th>状态</th>
27
+		                        <th>操作</th>
28
+		                    </tr>
29
+		                </thead>
30
+		                <tbody>
31
+		                {foreach $sorts(key,value)}
32
+		                	
33
+		                    <tr data-tt-id='[value->scode]' data-tt-parent-id="[value->pcode]">
34
+		                    	<td>
35
+		                    		<input type="checkbox" class="checkitem" lay-ignore name="list[]" value="[value->scode]">
36
+		                    		<input type="hidden" name="listall[]" value="[value->id]">
37
+		                    	</td>
38
+		                        <td>
39
+		                            {if($value->son)}
40
+		                               <i class="fa fa-folder-o" aria-hidden="true"></i>
41
+		                            {else}
42
+		                               <i class="fa fa-folder-open-o" aria-hidden="true"></i>
43
+		                            {/if}
44
+		                            [value->name]
45
+		                           
46
+		                            
47
+		                            {if($value->outlink)}
48
+		                            	<a href="[value->outlink]" target="_blank"><i class="fa fa-external-link" aria-hidden="true"></i></a>
49
+		                            {else}
50
+		                            	{if($value->type==1)}
51
+		                            	 <a href="{url./admin/Single/index/mcode}/[value->mcode]&scode=[value->scode]"><i class="fa fa-file-text-o" aria-hidden="true"></i> </a>
52
+		                            	{else}
53
+		                            	 <a href="{url./admin/Content/index/mcode}/[value->mcode]&scode=[value->scode]"><i class="fa fa-file-text-o" aria-hidden="true"></i> </a>
54
+		                            	 {/if}
55
+		                            {/if}
56
+		                        </td>
57
+		                        <td>[value->scode]</td>
58
+		                        <td>[value->filename]</td>
59
+		                        <td>
60
+		                        {foreach $allmodels(key2,value2)}	
61
+		                        	{if($value2->mcode==$value->mcode)}
62
+										[value2->name]
63
+									{/if}                        	
64
+				                {/foreach}
65
+								</td>
66
+		                        <td>[value->listtpl]</td>
67
+		                        <td>[value->contenttpl]</td>
68
+		                        <td class="table-input"><input type="text" name="sorting[]" value="[value->sorting]" class="layui-input"></td>
69
+		                       	<td>
70
+		                            {if($value->status)}
71
+		                            <a href="{url./admin/'.C.'/mod/scode/'.$value->scode.'/field/status/value/0}" class="switch"><i class='fa fa-toggle-on' title="点击禁用"></i></a>
72
+		                            {else}
73
+		                            <a href="{url./admin/'.C.'/mod/scode/'.$value->scode.'/field/status/value/1}" class="switch"><i class='fa fa-toggle-off' title="点击启用"></i></a>
74
+		                            {/if}
75
+		                        </td>
76
+		                        <td>
77
+		                        	{if(!$value->outlink)}
78
+		                        		{php}
79
+			                        		$Parser=new app\home\controller\ParserController();
80
+			                        		$link=$Parser->parserLink($value->type,$value->urlname,'list',$value->scode,$value->filename,'','');
81
+			                        	{/php}
82
+			                        	<a href="{php}echo $link{/php}" class="layui-btn layui-btn-xs layui-btn-primary"  target="_blank">查看</a>
83
+		                        	{/if}
84
+		                
85
+		                            {fun=get_btn_del($value->scode,'scode')}
86
+		                            {fun=get_btn_mod($value->scode,'scode')}
87
+		                        </td>
88
+		                    </tr>
89
+		                {/foreach}
90
+		                </tbody>
91
+	  	   		 </table>
92
+	  	   		 <button type="submit" name="submit" value="sorting" class="layui-btn">保存排序</button>
93
+	  	   		 <button type="submit" name="submit" onclick="return setDelAction();" class="layui-btn">批量删除</button>
94
+	  	   		 <script>
95
+		     		function setDelAction(){
96
+		     			document.sortForm.action = "{url./admin/ContentSort/del}"; 
97
+		     			return confirm("您确定要删除选中的栏目么?");
98
+		     		}
99
+		     		
100
+		     		$("#sortTable").treetable({ expandable: true,column: 1,indent:20,stringCollapse:'收缩',stringExpand:'展开' });
101
+		     	</script>
102
+	  	   		</form>
103
+	  	    </div>
104
+	  	    
105
+	  	     <div class="layui-tab-item">
106
+	  	     	<form action="{url./admin/ContentSort/add}" method="post" class="layui-form" lay-filter="sort">
107
+		  	     	<input type="hidden" name="formcheck" value="{$formcheck}" > 
108
+		  	     	<div class="layui-tab">
109
+					  <ul class="layui-tab-title">
110
+					    <li class="layui-this">基本选项</li>
111
+					    <li>高级选项</li>
112
+					  </ul>
113
+					  <div class="layui-tab-content">
114
+					    <div class="layui-tab-item layui-show">
115
+					    	<div class="layui-form-item">
116
+			                     <label class="layui-form-label">父栏目</label>
117
+			                     <div class="layui-input-block">
118
+			                     	<select name="pcode">
119
+				                        <option value="0" >顶级栏目</option>
120
+				                        {$sort_select}
121
+				                    </select>
122
+			                     </div>
123
+			                </div>
124
+			                
125
+			                <div class="layui-form-item">
126
+			                     <label class="layui-form-label">栏目名称 <span class="layui-text-red">*</span></label>
127
+			                     <div class="layui-input-block">
128
+			                     	<input type="text" name="name" required lay-verify="required" placeholder="请输入栏目名称" class="layui-input">
129
+			                     </div>
130
+			                </div>
131
+			                
132
+			                <div class="layui-form-item">
133
+			                     <label class="layui-form-label">URL名称 </label>
134
+			                     <div class="layui-input-block">
135
+			                     	<input type="text" name="filename"  placeholder="请输入URL名称,如:test,test/a/b/c" class="layui-input">
136
+			                     </div>
137
+			                </div>
138
+			                
139
+			                <div class="layui-form-item">
140
+			                     <label class="layui-form-label">内容模型 <span class="layui-text-red">*</span></label>
141
+			                     <div class="layui-input-block">
142
+			                     	<select name="mcode" lay-filter="model" lay-verify="required" >
143
+				                     	<option value="">请选择内容模型</option>
144
+				                        {foreach $models(key,value)}	                        	
145
+				                        	<option value="[value->mcode]" data-type="[value->type]"  data-listtpl="[value->listtpl]" data-contenttpl="[value->contenttpl]" >[value->name]</option>
146
+				                        {/foreach}
147
+				                    </select>
148
+			                     </div>
149
+			                </div>
150
+			                
151
+			                 <input type="hidden" value="1" name="type" id="type">
152
+			                 
153
+			                 <div class="layui-form-item">
154
+			                     <label class="layui-form-label">列表页模板</label>
155
+			                     <div class="layui-input-block">
156
+				                     <select name="listtpl" id="listtpl">
157
+				                     	<option value="">无</option>
158
+				                     	{foreach $tpls(key,value)}
159
+				                        	<option value="[value]">[value]</option>
160
+				                        {/foreach}
161
+				                     </select>
162
+			                     </div>
163
+			                </div>
164
+			                
165
+			                 <div class="layui-form-item">
166
+			                     <label class="layui-form-label">详情页模板</label>
167
+			                     <div class="layui-input-block">
168
+				                     <select name="contenttpl" id="contenttpl" >
169
+				                     	<option value="">无</option>
170
+				                     	{foreach $tpls(key,value)}
171
+				                        	<option value="[value]">[value]</option>
172
+				                        {/foreach}
173
+				                     </select>
174
+			                     </div>
175
+			                </div>
176
+			                
177
+			                <div class="layui-form-item">
178
+			                     <label class="layui-form-label">状态</label>
179
+			                     <div class="layui-input-block">
180
+			                     	<input type="radio" name="status" value="1" title="显示" checked>
181
+									<input type="radio" name="status" value="0" title="隐藏">
182
+			                     </div>
183
+			                </div>  
184
+			                
185
+			               <div class="layui-form-item">
186
+			                     <label class="layui-form-label">浏览权限</label>
187
+			                     <div class="layui-input-block">
188
+									<select name="gid">
189
+										<option value="">不限制</option>
190
+				                        {foreach $groups(key,value)}
191
+				                            <option value="[value->id]">[value->gname]</option>
192
+				                        {/foreach}
193
+				                    </select>
194
+			                     </div>
195
+			                </div>  
196
+			                
197
+			                <div class="layui-form-item">
198
+			                     <label class="layui-form-label">权限类型</label>
199
+			                     <div class="layui-input-block">
200
+			                     	<select name="gtype" id="gtype" >
201
+			                     		<option value="1">小于</option>
202
+			                     		<option value="2">小于等于</option>
203
+			                     		<option value="3">等于</option>
204
+			                     		<option value="4" selected>大于等于</option>
205
+			                     		<option value="5">大于</option>
206
+									</select>
207
+			                     </div>
208
+			                </div>   
209
+			                    
210
+					    </div>
211
+					    <div class="layui-tab-item">
212
+					    	<div class="layui-form-item">
213
+			                     <label class="layui-form-label">栏目副名称</label>
214
+			                     <div class="layui-input-block">
215
+			                     	<input type="text" name="subname" placeholder="请输入栏目副名称" class="layui-input">
216
+			                     </div>
217
+			                </div>
218
+			                
219
+			                <div class="layui-form-item">
220
+			                     <label class="layui-form-label">栏目描述1</label>
221
+			                     <div class="layui-input-block">
222
+			                     	<input type="text" name="def1"  placeholder="请输入栏目描述1内容"  class="layui-input">
223
+			                     </div>
224
+			                </div>
225
+			                
226
+			                <div class="layui-form-item">
227
+			                     <label class="layui-form-label">栏目描述2</label>
228
+			                     <div class="layui-input-block">
229
+			                     	<input type="text" name="def2" placeholder="请输入栏目描述2内容"  class="layui-input">
230
+			                     </div>
231
+			                </div>
232
+			                
233
+			                <div class="layui-form-item">
234
+			                     <label class="layui-form-label">栏目描述3</label>
235
+			                     <div class="layui-input-block">
236
+			                     	<input type="text" name="def3" placeholder="请输入栏目描述3内容"  class="layui-input">
237
+			                     </div>
238
+			                </div>
239
+			                
240
+			                <div class="layui-form-item">
241
+			                     <label class="layui-form-label">跳转链接</label>
242
+			                     <div class="layui-input-block">
243
+			                     	<input type="text" name="outlink" placeholder="请输入跳转链接" class="layui-input">
244
+			                     </div>
245
+			                </div>
246
+			                
247
+			                <div class="layui-form-item">
248
+			                     <label class="layui-form-label">权限不足提示</label>
249
+			                     <div class="layui-input-block">
250
+			                     	<input type="text" name="gnote"  placeholder="请输入权限不足时提示文本"  class="layui-input">
251
+			                     </div>
252
+			                </div>
253
+			                
254
+			                 <div class="layui-form-item">
255
+			                     <label class="layui-form-label">栏目缩略图</label>
256
+			                     <div class="layui-input-inline">
257
+			                     	<input type="text" name="ico" id="ico" placeholder="请上传栏目缩略图"  class="layui-input">
258
+			                     </div>
259
+			                     <button type="button" class="layui-btn upload" data-des="ico">
260
+								 	 <i class="layui-icon">&#xe67c;</i>上传图片
261
+								 </button>
262
+								 <div id="ico_box" class="pic"></div>
263
+			                </div>
264
+			                
265
+			                <div class="layui-form-item">
266
+			                     <label class="layui-form-label">栏目大图</label>
267
+			                     <div class="layui-input-inline">
268
+			                     	<input type="text" name="pic" id="pic" placeholder="请上传栏目大图"  class="layui-input">
269
+			                     </div>
270
+			                     <button type="button" class="layui-btn upload" data-des="pic">
271
+								 	 <i class="layui-icon">&#xe67c;</i>上传图片
272
+								 </button>
273
+								 <div id="pic_box" class="pic"></div>
274
+			                </div>
275
+			                
276
+			                <div class="layui-form-item">
277
+			                     <label class="layui-form-label">SEO标题</label>
278
+			                     <div class="layui-input-block">
279
+			                     	<input type="text" name="title" placeholder="请输入栏目SEO标题,需前端调用" class="layui-input">
280
+			                     </div>
281
+			                </div>
282
+			                
283
+			                <div class="layui-form-item">
284
+			                     <label class="layui-form-label">SEO关键字</label>
285
+			                     <div class="layui-input-block">
286
+			                     	<input type="text" name="keywords" placeholder="请输入栏目SEO关键字,需前端调用" class="layui-input">
287
+			                     </div>
288
+			                </div>
289
+			                
290
+			                <div class="layui-form-item">
291
+			                     <label class="layui-form-label">SEO描述</label>
292
+			                     <div class="layui-input-block">
293
+			                     	<textarea name="description" placeholder="请输入栏目SEO描述,需前端调用" class="layui-textarea"></textarea>
294
+			                     </div>
295
+			                </div>
296
+					    </div>
297
+					  </div>
298
+					</div>
299
+					<div class="layui-form-item">
300
+						 <div class="layui-input-block">
301
+						    <button class="layui-btn" lay-submit>立即提交</button>
302
+						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
303
+						 </div>
304
+					</div>
305
+				</form>
306
+	  	     </div>
307
+	  	     
308
+	  	     <!-- 批量新增 -->
309
+	  	     <div class="layui-tab-item">
310
+	  	     	<form action="{url./admin/ContentSort/add}" method="post" class="layui-form" lay-filter="sort">
311
+		  	     		<input type="hidden" name="formcheck" value="{$formcheck}" > 
312
+		  	     		<div class="layui-form-item">
313
+		                     <label class="layui-form-label">父栏目</label>
314
+		                     <div class="layui-input-block">
315
+		                     	<select name="pcode">
316
+			                        <option value="0" >顶级栏目</option>
317
+			                        {$sort_select}
318
+			                    </select>
319
+		                     </div>
320
+		                </div>
321
+		                
322
+		                <div class="layui-form-item">
323
+		                     <label class="layui-form-label">栏目名称</label>
324
+		                     <div class="layui-input-block">
325
+		                     	<input type="text" name="multiplename" required lay-verify="required" placeholder="请输入栏目名称,多个栏目用逗号隔开" class="layui-input">
326
+		                     </div>
327
+		                </div>
328
+		                
329
+		                <div class="layui-form-item">
330
+		                     <label class="layui-form-label">内容模型</label>
331
+		                     <div class="layui-input-block">
332
+		                     	<select name="mcode" lay-filter="model" lay-verify="required" >
333
+			                     	<option value="">请选择内容模型</option>
334
+			                        {foreach $models(key,value)}	                        	
335
+			                        	<option value="[value->mcode]" data-type="[value->type]"  data-listtpl="[value->listtpl]" data-contenttpl="[value->contenttpl]" >[value->name]</option>
336
+			                        {/foreach}
337
+			                    </select>
338
+		                     </div>
339
+		                </div>
340
+		                
341
+		                 <input type="hidden" value="1" name="type" id="type">
342
+		                 
343
+		                 <div class="layui-form-item">
344
+		                     <label class="layui-form-label">列表页模板</label>
345
+		                     <div class="layui-input-block">
346
+			                     <select name="listtpl" id="listtpl">
347
+			                     	<option value="">无</option>
348
+			                     	{foreach $tpls(key,value)}
349
+			                        	<option value="[value]">[value]</option>
350
+			                        {/foreach}
351
+			                     </select>
352
+		                     </div>
353
+		                </div>
354
+		                
355
+		                 <div class="layui-form-item">
356
+		                     <label class="layui-form-label">详情页模板</label>
357
+		                     <div class="layui-input-block">
358
+			                     <select name="contenttpl" id="contenttpl" >
359
+			                     	<option value="">无</option>
360
+			                     	{foreach $tpls(key,value)}
361
+			                        	<option value="[value]">[value]</option>
362
+			                        {/foreach}
363
+			                     </select>
364
+		                     </div>
365
+		                </div>
366
+		                
367
+		                <div class="layui-form-item">
368
+		                     <label class="layui-form-label">状态</label>
369
+		                     <div class="layui-input-block">
370
+		                     	<input type="radio" name="status" value="1" title="显示" checked>
371
+								<input type="radio" name="status" value="0" title="隐藏">
372
+		                     </div>
373
+		                </div>    
374
+					<div class="layui-form-item">
375
+						 <div class="layui-input-block">
376
+						    <button class="layui-btn" lay-submit>立即提交</button>
377
+						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
378
+						 </div>
379
+					</div>
380
+				</form>
381
+	  	     </div>
382
+	   </div>
383
+	</div>
384
+	{/if} 
385
+	
386
+	{if([$mod])}
387
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
388
+	  <ul class="layui-tab-title">
389
+	    <li class="layui-this">栏目修改</li>
390
+	  </ul>
391
+	  <div class="layui-tab-content">
392
+	  	<div class="layui-tab-item layui-show">
393
+	  		<form action="{url./admin/ContentSort/mod/scode/'.[$get.scode].'}{$backurl}" method="post" class="layui-form" lay-filter="sort">
394
+	  	     	<input type="hidden" name="formcheck" value="{$formcheck}" > 
395
+	  	     	<div class="layui-tab">
396
+				  <ul class="layui-tab-title">
397
+				    <li class="layui-this">基本选项</li>
398
+				    <li>高级选项</li>
399
+				  </ul>
400
+				  <div class="layui-tab-content">
401
+				    <div class="layui-tab-item layui-show">
402
+				    	<div class="layui-form-item">
403
+		                     <label class="layui-form-label">父栏目</label>
404
+		                     <div class="layui-input-block">
405
+		                     	<select name="pcode" id="pcode">
406
+			                        <option value="0" >顶级栏目</option>
407
+			                        {$sort_select}
408
+			                    </select>
409
+		                     </div>
410
+		                </div>
411
+		                
412
+		                <div class="layui-form-item">
413
+		                     <label class="layui-form-label">栏目名称  <span class="layui-text-red">*</span></label>
414
+		                     <div class="layui-input-block">
415
+		                     	<input type="text" name="name" required lay-verify="required" value="{$sort->name}" placeholder="请输入栏目名称" class="layui-input">
416
+		                     </div>
417
+		                </div>
418
+		                
419
+		                <div class="layui-form-item">
420
+		                     <label class="layui-form-label">URL名称 </label>
421
+		                     <div class="layui-input-block">
422
+		                     	<input type="text" name="filename" value="{$sort->filename}"  placeholder="请输入URL名称,如:test,test/a/b/c" class="layui-input">
423
+		                     </div>
424
+		                </div>
425
+		                
426
+		                <div class="layui-form-item">
427
+		                     <label class="layui-form-label">内容模型  <span class="layui-text-red">*</span></label>
428
+		                     <div class="layui-input-block">
429
+		                     	<select name="mcode" lay-filter="model" lay-verify="required" >
430
+			                     	<option value="">请选择内容模型</option>
431
+			                        {foreach $models(key,value)}	                        	
432
+			                        	<option value="[value->mcode]"  {if($value->mcode==[$sort->mcode])}selected{/if}  data-type="[value->type]"  data-listtpl="[value->listtpl]" data-contenttpl="[value->contenttpl]" >[value->name]</option>
433
+			                        {/foreach}
434
+			                    </select>
435
+		                     </div>
436
+		                </div>
437
+		                
438
+		                 <input type="hidden" name="type" id="type" value="{$sort->type}">
439
+		                 
440
+		                 <div class="layui-form-item">
441
+		                     <label class="layui-form-label">列表页模板</label>
442
+		                     <div class="layui-input-block">
443
+			                     <select name="listtpl" id="listtpl">
444
+			                     	<option value="{$sort->listtpl}">{$sort->listtpl}</option>
445
+			                     	<option value="">无</option>
446
+			                     	{foreach $tpls(key,value)}
447
+			                     		{if($value!=[$sort->listtpl])}
448
+			                        		<option value="[value]">[value]</option>
449
+			                        	{/if}
450
+			                        {/foreach}
451
+			                     </select>
452
+		                     </div>
453
+		                </div>
454
+		                
455
+		                 <div class="layui-form-item">
456
+		                     <label class="layui-form-label">详情页模板</label>
457
+		                     <div class="layui-input-block">
458
+			                     <select name="contenttpl" id="contenttpl" >
459
+			                     	<option value="{$sort->contenttpl}">{$sort->contenttpl}</option>
460
+			                     	<option value="">无</option>
461
+			                     	{foreach $tpls(key,value)}
462
+			                     		{if($value!=[$sort->contenttpl])}
463
+			                        		<option value="[value]">[value]</option>
464
+			                        	{/if}
465
+			                        {/foreach}
466
+			                     </select>
467
+		                     </div>
468
+		                </div>
469
+		                
470
+		                <div class="layui-form-item">
471
+		                     <label class="layui-form-label">同步子栏目模板</label>
472
+		                     <div class="layui-input-block">
473
+		                     	<input type="radio" name="modsub" value="1" title="是">
474
+								<input type="radio" name="modsub" value="0" title="否" checked>
475
+		                     </div>
476
+		                </div> 
477
+		                
478
+		                <div class="layui-form-item">
479
+		                     <label class="layui-form-label">状态</label>
480
+		                     <div class="layui-input-block">
481
+		                     	<input type="radio" name="status" value="1" title="显示" {if([$sort->status]==1)}checked="checked"{/if}>
482
+								<input type="radio" name="status" value="0" title="隐藏" {if([$sort->status]==0)}checked="checked"{/if}>
483
+		                     </div>
484
+		                </div>
485
+		                
486
+		                 <div class="layui-form-item">
487
+			                     <label class="layui-form-label">浏览权限</label>
488
+			                     <div class="layui-input-block">
489
+									<select name="gid">
490
+										<option value="">不限制</option>
491
+				                        {foreach $groups(key,value)}
492
+				                            <option value="[value->id]" {if([$sort->gid]==$value->id)}selected="selected"{/if}>[value->gname]</option>
493
+				                        {/foreach}
494
+				                    </select>
495
+			                     </div>
496
+			                </div>  
497
+			                
498
+			                <div class="layui-form-item">
499
+			                     <label class="layui-form-label">权限类型</label>
500
+			                     <div class="layui-input-block">
501
+			                     	<select name="gtype" id="gtype" >
502
+			                     		<option value="1" {if([$sort->gtype]==1)}selected="selected"{/if}>小于</option>
503
+			                     		<option value="2" {if([$sort->gtype]==2)}selected="selected"{/if}>小于等于</option>
504
+			                     		<option value="3" {if([$sort->gtype]==3)}selected="selected"{/if}>等于</option>
505
+			                     		<option value="4" {if([$sort->gtype]==4||(![$sort->gtype]))}selected="selected"{/if}>大于等于</option>
506
+			                     		<option value="5" {if([$sort->gtype]==5)}selected="selected"{/if}>大于</option>
507
+									</select>
508
+			                     </div>
509
+			                </div> 
510
+
511
+		                
512
+				    </div>
513
+				    <div class="layui-tab-item">
514
+				    	<div class="layui-form-item">
515
+		                     <label class="layui-form-label">栏目副名称</label>
516
+		                     <div class="layui-input-block">
517
+		                     	<input type="text" name="subname" value="{$sort->subname}" placeholder="请输入栏目副名称" class="layui-input">
518
+		                     </div>
519
+		                </div>
520
+		                
521
+		                 <div class="layui-form-item">
522
+		                     <label class="layui-form-label">栏目描述1</label>
523
+		                     <div class="layui-input-block">
524
+		                     	<input type="text" name="def1"  value="{$sort->def1}"  placeholder="请输入栏目描述1内容"  class="layui-input">
525
+		                     </div>
526
+		                </div>
527
+		                
528
+		                <div class="layui-form-item">
529
+		                     <label class="layui-form-label">栏目描述2</label>
530
+		                     <div class="layui-input-block">
531
+		                     	<input type="text" name="def2" value="{$sort->def2}" placeholder="请输入栏目描述2内容"  class="layui-input">
532
+		                     </div>
533
+		                </div>
534
+		                
535
+		                <div class="layui-form-item">
536
+		                     <label class="layui-form-label">栏目描述3</label>
537
+		                     <div class="layui-input-block">
538
+		                     	<input type="text" name="def3" value="{$sort->def3}" placeholder="请输入栏目描述3内容"  class="layui-input">
539
+		                     </div>
540
+		                </div>
541
+			                
542
+		                <div class="layui-form-item">
543
+		                     <label class="layui-form-label">跳转链接</label>
544
+		                     <div class="layui-input-block">
545
+		                     	<input type="text" name="outlink" value="{$sort->outlink}" placeholder="请输入跳转链接" class="layui-input">
546
+		                     </div>
547
+		                </div>
548
+		                
549
+	                    <div class="layui-form-item">
550
+		                     <label class="layui-form-label">权限不足提示</label>
551
+		                     <div class="layui-input-block">
552
+		                     	<input type="text" name="gnote" value="{$sort->gnote}"  placeholder="请输入权限不足时提示文本"  class="layui-input">
553
+		                     </div>
554
+		                </div>
555
+		                
556
+		                 <div class="layui-form-item">
557
+		                     <label class="layui-form-label">栏目缩略图</label>
558
+		                     <div class="layui-input-inline">
559
+		                     	<input type="text" name="ico" id="ico" value="{$sort->ico}" placeholder="请上传栏目缩略图"  class="layui-input">
560
+		                     </div>
561
+		                     <button type="button" class="layui-btn upload" data-des="ico">
562
+							 	 <i class="layui-icon">&#xe67c;</i>上传图片
563
+							 </button>
564
+							 <div id="ico_box" class="pic"><dl><dt>{if([$sort->ico])}<img src='{SITE_DIR}{$sort->ico}' data-url="{$sort->ico}"></dt><dd>删除</dd></dl>{/if}</div>
565
+		                </div>
566
+		                
567
+		                 <div class="layui-form-item">
568
+		                     <label class="layui-form-label">栏目大图</label>
569
+		                     <div class="layui-input-inline">
570
+		                     	<input type="text" name="pic" id="pic" value="{$sort->pic}" placeholder="请上传栏目大图"  class="layui-input">
571
+		                     </div>
572
+		                     <button type="button" class="layui-btn upload" data-des="pic">
573
+							 	 <i class="layui-icon">&#xe67c;</i>上传图片
574
+							 </button>
575
+							 <div id="pic_box" class="pic"><dl><dt>{if([$sort->pic])}<img src='{SITE_DIR}{$sort->pic}' data-url="{$sort->pic}"></dt><dd>删除</dd></dl>{/if}</div>
576
+		                </div>
577
+		                
578
+		                <div class="layui-form-item">
579
+		                     <label class="layui-form-label">SEO标题</label>
580
+		                     <div class="layui-input-block">
581
+		                     	<input type="text" name="title" value="{$sort->title}" placeholder="请输入栏目SEO标题,需前端调用" class="layui-input">
582
+		                     </div>
583
+		                </div>
584
+		                
585
+		                <div class="layui-form-item">
586
+		                     <label class="layui-form-label">SEO关键字</label>
587
+		                     <div class="layui-input-block">
588
+		                     	<input type="text" name="keywords" value="{$sort->keywords}" placeholder="请输入栏目SEO关键字,需前端调用" class="layui-input">
589
+		                     </div>
590
+		                </div>
591
+		                
592
+		                <div class="layui-form-item">
593
+		                     <label class="layui-form-label">SEO描述</label>
594
+		                     <div class="layui-input-block">
595
+		                     	<textarea name="description" placeholder="请输入栏目SEO描述,需前端调用" class="layui-textarea">{$sort->description}</textarea>
596
+		                     </div>
597
+		                </div>
598
+				    </div>
599
+				  </div>
600
+				</div>
601
+				<div class="layui-form-item">
602
+					 <div class="layui-input-block">
603
+					    <button class="layui-btn" lay-submit>立即提交</button>
604
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
605
+					    {fun=get_btn_back()}
606
+					 </div>
607
+				</div>
608
+			</form>
609
+	  	</div>
610
+	  </div>
611
+	</div>
612
+	{/if} 
613
+</div>
614
+
615
+{include file='common/foot.html'}

+ 135
- 0
apps/admin/view/default/content/delecache.html View File

@@ -0,0 +1,135 @@
1
+{include file='common/head.html'}
2
+<style>
3
+.huancuna{
4
+display: inline-block;
5
+padding: 9px 25px;
6
+font-weight: 400;
7
+line-height: 20px;
8
+text-align: right;
9
+color:#ffffff;
10
+background-color: #009688;
11
+border-radius:2px;
12
+}
13
+.huancuna:hover{
14
+background-color: #33aba0;
15
+color:#ffffff;
16
+}
17
+
18
+</style>
19
+<div class="layui-body">
20
+	
21
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
22
+	  <ul class="layui-tab-title">
23
+	    <li class="layui-this" lay-id="t1">更新缓存</li>
24
+	  </ul>
25
+	  
26
+	  <div class="layui-tab-content">
27
+  	     <div class="layui-tab-item layui-form  layui-show">
28
+  	     
29
+  	     	 <div class="layui-form-item">
30
+                  <label class="layui-form-label">更新首页和栏目</label>
31
+                  <button type="button" class="layui-btn deletecache" data-type="1">立即更新首页和栏目</button>
32
+             </div>
33
+           
34
+     		 <div class="layui-form-item">
35
+                  <label class="layui-form-label">更新栏目分页</label>
36
+                  <div class="layui-input-inline">
37
+	                  <select name="scode">
38
+	                      <option value="0" >全部栏目</option>
39
+	                      {$sort_select}
40
+	                  </select>
41
+                  </div>
42
+                  <button type="button" class="layui-btn deletecache" data-type="2">立即更新栏目页</button>
43
+             </div>
44
+             
45
+             <div class="layui-form-item">
46
+                  <label class="layui-form-label">更新内容页</label> &nbsp;&nbsp;起始ID
47
+				  <input type="text" id="idzuixiao" value="1" placeholder="最小ID"  class="layui-input input" style="width:15%; display:inline;">
48
+				  &nbsp;&nbsp;结束ID
49
+				  <input type="text" id="idzuida" value="10" placeholder="最大ID"  class="layui-input input" style="width:15%; display:inline;">
50
+                  <button type="button" class="layui-btn deletecache" data-type="3">立即更新内容页</button>
51
+             </div>
52
+			 <div class="layui-form-item">
53
+                  <label class="layui-form-label">更新系统缓存</label>
54
+				  <a href="{url./admin/Index/clearOnlySysCache}" class="ajaxlink huancuna">清理系统缓存</a> 
55
+
56
+             </div>
57
+			 <div class="layui-form-item">
58
+                  <label class="layui-form-label">更新所有缓存</label>
59
+				  <a href="{url./admin/Index/clearCache}" class="ajaxlink huancuna">清理所有缓存</a> 
60
+
61
+             </div>
62
+			 <div class="layui-form-item" style="padding-left:20px; line-height:24px;">
63
+                  功能说明:
64
+				  <br />1、《更新首页和栏目》:随便使用。
65
+				  <br />2、《更新栏目分页》:每天发布量<200篇。7天一次。每天发布量<500篇。3天只需使用一次。每天发布量>1000篇。1天只需使用一次。
66
+				  <br />3、《更新内容页》:根据需要去更新,无全局更新永远不使用。
67
+				  <br />4、《更新系统缓存》:随便使用。
68
+				  <br />5、《更新所有缓存》:如果数据量小,随便使用。如果数据量大,无全局更新永远不要使用。
69
+				  <br />6、一定要做好301,保证链接的唯一性。
70
+             </div>
71
+
72
+  	     </div>
73
+	   </div>
74
+	</div>
75
+	
76
+</div>
77
+
78
+ <script>
79
+ $(".deletecache").on("click",function(){
80
+	 var type=$(this).data("type");
81
+	 var scode=$(this).parents(".layui-form-item").find("select").val();
82
+	 var idzuixiao=$("#idzuixiao").val();
83
+	 var idzuida=$("#idzuida").val();
84
+	 
85
+	 var lyindex;
86
+	 layui.use('layer', function(){
87
+		var layer = layui.layer;
88
+		lyindex = layer.open({
89
+			type: 1,
90
+			title:'温馨提示',
91
+			closeBtn:0,
92
+			content: '<div style="padding:20px 10px;"><img src="{APP_THEME_DIR}/layui/css/modules/layer/default/loading-0.gif">正在更新...<div>' 
93
+		});
94
+	 });
95
+	
96
+	var url= "?p=/DeleCache/index";
97
+	$.ajax({
98
+   	  type: 'GET',
99
+   	  url: url,
100
+   	  data:{
101
+   		  type:type,
102
+   		  scode:scode,
103
+		  idzuixiao:idzuixiao,
104
+		  idzuida:idzuida
105
+   	  },
106
+   	  dataType: 'json',
107
+   	  success: function (response, status) {
108
+   		  if(response.code==1){
109
+   			 layer.close(lyindex);
110
+      		 layer.msg(response.data, {icon: 1});
111
+   		  }else{
112
+   			layer.close(lyindex);
113
+   			layer.open({
114
+	  			  type: 0,
115
+	  			  title:'错误提示:',
116
+	  			  closeBtn:0,
117
+	  			  btn: ['确认'],
118
+	  			  content: response.data,
119
+	  			  yes: function(index, layero){
120
+	  				  layer.close(index); 
121
+	  			  }
122
+	  		 });
123
+   		  }
124
+        },
125
+        error:function(xhr,status,error){
126
+     	  layer.close(lyindex);
127
+       	  layer.msg("执行更新发生错误!", {icon: 5});
128
+        }
129
+   	});
130
+	
131
+ });
132
+ 
133
+ </script>
134
+
135
+{include file='common/foot.html'}

+ 68
- 0
apps/admin/view/default/content/exform.html View File

@@ -0,0 +1,68 @@
1
+<html xmlns:x="urn:schemas-microsoft-com:office:excel">
2
+<head>
3
+  <meta charset="utf-8">
4
+  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
5
+  <title>{$form->form_name}记录导出</title>
6
+  <style>
7
+	table,table tr th, table tr td{
8
+		border:1px solid #333;
9
+	}
10
+	table tr th, table tr td{
11
+		padding:2px 5px;
12
+	}
13
+	.text{
14
+		mso-number-format:\@;
15
+	}
16
+	table{
17
+		margin:10px 0;
18
+		border-collapse:collapse;
19
+	}
20
+	</style>
21
+	
22
+	<!--[if gte mso 9]><xml>
23
+            <x:ExcelWorkbook>
24
+                <x:ExcelWorksheets>
25
+                    <x:ExcelWorksheet>
26
+                        <x:Name>Sheet1</x:Name>
27
+                        <x:WorksheetOptions>
28
+                            <x:Print>
29
+                                <x:ValidPrinterInfo />
30
+                            </x:Print>
31
+                        </x:WorksheetOptions>
32
+                    </x:ExcelWorksheet>
33
+                </x:ExcelWorksheets>
34
+            </x:ExcelWorkbook>
35
+        </xml>
36
+        <![endif]-->
37
+	
38
+</head>
39
+<body>
40
+
41
+
42
+ <table class="layui-table">
43
+	<thead>
44
+		<tr>
45
+			<th>序号</th>
46
+			{foreach $fields(key1,value1,num1)}
47
+			  <th>[value1->description]</th>
48
+   			{/foreach}
49
+   			<th>时间</th>
50
+		</tr>
51
+	</thead>
52
+	<tbody>
53
+		{foreach $formdata(key,value,num)}
54
+		<tr>
55
+			<td>[num]</td>
56
+			{foreach $fields(key2,value2,num2)}
57
+		      	{php} $field=$value2->name {/php}
58
+		      	<td class="text">[value->$field]</td>
59
+ 	   		{/foreach}
60
+ 	   		<td>[value->create_time]</td>
61
+		</tr>
62
+		{/foreach}
63
+	</tbody>
64
+</table>
65
+
66
+</body>
67
+</html>
68
+	

+ 76
- 0
apps/admin/view/default/content/exmessage.html View File

@@ -0,0 +1,76 @@
1
+<html xmlns:x="urn:schemas-microsoft-com:office:excel">
2
+<head>
3
+  <meta charset="utf-8">
4
+  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
5
+  <title>留言记录导出</title>
6
+  <style>
7
+	table,table tr th, table tr td{
8
+		border:1px solid #333;
9
+	}
10
+	table tr th, table tr td{
11
+		padding:2px 5px;
12
+	}
13
+	.text{
14
+		mso-number-format:\@;
15
+	}
16
+	table{
17
+		margin:10px 0;
18
+		border-collapse:collapse;
19
+	}
20
+	</style>
21
+	
22
+	<!--[if gte mso 9]><xml>
23
+            <x:ExcelWorkbook>
24
+                <x:ExcelWorksheets>
25
+                    <x:ExcelWorksheet>
26
+                        <x:Name>Sheet1</x:Name>
27
+                        <x:WorksheetOptions>
28
+                            <x:Print>
29
+                                <x:ValidPrinterInfo />
30
+                            </x:Print>
31
+                        </x:WorksheetOptions>
32
+                    </x:ExcelWorksheet>
33
+                </x:ExcelWorksheets>
34
+            </x:ExcelWorkbook>
35
+        </xml>
36
+        <![endif]-->
37
+	
38
+</head>
39
+<body>
40
+
41
+
42
+ <table class="layui-table">
43
+	<thead>
44
+		<tr>
45
+			<th>序号</th>
46
+			{foreach $fields(key1,value1,num1)}
47
+			  <th class="text">[value1->description]</th>
48
+   			{/foreach}
49
+   			<th>时间</th>
50
+   			<th>访客信息</th>
51
+   			<th>回复内容</th>
52
+		</tr>
53
+	</thead>
54
+	<tbody>
55
+		{foreach $messages(key,value,num)}
56
+		<tr>
57
+			<td>[num]</td>
58
+			{foreach $fields(key2,value2,num2)}
59
+		      	{php} $field=$value2->name {/php}
60
+		      	<td>[value->$field]</td>
61
+ 	   		{/foreach}
62
+ 	   		<td>[value->create_time]</td>
63
+ 	   		<td>
64
+	      		IP:{fun=long2ip($value->user_ip)};
65
+				浏览器:[value->user_bs];
66
+				操作系统:[value->user_os]
67
+			</td>
68
+			<td>[value->recontent]</td>
69
+		</tr>
70
+		{/foreach}
71
+	</tbody>
72
+</table>
73
+
74
+</body>
75
+</html>
76
+	

+ 230
- 0
apps/admin/view/default/content/extfield.html View File

@@ -0,0 +1,230 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">扩展字段列表</li>
8
+	    <li lay-id="t2">扩展字段新增</li>
9
+	  </ul>
10
+	  <div class="layui-tab-content">
11
+	  	   <div class="layui-tab-item layui-show">
12
+	  	   		<table class="layui-table">
13
+	            	<thead>
14
+	                    <tr>
15
+	                    	<th>序号</th>
16
+	                        <th>内容模型</th>
17
+	                        <th>字段描述</th>
18
+	                        <th>字段名称</th>
19
+	                        <th>字段类型</th>
20
+	                        <th>排序</th>
21
+	                        <th>操作</th>
22
+	                    </tr>
23
+	                </thead>
24
+	                <tbody>
25
+	                    {foreach $extfields(key,value)}
26
+	                    <tr>
27
+	                    	<td>[num]</td>
28
+	                    	<td>
29
+	                    		{foreach $models(key2,value2,num2)}	
30
+	                        		{if($value2->mcode==$value->mcode)}
31
+										[value2->name]
32
+									{/if}                        	
33
+			                	{/foreach}
34
+							</td>
35
+	                        <td>[value->description]</td>
36
+	                        <td>[value->name]</td>
37
+	                        <td>
38
+	                        	{if($value->type==1)}单行文本{/if}
39
+	                    		{if($value->type==2)}多行文本{/if}
40
+	                    		{if($value->type==3)}单选按钮{/if}
41
+	                    		{if($value->type==4)}多选按钮{/if}
42
+	                    		{if($value->type==5)}单图上传{/if}
43
+	                    		{if($value->type==10)}多图上传{/if}
44
+	                    		{if($value->type==6)}附件上传{/if}
45
+	                    		{if($value->type==7)}日期选择{/if}
46
+	                    		{if($value->type==8)}编辑器{/if}
47
+	                    		{if($value->type==9)}下拉选择{/if}
48
+							</td>
49
+							<td>[value->sorting]</td>
50
+	                        <td>
51
+	                            {fun=get_btn_del($value->id)}
52
+	                            {fun=get_btn_mod($value->id)}
53
+	                        </td>
54
+	                    </tr>
55
+	                    {/foreach}
56
+	                </tbody>
57
+	            </table>
58
+	            <div class="page">{$pagebar}</div>
59
+	  	   </div>
60
+	  	   
61
+	  	    <div class="layui-tab-item">
62
+	   			<form action="{url./admin/ExtField/add}" method="post" class="layui-form">
63
+	   				<input type="hidden" name="formcheck" value="{$formcheck}" > 
64
+	   				<div class="layui-form-item">
65
+	                     <label class="layui-form-label">内容模型</label>
66
+	                     <div class="layui-input-block">
67
+	                     	 <select name="mcode" lay-verify="required">
68
+		                        <option value="">请选择内容模型</option>
69
+		                        {foreach $models(key,value)}	                        	
70
+		                        	<option value="[value->mcode]">[value->name]</option>
71
+		                        {/foreach}
72
+		                    </select>
73
+	                     </div>
74
+	                </div>
75
+	                
76
+	                <div class="layui-form-item">
77
+	                     <label class="layui-form-label">字段描述</label>
78
+	                     <div class="layui-input-block">
79
+	                     	<input type="text" name="description" required lay-verify="required"  placeholder="请输入字段描述,如:产品价格" class="layui-input">
80
+	                     </div>
81
+	                </div>
82
+	                
83
+	                <div class="layui-form-item">
84
+	                     <label class="layui-form-label">字段名称</label>
85
+	                     <div class="layui-input-block">
86
+	                     	<input type="text" name="name" required maxlength="20" lay-verify="required"  placeholder="请输入字段名称,字母、数组、下划线,如:price" class="layui-input">
87
+	                     </div>
88
+	                </div>
89
+	                
90
+	                <div class="layui-form-item">
91
+	                     <label class="layui-form-label">字段类型</label>
92
+	                     <div class="layui-input-block">
93
+	                     	 <select name="type" lay-verify="required">
94
+		                    	<option value="1">单行文本</option>
95
+		                    	<option value="2">多行文本</option>
96
+		                    	<option value="3">单选按钮</option>
97
+		                    	<option value="4">多选按钮</option>
98
+		                    	<option value="5">单图上传</option>
99
+		                    	<option value="10">多图上传</option>
100
+		                    	<option value="6">附件上传</option>
101
+		                    	<option value="7">日期选择</option>
102
+		                    	<option value="8">编辑器</option>
103
+		                    	<option value="9">下拉选择</option>
104
+		                    </select>
105
+	                     </div>
106
+	                </div>
107
+	                
108
+	                <div class="layui-form-item">
109
+	                     <label class="layui-form-label">选择按钮值</label>
110
+	                     <div class="layui-input-block">
111
+	                     	<textarea name="value" placeholder="多个选项用逗号隔开或者回车"  class="layui-textarea"></textarea>
112
+	                     	<div class="layui-form-mid layui-word-aux">只在类型为单选或多选时填写有效。</div>
113
+	                     </div>
114
+	                </div>
115
+	                
116
+	                <div class="layui-form-item">
117
+	                     <label class="layui-form-label">排序</label>
118
+	                     <div class="layui-input-block">
119
+	                     	<input type="text" name="sorting" required lay-verify="required" value="255" placeholder="请输入排序"  class="layui-input">
120
+	                     </div>
121
+	                </div>
122
+		   			
123
+	   				<div class="layui-form-item">
124
+						 <div class="layui-input-block">
125
+						    <button class="layui-btn" lay-submit>立即提交</button>
126
+						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
127
+						 </div>
128
+					</div>
129
+	   			</form>
130
+	   	 	</div>
131
+	   </div>
132
+	 </div>
133
+	{/if} 
134
+	
135
+	{if([$mod])}
136
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
137
+	  <ul class="layui-tab-title">
138
+	    <li class="layui-this">扩展字段修改</li>
139
+	  </ul>
140
+	  <div class="layui-tab-content">
141
+	  	<div class="layui-tab-item layui-show">
142
+	  		<form action="{url./admin/ExtField/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
143
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
144
+	  			<div class="layui-form-item">
145
+                     <label class="layui-form-label">内容模型</label>
146
+                     <div class="layui-input-block">
147
+                     	 <select name="mcode" lay-verify="required">
148
+	                        <option value="">请选择内容模型</option>
149
+	                        {foreach $models(key,value)}	                        	
150
+	                        	<option value="[value->mcode]" {if($value->mcode==[$extfield->mcode])}selected{/if}>[value->name]</option>
151
+	                        {/foreach}
152
+	                    </select>
153
+                     </div>
154
+                </div>
155
+                
156
+                <div class="layui-form-item">
157
+                     <label class="layui-form-label">字段描述</label>
158
+                     <div class="layui-input-block">
159
+                     	<input type="text" name="description"  value="{$extfield->description}" placeholder="请输入字段描述,如:产品价格" class="layui-input">
160
+                     </div>
161
+                </div>
162
+                
163
+                <div class="layui-form-item">
164
+                     <label class="layui-form-label">字段名称</label>
165
+                     <div class="layui-input-block">
166
+                     	<input type="text" name="name" readonly value="{$extfield->name}" maxlength="20" placeholder="请输入字段名称,字母、数组、下划线,如:price" class="layui-input readonly">
167
+                     </div>
168
+                </div>
169
+                
170
+                <div class="layui-form-item">
171
+                     <label class="layui-form-label">字段类型</label>
172
+                     <div class="layui-input-block">
173
+                     	 <select name="type" lay-verify="required">
174
+	                    	{if([$extfield->type]==2)}
175
+	                    		<option value="2" selected>多行文本</option>
176
+	                    	{/if}
177
+	                    	
178
+	                    	{if([$extfield->type]==7)}
179
+	                    		<option value="7" selected>日期选择</option>
180
+	                    	{/if}
181
+	                    	
182
+	                    	{if([$extfield->type]==8)}
183
+	                    		<option value="8" selected>编辑器</option>
184
+	                    	{/if}
185
+	                    	
186
+	                    	{if([$extfield->type]==10)}
187
+	                    		<option value="10" selected>多图上传</option>
188
+	                    	{/if}
189
+	                    	
190
+	                    	{if([$extfield->type]!=2 && [$extfield->type]!=7 && [$extfield->type]!=8 && [$extfield->type]!=10)}
191
+	                    		<option value="1" {if([$extfield->type]==1)}selected{/if}>单行文本</option>
192
+	                    		<option value="3" {if([$extfield->type]==3)}selected{/if}>单选按钮</option>
193
+	                    		<option value="4" {if([$extfield->type]==4)}selected{/if}>多选按钮</option>
194
+	                    		<option value="5" {if([$extfield->type]==5)}selected{/if}>单图上传</option>
195
+	                    		<option value="6" {if([$extfield->type]==6)}selected{/if}>附件上传</option>
196
+	                    		<option value="9" {if([$extfield->type]==9)}selected{/if}>下拉选择</option>
197
+	                    	{/if}
198
+	                    </select>
199
+                     </div>
200
+                </div>
201
+                
202
+                <div class="layui-form-item">
203
+                     <label class="layui-form-label">选择按钮值</label>
204
+                     <div class="layui-input-block">
205
+                     	<textarea name="value" placeholder="多个选项用逗号或回车隔开"  class="layui-textarea">{$extfield->value}</textarea>
206
+                     	<div class="layui-form-mid layui-word-aux">只在类型为单选或多选时填写有效,多个选项用逗号或回车隔开。</div>
207
+                     </div>
208
+                </div>
209
+                
210
+                <div class="layui-form-item">
211
+                     <label class="layui-form-label">排序</label>
212
+                     <div class="layui-input-block">
213
+                     	<input type="text" name="sorting" required lay-verify="required" value="{$extfield->sorting}" placeholder="请输入排序"  class="layui-input">
214
+                     </div>
215
+                </div>
216
+   			
217
+   				<div class="layui-form-item">
218
+					 <div class="layui-input-block">
219
+					    <button class="layui-btn" lay-submit>立即提交</button>
220
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
221
+					    {fun=get_btn_back()}
222
+					 </div>
223
+				</div>
224
+	  		</form>
225
+	  	</div>
226
+	  </div>
227
+	 </div>
228
+	{/if} 
229
+</div>
230
+{include file='common/foot.html'}

+ 327
- 0
apps/admin/view/default/content/form.html View File

@@ -0,0 +1,327 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">表单列表</li>
8
+	    <li lay-id="t2">表单新增</li>
9
+	  </ul>
10
+	  <div class="layui-tab-content">
11
+	  	   <div class="layui-tab-item layui-show">
12
+	  	   		<table class="layui-table">
13
+	            	<thead>
14
+	                    <tr>
15
+	                    	<th>编码</th>
16
+							<th>表单名称</th>
17
+	                        <th>表名称</th>
18
+	                        <th>数据</th>
19
+	                        <th>字段</th>
20
+	                        <th>操作</th>
21
+	                    </tr>
22
+	                </thead>
23
+	                <tbody>
24
+	                    {foreach $forms(key,value)}
25
+	                    <tr>
26
+	                    	<td>[value->fcode]</td>
27
+							<td>[value->form_name]</td>
28
+	                    	<td>[value->table_name]</td>
29
+	                    	<td>
30
+	                    	{if($value->id==1)}
31
+	                    	<a href="{url./admin/Message/index}"><i class="fa fa-list"></i> 查看数据</a></td>
32
+	                    	{else}
33
+	                    	<a href="{url./admin/Form/index/fcode/'.$value->fcode.'/action/showdata}"><i class="fa fa-list"></i> 查看数据</a></td>
34
+	                    	{/if}
35
+	                    	<td><a href="{url./admin/Form/index/fcode/'.$value->fcode.'/action/showfield}"><i class="fa fa-pencil-square-o"></i> 编辑字段</a></td>
36
+	                        <td>
37
+								
38
+	                        	{if($value->id!=1)}
39
+									<a href="{url./admin/Form/mod/id/'.$value->id.'/action/addmenu}{$btnqs}" class="layui-btn layui-btn-xs layui-btn-primary">添加到菜单</a>
40
+	                        		<a href="{url./admin/Form/del/id/'.$value->id.'/action/delform}" onclick="return confirm('您确定要删除么?')" class="layui-btn layui-btn-xs layui-btn-danger" title="删除">删除</a>
41
+	                            {/if}
42
+	                            <a href="{url./admin/Form/mod/id/'.$value->id.'/action/modform}{$btnqs}" class="layui-btn layui-btn-xs">修改</a>
43
+								
44
+	                        </td>
45
+	                    </tr>
46
+	                    {/foreach}
47
+	                </tbody>
48
+	            </table>
49
+	            <div class="page">{$pagebar}</div>
50
+	  	   </div>
51
+	  	   
52
+	  	    <div class="layui-tab-item">
53
+	   			<form action="{url./admin/Form/add/action/addform}" method="post" class="layui-form">
54
+	   				<input type="hidden" name="formcheck" value="{$formcheck}" > 
55
+	   				<div class="layui-form-item">
56
+	                     <label class="layui-form-label">表单名称</label>
57
+	                     <div class="layui-input-block">
58
+	                     	<input type="text" name="form_name" maxlength=20 required lay-verify="required"  placeholder="请输入表单名称,如:报名表" class="layui-input">
59
+	                     </div>
60
+	                </div>
61
+	                
62
+	                <div class="layui-form-item">
63
+	                     <label class="layui-form-label">表名称</label>
64
+	                     <div class="layui-input-block">
65
+	                     	<input type="text" name="table_name" maxlength=30 required lay-verify="required"  placeholder="请输入表名称,如:baoming" class="layui-input">
66
+	                     </div>
67
+	                </div>
68
+	                
69
+	   				<div class="layui-form-item">
70
+						 <div class="layui-input-block">
71
+						    <button class="layui-btn" lay-submit>立即提交</button>
72
+						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
73
+						 </div>
74
+					</div>
75
+	   			</form>
76
+	   	 	</div>
77
+	   </div>
78
+	 </div>
79
+	{/if} 
80
+	
81
+	{if([$showdata])}
82
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
83
+	  <ul class="layui-tab-title">
84
+	    <li class="layui-this" lay-id="t1">{$form->form_name} — 数据</li>
85
+	  </ul>
86
+	  <div class="layui-tab-content">
87
+	  	   <div class="layui-tab-item layui-show">
88
+	  	   		{foreach $formdata(key,value,num)}
89
+	  	   		<table class="layui-table table-two">
90
+	  	   			<thead>
91
+				  		<tr>
92
+					  		<th colspan="2">
93
+					  			{$form->form_name}-[num] 
94
+					  			<span style="float:right"><a href="{url./admin/Form/del/id/'.$value->id.'/fcode/'.[$form->fcode].'/action/deldata}" onclick="return confirm('您确定要删除么?')" class="layui-btn layui-btn-xs layui-btn-danger" style="margin-bottom:0px" title="删除">删除</a></span>
95
+					  		</th>
96
+					  	</tr>
97
+				    </thead>
98
+	  	   			<tbody>
99
+		  	   			{foreach $fields(key2,value2,num2)}
100
+			  	   			<tr>
101
+						      	<th>[value2->description]</th>
102
+						      	{php} $field=$value2->name {/php}
103
+						      	<td>[value->$field]</td>
104
+						    </tr>
105
+		  	   			{/foreach}
106
+		  	   			<tr>
107
+					      	<th>时间</th>
108
+					      	<td>[value->create_time]</td>
109
+					    </tr>
110
+	  	   			</tbody>
111
+	            </table>
112
+	            {/foreach}
113
+	            
114
+	            {if(session('ucode')==10001 && [$formdata])}
115
+			     	<a href="{url./admin/Form/clear/fcode/'.[$form->fcode].'}"  onclick='return confirm("您确定要清空么?")' class="layui-btn layui-btn-sm">清空记录</a>
116
+			    {/if}
117
+			    
118
+			    {if([$formdata])}
119
+			    	<a href="{url./admin/Form/index/fcode/'.[$form->fcode].'/action/showdata/export/1}" class="layui-btn layui-btn-sm">导出记录</a>
120
+			    {/if}
121
+			    
122
+	            <div class="page">{$pagebar}</div>
123
+	  	   </div>
124
+	  	 </div>
125
+	  </div>
126
+	{/if}  	  
127
+	
128
+	{if([$showfield])}
129
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
130
+	  <ul class="layui-tab-title">
131
+	    <li class="layui-this" lay-id="t1">{$form->form_name}-表单字段</li>
132
+	    <li lay-id="t2">新增字段</li>
133
+	  </ul>
134
+	  <div class="layui-tab-content">
135
+	  	   <div class="layui-tab-item layui-show">
136
+	  	   		<table class="layui-table">
137
+	            	<thead>
138
+	                    <tr>
139
+	                    	<th width=40>序号</th>
140
+	                    	<th>描述</th>
141
+	                    	<th>字段</th>
142
+	                    	<th>长度</th>
143
+	                    	<th>是否必填</th>
144
+	                    	<th>排序</th>
145
+	                        <th>操作</th>
146
+	                    </tr>
147
+	                </thead>
148
+	                <tbody>
149
+	                    {foreach $fields(key,value)}
150
+	                    <tr>
151
+	                    	<td>[num]</td>
152
+	                    	<td>[value->description]</td>
153
+	                    	<td>[value->name]</td>
154
+	                    	<td>[value->length]</td>
155
+	                    	<td>
156
+		                        {if($value->required)}
157
+		                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/required/value/0}"><i class='fa fa-toggle-on' title="点击关闭必填"></i></a>
158
+		                        {else}
159
+		                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/required/value/1}"><i class='fa fa-toggle-off' title="点击开启必填"></i></a>
160
+		                        {/if}
161
+	                    	</td>
162
+	                    	<td>[value->sorting]</td>
163
+	                        <td>
164
+	                       		<a href="{url./admin/Form/del/id/'.$value->id.'/fcode/'.[$get.fcode].'}" onclick="return confirm('您确定要删除么?')" class="layui-btn layui-btn-xs layui-btn-danger" title="删除">删除</a>
165
+	                            {fun=get_btn_mod($value->id)}
166
+	                        </td>
167
+	                    </tr>
168
+	                    {/foreach}
169
+	                </tbody>
170
+	            </table>
171
+	            <div class="page">{$pagebar}</div>
172
+	            <div><a href="{url./admin/Form/index}" class="layui-btn">返回表单</a></div>
173
+	  	   </div>
174
+	  	   
175
+	  	   <div class="layui-tab-item">
176
+	   			<form action="{url./admin/Form/add}" method="post" class="layui-form">
177
+					<input type="hidden" name="formcheck" value="{$formcheck}" > 
178
+	                <div class="layui-form-item">
179
+	                     <label class="layui-form-label">字段描述</label>
180
+	                     <div class="layui-input-block">
181
+	                     	<input type="hidden" value="{$get.fcode}" name="fcode" >
182
+	                     	<input type="text" name="description" required lay-verify="required"  placeholder="请输入字段描述,如:联系人" class="layui-input">
183
+	                     </div>
184
+	                </div>
185
+	                
186
+	                <div class="layui-form-item">
187
+	                     <label class="layui-form-label">字段名称</label>
188
+	                     <div class="layui-input-block">
189
+	                     	<input type="text" name="name" required maxlength="20" lay-verify="required"  placeholder="请输入字段名称,必须以字母开头,如:contacts" class="layui-input">
190
+	                     </div>
191
+	                </div>
192
+	                
193
+	                <div class="layui-form-item">
194
+	                     <label class="layui-form-label">字段长度</label>
195
+	                     <div class="layui-input-block">
196
+	                     	<input type="text" name="length" value="20" required lay-verify="required" class="layui-input">
197
+	                     </div>
198
+	                </div>
199
+	                
200
+	                <div class="layui-form-item">
201
+	                     <label class="layui-form-label">是否必填</label>
202
+	                     <div class="layui-input-block">
203
+	                     	<input type="radio" name="required" value="1" title="必填" checked>
204
+							<input type="radio" name="required" value="0" title="非必填"  checked>
205
+	                     </div>
206
+	                </div>
207
+	                
208
+	                <div class="layui-form-item">
209
+	                     <label class="layui-form-label">字段排序</label>
210
+	                     <div class="layui-input-block">
211
+	                     	<input type="text" name="sorting" value="255" required lay-verify="required" class="layui-input">
212
+	                     </div>
213
+	                </div>
214
+	   			
215
+	   				<div class="layui-form-item">
216
+						 <div class="layui-input-block">
217
+						    <button class="layui-btn" lay-submit>立即提交</button>
218
+						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
219
+						 </div>
220
+					</div>
221
+	   			</form>
222
+	   	 	</div>
223
+	   	 	
224
+	   </div>
225
+	 </div>
226
+	{/if} 
227
+	
228
+	
229
+	{if(@[$mod])}
230
+	
231
+	{if([$form])}
232
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
233
+	  <ul class="layui-tab-title">
234
+	    <li class="layui-this">自定义表单修改</li>
235
+	  </ul>
236
+	  <div class="layui-tab-content">
237
+	  	<div class="layui-tab-item layui-show">
238
+	  		<form action="{url./admin/Form/mod/id/'.[$get.id].'/action/modform}{$backurl}" method="post" class="layui-form">
239
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
240
+	  			<div class="layui-form-item">
241
+                     <label class="layui-form-label">表单名称</label>
242
+                     <div class="layui-input-block">
243
+                     	<input type="text" name="form_name" maxlength=20 required value="{$form->form_name}" lay-verify="required"  placeholder="请输入表单名称,如:报名表" class="layui-input">
244
+                     </div>
245
+                </div>
246
+                
247
+                <div class="layui-form-item">
248
+                     <label class="layui-form-label">表名称</label>
249
+                     <div class="layui-input-block">
250
+                     	<input type="text" maxlength=30 required readonly value="{$form->table_name}" lay-verify="required"  placeholder="请输入表名称,如:baoming" class="layui-input readonly">
251
+                     </div>
252
+                </div>
253
+
254
+   				<div class="layui-form-item">
255
+					 <div class="layui-input-block">
256
+					    <button class="layui-btn" lay-submit>立即提交</button>
257
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
258
+					    {fun=get_btn_back()}
259
+					 </div>
260
+				</div>
261
+	  		</form>
262
+	  	</div>
263
+	  </div>
264
+	 </div>
265
+	 {/if} 
266
+	 
267
+	 {if(@[$field])}
268
+	 <div class="layui-tab layui-tab-brief" lay-filter="tab">
269
+	  <ul class="layui-tab-title">
270
+	    <li class="layui-this">表单字段修改</li>
271
+	  </ul>
272
+	  <div class="layui-tab-content">
273
+	  	<div class="layui-tab-item layui-show">
274
+	  		<form action="{url./admin/Form/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
275
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
276
+                <div class="layui-form-item">
277
+                     <label class="layui-form-label">字段描述</label>
278
+                     <div class="layui-input-block">
279
+                     	<input type="text" name="description"  value="{$field->description}" placeholder="请输入字段描述,如:联系人" class="layui-input">
280
+                     </div>
281
+                </div>
282
+                
283
+                <div class="layui-form-item">
284
+                     <label class="layui-form-label">字段名称</label>
285
+                     <div class="layui-input-block">
286
+                     	<input type="text" name="name" readonly value="{$field->name}" class="layui-input readonly">
287
+                     </div>
288
+                </div>
289
+                
290
+                <div class="layui-form-item">
291
+                     <label class="layui-form-label">字段长度</label>
292
+                     <div class="layui-input-block">
293
+                     	<input type="text" name="length" readonly value="{$field->length}" class="layui-input readonly">
294
+                     </div>
295
+                </div>
296
+                
297
+                <div class="layui-form-item">
298
+                     <label class="layui-form-label">是否必填</label>
299
+                     <div class="layui-input-block">
300
+                     	<input type="radio" name="required" value="1" title="必填" {if([$field->required]==1)}checked{/if}>
301
+						<input type="radio" name="required" value="0" title="非必填" {if([$field->required]==0)}checked{/if}>
302
+                     </div>
303
+                </div>
304
+                
305
+                <div class="layui-form-item">
306
+                     <label class="layui-form-label">字段排序</label>
307
+                     <div class="layui-input-block">
308
+                     	<input type="text" name="sorting" value="{$field->sorting}" required lay-verify="required" class="layui-input">
309
+                     </div>
310
+                </div>
311
+   			
312
+   				<div class="layui-form-item">
313
+					 <div class="layui-input-block">
314
+					    <button class="layui-btn" lay-submit>立即提交</button>
315
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
316
+					    {fun=get_btn_back()}
317
+					 </div>
318
+				</div>
319
+	  		</form>
320
+	  	</div>
321
+	  </div>
322
+	 </div>
323
+	 {/if} 
324
+	 
325
+	{/if} 
326
+</div>
327
+{include file='common/foot.html'}

+ 254
- 0
apps/admin/view/default/content/label.html View File

@@ -0,0 +1,254 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+
5
+	{if([$list])}
6
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
7
+	  <ul class="layui-tab-title">
8
+	    <li class="layui-this" lay-id="t1">标签内容</li>
9
+	    <li lay-id="t2">标签管理</li>
10
+	    <li lay-id="t3">新增标签</li>
11
+	  </ul>
12
+	  <div class="layui-tab-content">
13
+	  	<div class="layui-tab-item layui-show">
14
+	  		<form action="{url./admin/Label/index}" method="post" class="layui-form">
15
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
16
+	  			{foreach $labels(key,value)}
17
+	  				{if($value->type==1)} <!-- 文本 -->
18
+		                <div class="layui-form-item">
19
+		                     <label class="layui-form-label">[value->description]<br><span class="layui-badge layui-bg-gray">{label:[value->name]}</span></label>
20
+		                     <div class="layui-input-block">
21
+		                     	<input type="text" name="[value->name]" value="[value->value]" placeholder="请输入[value->description]"  class="layui-input">
22
+		                     </div>
23
+		                </div>
24
+	                {/if}
25
+	                
26
+	                {if($value->type==2)}<!-- 日期 -->
27
+	                	 <div class="layui-form-item">
28
+		                     <label class="layui-form-label">[value->description]<br><span class="layui-badge layui-bg-gray">{label:[value->name]}</span></label>
29
+		                     <div class="layui-input-block">
30
+		                     	<input type="text" name="[value->name]" readonly value="[value->value]" placeholder="请选择[value->description]"  class="layui-input datetime">
31
+		                     </div>
32
+		                </div>
33
+	                {/if}
34
+	                
35
+	                {if($value->type==3)}<!-- 图片 -->
36
+	                	<div class="layui-form-item">
37
+		                     <label class="layui-form-label">[value->description]<br><span class="layui-badge layui-bg-gray">{label:[value->name]}</span></label>
38
+		                     <div class="layui-input-inline">
39
+		                     	<input type="text" name="[value->name]" id="[value->name]" value="[value->value]" placeholder="请上传[value->description]"  class="layui-input">
40
+		                     </div>
41
+		                     <button type="button" class="layui-btn upload" data-des="[value->name]">
42
+							 	 <i class="layui-icon">&#xe67c;</i>上传图片
43
+							 </button>
44
+							 <div id="[value->name]_box" class="pic">{if($value->value)}<dl><dt><img src="{SITE_DIR}[value->value]" data-url="[value->value]"></dt><dd>删除</dd></dl>{/if}</div>
45
+		                </div>
46
+	                {/if}
47
+	                
48
+	                {if($value->type==4)}<!-- 文件 -->
49
+	                	<div class="layui-form-item">
50
+		                     <label class="layui-form-label">[value->description]<br><span class="layui-badge layui-bg-gray">{label:[value->name]}</span></label>
51
+		                     <div class="layui-input-inline">
52
+		                     	<input type="text" name="[value->name]" id="[value->name]" value="[value->value]" placeholder="请上传[value->description]"  class="layui-input">
53
+		                     </div>
54
+		                     <button type="button" class="layui-btn file" data-des="[value->name]">
55
+							 	 <i class="layui-icon">&#xe67c;</i>上传文件
56
+							 </button>
57
+		                </div>
58
+	                {/if}
59
+	                
60
+	                {if($value->type==5)}<!-- 编辑器 -->
61
+	                	<div class="layui-form-item">
62
+		                     <label class="layui-form-label">[value->description]<br><span class="layui-badge layui-bg-gray">{label:[value->name]}</span></label>
63
+		                     <div class="layui-input-block">
64
+		                     	<script type="text/plain" id="[value->name]" name="[value->name]" style="width:100%;height:240px;">{fun=decode_string($value->value)}</script>
65
+		                     </div>
66
+		                </div>
67
+		                <script>
68
+							//初始化编辑器
69
+							$(document).ready(function (e) {
70
+								var ue = UE.getEditor('[value->name]',{
71
+									maximumWords:500 
72
+								});
73
+							})
74
+						</script>
75
+	                {/if}
76
+	                
77
+	                {if($value->type==6)} <!-- 开关 -->
78
+		                <div class="layui-form-item">
79
+		                     <label class="layui-form-label">[value->description]<br><span class="layui-badge layui-bg-gray">{label:[value->name]}</span></label>
80
+		                     <div class="layui-input-block">
81
+		                     	<input type="radio" name="[value->name]" value="1" title="开启" {if($value->value)}checked{/if}>
82
+      							<input type="radio" name="[value->name]" value="0" title="关闭" {if(!$value->value)}checked{/if}>
83
+		                     </div>
84
+		                </div>
85
+	                {/if}
86
+	                
87
+	                {if($value->type==7)} <!-- 多行文本 -->
88
+		                <div class="layui-form-item">
89
+		                     <label class="layui-form-label">[value->description]<br><span class="layui-badge layui-bg-gray">{label:[value->name]}</span></label>
90
+		                     <div class="layui-input-block">
91
+		                     	<textarea name="[value->name]" class="layui-textarea" placeholder="请输入[value->description]">{fun=str_replace("<br>","\r\n",html_entity_decode($value->value))}</textarea>
92
+		                     </div>
93
+		                </div>
94
+	                {/if}
95
+	                
96
+	  			{/foreach}
97
+	  			<div class="layui-form-item">
98
+					 <div class="layui-input-block">
99
+					    <button class="layui-btn" lay-submit>立即提交</button>
100
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
101
+					 </div>
102
+				</div>
103
+	  		</form>
104
+	  	</div>
105
+	  	
106
+	  	<div class="layui-tab-item">
107
+	  		<table class="layui-table">
108
+            	<thead>
109
+                    <tr>
110
+                        <th>序号</th>
111
+                        <th>名称</th>
112
+                        <th>描述</th>
113
+                        <th>类型</th>
114
+                        <th>添加人员</th>
115
+                        <th>修改人员</th>
116
+                        <th>添加时间</th>
117
+                        <th>修改时间</th>
118
+                        <th>操作</th>
119
+                    </tr>
120
+        		</thead>
121
+                <tbody>
122
+                {foreach $labels(key,value,num)}
123
+                    <tr>
124
+                        <td>[num]</td>
125
+                        <td>[value->name]</td>
126
+                        <td>[value->description]</td>
127
+                        <td>
128
+                        {if($value->type==1)}单行文本{/if}
129
+                        {if($value->type==7)}多行文本{/if}
130
+                        {if($value->type==2)}时间{/if}
131
+                        {if($value->type==3)}图片{/if}
132
+                        {if($value->type==4)}附件{/if}
133
+                        {if($value->type==5)}编辑器{/if}
134
+                        {if($value->type==6)}开关{/if}
135
+                        </td>
136
+                        <td>[value->create_user]</td>
137
+                        <td>[value->update_user]</td>
138
+                        <td>[value->create_time]</td>
139
+                        <td>[value->update_time]</td>
140
+                        <td>
141
+                            {fun=get_btn_del($value->id)}
142
+                            {fun=get_btn_mod($value->id)}
143
+                        </td>
144
+                    </tr>
145
+                {/foreach}
146
+                </tbody>
147
+            </table>
148
+	  	</div>
149
+	  	
150
+	  	<div class="layui-tab-item">
151
+	  		 <form action="{url./admin/Label/add}" method="post" class="layui-form">
152
+	  		 	<input type="hidden" name="formcheck" value="{$formcheck}" > 
153
+	  		 	<div class="layui-form-item">
154
+                     <label class="layui-form-label">标签名称</label>
155
+                     <div class="layui-input-block">
156
+                     	<input type="text" name="name" required  lay-verify="required" placeholder="请输入标签名称"  class="layui-input">
157
+                     	<div class="layui-form-mid layui-word-aux">只能含有字母、数字、下划线</div>
158
+                     </div>
159
+                     
160
+                </div>
161
+                
162
+                <div class="layui-form-item">
163
+                     <label class="layui-form-label">标签描述</label>
164
+                     <div class="layui-input-block">
165
+                     	<input type="text" name="description" required  lay-verify="required" placeholder="请输入标签描述"  class="layui-input">
166
+                     </div>
167
+                </div>
168
+                
169
+                <div class="layui-form-item">
170
+                     <label class="layui-form-label">标签类型</label>
171
+                     <div class="layui-input-block">
172
+                     	<select name="type" lay-verify="required">
173
+	                    	<option value="1">单行文本</option>
174
+	                    	<option value="7">多行文本</option>
175
+	                    	<option value="2">时间</option>
176
+	                    	<option value="3">图片</option>
177
+	                    	<option value="4">附件</option>
178
+	                    	<option value="5">编辑器</option>
179
+	                    	<option value="6">开关</option>
180
+	                    </select>
181
+                     </div>
182
+                </div>
183
+                
184
+                <div class="layui-form-item">
185
+					 <div class="layui-input-block">
186
+					    <button class="layui-btn" lay-submit>立即提交</button>
187
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
188
+					 </div>
189
+				</div>
190
+	  		 </form>
191
+	  	</div>
192
+	  	
193
+	  </div>
194
+	</div>
195
+	{/if} 
196
+	
197
+	
198
+	{if([$mod])}
199
+	
200
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
201
+	  <ul class="layui-tab-title">
202
+	    <li class="layui-this">标签修改</li>
203
+	  </ul>
204
+	  <div class="layui-tab-content">
205
+	  	<div class="layui-tab-item layui-show">
206
+	  		  <form action="{url./admin/Label/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
207
+	  		  	<input type="hidden" name="formcheck" value="{$formcheck}" > 
208
+	  		  	<div class="layui-form-item">
209
+                     <label class="layui-form-label">标签名称</label>
210
+                     <div class="layui-input-block">
211
+                     	<input type="text" name="name" required  lay-verify="required" value="{$label->name}"  placeholder="请输入标签名称"  class="layui-input">
212
+                     	<div class="layui-form-mid layui-word-aux">只能含有字母、数字、下划线</div>
213
+                     </div>
214
+                     
215
+                </div>
216
+                
217
+                <div class="layui-form-item">
218
+                     <label class="layui-form-label">标签描述</label>
219
+                     <div class="layui-input-block">
220
+                     	<input type="text" name="description" required  lay-verify="required"  value="{$label->description}" placeholder="请输入标签描述"  class="layui-input">
221
+                     </div>
222
+                </div>
223
+                
224
+                <div class="layui-form-item">
225
+                     <label class="layui-form-label">标签类型</label>
226
+                     <div class="layui-input-block">
227
+                     	<select name="type" lay-verify="required">
228
+	                    	<option value="1" {if([$label->type]==1)}selected{/if}>单行文本</option>
229
+	                    	<option value="7" {if([$label->type]==7)}selected{/if}>多行文本</option>
230
+	                    	<option value="2" {if([$label->type]==2)}selected{/if}>时间</option>
231
+	                    	<option value="3" {if([$label->type]==3)}selected{/if}>图片</option>
232
+	                    	<option value="4" {if([$label->type]==4)}selected{/if}>附件</option>
233
+	                    	<option value="5" {if([$label->type]==5)}selected{/if}>编辑器</option>
234
+	                    	<option value="6" {if([$label->type]==6)}selected{/if}>开关</option>
235
+	                    </select>
236
+                     </div>
237
+                </div>
238
+                
239
+                <div class="layui-form-item">
240
+					 <div class="layui-input-block">
241
+					    <button class="layui-btn" lay-submit>立即提交</button>
242
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
243
+					    {fun=get_btn_back()}
244
+					 </div>
245
+				</div>
246
+	  		  </form>
247
+	  	</div>
248
+	  </div>
249
+	 </div>
250
+	{/if}
251
+
252
+</div>
253
+{include file='common/ueditor.html'}
254
+{include file='common/foot.html'}

+ 170
- 0
apps/admin/view/default/content/link.html View File

@@ -0,0 +1,170 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">友情链接列表</li>
8
+	    <li lay-id="t2">友情链接新增</li>
9
+	  </ul>
10
+	  <div class="layui-tab-content">
11
+	  	<div class="layui-tab-item layui-show">
12
+	  		<form action="{url./admin/Link/mod}" method="post" class="layui-form" onkeydown="if(event.keyCode==13) return false;">
13
+		   	 <input type="hidden" name="formcheck" value="{$formcheck}" > 
14
+	  		<table class="layui-table">
15
+	  			<thead>
16
+                    <tr>
17
+                    	<th>分组(gid)</th>
18
+                        <th>名称</th>
19
+                        <th>链接</th>
20
+                        <th>Logo</th>
21
+                        <th>排序</th>
22
+                        <th>操作</th>
23
+                    </tr>
24
+                </thead>
25
+                <tbody>
26
+                    {foreach $links(key,value)}
27
+                    <tr>
28
+                    	<td>[value->gid]</td>
29
+                        <td>[value->name]</td>
30
+                        <td>[value->link]</td>
31
+                        <td><img src="{SITE_DIR}[value->logo]" style="height:20px;"></td>
32
+                        <td class="table-input">
33
+                        	<input type="hidden" name="listall[]" value="[value->id]">
34
+                        	<input type="text" lay-ignore class="layui-input" name="sorting[]" value="[value->sorting]">
35
+                        </td>
36
+                        <td>
37
+                            {fun=get_btn_del($value->id)}
38
+                            {fun=get_btn_mod($value->id)}
39
+                        </td>
40
+                    </tr>
41
+                    {/foreach}
42
+                </tbody>
43
+	  		</table>
44
+	  		 <button type="submit" name="submit" value="sorting" class="layui-btn layui-btn-sm">保存排序</button>
45
+            </form>
46
+	  		<div class="page">{$pagebar}</div>
47
+	  	</div>
48
+	  	<div class="layui-tab-item">
49
+	  		 <form action="{url./admin/Link/add}" method="post" class="layui-form">
50
+	  		 	<input type="hidden" name="formcheck" value="{$formcheck}" > 
51
+	  		 	<div class="layui-form-item">
52
+                     <label class="layui-form-label">分组</label>
53
+                     <div class="layui-input-block">
54
+                     	<select name="gid">	
55
+                     		{foreach $gids(key,value)}
56
+	                			<option value="[value]" >分组[value]</option>
57
+	                		{/foreach}
58
+	                		<option value="" >自动新增分组</option>
59
+	                	</select>
60
+                     </div>
61
+                </div>
62
+                
63
+                 <div class="layui-form-item">
64
+                     <label class="layui-form-label">名称</label>
65
+                     <div class="layui-input-block">
66
+                     	<input type="text" name="name" required  lay-verify="required" placeholder="请输入名称"  class="layui-input">
67
+                     </div>
68
+                </div>
69
+                
70
+                <div class="layui-form-item">
71
+                     <label class="layui-form-label">链接</label>
72
+                     <div class="layui-input-block">
73
+                     	<input type="text" name="link" required  lay-verify="required" placeholder="请输入链接"  class="layui-input">
74
+                     </div>
75
+                </div>
76
+                
77
+                <div class="layui-form-item">
78
+                     <label class="layui-form-label">图片</label>
79
+                     <div class="layui-input-inline">
80
+                     	<input type="text" name="logo" id="logo" placeholder="请上传图片"  class="layui-input">
81
+                     </div>
82
+                     <button type="button" class="layui-btn upload" data-des="logo">
83
+					 	 <i class="layui-icon">&#xe67c;</i>上传图片
84
+					 </button>
85
+					 <div id="logo_box" class="pic"></div>
86
+                </div>
87
+                
88
+                <div class="layui-form-item">
89
+                     <label class="layui-form-label">排序</label>
90
+                     <div class="layui-input-block">
91
+                     	<input type="text" name="sorting" required lay-verify="required" value="255" placeholder="请输入排序"  class="layui-input">
92
+                     </div>
93
+                </div>
94
+                
95
+                <div class="layui-form-item">
96
+					 <div class="layui-input-block">
97
+					    <button class="layui-btn" lay-submit>立即提交</button>
98
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
99
+					 </div>
100
+				</div>
101
+	  		 </form>
102
+	  	</div>
103
+	  </div>
104
+	</div>
105
+	{/if} 
106
+	
107
+	{if([$mod])}
108
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
109
+	  <ul class="layui-tab-title">
110
+	    <li class="layui-this">友情链接修改</li>
111
+	  </ul>
112
+	  <div class="layui-tab-content">
113
+	  	<div class="layui-tab-item layui-show">
114
+	  		 <form action="{url./admin/Link/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
115
+	  		 	<input type="hidden" name="formcheck" value="{$formcheck}" > 
116
+
117
+                <div class="layui-form-item">
118
+                     <label class="layui-form-label">分组</label>
119
+                     <div class="layui-input-block">
120
+                     	<input type="text" name="gid" required  lay-verify="required" value="{$link->gid}" placeholder="请输入分组"  class="layui-input">
121
+                     </div>
122
+                </div>
123
+                
124
+                <div class="layui-form-item">
125
+                     <label class="layui-form-label">名称</label>
126
+                     <div class="layui-input-block">
127
+                     	<input type="text" name="name" required  lay-verify="required" value="{$link->name}" placeholder="请输入名称"  class="layui-input">
128
+                     </div>
129
+                </div>
130
+                
131
+                <div class="layui-form-item">
132
+                     <label class="layui-form-label">链接</label>
133
+                     <div class="layui-input-block">
134
+                     	<input type="text" name="link" required  lay-verify="required" value="{$link->link}" placeholder="请输入链接"  class="layui-input">
135
+                     </div>
136
+                </div>
137
+                
138
+                <div class="layui-form-item">
139
+                     <label class="layui-form-label">图片</label>
140
+                     <div class="layui-input-inline">
141
+                     	<input type="text" name="logo" id="logo" placeholder="请上传图片"  value="{$link->logo}" class="layui-input">
142
+                     </div>
143
+                     <button type="button" class="layui-btn upload" data-des="logo">
144
+					 	 <i class="layui-icon">&#xe67c;</i>上传图片
145
+					 </button>
146
+					 <div id="logo_box" class="pic">{if([$link->logo])}<dl><dt><img src="{SITE_DIR}{$link->logo}" data-url="{$link->logo}"></dt><dd>删除</dd></dl>{/if}</div>
147
+                </div>
148
+                
149
+                 <div class="layui-form-item">
150
+                     <label class="layui-form-label">排序</label>
151
+                     <div class="layui-input-block">
152
+                     	<input type="text" name="sorting" required lay-verify="required" value="{$link->sorting}" placeholder="请输入排序"  class="layui-input">
153
+                     </div>
154
+                </div>
155
+                
156
+                 <div class="layui-form-item">
157
+					 <div class="layui-input-block">
158
+					    <button class="layui-btn" lay-submit>立即提交</button>
159
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
160
+					    {fun=get_btn_back()}
161
+					 </div>
162
+				</div>
163
+				
164
+	  		 </form>
165
+	  	</div>
166
+	  </div>
167
+	 </div>
168
+	{/if} 
169
+</div>
170
+{include file='common/foot.html'}

+ 148
- 0
apps/admin/view/default/content/message.html View File

@@ -0,0 +1,148 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">留言列表</li>
8
+	  </ul>
9
+	  <div class="layui-tab-content">
10
+		  <form method="get" name="contentForm" >
11
+	  	   <div class="layui-tab-item layui-show">
12
+	  	   		{foreach $messages(key,value,num)}
13
+	  	   		<table class="layui-table table-two">
14
+	  	   			<thead>
15
+				  		<tr>
16
+					  		<th colspan="2">
17
+								<input type="checkbox" name="checkbox" title="选择" lay-skin="primary" class="check" value="[value->id]">
18
+								<input type="hidden" name="listall[]" value="[value->id]">
19
+								在线留言-[num]
20
+					  			<span style="float:right">
21
+						  			{if($value->status)}
22
+		                            <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/0}"><i class='fa fa-toggle-on' title="点击前端隐藏" style="vertical-align:middle"></i></a>
23
+		                            {else}
24
+		                            <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/1}"><i class='fa fa-toggle-off' title="点击前端显示" style="vertical-align:middle"></i></a>
25
+		                            {/if}
26
+						  			{fun=get_btn_mod($value->id,'id','回复')}
27
+						  			{fun=get_btn_del($value->id)}
28
+					  			</span>
29
+					  		</th>
30
+					  	</tr>
31
+				    </thead>
32
+	  	   			<tbody>
33
+		  	   			{foreach $fields(key2,value2,num2)}
34
+			  	   			<tr>
35
+						      	<th>[value2->description]</th>
36
+						      	{php} $field=$value2->name {/php}
37
+						      	<td>[value->$field]</td>
38
+						    </tr>
39
+		  	   			{/foreach}
40
+		  	   			<tr>
41
+					      	<th>时间</th>
42
+					      	<td>[value->create_time]</td>
43
+					    </tr>
44
+					    <tr>
45
+					      	<th>访客信息</th>
46
+					      	<td>
47
+					      		IP:<a href="http://ip.taobao.com/ipSearch.html?ipAddr={fun=long2ip($value->user_ip)}" target="_blank" title="点击查看归属地">{fun=long2ip($value->user_ip)}</a>;
48
+								浏览器:[value->user_bs];
49
+								操作系统:[value->user_os]
50
+							</td>
51
+					    </tr>
52
+					    {if($value->username)}
53
+					    <tr>
54
+					      	<th>会员账号</th>
55
+					      	<td>[value->username]([value->nickname])</td>
56
+					    </tr>
57
+					    {/if}
58
+					    <tr>
59
+					      	<th>回复内容</th>
60
+					      	<td>[value->recontent]</td>
61
+					    </tr>
62
+	  	   			</tbody>
63
+	            </table>
64
+	            {/foreach}
65
+	            
66
+	            {if(session('ucode')==10001 && [$messages])}
67
+			     	<a href="{url./admin/Message/clear}"  onclick='return confirm("您确定要全部清空么?")' class="layui-btn layui-btn-sm">清空全部记录</a>
68
+			   		<a href="javascript:" onclick="selectall('checkbox')" class="layui-btn layui-btn-sm">全选</a>
69
+			   		<a href="javascript:" onclick="delselect(this);return false" class="layui-btn layui-btn-sm">清空选中记录</a>
70
+			    {/if}
71
+			    
72
+			    {if([$messages])}
73
+			    <a href="{url./admin/Message/index/export/1}" class="layui-btn layui-btn-sm">导出记录</a>
74
+			    {/if}
75
+			    
76
+	            <div class="page">{$pagebar}</div>
77
+	  	   </div>
78
+		  </form>
79
+	  	 </div>
80
+	</div>
81
+	{/if}
82
+	
83
+	{if([$mod])}
84
+	
85
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
86
+	  <ul class="layui-tab-title">
87
+	    <li class="layui-this">留言回复</li>
88
+	  </ul>
89
+	  <div class="layui-tab-content">
90
+	  	<div class="layui-tab-item layui-show">
91
+	  		 <form action="{url./admin/Message/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
92
+	  		 	<input type="hidden" name="formcheck" value="{$formcheck}" > 
93
+	  		 	<div class="layui-form-item">
94
+                     <label class="layui-form-label">回复内容</label>
95
+                     <div class="layui-input-block">
96
+                     	<textarea name="recontent" placeholder="请输入回复内容" class="layui-textarea">{$message->recontent}</textarea>
97
+                     </div>
98
+                </div>
99
+                
100
+                <div class="layui-form-item">
101
+                    <label class="layui-form-label">状态</label>
102
+                    <div class="layui-input-block">
103
+                    	<input type="radio" name="status" value="1" title="显示" {if([$message->status]==1)}checked="checked"{/if}>
104
+						<input type="radio" name="status" value="0" title="隐藏" {if([$message->status]==0)}checked="checked"{/if}>
105
+                    </div>
106
+                </div>
107
+                
108
+	  		 	<div class="layui-form-item">
109
+				 <div class="layui-input-block">
110
+				    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
111
+				    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
112
+				    {fun=get_btn_back()}
113
+				 </div>
114
+			   </div>
115
+			   
116
+	  		 </form>
117
+	  	</div>
118
+	  </div>
119
+	 </div>
120
+
121
+	{/if} 
122
+	
123
+</div>
124
+<script>
125
+
126
+	function selectall(objName){
127
+		var objNameList=document.getElementsByName(objName);
128
+		if(null!=objNameList){
129
+			for(var i=0;i<objNameList.length;i++){
130
+				objNameList[i].checked="checked";
131
+			}
132
+		}
133
+	}
134
+
135
+	function delselect(obj){
136
+		if(confirm("您确定要删除选中的内容么?")){
137
+			var check_list = [];
138
+			$('input[name="checkbox"]:checked').each(function (){
139
+				check_list.push($(this).val());
140
+			});
141
+			var url = $(obj).attr("href");
142
+			var str = check_list.join("and");
143
+			// $(obj).attr("href", url + "" + str);
144
+			location.href = "{url./admin/Message/clear}/ids/" + str;
145
+		}
146
+	}
147
+</script>
148
+{include file='common/foot.html'}

+ 191
- 0
apps/admin/view/default/content/model.html View File

@@ -0,0 +1,191 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">模型列表</li>
8
+	    <li lay-id="t2">模型新增</li>
9
+	  </ul>
10
+	  <div class="layui-tab-content">
11
+	  	   <div class="layui-tab-item layui-show">
12
+	  	   		 <table class="layui-table">
13
+	            	<thead>
14
+	                    <tr>
15
+	                    	<th>序号</th>
16
+	                        <th>名称</th>
17
+	                        <th>类型</th>
18
+	                        <th>URL名称</th>
19
+	                        <th>列表页模板</th>
20
+	                        <th>详情页模板</th>
21
+	                        <th>状态</th>
22
+	                        <th>操作</th>
23
+	                    </tr>
24
+	                </thead>
25
+	                <tbody>
26
+	                    {foreach $models(key,value)}
27
+	                    <tr>
28
+	                    	<td>[num]</td>
29
+	                        <td>[value->name]</td>
30
+	                        <td>
31
+								{if($value->type==1)}单页{/if}
32
+	                        	{if($value->type==2)}列表{/if}
33
+							</td>
34
+							<td>[value->urlname]</td>
35
+	                        <td>[value->listtpl]</td>
36
+	                        <td>[value->contenttpl]</td>
37
+	                        <td>
38
+	                            {if($value->status)}
39
+	                            <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/0}" class="switch"><i class='fa fa-toggle-on' title="点击禁用"></i></a>
40
+	                            {else}
41
+	                            <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/1}" class="switch"><i class='fa fa-toggle-off' title="点击启用"></i></a>
42
+	                            {/if}
43
+	                        </td>
44
+	                        <td>
45
+	                        	{if(!$value->issystem)}
46
+	                            	{fun=get_btn_del($value->id)}
47
+	                            {/if}
48
+	                            {fun=get_btn_mod($value->id)}
49
+	                        </td>
50
+	                    </tr>
51
+	                    {/foreach}
52
+	                </tbody>
53
+	            </table>
54
+	            <div class="page">{$pagebar}</div>
55
+	  	   </div>
56
+	  	   
57
+	  	   <div class="layui-tab-item">
58
+	  	   		<form action="{url./admin/Model/add}" method="post" class="layui-form">
59
+	                <input type="hidden" name="formcheck" value="{$formcheck}" > 
60
+	                <div class="layui-form-item">
61
+	                     <label class="layui-form-label">模型名称  <span class="layui-text-red">*</span></label>
62
+	                     <div class="layui-input-block">
63
+	                     	<input type="text" name="name" required lay-verify="required" placeholder="请输入模型名称" class="layui-input">
64
+	                     </div>
65
+	                </div>
66
+	                
67
+	                 <div class="layui-form-item">
68
+	                     <label class="layui-form-label">模型类型  <span class="layui-text-red">*</span></label>
69
+	                     <div class="layui-input-block">
70
+	                     	 <select name="type" lay-verify="required">
71
+		                     	<option value="">请选择模型类型</option>
72
+		                        <option value="1">单页</option>
73
+		                        <option value="2">列表</option>
74
+		                    </select>
75
+	                     </div>
76
+	                </div>
77
+	                
78
+	                <div class="layui-form-item">
79
+	                     <label class="layui-form-label">URL名称 </label>
80
+	                     <div class="layui-input-block">
81
+	                     	<input type="text" name="urlname"  placeholder="请输入URL地址名称,如:news" class="layui-input">
82
+	                     </div>
83
+	                </div>
84
+	                
85
+	                <div class="layui-form-item">
86
+	                     <label class="layui-form-label">列表页模板</label>
87
+	                     <div class="layui-input-block">
88
+	                     	<input type="text" name="listtpl" placeholder="请输入列表页模板" class="layui-input">
89
+	                     </div>
90
+	                </div>
91
+	                
92
+	                <div class="layui-form-item">
93
+	                     <label class="layui-form-label">详情页模板</label>
94
+	                     <div class="layui-input-block">
95
+	                     	<input type="text" name="contenttpl" placeholder="请输入详情页模板" class="layui-input">
96
+	                     </div>
97
+	                </div>
98
+	                
99
+	                <div class="layui-form-item">
100
+	                     <label class="layui-form-label">状态</label>
101
+	                     <div class="layui-input-block">
102
+	                     	<input type="radio" name="status" value="1" title="启用" checked>
103
+							<input type="radio" name="status" value="0" title="禁用">
104
+	                     </div>
105
+	                </div>
106
+	  	   		
107
+	  	   			<div class="layui-form-item">
108
+						 <div class="layui-input-block">
109
+						    <button class="layui-btn" lay-submit>立即提交</button>
110
+						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
111
+						 </div>
112
+					</div>
113
+
114
+	  	   		</form>
115
+	  	   </div>
116
+	  </div>
117
+	</div>
118
+	{/if} 
119
+	
120
+	{if([$mod])}
121
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
122
+	  <ul class="layui-tab-title">
123
+	    <li class="layui-this">模型修改</li>
124
+	  </ul>
125
+	  <div class="layui-tab-content">
126
+	  	<div class="layui-tab-item layui-show">
127
+	  		<form action="{url./admin/Model/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
128
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
129
+	  			<div class="layui-form-item">
130
+                     <label class="layui-form-label">模型名称 <span class="layui-text-red">*</span></label>
131
+                     <div class="layui-input-block">
132
+                     	<input type="text" name="name" required lay-verify="required" value="{$model->name}" placeholder="请输入模型名称" class="layui-input">
133
+                     </div>
134
+                </div>
135
+                
136
+                 <div class="layui-form-item">
137
+                     <label class="layui-form-label">模型类型  <span class="layui-text-red">*</span></label>
138
+                     <div class="layui-input-block">
139
+                     	 <select name="type" lay-verify="required">
140
+	                     	<option value="">请选择模型类型</option>
141
+	                        <option value="1" {if([$model->type]==1)}selected{/if}>单页</option>
142
+	                        <option value="2" {if([$model->type]==2)}selected{/if}>列表</option>
143
+	                    </select>
144
+                     </div>
145
+                </div>
146
+                
147
+                <div class="layui-form-item">
148
+                     <label class="layui-form-label">URL名称</label>
149
+                     <div class="layui-input-block">
150
+                     	<input type="text" name="urlname" value="{$model->urlname}" placeholder="请输入URL地址名称,如:news" class="layui-input">
151
+                     </div>
152
+                </div>
153
+                
154
+                <div class="layui-form-item">
155
+                     <label class="layui-form-label">列表页模板</label>
156
+                     <div class="layui-input-block">
157
+                     	<input type="text" name="listtpl" value="{$model->listtpl}" placeholder="请输入列表页模板" class="layui-input">
158
+                     </div>
159
+                </div>
160
+                
161
+                <div class="layui-form-item">
162
+                     <label class="layui-form-label">详情页模板</label>
163
+                     <div class="layui-input-block">
164
+                     	<input type="text" name="contenttpl"  value="{$model->contenttpl}" placeholder="请输入详情页模板" class="layui-input">
165
+                     </div>
166
+                </div>
167
+                
168
+                <div class="layui-form-item">
169
+                     <label class="layui-form-label">状态</label>
170
+                     <div class="layui-input-block">
171
+                     	<input type="radio" name="status" value="1" title="启用" {if([$model->status]==1)}checked{/if}>
172
+						<input type="radio" name="status" value="0" title="禁用" {if([$model->status]==0)}checked{/if}>
173
+                     </div>
174
+                </div>
175
+  	   		
176
+  	   			<div class="layui-form-item">
177
+					 <div class="layui-input-block">
178
+					    <button class="layui-btn" lay-submit>立即提交</button>
179
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
180
+					    {fun=get_btn_back()}
181
+					 </div>
182
+				</div>	
183
+	  		</form>
184
+	  	</div>
185
+	  </div>
186
+	 </div>
187
+	{/if} 
188
+
189
+</div>
190
+
191
+{include file='common/foot.html'}

+ 426
- 0
apps/admin/view/default/content/single.html View File

@@ -0,0 +1,426 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">{$model_name}内容</li>
8
+	  </ul>
9
+	  <div class="layui-tab-content">
10
+	  	   <div class="layui-tab-item layui-show">
11
+	  	   		<form action="{url./admin/Single/index/mcode/'.get('mcode').'}" method="get" class="layui-form">
12
+		  	   		<div class="layui-form-item nospace">
13
+		  	   			<div class="layui-input-inline">
14
+		  	   				{$pathinfo}
15
+					       <select name="field" class="form-control input-sm" style="width:auto;">
16
+					       		<option value="b.name" {if(get('field')=='b.name')}selected="selected" {/if}>栏目名称</option>
17
+                                <option value="a.title" {if(get('field')=='a.title')}selected="selected" {/if} >文章标题</option>
18
+                                <option value="a.content" {if(get('field')=='a.content')}selected="selected" {/if}>文章内容</option>
19
+                        	</select>
20
+					    </div>
21
+	                     <div class="layui-input-inline">
22
+	                     	<input type="text" name="keyword"  value="{$get.keyword}"  placeholder="请输入搜索关键字" class="layui-input">
23
+	                     </div>
24
+	                     <div class="layui-input-inline">
25
+	                     	<button class="layui-btn" lay-submit>搜索</button>
26
+	                     	<a class="layui-btn layui-btn-primary"  href="{url./admin/Single/index/mcode/'.get('mcode').'}">清除搜索</a>
27
+	                     </div>
28
+	                </div>
29
+                </form>
30
+
31
+	            <table class="layui-table">
32
+	            	<thead>
33
+	                    <tr>
34
+	                    	<th>ID</th>
35
+	                        <th>栏目</th>
36
+	                        <th>标题</th>
37
+	                        <th>时间</th>
38
+	                        <th>状态</th>
39
+	                        <th>访问量</th>
40
+	                        <th>操作</th>
41
+	                    </tr>
42
+	                </thead>
43
+	                <tbody>
44
+	                    {foreach $contents(key,value)}
45
+	                    <tr>
46
+	                    	<td>[value->id]</td>
47
+	                        <td title="[value->scode]">[value->sortname]</td>
48
+	                         <td title="[value->title]">
49
+		                        {fun=substr_both($value->title,0,15)}
50
+		                        {if($value->ico)}
51
+		                        	<span class="layui-badge layui-bg-orange">缩</span>
52
+		                        {/if}
53
+		                        {if($value->pics)}
54
+		                        	<span class="layui-badge">图</span>
55
+		                        {/if}
56
+		                        {if($value->outlink)}
57
+	                            	<span class="layui-badge layui-bg-black">链</span>
58
+	                            {/if}
59
+	                        </td>
60
+	                        <td>[value->date]</td>
61
+	                        <td>
62
+	                        {if($value->status)}
63
+		                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/0}" class="switch"><i class='fa fa-toggle-on' title="点击关闭"></i></a>
64
+		                        {else}
65
+		                        <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/status/value/1}" class="switch"><i class='fa fa-toggle-off' title="点击开启"></i></a>
66
+		                    {/if}
67
+		                    </td>
68
+		                    <td>[value->visits]</td>
69
+	                        <td>
70
+	                        	{if(!$value->outlink)}
71
+	                        		{php}
72
+			                        		$Parser=new app\home\controller\ParserController();
73
+			                        		$link=$Parser->parserLink(1,$value->urlname,'about',$value->scode,$value->filename,'','');
74
+			                       {/php}
75
+		                        	<a href="{php}echo $link{/php}" class="layui-btn layui-btn-xs layui-btn-primary"  target="_blank">查看</a>
76
+	                        	{/if}
77
+	                        	
78
+	                            {if(check_level('mod'))}
79
+	                            	<a href="{url./admin/Single/mod/mcode/'.$value->mcode.'/id/'.$value->id.'}{$btnqs}" class="layui-btn layui-btn-xs" >修改</a>
80
+	                            	{if([$baidu_zz_token] && !$value->outlink)}
81
+	                            		<a href="{url./admin/'.C.'/mod/baiduzz/'.$value->id.'}" class="layui-btn layui-btn-xs layui-btn-primary" >百度普通推送</a>
82
+	                            	{/if}
83
+	                            	{if([$baidu_ks_token] && !$value->outlink)}
84
+	                            		<a href="{url./admin/'.C.'/mod/baiduks/'.$value->id.'}" class="layui-btn layui-btn-xs layui-btn-primary" >百度快速推送</a>
85
+	                            	{/if}
86
+	                            {/if}
87
+	                        </td>
88
+	                    </tr>
89
+	                    {/foreach}
90
+	                </tbody>
91
+	            </table>
92
+	  	   </div>
93
+	  </div>
94
+	 </div>
95
+	{/if} 
96
+	
97
+	{if([$mod])}
98
+	
99
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
100
+	  <ul class="layui-tab-title">
101
+	    <li class="layui-this">单页修改</li>
102
+	  </ul>
103
+	  <div class="layui-tab-content">
104
+	  	<div class="layui-tab-item layui-show">
105
+	  		<form action="{url./admin/Single/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form" id="edit">
106
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
107
+	  			<div class="layui-tab">
108
+					  <ul class="layui-tab-title">
109
+					    <li class="layui-this">基本内容</li>
110
+					    <li>高级内容</li>
111
+					  </ul>
112
+					  <div class="layui-tab-content">
113
+					    <div class="layui-tab-item layui-show">
114
+
115
+			                <div class="layui-form-item">
116
+			                     <label class="layui-form-label">内容标题   <span class="layui-text-red">*</span></label>
117
+			                     <div class="layui-input-block">
118
+			                     	<input type="text" name="title" required lay-verify="required" value="{$content->title}" placeholder="请输入内容标题" class="layui-input">
119
+			                     </div>
120
+			                </div>
121
+			                
122
+			                 {foreach $extfield(key,value)}
123
+			                	{if($value->type==1)} <!-- 单行文本 -->
124
+			                	<div class="layui-form-item">
125
+			                		<label class="layui-form-label">[value->description]</label>
126
+			                		<div class="layui-input-block">
127
+				                    	<input type="text" name="[value->name]" value="{$content->{$value->name}}"  placeholder="请输入[value->description]"  class="layui-input">
128
+				                	</div>
129
+				                </div>
130
+			                	{/if}
131
+			                	
132
+			                	{if($value->type==2)}<!-- 多行文本 -->
133
+			                	<div class="layui-form-item">
134
+			                		<label class="layui-form-label">[value->description]</label>
135
+			                		<div class="layui-input-block">
136
+				                		<textarea name="[value->name]" class="layui-textarea" placeholder="请输入[value->description]">{php}$name=$value->name;echo str_replace('<br>', "\r\n",$this->vars['content']->$name);{/php}</textarea>
137
+				                	</div>
138
+				                </div>
139
+			                	{/if}
140
+			                	
141
+			                    {if($value->type==3)}<!-- 单选 -->
142
+			                	<div class="layui-form-item">
143
+			                		<label class="layui-form-label">[value->description]</label>
144
+			                		<div class="layui-input-block">
145
+				                		<div>
146
+	            						     {php}
147
+				                				$radios=explode(',',$value->value);
148
+				                				$name=$value->name;
149
+				                				foreach ($radios as $value2) {
150
+				                					if($this->vars['content']->$name==$value2){
151
+	                									echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'" checked>';
152
+	                								}else{
153
+	                									echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'">';
154
+	                								}
155
+	            								}
156
+	            						     {/php}
157
+					                    </div>
158
+				                	</div>
159
+				                </div>
160
+			                	{/if}
161
+			                	
162
+			                    {if($value->type==4)}<!-- 多选 -->
163
+			                	<div class="layui-form-item">
164
+			                		<label class="layui-form-label">[value->description]</label>
165
+			                		<div class="layui-input-block">
166
+				                		<div>
167
+	            						     {php}
168
+				                				$checkboxs=explode(',',$value->value);
169
+				                				$name=$value->name;
170
+				                				echo '<input name="'.$value->name.'" type="hidden">';//占位清空
171
+				                				$values=explode(',',$this->vars['content']->$name);
172
+				                				foreach ($checkboxs as $value2) {
173
+				                					if(in_array($value2,$values)){
174
+	            										echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'" checked>';
175
+	            									}else{
176
+	            										echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'">';
177
+	            									}
178
+	            								}
179
+	            						     {/php}
180
+					                    </div>
181
+				                	</div>
182
+				                </div>
183
+			                	{/if}
184
+			                	
185
+			                	{if($value->type==5)}<!-- 图片 -->
186
+			                	<div class="layui-form-item">
187
+			                		<label class="layui-form-label">[value->description]</label>
188
+			                		<div class="layui-input-inline">
189
+				                     	<input type="text" name="[value->name]" id="[value->name]" value="{$content->{$value->name}}" placeholder="请上传[value->description]"  class="layui-input">
190
+				                     </div>
191
+				                     <button type="button" class="layui-btn upload watermark" data-des="[value->name]">
192
+									 	 <i class="layui-icon">&#xe67c;</i>上传图片
193
+									 </button>
194
+									 {php}$name=$value->name; {/php}
195
+									 <div id="[value->name]_box" class="pic"><dl><dt>{if([$content]->$name)}<img src='{SITE_DIR}{$content->{$value->name}}' data-url="{$content->{$value->name}}"></dt><dd>删除</dd></dl>{/if}</div>
196
+				                </div>
197
+			                	{/if}
198
+			                	
199
+			                	{if($value->type==6)}<!-- 文件 -->
200
+			                	<div class="layui-form-item">
201
+			                		<label class="layui-form-label">[value->description]</label>
202
+			                		<div class="layui-input-inline">
203
+				                     	<input type="text" name="[value->name]" id="[value->name]" value="{$content->{$value->name}}" placeholder="请上传[value->description]"  class="layui-input">
204
+				                     </div>
205
+				                     <button type="button" class="layui-btn file" data-des="[value->name]">
206
+									 	 <i class="layui-icon">&#xe67c;</i>上传文件
207
+									 </button>
208
+				                </div>
209
+			                	{/if}
210
+			                	
211
+			                	{if($value->type==7)}<!-- 日期 -->
212
+				                <div class="layui-form-item">
213
+				                     <label class="layui-form-label">[value->description]</label>
214
+				                     <div class="layui-input-block">
215
+				                     	<input type="text" name="[value->name]" value="{$content->{$value->name}}" readonly placeholder="请选择[value->description]"  class="layui-input datetime">
216
+				                     </div>
217
+				                </div>
218
+			                	{/if}
219
+			                	
220
+			                	{if($value->type==8)}<!-- 编辑器 -->
221
+			                	<div class="layui-form-item">
222
+			                		<label class="layui-form-label">[value->description]</label>
223
+			                		<div class="layui-input-block">
224
+			                			{php}
225
+			                				$name=@$value->name;
226
+			                			{/php}
227
+				                		<script type="text/plain" id="editor_[value->name]" name="[value->name]" style="width:100%;height:240px;">{fun=decode_string([$content->$name])}</script>
228
+				                		<script>
229
+											//初始化编辑器
230
+											$(document).ready(function (e) {
231
+												var ue = UE.getEditor('editor_[value->name]',{
232
+													maximumWords:10000 
233
+												});
234
+											})
235
+										</script>
236
+				                	</div>
237
+				                </div>
238
+			                	{/if}
239
+			                	
240
+			                	{if($value->type==9)}<!-- 下拉 -->
241
+			                	<div class="layui-form-item">
242
+			                		<label class="layui-form-label">[value->description]</label>
243
+			                		<div class="layui-input-block">
244
+			                			<select name="[value->name]">
245
+			                				{php}
246
+				                				$selects=explode(',',$value->value);
247
+				                				$name=$value->name;
248
+				                				foreach ($selects as $value2) {
249
+				                					if($this->vars['content']->$name==$value2){
250
+				                						echo '<option value="'.$value2.'" selected>'.$value2.'</option>';
251
+	                								}else{
252
+	                									echo '<option value="'.$value2.'">'.$value2.'</option>';
253
+	                								}
254
+	            								}
255
+	            						    {/php}
256
+			                			</select>
257
+				                	</div>
258
+				                 </div>
259
+			                	 {/if}
260
+			                	 
261
+			                {/foreach}
262
+			                
263
+			                <div class="layui-form-item">
264
+			                     <label class="layui-form-label">内容</label>
265
+			                     <div class="layui-input-block">
266
+			                     	<script type="text/plain" id="editor" name="content" style="width:100%;height:240px;">{fun=decode_string([$content->content])}</script>
267
+			                     </div>
268
+			                </div>
269
+			                
270
+			                <div class="layui-form-item">
271
+			                     <label class="layui-form-label">tags</label>
272
+			                     <div class="layui-input-block">
273
+			                     	<input type="text" name="tags" placeholder="请输入文章tag,英文逗号隔开" value="{$content->tags}" class="layui-input">
274
+			                     </div>
275
+			                </div>
276
+			                
277
+			                <div class="layui-form-item">
278
+			                     <label class="layui-form-label">作者</label>
279
+			                     <div class="layui-input-block">
280
+			                     	<input type="text" name="author" placeholder="请输入作者" value="{$content->author}" class="layui-input">
281
+			                     </div>
282
+			                </div>
283
+			                
284
+			                <div class="layui-form-item">
285
+			                     <label class="layui-form-label">来源</label>
286
+			                     <div class="layui-input-block">
287
+			                     	<input type="text" name="source" placeholder="请输入来源" value="{$content->source}" class="layui-input">
288
+			                     </div>
289
+			                </div>
290
+			                
291
+			                <div class="layui-form-item">
292
+			                     <label class="layui-form-label">缩略图</label>
293
+			                     <div class="layui-input-inline">
294
+			                     	<input type="text" name="ico" id="ico" value="{$content->ico}" placeholder="请上传缩略图"  class="layui-input">
295
+			                     </div>
296
+			                     <button type="button" class="layui-btn upload watermark" data-des="ico">
297
+								 	 <i class="layui-icon">&#xe67c;</i>上传图片
298
+								 </button>
299
+								 <div id="ico_box" class="pic addedit">{if([$content->ico])}<dl><dt><img src="{SITE_DIR}{$content->ico}" data-url="{$content->ico}"></dt><dd>删除</dd></dl>{/if}</div>
300
+			                </div>
301
+			                
302
+			                <div class="layui-form-item">
303
+			                     <label class="layui-form-label">轮播多图</label>
304
+			                     <div class="layui-input-inline">
305
+			                     	<input type="text" name="pics" id="pics" value="{$content->pics}" placeholder="请上传轮播多图"  class="layui-input">
306
+			                     </div>
307
+			                     <button type="button" class="layui-btn uploads watermark" data-des="pics">
308
+								 	 <i class="layui-icon">&#xe67c;</i>上传多图
309
+								 </button>
310
+								 <div id="pics_box" class="pic addedit">
311
+								 	<dl></dl> <!-- 规避空内容拖动bug -->
312
+								 	 {php}
313
+									    if([$content->pics]){
314
+		                					$pics=explode(',',[$content->pics]);
315
+		                				}else{
316
+		                					$pics = array();
317
+		                				}
318
+		                				if([$content->picstitle]){
319
+		                					$picstitle=explode(',',[$content->picstitle]);
320
+		                				}else{
321
+		                					$picstitle = array();
322
+		                				}
323
+		                				foreach ($pics as $key=>$value) {
324
+		                					//需要留一个空,不然被解析为标签了
325
+		                					echo "<dl><dt><img src='".SITE_DIR.$value."' data-url='".$value."'></dt><dd>删除</dd><dt><input type='text' value='".$picstitle[$key ]."' name='picstitle[]' style='width:95%' /></dt></dl>";
326
+	          							}
327
+	         						 {/php}
328
+								 </div>
329
+			                </div>
330
+					    </div>
331
+					    
332
+					    <div class="layui-tab-item ">
333
+					    
334
+					   		 <div class="layui-form-item">
335
+			                     <label class="layui-form-label">标题颜色</label>
336
+			                     <div class="layui-input-inline">
337
+			                     	<input type="text" name="titlecolor" value="{$content->titlecolor}" placeholder="请选择标题颜色"  class="layui-input jscolor {hash:true}">
338
+			                     </div>
339
+			                 </div>
340
+			                 
341
+			                 <div class="layui-form-item">
342
+			                     <label class="layui-form-label">副标题</label>
343
+			                     <div class="layui-input-block">
344
+			                     	<input type="text" name="subtitle" value="{$content->subtitle}" placeholder="请输入副标题" class="layui-input">
345
+			                     </div>
346
+			                 </div>
347
+
348
+			                 <div class="layui-form-item">
349
+			                     <label class="layui-form-label">时间</label>
350
+			                     <div class="layui-input-inline">
351
+			                     	<input type="text" name="date" value="{$content->date}" readonly placeholder="请选择发布时间"  class="layui-input datetime">
352
+			                     </div>
353
+			                     <div class="layui-form-mid layui-word-aux">温馨提示:单页不支持定时发布!</div>
354
+			                </div>
355
+			                
356
+			                <div class="layui-form-item">
357
+		                		<label class="layui-form-label">附件</label>
358
+		                		<div class="layui-input-inline">
359
+			                     	<input type="text" name="enclosure" id="enclosure" value="{$content->enclosure}" placeholder="请上传附件"  class="layui-input">
360
+			                     </div>
361
+			                     <button type="button" class="layui-btn file" data-des="enclosure">
362
+								 	 <i class="layui-icon">&#xe67c;</i>上传附件
363
+								 </button>
364
+			                </div>
365
+			                
366
+			                <div class="layui-form-item">
367
+			                     <label class="layui-form-label">SEO关键字</label>
368
+			                     <div class="layui-input-block">
369
+			                     	<input type="text" name="keywords" value="{$content->keywords}"  placeholder="请输入详情页SEO关键字" class="layui-input">
370
+			                     </div>
371
+			                </div>
372
+			                
373
+			                <div class="layui-form-item">
374
+			                     <label class="layui-form-label">SEO描述</label>
375
+			                     <div class="layui-input-block">
376
+			                     	<textarea name="description" placeholder="请输入详情页SEO描述" class="layui-textarea">{$content->description}</textarea>
377
+			                     </div>
378
+			                </div>
379
+			                
380
+			                <div class="layui-form-item">
381
+			                     <label class="layui-form-label">状态</label>
382
+			                     <div class="layui-input-block">
383
+			                     	<input type="radio" name="status" value="1" title="显示" {if([$content->status]==1)} checked="checked"{/if}>
384
+									<input type="radio" name="status" value="0" title="隐藏" {if([$content->status]==0)} checked="checked"{/if}>
385
+			                     </div>
386
+			                </div>
387
+					    </div>
388
+					  </div>
389
+					</div>
390
+					<div class="layui-form-item">
391
+						 <div class="layui-input-block">
392
+						    <button class="layui-btn" lay-submit>立即提交</button>
393
+						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
394
+						    {fun=get_btn_back()}
395
+						 </div>
396
+					</div>
397
+	  		</form>
398
+	  	</div>
399
+	  </div>
400
+	</div>
401
+	{/if} 
402
+
403
+</div>
404
+
405
+<style>.placeHolder {border:dashed 2px gray; }</style>
406
+<script type="text/javascript" src="{APP_THEME_DIR}/js/jquery.dragsort-0.5.2.min.js"></script>
407
+<script type="text/javascript">
408
+$("#pics_box").dragsort({
409
+	dragSelector: "dl",
410
+	dragSelectorExclude: "input,textarea,dd",
411
+	dragBetween: false,
412
+	dragEnd: saveOrder,
413
+	placeHolderTemplate: "<dl class='placeHolder'><dt></dt></dl>"
414
+});
415
+
416
+function saveOrder() {
417
+	var data = $("#pics_box dl dt img").map(function() {
418
+		return $(this).data("url");
419
+	}).get();
420
+	$("input[name=pics]").val(data.join(","))
421
+};
422
+</script>
423
+<script type="text/javascript" src="{APP_THEME_DIR}/js/jscolor.js"></script>
424
+
425
+{include file='common/ueditor.html'}
426
+{include file='common/foot.html'}

+ 107
- 0
apps/admin/view/default/content/site.html View File

@@ -0,0 +1,107 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
5
+	  <ul class="layui-tab-title">
6
+	    <li class="layui-this">站点信息</li>
7
+	  </ul>
8
+	  <div class="layui-tab-content">
9
+	  	<div class="layui-tab-item layui-show">
10
+	  		<form action="{url./admin/Site/mod}" method="post" class="layui-form">
11
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
12
+	  			<div class="layui-form-item">
13
+                     <label class="layui-form-label">站点标题</label>
14
+                     <div class="layui-input-block">
15
+                     	<input type="text" name="title" value="{$sites->title}" placeholder="请输入站点标题,格式小写的{xx}:{xx}关键词A_{xx}关键词B"  class="layui-input">
16
+                     </div>
17
+                </div>
18
+                
19
+                <div class="layui-form-item">
20
+                     <label class="layui-form-label">站点副标题</label>
21
+                     <div class="layui-input-block">
22
+                     	<input type="text" name="subtitle" value="{$sites->subtitle}" placeholder="请输入站点副标题"  class="layui-input">
23
+                     </div>
24
+                </div>
25
+                
26
+                <div class="layui-form-item">
27
+                     <label class="layui-form-label">站点域名</label>
28
+                     <div class="layui-input-block">
29
+                     	<input type="text" name="domain" value="{$sites->domain}" placeholder="请输入站点域名"  class="layui-input">
30
+                     </div>
31
+                </div>
32
+                
33
+                <div class="layui-form-item">
34
+                     <label class="layui-form-label">站点LOGO</label>
35
+                     <div class="layui-input-inline">
36
+                     	<input type="text" name="logo" id="logo" value="{$sites->logo}" placeholder="请上传站点LOGO图"  class="layui-input">
37
+                     </div>
38
+                     <button type="button" class="layui-btn upload" data-des="logo">
39
+					 	 <i class="layui-icon">&#xe67c;</i>上传图片
40
+					 </button>
41
+					 <div id="logo_box" class="pic"><dl><dt>{if(@[$sites->logo])}<img src="{SITE_DIR}{$sites->logo}" data-url="{$sites->logo}"></dt><dd>删除</dd></dl>{/if}</div>
42
+                </div>
43
+                
44
+                <div class="layui-form-item">
45
+                     <label class="layui-form-label">站点关键字</label>
46
+                     <div class="layui-input-block">
47
+                     	<input type="text" name="keywords" value="{$sites->keywords}" placeholder="请输入站点关键字,格式小写的{xx}:{xx}关键词A_{xx}关键词B"  class="layui-input">
48
+                     </div>
49
+                </div>
50
+                
51
+                <div class="layui-form-item">
52
+                     <label class="layui-form-label">站点描述</label>
53
+                     <div class="layui-input-block">
54
+                     	<textarea name="description" placeholder="请输入站点描述,格式小写的{xx}:{xx}关键词A_{xx}关键词B,某某某描述" class="layui-textarea">{$sites->description}</textarea>
55
+                     </div>
56
+                </div>
57
+                
58
+                <div class="layui-form-item">
59
+                     <label class="layui-form-label">站点备案</label>
60
+                     <div class="layui-input-block">
61
+                     	<input type="text" name="icp" value="{$sites->icp}" placeholder="请输入站点备案"  class="layui-input">
62
+                     </div>
63
+                </div>
64
+                
65
+                <div class="layui-form-item">
66
+				    <label class="layui-form-label">站点模板</label>
67
+				    <div class="layui-input-block">
68
+				      <select name="theme">
69
+                       	{foreach $themes(key,value)} 
70
+                            {if($value == [$sites->theme])}
71
+                                <option value="[value]" selected='selected'>[value]</option> 
72
+                            {else}
73
+                                <option value="[value]">[value]</option> 
74
+                            {/if}
75
+                        {/foreach}
76
+				      </select>
77
+				    </div>
78
+				 </div>
79
+				 
80
+				 <div class="layui-form-item">
81
+                     <label class="layui-form-label">统计代码</label>
82
+                     <div class="layui-input-block">
83
+                     	<textarea name="statistical" placeholder="请输入统计代码" class="layui-textarea">{$sites->statistical}</textarea>
84
+                     </div>
85
+                </div>
86
+                
87
+                <div class="layui-form-item">
88
+                     <label class="layui-form-label">尾部信息</label>
89
+                     <div class="layui-input-block">
90
+                     	<textarea name="copyright" placeholder="请输入尾部信息" class="layui-textarea">{$sites->copyright}</textarea>
91
+                     </div>
92
+                </div>
93
+				
94
+				<div class="layui-form-item">
95
+					 <div class="layui-input-block">
96
+					    <button class="layui-btn" lay-submit>立即提交</button>
97
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
98
+					 </div>
99
+				</div>
100
+				 
101
+	  		</form>
102
+	  	</div>
103
+	  </div>
104
+	</div>
105
+</div>
106
+
107
+{include file='common/foot.html'}

+ 187
- 0
apps/admin/view/default/content/slide.html View File

@@ -0,0 +1,187 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">幻灯片列表</li>
8
+	    <li lay-id="t2">幻灯片新增</li>
9
+	  </ul>
10
+	  <div class="layui-tab-content">
11
+	  	<div class="layui-tab-item layui-show">
12
+	  		<form action="{url./admin/Slide/mod}" method="post" class="layui-form" onkeydown="if(event.keyCode==13) return false;">
13
+		    <input type="hidden" name="formcheck" value="{$formcheck}" > 
14
+	  		<table class="layui-table">
15
+            	<thead>
16
+                    <tr>
17
+                    	<th>分组(gid)</th>
18
+                        <th>图片</th>
19
+                        <th>链接</th>
20
+                        <th>标题</th>
21
+                        <th>副标题</th>
22
+                        <th>排序</th>
23
+                        <th>操作</th>
24
+                    </tr>
25
+                </thead>
26
+                <tbody>
27
+                    {foreach $slides(key,value)}
28
+                    <tr>
29
+                    	<td>[value->gid]</td>
30
+                        <td><img src="{SITE_DIR}[value->pic]" style="height:30px;"></td>
31
+                        <td>[value->link]</td>
32
+                        <td>[value->title]</td>
33
+                        <td>[value->subtitle]</td>
34
+                        <td class="table-input">
35
+                        <input type="hidden" name="listall[]" value="[value->id]">
36
+                        <input type="text" lay-ignore class="layui-input" name="sorting[]" value="[value->sorting]">
37
+                        </td>
38
+                        <td>
39
+                            {fun=get_btn_del($value->id)}
40
+                            {fun=get_btn_mod($value->id)}
41
+                        </td>
42
+                    </tr>
43
+                    {/foreach}
44
+                </tbody>
45
+            </table>
46
+            <button type="submit" name="submit" value="sorting" class="layui-btn layui-btn-sm">保存排序</button>
47
+            </form> 
48
+            <div class="page">{$pagebar}</div>
49
+	  	</div>
50
+	  	
51
+	  	<div class="layui-tab-item">
52
+	  		<form action="{url./admin/Slide/add}" method="post" class="layui-form">
53
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
54
+	  			<div class="layui-form-item">
55
+                     <label class="layui-form-label">分组</label>
56
+                     <div class="layui-input-block">
57
+                     	<select name="gid" >	
58
+                     		{foreach $gids(key,value)}
59
+	                			<option value="[value]" >分组[value]</option>
60
+	                		{/foreach}
61
+	                		<option value="" >自动新增分组</option>
62
+	                	</select>
63
+                     </div>
64
+                </div>
65
+                
66
+                <div class="layui-form-item">
67
+                     <label class="layui-form-label">图片</label>
68
+                     <div class="layui-input-inline">
69
+                     	<input type="text" name="pic" id="pic" required  lay-verify="required" placeholder="请上传图片"  class="layui-input">
70
+                     </div>
71
+                     <button type="button" class="layui-btn upload" data-des="pic">
72
+					 	 <i class="layui-icon">&#xe67c;</i>上传图片
73
+					 </button>
74
+					 <div id="pic_box" class="pic"></div>
75
+                </div>
76
+                
77
+                <div class="layui-form-item">
78
+                     <label class="layui-form-label">链接</label>
79
+                     <div class="layui-input-block">
80
+                     	<input type="text" name="link" placeholder="请输入跳转链接"  class="layui-input">
81
+                     </div>
82
+                </div>
83
+                
84
+                 <div class="layui-form-item">
85
+                     <label class="layui-form-label">标题</label>
86
+                     <div class="layui-input-block">
87
+                     	<input type="text" name="title" placeholder="请输入标题"  class="layui-input">
88
+                     </div>
89
+                </div>
90
+                
91
+                <div class="layui-form-item">
92
+                     <label class="layui-form-label">副标题</label>
93
+                     <div class="layui-input-block">
94
+                     	<input type="text" name="subtitle" placeholder="请输入副标题"  class="layui-input">
95
+                     </div>
96
+                </div>
97
+                
98
+                <div class="layui-form-item">
99
+                     <label class="layui-form-label">排序</label>
100
+                     <div class="layui-input-block">
101
+                     	<input type="text" name="sorting" required lay-verify="required" value="255" placeholder="请输入排序"  class="layui-input">
102
+                     </div>
103
+                </div>
104
+                
105
+                 <div class="layui-form-item">
106
+					 <div class="layui-input-block">
107
+					    <button class="layui-btn" lay-submit>立即提交</button>
108
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
109
+					 </div>
110
+				</div>
111
+	  		</form>
112
+	  	</div>
113
+	  </div>
114
+	</div>
115
+	{/if} 
116
+	
117
+	{if([$mod])}
118
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
119
+	  <ul class="layui-tab-title">
120
+	    <li class="layui-this">幻灯片修改</li>
121
+	  </ul>
122
+	  <div class="layui-tab-content">
123
+	  	<div class="layui-tab-item layui-show">
124
+	  		<form action="{url./admin/Slide/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
125
+	  			<input type="hidden" name="formcheck" value="{$formcheck}" > 
126
+	  			
127
+                <div class="layui-form-item">
128
+                     <label class="layui-form-label">分组</label>
129
+                     <div class="layui-input-block">
130
+                     	<input type="text" name="gid" required  lay-verify="required" value="{$slide->gid}" placeholder="请输入分组"  class="layui-input">
131
+                     </div>
132
+                </div>
133
+                
134
+                <div class="layui-form-item">
135
+                     <label class="layui-form-label">图片</label>
136
+                     <div class="layui-input-inline">
137
+                     	<input type="text" name="pic" id="pic" required  lay-verify="required" value="{$slide->pic}" placeholder="请上传图片"  class="layui-input">
138
+                     </div>
139
+                     <button type="button" class="layui-btn upload" data-des="pic">
140
+					 	 <i class="layui-icon">&#xe67c;</i>上传图片
141
+					 </button>
142
+					 <div id="pic_box" class="pic">{if([$slide->pic])}<dl><dt><img src="{SITE_DIR}{$slide->pic}" data-url="{$slide->pic}"></dt><dd>删除</dd></dl>{/if}</div>
143
+                </div>
144
+                
145
+                <div class="layui-form-item">
146
+                     <label class="layui-form-label">跳转链接</label>
147
+                     <div class="layui-input-block">
148
+                     	<input type="text" name="link" value="{$slide->link}"  placeholder="请输入跳转链接"  class="layui-input">
149
+                     </div>
150
+                </div>
151
+                
152
+                <div class="layui-form-item">
153
+                     <label class="layui-form-label">标题</label>
154
+                     <div class="layui-input-block">
155
+                     	<input type="text" name="title" value="{$slide->title}" placeholder="请输入标题"  class="layui-input">
156
+                     </div>
157
+                </div>
158
+                
159
+                 <div class="layui-form-item">
160
+                     <label class="layui-form-label">副标题</label>
161
+                     <div class="layui-input-block">
162
+                     	<input type="text" name="subtitle" value="{$slide->subtitle}" placeholder="请输入副标题"  class="layui-input">
163
+                     </div>
164
+                </div>
165
+                
166
+                 <div class="layui-form-item">
167
+                     <label class="layui-form-label">排序</label>
168
+                     <div class="layui-input-block">
169
+                     	<input type="text" name="sorting" required lay-verify="required" value="{$slide->sorting}" placeholder="请输入排序"  class="layui-input">
170
+                     </div>
171
+                </div>
172
+                
173
+                 <div class="layui-form-item">
174
+					 <div class="layui-input-block">
175
+					    <button class="layui-btn" lay-submit>立即提交</button>
176
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
177
+					    {fun=get_btn_back()}
178
+					 </div>
179
+				</div>
180
+	  		</form>
181
+	  	</div>
182
+	  </div>
183
+	</div>
184
+	{/if} 
185
+
186
+</div>
187
+{include file='common/foot.html'}

+ 105
- 0
apps/admin/view/default/content/tags.html View File

@@ -0,0 +1,105 @@
1
+{include file='common/head.html'}
2
+
3
+<div class="layui-body">
4
+	{if([$list])}
5
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
6
+	  <ul class="layui-tab-title">
7
+	    <li class="layui-this" lay-id="t1">文章内链列表</li>
8
+	    <li lay-id="t2">文章内链新增</li>
9
+	  </ul>
10
+	  <div class="layui-tab-content">
11
+	  	<div class="layui-tab-item layui-show">
12
+	  		<table class="layui-table">
13
+	  			<thead>
14
+                    <tr>
15
+                    	<th>序号</th>
16
+                        <th>名称</th>
17
+                        <th>链接</th>
18
+                        <th>操作</th>
19
+                    </tr>
20
+                </thead>
21
+                <tbody>
22
+                    {foreach $tags(key,value)}
23
+                    <tr>
24
+                    	<td>[num]</td>
25
+                        <td>[value->name]</td>
26
+                        <td>[value->link]</td>
27
+                        <td>
28
+                            {fun=get_btn_del($value->id)}
29
+                            {fun=get_btn_mod($value->id)}
30
+                        </td>
31
+                    </tr>
32
+                    {/foreach}
33
+                </tbody>
34
+	  		</table>
35
+	  		<div class="page">{$pagebar}</div>
36
+	  	</div>
37
+	  	<div class="layui-tab-item">
38
+	  		 <form action="{url./admin/Tags/add}" method="post" class="layui-form">
39
+	  		 	<input type="hidden" name="formcheck" value="{$formcheck}" > 
40
+
41
+                 <div class="layui-form-item">
42
+                     <label class="layui-form-label">名称</label>
43
+                     <div class="layui-input-block">
44
+                     	<input type="text" name="name" required  lay-verify="required" placeholder="请输入名称"  class="layui-input">
45
+                     </div>
46
+                </div>
47
+                
48
+                <div class="layui-form-item">
49
+                     <label class="layui-form-label">链接</label>
50
+                     <div class="layui-input-block">
51
+                     	<input type="text" name="link" required  lay-verify="required" placeholder="请输入链接"  class="layui-input">
52
+                     </div>
53
+                </div>
54
+
55
+                <div class="layui-form-item">
56
+					 <div class="layui-input-block">
57
+					    <button class="layui-btn" lay-submit>立即提交</button>
58
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
59
+					 </div>
60
+				</div>
61
+	  		 </form>
62
+	  	</div>
63
+	  </div>
64
+	</div>
65
+	{/if} 
66
+	
67
+	{if([$mod])}
68
+	<div class="layui-tab layui-tab-brief" lay-filter="tab">
69
+	  <ul class="layui-tab-title">
70
+	    <li class="layui-this">文章内链修改</li>
71
+	  </ul>
72
+	  <div class="layui-tab-content">
73
+	  	<div class="layui-tab-item layui-show">
74
+	  		 <form action="{url./admin/Tags/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
75
+	  		 	<input type="hidden" name="formcheck" value="{$formcheck}" > 
76
+
77
+                <div class="layui-form-item">
78
+                     <label class="layui-form-label">名称</label>
79
+                     <div class="layui-input-block">
80
+                     	<input type="text" name="name" required  lay-verify="required" value="{$tags->name}" placeholder="请输入名称"  class="layui-input">
81
+                     </div>
82
+                </div>
83
+                
84
+                <div class="layui-form-item">
85
+                     <label class="layui-form-label">链接</label>
86
+                     <div class="layui-input-block">
87
+                     	<input type="text" name="link" required  lay-verify="required" value="{$tags->link}" placeholder="请输入链接"  class="layui-input">
88
+                     </div>
89
+                </div>
90
+                
91
+                 <div class="layui-form-item">
92
+					 <div class="layui-input-block">
93
+					    <button class="layui-btn" lay-submit>立即提交</button>
94
+					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
95
+					    {fun=get_btn_back()}
96
+					 </div>
97
+				</div>
98
+				
99
+	  		 </form>
100
+	  	</div>
101
+	  </div>
102
+	 </div>
103
+	{/if} 
104
+</div>
105
+{include file='common/foot.html'}

+ 265
- 0
apps/admin/view/default/css/comm.css View File

@@ -0,0 +1,265 @@
1
+/*分页样式*/
2
+.layui-header {
3
+	height: 50px;
4
+}
5
+.layui-body {
6
+	padding: 10px 15px;
7
+}
8
+.layui-layout-admin .layui-body {
9
+	top: 50px;
10
+	bottom:0;
11
+}
12
+.layui-layout-admin .layui-logo {
13
+	color: #fff;
14
+	font-size: 20px;
15
+	line-height: 50px;
16
+	height: 50px;
17
+	overflow:hidden;
18
+	text-align: left;
19
+	width: 180px;
20
+	padding-left: 10px;
21
+}
22
+.layui-layout-admin .layui-logo .layui-badge{
23
+	font-size:10px;
24
+	padding: 3px;
25
+	height: 12px;
26
+	line-height: 12px;
27
+	top:-3px;
28
+}
29
+.layui-layout-admin .layui-logo img {
30
+	vertical-align: middle;
31
+	margin-top: -3px;
32
+}
33
+.layui-layout-admin .layui-logo a {
34
+	color: #fff;
35
+}
36
+.layui-layout-admin .layui-header .layui-nav .layui-nav-item {
37
+	height: 50px;
38
+	line-height: 50px;
39
+}
40
+.layui-layout-admin .layui-side {
41
+	top: 50px;
42
+}
43
+.layui-layout-admin .layui-side .layui-nav i {
44
+	margin-right: 10px;
45
+}
46
+.layui-layout-admin .layui-side .layui-nav-child dd {
47
+	padding-left: 20px;
48
+}
49
+.layui-form-label {
50
+	width: 100px;
51
+}
52
+.layui-input-block {
53
+	margin-left: 130px;
54
+}
55
+.layui-layout-left {
56
+	left: 220px;
57
+}
58
+.layui-table .layui-btn {
59
+	margin: 0.5px 0;
60
+}
61
+.layui-table .layui-btn + .layui-btn {
62
+	margin-left: 0px;
63
+}
64
+.layui-form-select dl {
65
+	z-index: 9999;
66
+	max-height: 250px;
67
+}
68
+.layui-text-red{
69
+	color:red;
70
+}
71
+/*菜单显示按钮*/
72
+.menu {
73
+	position: absolute !important;
74
+	left : 200px;
75
+	top: 10px;
76
+	line-height: 30px;
77
+	color: #ccc;
78
+	text-align: center;
79
+	z-index: 999;
80
+}
81
+.menu li {
82
+	width: 30px;
83
+	background: #2F4056;
84
+}
85
+.menu a {
86
+	color: #ccc;
87
+}
88
+.menu .menu-ico {
89
+	font-size: 20px;
90
+	cursor: pointer;
91
+}
92
+.area-select {
93
+	position: absolute;
94
+	left : 250px;
95
+	top: 10px;
96
+}
97
+.area-select select {
98
+	height: 30px;
99
+	border: 1px solid #fafafa;
100
+	padding-left: 5px;
101
+	border-radius: 2px;
102
+}
103
+.area-select .layui-select-title {
104
+}
105
+/*桌面快捷图标*/
106
+.deskbox {
107
+	height: 90px;
108
+	border-radius: 5px;
109
+	color: #666;
110
+	text-align: center;
111
+	background: #f2f2f2;
112
+	margin: 5px;
113
+}
114
+.deskbox:hover {
115
+	background: #e0e0e0;
116
+}
117
+.deskbox dd {
118
+	font-size: 30px;
119
+	line-height: 50px;
120
+	color:#009688;
121
+}
122
+.deskbox dt {
123
+	padding-top:15px;
124
+	color:#999;
125
+	font-weight: normal;
126
+}
127
+.page {
128
+	clear: both;
129
+	margin: 10px 0;
130
+	text-align: center;
131
+}
132
+.page a:hover {
133
+	color:#009688;
134
+}
135
+.page-status{
136
+	border-radius: 2px 0 0 2px;
137
+}
138
+.page-last{
139
+	border-radius: 0 2px 2px 0;
140
+}
141
+.page-status,.page-index,.page-pre,.page-num,.page-next,.page-last{
142
+	display: inline-block;
143
+	*display: inline;
144
+	*zoom: 1;
145
+	vertical-align: middle;
146
+	padding: 0 15px;
147
+	height: 28px;
148
+	line-height: 28px;
149
+	margin: 0 -1px 5px 0;
150
+	background-color: #fff;
151
+	color: #333;
152
+	font-size: 12px;
153
+	border: 1px solid #e2e2e2;
154
+}
155
+.page-num-current{
156
+	background-color: #009688;
157
+	height:30px;
158
+	line-height: 30px;
159
+	border-top:none;
160
+	border-bottom:none;
161
+	color:#fff;
162
+}
163
+a.page-num-current:hover{
164
+	color:#fff;
165
+}
166
+.readonly {
167
+	background: #fafafa;
168
+}
169
+.table-input {
170
+	padding: 0px 15px!important;
171
+}
172
+.table-input input {
173
+	height: 30px;
174
+	max-width: 50px;
175
+	padding: 0px;
176
+	text-align: center;
177
+	color: #666;
178
+}
179
+.table-two tbody td {
180
+	text-align: left;
181
+}
182
+.table-two tbody th {
183
+	text-align: right;
184
+	width: 110px;
185
+}
186
+.fa-toggle-on {
187
+	font-size: 20px;
188
+	color: #5FB878;
189
+}
190
+.fa-toggle-off {
191
+	font-size: 20px;
192
+	color: #d2d2d2;
193
+}
194
+.pic {
195
+	margin-left: 130px;
196
+}
197
+.pic dl {
198
+	float: left;
199
+	position: relative;
200
+}
201
+.pic dl dd {
202
+	position: absolute;
203
+	right: 5px;
204
+	top: 5px;
205
+	cursor: pointer;
206
+	background: #666;
207
+	color: #fff;
208
+	padding: 2px;
209
+}
210
+.pic img {
211
+	max-height: 100px;
212
+	margin: 5px 0;
213
+	margin-right: 5px;
214
+}
215
+
216
+@media only screen and (min-width: 450px) {
217
+.layui-form-item .layui-input-inline {
218
+	width: 260px;
219
+}
220
+}
221
+
222
+@media only screen and (max-width: 750px) {
223
+.layui-body {
224
+	left: 0px !important;
225
+}
226
+.layui-layout-admin .layui-logo {
227
+	width: 180px;
228
+	text-align: left;
229
+	padding-left: 5px;
230
+}
231
+.menu {
232
+	left: 185px;
233
+}
234
+.area-select {
235
+	right: 5px;
236
+	left: auto;
237
+}
238
+.layui-layout-admin .layui-footer {
239
+	left: 0px !important;
240
+}
241
+.layui-layout-admin .layui-side {
242
+	display: none;
243
+}
244
+.layui-body {
245
+	overflow-x: auto;
246
+}
247
+.hidden-xs {
248
+	display: none;
249
+}
250
+.layui-form-label {
251
+	width: 80px;
252
+}
253
+.pic {
254
+	margin-left: 110px;
255
+}
256
+.layui-input-block {
257
+	margin-left: 110px;
258
+}
259
+}
260
+
261
+@media only screen and (max-width: 450px) {
262
+.layui-form-item.nospace .layui-input-inline {
263
+	margin: 0 0 10px 0px;
264
+}
265
+}

+ 28
- 0
apps/admin/view/default/css/jquery.treetable.css View File

@@ -0,0 +1,28 @@
1
+table.treetable span.indenter {
2
+  display: inline-block;
3
+  margin: 0;
4
+  padding: 0;
5
+  text-align: right;
6
+
7
+  /* Disable text selection of nodes (for better D&D UX) */
8
+  user-select: none;
9
+  -khtml-user-select: none;
10
+  -moz-user-select: none;
11
+  -o-user-select: none;
12
+  -webkit-user-select: none;
13
+
14
+  /* Force content-box box model for indenter (Bootstrap compatibility) */
15
+  -webkit-box-sizing: content-box;
16
+  -moz-box-sizing: content-box;
17
+  box-sizing: content-box;
18
+
19
+  width: 19px;
20
+}
21
+
22
+table.treetable span.indenter a {
23
+  background-position: left center;
24
+  background-repeat: no-repeat;
25
+  display: inline-block;
26
+  text-decoration: none;
27
+  width: 19px;
28
+}

+ 102
- 0
apps/admin/view/default/css/login.css View File

@@ -0,0 +1,102 @@
1
+body, html {
2
+	height: 100%
3
+}
4
+body {
5
+	background: url(../images/bg.jpg);
6
+}
7
+.user-login {
8
+	position: relative;
9
+	left: 0;
10
+	top: 0;
11
+	padding: 120px 0;
12
+	min-height: 100%;
13
+	box-sizing: border-box;
14
+}
15
+.user-login-main {
16
+	width: 375px;
17
+	margin: 0 auto;
18
+	box-sizing: border-box;
19
+	background: #ccc;
20
+	background-color: rgba(248,248,255,0.2);
21
+	border-radius: 5px;
22
+}
23
+.user-login-header {
24
+	text-align: center;
25
+	padding-top: 20px;
26
+}
27
+.user-login-header h2 {
28
+	margin-bottom: 10px;
29
+	font-weight: 300;
30
+	font-size: 25px;
31
+	color: #fff;
32
+	font-weight: bold;
33
+}
34
+.user-login-header p {
35
+	font-weight: 300;
36
+	color: #eee;
37
+}
38
+.user-login-box {
39
+	padding: 20px;
40
+}
41
+.user-login-icon {
42
+	position: absolute;
43
+	left: 1px;
44
+	top: 1px;
45
+	width: 38px;
46
+	line-height: 36px;
47
+	text-align: center;
48
+	color: #d2d2d2;
49
+}
50
+.user-login-box .layui-form-item {
51
+	position: relative;
52
+}
53
+.user-login-box .layui-form-item .layui-input {
54
+	padding-left: 38px
55
+}
56
+.user-login-codeimg {
57
+	height: 38px;
58
+	width: 100%;
59
+	cursor: pointer;
60
+	box-sizing: border-box;
61
+}
62
+.user-login-footer {
63
+	position: absolute;
64
+	left: 0;
65
+	bottom: 0;
66
+	width: 100%;
67
+	line-height: 1.5;
68
+	padding: 20px;
69
+	text-align: center;
70
+	box-sizing: border-box;
71
+	color: rgba(0,0,0,.5);
72
+}
73
+.user-login-footer span {
74
+	padding: 0 5px;
75
+}
76
+.user-login-footer a {
77
+	color: rgba(0,0,0,.5);
78
+}
79
+.user-login-footer a:hover {
80
+	color: rgba(0,0,0,1);
81
+}
82
+
83
+@media screen and (max-width:768px) {
84
+.user-login {
85
+	padding-top: 60px;
86
+}
87
+.user-login-main {
88
+	width: 300px;
89
+}
90
+.user-login-box {
91
+	padding: 10px;
92
+}
93
+}
94
+
95
+@media \0screen\,screen\9 {/* 只支持IE6、7、8 */
96
+.user-login-header h2 {
97
+	color: #000;
98
+}
99
+.user-login-header p {
100
+	color: #999;
101
+}
102
+}

+ 7
- 0
apps/admin/view/default/font-awesome/HELP-US-OUT.txt View File

@@ -0,0 +1,7 @@
1
+I hope you love Font Awesome. If you've found it useful, please do me a favor and check out my latest project,
2
+Fort Awesome (https://fortawesome.com). It makes it easy to put the perfect icons on your website. Choose from our awesome,
3
+comprehensive icon sets or copy and paste your own.
4
+
5
+Please. Check it out.
6
+
7
+-Dave Gandy

+ 2337
- 0
apps/admin/view/default/font-awesome/css/font-awesome.css
File diff suppressed because it is too large
View File


+ 4
- 0
apps/admin/view/default/font-awesome/css/font-awesome.min.css
File diff suppressed because it is too large
View File


BIN
apps/admin/view/default/font-awesome/fonts/FontAwesome.otf View File


BIN
apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.eot View File


+ 2671
- 0
apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.svg
File diff suppressed because it is too large
View File


BIN
apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.ttf View File


BIN
apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.woff View File


BIN
apps/admin/view/default/font-awesome/fonts/fontawesome-webfont.woff2 View File


+ 34
- 0
apps/admin/view/default/font-awesome/less/animated.less View File

@@ -0,0 +1,34 @@
1
+// Animated Icons
2
+// --------------------------
3
+
4
+.@{fa-css-prefix}-spin {
5
+  -webkit-animation: fa-spin 2s infinite linear;
6
+          animation: fa-spin 2s infinite linear;
7
+}
8
+
9
+.@{fa-css-prefix}-pulse {
10
+  -webkit-animation: fa-spin 1s infinite steps(8);
11
+          animation: fa-spin 1s infinite steps(8);
12
+}
13
+
14
+@-webkit-keyframes fa-spin {
15
+  0% {
16
+    -webkit-transform: rotate(0deg);
17
+            transform: rotate(0deg);
18
+  }
19
+  100% {
20
+    -webkit-transform: rotate(359deg);
21
+            transform: rotate(359deg);
22
+  }
23
+}
24
+
25
+@keyframes fa-spin {
26
+  0% {
27
+    -webkit-transform: rotate(0deg);
28
+            transform: rotate(0deg);
29
+  }
30
+  100% {
31
+    -webkit-transform: rotate(359deg);
32
+            transform: rotate(359deg);
33
+  }
34
+}

+ 25
- 0
apps/admin/view/default/font-awesome/less/bordered-pulled.less View File

@@ -0,0 +1,25 @@
1
+// Bordered & Pulled
2
+// -------------------------
3
+
4
+.@{fa-css-prefix}-border {
5
+  padding: .2em .25em .15em;
6
+  border: solid .08em @fa-border-color;
7
+  border-radius: .1em;
8
+}
9
+
10
+.@{fa-css-prefix}-pull-left { float: left; }
11
+.@{fa-css-prefix}-pull-right { float: right; }
12
+
13
+.@{fa-css-prefix} {
14
+  &.@{fa-css-prefix}-pull-left { margin-right: .3em; }
15
+  &.@{fa-css-prefix}-pull-right { margin-left: .3em; }
16
+}
17
+
18
+/* Deprecated as of 4.4.0 */
19
+.pull-right { float: right; }
20
+.pull-left { float: left; }
21
+
22
+.@{fa-css-prefix} {
23
+  &.pull-left { margin-right: .3em; }
24
+  &.pull-right { margin-left: .3em; }
25
+}

+ 0
- 0
apps/admin/view/default/font-awesome/less/core.less View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save