切换导航条
此项目
正在载入...
登录
何书鹏
/
recruit
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
继续操作前请注册或者登录。
下载为
邮件补丁
差异文件
浏览文件
作者
Karson
8 years ago
提交
a0eca04ae912edf7649dec07b5a715748b301579
1 个父辈
65a3080d
master
统一修改文件换行符
修复后台提示两次的BUG 修复上传不能传xls和xlsx文件的BUG
隐藏空白字符变更
内嵌
并排对比
正在显示
27 个修改的文件
包含
2304 行增加
和
2304 行删除
.travis.yml
LICENSE
application/admin/command/Addon/stubs/config.stub
application/admin/command/Addon/stubs/info.stub
application/admin/command/Crud/stubs/controller.stub
application/admin/command/Crud/stubs/model.stub
application/admin/command/Crud/stubs/relationmodel.stub
application/admin/command/Crud/stubs/validate.stub
application/admin/common.php
application/admin/controller/Addon.php
application/admin/controller/Ajax.php
application/admin/controller/Category.php
application/admin/controller/Dashboard.php
application/admin/controller/Index.php
application/admin/controller/general/Attachment.php
application/admin/controller/general/Config.php
application/admin/controller/general/Profile.php
application/admin/library/traits/Backend.php
application/admin/model/Admin.php
application/admin/model/AdminLog.php
application/admin/model/AuthGroup.php
application/admin/model/AuthGroupAccess.php
application/admin/model/AuthRule.php
application/admin/tags.php
application/admin/validate/Category.php
application/build.php
application/command.php
要显示太多修改。
重新载入完整差异
差异文件
邮件补丁
为保证性能只显示
27 of 27+
个文件。
.travis.yml
查看文件 @
a0eca04
sudo
:
false
language
:
php
branches:
only:
- stable
cache:
directories:
- $HOME/.composer/cache
before_install:
- composer self-update
install:
- composer install --no-dev --no-interaction --ignore-platform-reqs
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
- composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
- composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
script:
- php think unit
deploy:
provider
:
releases
api_key:
secure
:
TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
file:
- ThinkPHP_Core.zip
- ThinkPHP_Full.zip
skip_cleanup
:
true
on:
tags
:
true
sudo
:
false
language
:
php
branches
:
only
:
-
stable
cache
:
directories
:
-
$HOME/.composer/cache
before_install
:
-
composer self-update
install
:
-
composer install --no-dev --no-interaction --ignore-platform-reqs
-
zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
-
composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
-
composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
-
composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
-
composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
-
composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
-
composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
-
composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
-
composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
-
composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
-
zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
script
:
-
php think unit
deploy
:
provider
:
releases
api_key
:
secure
:
TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
file
:
-
ThinkPHP_Core.zip
-
ThinkPHP_Full.zip
skip_cleanup
:
true
on
:
tags
:
true
...
...
LICENSE
查看文件 @
a0eca04
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "{}" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright 2017 Karson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "{}" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright 2017 Karson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
\ No newline at end of file
...
...
application/admin/command/Addon/stubs/config.stub
查看文件 @
a0eca04
<?php
return [
[
//配置唯一标识
'name' => 'usernmae',
//显示的标题
'title' => '用户名',
//类型
'type' => 'string',
//数据字典
'content' => [
],
//值
'value' => '',
//验证规则
'rule' => 'required',
//错误消息
'msg' => '',
//提示消息
'tip' => '',
//成功消息
'ok' => '',
//扩展信息
'extend' => ''
],
[
'name' => 'password',
'title' => '密码',
'type' => 'string',
'content' => [
],
'value' => '',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => ''
],
];
<?php
return [
[
//配置唯一标识
'name' => 'usernmae',
//显示的标题
'title' => '用户名',
//类型
'type' => 'string',
//数据字典
'content' => [
],
//值
'value' => '',
//验证规则
'rule' => 'required',
//错误消息
'msg' => '',
//提示消息
'tip' => '',
//成功消息
'ok' => '',
//扩展信息
'extend' => ''
],
[
'name' => 'password',
'title' => '密码',
'type' => 'string',
'content' => [
],
'value' => '',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => ''
],
];
...
...
application/admin/command/Addon/stubs/info.stub
查看文件 @
a0eca04
name = {%name%}
title = 插件名称
intro = FastAdmin插件
author = yourname
website = http://www.fastadmin.net
version = 1.0.0
name = {%name%}
title = 插件名称
intro = FastAdmin插件
author = yourname
website = http://www.fastadmin.net
version = 1.0.0
state = 1
\ No newline at end of file
...
...
application/admin/command/Crud/stubs/controller.stub
查看文件 @
a0eca04
<?php
namespace {%controllerNamespace%};
use app\common\controller\Backend;
use think\Controller;
use think\Request;
/**
* {%tableComment%}
*
* @icon {%iconName%}
*/
class {%controllerName%} extends Backend
{
/**
* {%modelName%}模型对象
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = model('{%modelName%}');
{%controllerAssignList%}
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个方法
* 因此在当前控制器中可不用编写增删改查的代码,如果需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
{%controllerIndex%}
}
<?php
namespace {%controllerNamespace%};
use app\common\controller\Backend;
use think\Controller;
use think\Request;
/**
* {%tableComment%}
*
* @icon {%iconName%}
*/
class {%controllerName%} extends Backend
{
/**
* {%modelName%}模型对象
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = model('{%modelName%}');
{%controllerAssignList%}
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个方法
* 因此在当前控制器中可不用编写增删改查的代码,如果需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
{%controllerIndex%}
}
...
...
application/admin/command/Crud/stubs/model.stub
查看文件 @
a0eca04
<?php
namespace {%modelNamespace%};
use think\Model;
class {%modelName%} extends Model
{
// 表名
protected ${%modelTableType%} = '{%modelTableName%}';
// 自动写入时间戳字段
protected $autoWriteTimestamp = {%modelAutoWriteTimestamp%};
// 定义时间戳字段名
protected $createTime = {%createTime%};
protected $updateTime = {%updateTime%};
// 追加属性
protected $append = [
{%appendAttrList%}
];
{%modelInit%}
{%getEnumList%}
{%getAttrList%}
{%setAttrList%}
{%modelRelationMethod%}
}
<?php
namespace {%modelNamespace%};
use think\Model;
class {%modelName%} extends Model
{
// 表名
protected ${%modelTableType%} = '{%modelTableName%}';
// 自动写入时间戳字段
protected $autoWriteTimestamp = {%modelAutoWriteTimestamp%};
// 定义时间戳字段名
protected $createTime = {%createTime%};
protected $updateTime = {%updateTime%};
// 追加属性
protected $append = [
{%appendAttrList%}
];
{%modelInit%}
{%getEnumList%}
{%getAttrList%}
{%setAttrList%}
{%modelRelationMethod%}
}
...
...
application/admin/command/Crud/stubs/relationmodel.stub
查看文件 @
a0eca04
<?php
namespace {%modelNamespace%};
use think\Model;
class {%relationModelName%} extends Model
{
// 表名
protected ${%relationModelTableType%} = '{%relationModelTableName%}';
}
<?php
namespace {%modelNamespace%};
use think\Model;
class {%relationModelName%} extends Model
{
// 表名
protected ${%relationModelTableType%} = '{%relationModelTableName%}';
}
...
...
application/admin/command/Crud/stubs/validate.stub
查看文件 @
a0eca04
<?php
namespace {%validateNamespace%};
use think\Validate;
class {%validateName%} extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
<?php
namespace {%validateNamespace%};
use think\Validate;
class {%validateName%} extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
...
...
application/admin/common.php
查看文件 @
a0eca04
...
...
@@ -114,7 +114,7 @@ function build_toolbar($btns = NULL, $attr = [])
continue
;
}
list
(
$href
,
$class
,
$icon
,
$text
,
$title
)
=
$btnAttr
[
$v
];
$extend
=
$v
==
'import'
?
'id="btn-import-'
.
\fast\Random
::
alpha
()
.
'" data-url="ajax/upload" data-mimetype="csv,x
sl,xsl
x" data-multiple="false"'
:
''
;
$extend
=
$v
==
'import'
?
'id="btn-import-'
.
\fast\Random
::
alpha
()
.
'" data-url="ajax/upload" data-mimetype="csv,x
ls,xls
x" data-multiple="false"'
:
''
;
$html
[]
=
'<a href="'
.
$href
.
'" class="'
.
$class
.
'" title="'
.
$title
.
'" '
.
$extend
.
'><i class="'
.
$icon
.
'"></i> '
.
$text
.
'</a>'
;
}
return
implode
(
' '
,
$html
);
...
...
application/admin/controller/Addon.php
查看文件 @
a0eca04
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
think\addons\AddonException
;
use
think\addons\Service
;
use
think\Config
;
use
think\Exception
;
/**
* 插件管理
*
* @icon fa fa-circle-o
*/
class
Addon
extends
Backend
{
protected
$model
=
null
;
public
function
_initialize
()
{
parent
::
_initialize
();
}
/**
* 查看
*/
public
function
index
()
{
$addons
=
get_addon_list
();
foreach
(
$addons
as
$k
=>
&
$v
)
{
$config
=
get_addon_config
(
$v
[
'name'
]);
$v
[
'config'
]
=
$config
?
1
:
0
;
}
$this
->
assignconfig
([
'addons'
=>
$addons
]);
return
$this
->
view
->
fetch
();
}
/**
* 配置
*/
public
function
config
(
$ids
=
NULL
)
{
$name
=
$this
->
request
->
get
(
"name"
);
if
(
!
$name
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
$ids
?
'id'
:
'name'
));
}
if
(
!
is_dir
(
ADDON_PATH
.
$name
))
{
$this
->
error
(
__
(
'Directory not found'
));
}
$info
=
get_addon_info
(
$name
);
$config
=
get_addon_fullconfig
(
$name
);
if
(
!
$info
)
$this
->
error
(
__
(
'No Results were found'
));
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$configList
=
[];
foreach
(
$config
as
$k
=>
&
$v
)
{
if
(
isset
(
$params
[
$v
[
'name'
]]))
{
if
(
$v
[
'type'
]
==
'array'
)
{
$fieldarr
=
$valuearr
=
[];
$field
=
$params
[
$v
[
'name'
]][
'field'
];
$value
=
$params
[
$v
[
'name'
]][
'value'
];
foreach
(
$field
as
$m
=>
$n
)
{
if
(
$n
!=
''
)
{
$fieldarr
[]
=
$field
[
$m
];
$valuearr
[]
=
$value
[
$m
];
}
}
$params
[
$v
[
'name'
]]
=
array_combine
(
$fieldarr
,
$valuearr
);
$value
=
$params
[
$v
[
'name'
]];
}
else
{
$value
=
is_array
(
$params
[
$v
[
'name'
]])
?
implode
(
','
,
$params
[
$v
[
'name'
]])
:
$params
[
$v
[
'name'
]];
}
$v
[
'value'
]
=
$value
;
}
}
try
{
//更新配置文件
set_addon_fullconfig
(
$name
,
$config
);
$this
->
success
();
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
$this
->
view
->
assign
(
"addon"
,
[
'info'
=>
$info
,
'config'
=>
$config
]);
return
$this
->
view
->
fetch
();
}
/**
* 安装
*/
public
function
install
()
{
$name
=
$this
->
request
->
post
(
"name"
);
$force
=
(
int
)
$this
->
request
->
post
(
"force"
);
if
(
!
$name
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'name'
));
}
try
{
$uid
=
$this
->
request
->
post
(
"uid"
);
$token
=
$this
->
request
->
post
(
"token"
);
Service
::
install
(
$name
,
$force
,
[
'uid'
=>
$uid
,
'token'
=>
$token
]);
$info
=
get_addon_info
(
$name
);
$info
[
'config'
]
=
get_addon_config
(
$name
)
?
1
:
0
;
$this
->
success
(
__
(
'Install successful'
),
null
,
[
'addon'
=>
$info
]);
}
catch
(
AddonException
$e
)
{
$this
->
result
(
$e
->
getData
(),
$e
->
getCode
(),
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
(),
$e
->
getCode
());
}
}
/**
* 卸载
*/
public
function
uninstall
()
{
$name
=
$this
->
request
->
post
(
"name"
);
$force
=
(
int
)
$this
->
request
->
post
(
"force"
);
if
(
!
$name
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'name'
));
}
try
{
Service
::
uninstall
(
$name
,
$force
);
$this
->
success
(
__
(
'Uninstall successful'
));
}
catch
(
AddonException
$e
)
{
$this
->
result
(
$e
->
getData
(),
$e
->
getCode
(),
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
/**
* 禁用启用
*/
public
function
state
()
{
$name
=
$this
->
request
->
post
(
"name"
);
$action
=
$this
->
request
->
post
(
"action"
);
$force
=
(
int
)
$this
->
request
->
post
(
"force"
);
if
(
!
$name
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'name'
));
}
try
{
$action
=
$action
==
'enable'
?
$action
:
'disable'
;
//调用启用、禁用的方法
Service
::
$action
(
$name
,
$force
);
$this
->
success
(
__
(
'Operate successful'
));
}
catch
(
AddonException
$e
)
{
$this
->
result
(
$e
->
getData
(),
$e
->
getCode
(),
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
/**
* 本地上传
*/
public
function
local
()
{
Config
::
set
(
'default_return_type'
,
'json'
);
$file
=
$this
->
request
->
file
(
'file'
);
$addonTmpDir
=
RUNTIME_PATH
.
'addons'
.
DS
;
if
(
!
is_dir
(
$addonTmpDir
))
{
@
mkdir
(
$addonTmpDir
,
0755
,
true
);
}
$info
=
$file
->
rule
(
'uniqid'
)
->
validate
([
'size'
=>
10240000
,
'ext'
=>
'zip'
])
->
move
(
$addonTmpDir
);
if
(
$info
)
{
$tmpName
=
substr
(
$info
->
getFilename
(),
0
,
stripos
(
$info
->
getFilename
(),
'.'
));
$tmpAddonDir
=
ADDON_PATH
.
$tmpName
.
DS
;
$tmpFile
=
$addonTmpDir
.
$info
->
getSaveName
();
try
{
Service
::
unzip
(
$tmpName
);
@
unlink
(
$tmpFile
);
$infoFile
=
$tmpAddonDir
.
'info.ini'
;
if
(
!
is_file
(
$infoFile
))
{
throw
new
Exception
(
__
(
'Addon info file was not found'
));
}
$config
=
Config
::
parse
(
$infoFile
,
''
,
$tmpName
);
$name
=
isset
(
$config
[
'name'
])
?
$config
[
'name'
]
:
''
;
if
(
!
$name
)
{
throw
new
Exception
(
__
(
'Addon info file data incorrect'
));
}
$newAddonDir
=
ADDON_PATH
.
$name
.
DS
;
if
(
is_dir
(
$newAddonDir
))
{
throw
new
Exception
(
__
(
'Addon already exists'
));
}
//重命名插件文件夹
rename
(
$tmpAddonDir
,
$newAddonDir
);
try
{
//默认禁用该插件
$info
=
get_addon_info
(
$name
);
if
(
$info
[
'state'
])
{
$info
[
'state'
]
=
0
;
set_addon_info
(
$name
,
$info
);
}
//执行插件的安装方法
$class
=
get_addon_class
(
$name
);
if
(
class_exists
(
$class
))
{
$addon
=
new
$class
();
$addon
->
install
();
}
//导入SQL
Service
::
importsql
(
$name
);
$info
[
'config'
]
=
get_addon_config
(
$name
)
?
1
:
0
;
$this
->
success
(
__
(
'Offline installed tips'
),
null
,
[
'addon'
=>
$info
]);
}
catch
(
Exception
$e
)
{
@
rmdirs
(
$newAddonDir
);
throw
new
Exception
(
$e
->
getMessage
());
}
}
catch
(
Exception
$e
)
{
@
unlink
(
$tmpFile
);
@
rmdirs
(
$tmpAddonDir
);
$this
->
error
(
$e
->
getMessage
());
}
}
else
{
// 上传失败获取错误信息
$this
->
error
(
$file
->
getError
());
}
}
/**
* 刷新缓存
*/
public
function
refresh
()
{
try
{
Service
::
refresh
();
$this
->
success
(
__
(
'Operate successful'
));
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
/**
* 已装插件
*/
public
function
downloaded
()
{
$offset
=
(
int
)
$this
->
request
->
get
(
"offset"
);
$limit
=
(
int
)
$this
->
request
->
get
(
"limit"
);
$filter
=
$this
->
request
->
get
(
"filter"
);
$filter
=
(
array
)
json_decode
(
$filter
,
true
);
foreach
(
$filter
as
$k
=>
&
$v
)
{
$v
=
htmlspecialchars
(
strip_tags
(
$v
));
}
unset
(
$v
);
$where
=
[
'status'
=>
'normal'
];
if
(
isset
(
$filter
[
'id'
]))
{
$where
[
'id'
]
=
(
int
)
$filter
[
'id'
];
}
if
(
isset
(
$filter
[
'name'
]))
{
$where
[
'name'
]
=
[
'like'
,
"%
{
$filter
[
'name'
]}
%
"];
}
if (isset(
$filter['title']
))
{
$where['title']
= ['like', "
%
{
$filter
[
'title'
]}
%
"];
}
$addons
= get_addon_list();
$list
= [];
foreach (
$addons
as
$k
=>
$v
)
{
$v['flag']
= '';
$v['banner']
= '';
$v['image']
= '';
$v['donateimage']
= '';
$v['demourl']
= '';
$v['price']
= '0.00';
$v['url']
= '/addons/' .
$v['name']
;
$v['createtime']
= 0;
$list
[] =
$v
;
}
$list
= array_slice(
$list
,
$offset
,
$limit
);
$result
= array("
total
" => count(
$addons
), "
rows
" =>
$list
);
$callback
=
$this->request
->get('callback') ? "
jsonp
" : "
json
";
return
$callback
(
$result
);
}
}
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
think\addons\AddonException
;
use
think\addons\Service
;
use
think\Config
;
use
think\Exception
;
/**
* 插件管理
*
* @icon fa fa-circle-o
*/
class
Addon
extends
Backend
{
protected
$model
=
null
;
public
function
_initialize
()
{
parent
::
_initialize
();
}
/**
* 查看
*/
public
function
index
()
{
$addons
=
get_addon_list
();
foreach
(
$addons
as
$k
=>
&
$v
)
{
$config
=
get_addon_config
(
$v
[
'name'
]);
$v
[
'config'
]
=
$config
?
1
:
0
;
}
$this
->
assignconfig
([
'addons'
=>
$addons
]);
return
$this
->
view
->
fetch
();
}
/**
* 配置
*/
public
function
config
(
$ids
=
NULL
)
{
$name
=
$this
->
request
->
get
(
"name"
);
if
(
!
$name
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
$ids
?
'id'
:
'name'
));
}
if
(
!
is_dir
(
ADDON_PATH
.
$name
))
{
$this
->
error
(
__
(
'Directory not found'
));
}
$info
=
get_addon_info
(
$name
);
$config
=
get_addon_fullconfig
(
$name
);
if
(
!
$info
)
$this
->
error
(
__
(
'No Results were found'
));
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$configList
=
[];
foreach
(
$config
as
$k
=>
&
$v
)
{
if
(
isset
(
$params
[
$v
[
'name'
]]))
{
if
(
$v
[
'type'
]
==
'array'
)
{
$fieldarr
=
$valuearr
=
[];
$field
=
$params
[
$v
[
'name'
]][
'field'
];
$value
=
$params
[
$v
[
'name'
]][
'value'
];
foreach
(
$field
as
$m
=>
$n
)
{
if
(
$n
!=
''
)
{
$fieldarr
[]
=
$field
[
$m
];
$valuearr
[]
=
$value
[
$m
];
}
}
$params
[
$v
[
'name'
]]
=
array_combine
(
$fieldarr
,
$valuearr
);
$value
=
$params
[
$v
[
'name'
]];
}
else
{
$value
=
is_array
(
$params
[
$v
[
'name'
]])
?
implode
(
','
,
$params
[
$v
[
'name'
]])
:
$params
[
$v
[
'name'
]];
}
$v
[
'value'
]
=
$value
;
}
}
try
{
//更新配置文件
set_addon_fullconfig
(
$name
,
$config
);
$this
->
success
();
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
$this
->
view
->
assign
(
"addon"
,
[
'info'
=>
$info
,
'config'
=>
$config
]);
return
$this
->
view
->
fetch
();
}
/**
* 安装
*/
public
function
install
()
{
$name
=
$this
->
request
->
post
(
"name"
);
$force
=
(
int
)
$this
->
request
->
post
(
"force"
);
if
(
!
$name
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'name'
));
}
try
{
$uid
=
$this
->
request
->
post
(
"uid"
);
$token
=
$this
->
request
->
post
(
"token"
);
Service
::
install
(
$name
,
$force
,
[
'uid'
=>
$uid
,
'token'
=>
$token
]);
$info
=
get_addon_info
(
$name
);
$info
[
'config'
]
=
get_addon_config
(
$name
)
?
1
:
0
;
$this
->
success
(
__
(
'Install successful'
),
null
,
[
'addon'
=>
$info
]);
}
catch
(
AddonException
$e
)
{
$this
->
result
(
$e
->
getData
(),
$e
->
getCode
(),
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
(),
$e
->
getCode
());
}
}
/**
* 卸载
*/
public
function
uninstall
()
{
$name
=
$this
->
request
->
post
(
"name"
);
$force
=
(
int
)
$this
->
request
->
post
(
"force"
);
if
(
!
$name
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'name'
));
}
try
{
Service
::
uninstall
(
$name
,
$force
);
$this
->
success
(
__
(
'Uninstall successful'
));
}
catch
(
AddonException
$e
)
{
$this
->
result
(
$e
->
getData
(),
$e
->
getCode
(),
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
/**
* 禁用启用
*/
public
function
state
()
{
$name
=
$this
->
request
->
post
(
"name"
);
$action
=
$this
->
request
->
post
(
"action"
);
$force
=
(
int
)
$this
->
request
->
post
(
"force"
);
if
(
!
$name
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'name'
));
}
try
{
$action
=
$action
==
'enable'
?
$action
:
'disable'
;
//调用启用、禁用的方法
Service
::
$action
(
$name
,
$force
);
$this
->
success
(
__
(
'Operate successful'
));
}
catch
(
AddonException
$e
)
{
$this
->
result
(
$e
->
getData
(),
$e
->
getCode
(),
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
/**
* 本地上传
*/
public
function
local
()
{
Config
::
set
(
'default_return_type'
,
'json'
);
$file
=
$this
->
request
->
file
(
'file'
);
$addonTmpDir
=
RUNTIME_PATH
.
'addons'
.
DS
;
if
(
!
is_dir
(
$addonTmpDir
))
{
@
mkdir
(
$addonTmpDir
,
0755
,
true
);
}
$info
=
$file
->
rule
(
'uniqid'
)
->
validate
([
'size'
=>
10240000
,
'ext'
=>
'zip'
])
->
move
(
$addonTmpDir
);
if
(
$info
)
{
$tmpName
=
substr
(
$info
->
getFilename
(),
0
,
stripos
(
$info
->
getFilename
(),
'.'
));
$tmpAddonDir
=
ADDON_PATH
.
$tmpName
.
DS
;
$tmpFile
=
$addonTmpDir
.
$info
->
getSaveName
();
try
{
Service
::
unzip
(
$tmpName
);
@
unlink
(
$tmpFile
);
$infoFile
=
$tmpAddonDir
.
'info.ini'
;
if
(
!
is_file
(
$infoFile
))
{
throw
new
Exception
(
__
(
'Addon info file was not found'
));
}
$config
=
Config
::
parse
(
$infoFile
,
''
,
$tmpName
);
$name
=
isset
(
$config
[
'name'
])
?
$config
[
'name'
]
:
''
;
if
(
!
$name
)
{
throw
new
Exception
(
__
(
'Addon info file data incorrect'
));
}
$newAddonDir
=
ADDON_PATH
.
$name
.
DS
;
if
(
is_dir
(
$newAddonDir
))
{
throw
new
Exception
(
__
(
'Addon already exists'
));
}
//重命名插件文件夹
rename
(
$tmpAddonDir
,
$newAddonDir
);
try
{
//默认禁用该插件
$info
=
get_addon_info
(
$name
);
if
(
$info
[
'state'
])
{
$info
[
'state'
]
=
0
;
set_addon_info
(
$name
,
$info
);
}
//执行插件的安装方法
$class
=
get_addon_class
(
$name
);
if
(
class_exists
(
$class
))
{
$addon
=
new
$class
();
$addon
->
install
();
}
//导入SQL
Service
::
importsql
(
$name
);
$info
[
'config'
]
=
get_addon_config
(
$name
)
?
1
:
0
;
$this
->
success
(
__
(
'Offline installed tips'
),
null
,
[
'addon'
=>
$info
]);
}
catch
(
Exception
$e
)
{
@
rmdirs
(
$newAddonDir
);
throw
new
Exception
(
$e
->
getMessage
());
}
}
catch
(
Exception
$e
)
{
@
unlink
(
$tmpFile
);
@
rmdirs
(
$tmpAddonDir
);
$this
->
error
(
$e
->
getMessage
());
}
}
else
{
// 上传失败获取错误信息
$this
->
error
(
$file
->
getError
());
}
}
/**
* 刷新缓存
*/
public
function
refresh
()
{
try
{
Service
::
refresh
();
$this
->
success
(
__
(
'Operate successful'
));
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
/**
* 已装插件
*/
public
function
downloaded
()
{
$offset
=
(
int
)
$this
->
request
->
get
(
"offset"
);
$limit
=
(
int
)
$this
->
request
->
get
(
"limit"
);
$filter
=
$this
->
request
->
get
(
"filter"
);
$filter
=
(
array
)
json_decode
(
$filter
,
true
);
foreach
(
$filter
as
$k
=>
&
$v
)
{
$v
=
htmlspecialchars
(
strip_tags
(
$v
));
}
unset
(
$v
);
$where
=
[
'status'
=>
'normal'
];
if
(
isset
(
$filter
[
'id'
]))
{
$where
[
'id'
]
=
(
int
)
$filter
[
'id'
];
}
if
(
isset
(
$filter
[
'name'
]))
{
$where
[
'name'
]
=
[
'like'
,
"%
{
$filter
[
'name'
]}
%
"];
}
if (isset(
$filter['title']
))
{
$where['title']
= ['like', "
%
{
$filter
[
'title'
]}
%
"];
}
$addons
= get_addon_list();
$list
= [];
foreach (
$addons
as
$k
=>
$v
)
{
$v['flag']
= '';
$v['banner']
= '';
$v['image']
= '';
$v['donateimage']
= '';
$v['demourl']
= '';
$v['price']
= '0.00';
$v['url']
= '/addons/' .
$v['name']
;
$v['createtime']
= 0;
$list
[] =
$v
;
}
$list
= array_slice(
$list
,
$offset
,
$limit
);
$result
= array("
total
" => count(
$addons
), "
rows
" =>
$list
);
$callback
=
$this->request
->get('callback') ? "
jsonp
" : "
json
";
return
$callback
(
$result
);
}
}
...
...
application/admin/controller/Ajax.php
查看文件 @
a0eca04
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
fast\Random
;
use
think\Cache
;
use
think\Config
;
use
think\Db
;
use
think\Lang
;
/**
* Ajax异步请求接口
* @internal
*/
class
Ajax
extends
Backend
{
protected
$noNeedLogin
=
[
'lang'
];
protected
$noNeedRight
=
[
'*'
];
protected
$layout
=
''
;
public
function
_initialize
()
{
parent
::
_initialize
();
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
,
'htmlspecialchars'
]);
}
/**
* 加载语言包
*/
public
function
lang
()
{
header
(
'Content-Type: application/javascript'
);
$controllername
=
input
(
"controllername"
);
//默认只加载了控制器对应的语言名,你还根据控制器名来加载额外的语言包
$this
->
loadlang
(
$controllername
);
return
jsonp
(
Lang
::
get
(),
200
,
[],
[
'json_encode_param'
=>
JSON_FORCE_OBJECT
|
JSON_UNESCAPED_UNICODE
]);
}
/**
* 上传文件
*/
public
function
upload
()
{
Config
::
set
(
'default_return_type'
,
'json'
);
$file
=
$this
->
request
->
file
(
'file'
);
if
(
empty
(
$file
))
{
$this
->
error
(
"未上传文件或超出服务器上传限制"
);
}
//判断是否已经存在附件
$sha1
=
$file
->
hash
();
$upload
=
Config
::
get
(
'upload'
);
preg_match
(
'/(\d+)(\w+)/'
,
$upload
[
'maxsize'
],
$matches
);
$type
=
strtolower
(
$matches
[
2
]);
$typeDict
=
[
'b'
=>
0
,
'k'
=>
1
,
'kb'
=>
1
,
'm'
=>
2
,
'mb'
=>
2
,
'gb'
=>
3
,
'g'
=>
3
];
$size
=
(
int
)
$upload
[
'maxsize'
]
*
pow
(
1024
,
isset
(
$typeDict
[
$type
])
?
$typeDict
[
$type
]
:
0
);
$fileInfo
=
$file
->
getInfo
();
$suffix
=
strtolower
(
pathinfo
(
$fileInfo
[
'name'
],
PATHINFO_EXTENSION
));
$suffix
=
$suffix
?
$suffix
:
'file'
;
$replaceArr
=
[
'{year}'
=>
date
(
"Y"
),
'{mon}'
=>
date
(
"m"
),
'{day}'
=>
date
(
"d"
),
'{hour}'
=>
date
(
"H"
),
'{min}'
=>
date
(
"i"
),
'{sec}'
=>
date
(
"s"
),
'{random}'
=>
Random
::
alnum
(
16
),
'{random32}'
=>
Random
::
alnum
(
32
),
'{filename}'
=>
$suffix
?
substr
(
$fileInfo
[
'name'
],
0
,
strripos
(
$fileInfo
[
'name'
],
'.'
))
:
$fileInfo
[
'name'
],
'{suffix}'
=>
$suffix
,
'{.suffix}'
=>
$suffix
?
'.'
.
$suffix
:
''
,
'{filemd5}'
=>
md5_file
(
$fileInfo
[
'tmp_name'
]),
];
$savekey
=
$upload
[
'savekey'
];
$savekey
=
str_replace
(
array_keys
(
$replaceArr
),
array_values
(
$replaceArr
),
$savekey
);
$uploadDir
=
substr
(
$savekey
,
0
,
strripos
(
$savekey
,
'/'
)
+
1
);
$fileName
=
substr
(
$savekey
,
strripos
(
$savekey
,
'/'
)
+
1
);
//
$splInfo
=
$file
->
validate
([
'size'
=>
$size
])
->
move
(
ROOT_PATH
.
'/public'
.
$uploadDir
,
$fileName
);
if
(
$splInfo
)
{
$imagewidth
=
$imageheight
=
0
;
if
(
in_array
(
$suffix
,
[
'gif'
,
'jpg'
,
'jpeg'
,
'bmp'
,
'png'
,
'swf'
]))
{
$imgInfo
=
getimagesize
(
$splInfo
->
getPathname
());
$imagewidth
=
isset
(
$imgInfo
[
0
])
?
$imgInfo
[
0
]
:
$imagewidth
;
$imageheight
=
isset
(
$imgInfo
[
1
])
?
$imgInfo
[
1
]
:
$imageheight
;
}
$params
=
array
(
'filesize'
=>
$fileInfo
[
'size'
],
'imagewidth'
=>
$imagewidth
,
'imageheight'
=>
$imageheight
,
'imagetype'
=>
$suffix
,
'imageframes'
=>
0
,
'mimetype'
=>
$fileInfo
[
'type'
],
'url'
=>
$uploadDir
.
$splInfo
->
getSaveName
(),
'uploadtime'
=>
time
(),
'storage'
=>
'local'
,
'sha1'
=>
$sha1
,
);
$attachment
=
model
(
"attachment"
);
$attachment
->
data
(
array_filter
(
$params
));
$attachment
->
save
();
\think\Hook
::
listen
(
"upload_after"
,
$attachment
);
$this
->
success
(
'上传成功'
,
null
,
[
'url'
=>
$uploadDir
.
$splInfo
->
getSaveName
()
]);
}
else
{
// 上传失败获取错误信息
$this
->
error
(
$file
->
getError
());
}
}
/**
* 通用排序
*/
public
function
weigh
()
{
//排序的数组
$ids
=
$this
->
request
->
post
(
"ids"
);
//拖动的记录ID
$changeid
=
$this
->
request
->
post
(
"changeid"
);
//操作字段
$field
=
$this
->
request
->
post
(
"field"
);
//操作的数据表
$table
=
$this
->
request
->
post
(
"table"
);
//排序的方式
$orderway
=
$this
->
request
->
post
(
"orderway"
,
'strtolower'
);
$orderway
=
$orderway
==
'asc'
?
'ASC'
:
'DESC'
;
$sour
=
$weighdata
=
[];
$ids
=
explode
(
','
,
$ids
);
$prikey
=
'id'
;
$pid
=
$this
->
request
->
post
(
"pid"
);
//限制更新的字段
$field
=
in_array
(
$field
,
[
'weigh'
])
?
$field
:
'weigh'
;
// 如果设定了pid的值,此时只匹配满足条件的ID,其它忽略
if
(
$pid
!==
''
)
{
$hasids
=
[];
$list
=
Db
::
name
(
$table
)
->
where
(
$prikey
,
'in'
,
$ids
)
->
where
(
'pid'
,
'in'
,
$pid
)
->
field
(
'id,pid'
)
->
select
();
foreach
(
$list
as
$k
=>
$v
)
{
$hasids
[]
=
$v
[
'id'
];
}
$ids
=
array_values
(
array_intersect
(
$ids
,
$hasids
));
}
//直接修复排序
$one
=
Db
::
name
(
$table
)
->
field
(
"
{
$field
}
,COUNT(*) AS nums"
)
->
group
(
$field
)
->
having
(
'nums > 1'
)
->
find
();
if
(
$one
)
{
$list
=
Db
::
name
(
$table
)
->
field
(
"
$prikey
,
$field
"
)
->
order
(
$field
,
$orderway
)
->
select
();
foreach
(
$list
as
$k
=>
$v
)
{
Db
::
name
(
$table
)
->
where
(
$prikey
,
$v
[
$prikey
])
->
update
([
$field
=>
$k
+
1
]);
}
$this
->
success
();
}
else
{
$list
=
Db
::
name
(
$table
)
->
field
(
"
$prikey
,
$field
"
)
->
where
(
$prikey
,
'in'
,
$ids
)
->
order
(
$field
,
$orderway
)
->
select
();
foreach
(
$list
as
$k
=>
$v
)
{
$sour
[]
=
$v
[
$prikey
];
$weighdata
[
$v
[
$prikey
]]
=
$v
[
$field
];
}
$position
=
array_search
(
$changeid
,
$ids
);
$desc_id
=
$sour
[
$position
];
//移动到目标的ID值,取出所处改变前位置的值
$sour_id
=
$changeid
;
$desc_value
=
$weighdata
[
$desc_id
];
$sour_value
=
$weighdata
[
$sour_id
];
//echo "移动的ID:{$sour_id}\n";
//echo "替换的ID:{$desc_id}\n";
$weighids
=
array
();
$temp
=
array_values
(
array_diff_assoc
(
$ids
,
$sour
));
foreach
(
$temp
as
$m
=>
$n
)
{
if
(
$n
==
$sour_id
)
{
$offset
=
$desc_id
;
}
else
{
if
(
$sour_id
==
$temp
[
0
])
{
$offset
=
isset
(
$temp
[
$m
+
1
])
?
$temp
[
$m
+
1
]
:
$sour_id
;
}
else
{
$offset
=
isset
(
$temp
[
$m
-
1
])
?
$temp
[
$m
-
1
]
:
$sour_id
;
}
}
$weighids
[
$n
]
=
$weighdata
[
$offset
];
Db
::
name
(
$table
)
->
where
(
$prikey
,
$n
)
->
update
([
$field
=>
$weighdata
[
$offset
]]);
}
$this
->
success
();
}
}
/**
* 清空系统缓存
*/
public
function
wipecache
()
{
$wipe_cache_type
=
[
'TEMP_PATH'
,
'LOG_PATH'
,
'CACHE_PATH'
];
foreach
(
$wipe_cache_type
as
$item
)
{
$dir
=
constant
(
$item
);
if
(
!
is_dir
(
$dir
))
continue
;
rmdirs
(
$dir
);
}
Cache
::
clear
();
\think\Hook
::
listen
(
"wipecache_after"
);
$this
->
success
();
}
/**
* 读取分类数据,联动列表
*/
public
function
category
()
{
$type
=
$this
->
request
->
get
(
'type'
);
$pid
=
$this
->
request
->
get
(
'pid'
);
$where
=
[
'status'
=>
'normal'
];
$categorylist
=
null
;
if
(
$pid
!==
''
)
{
if
(
$type
)
{
$where
[
'type'
]
=
$type
;
}
if
(
$pid
)
{
$where
[
'pid'
]
=
$pid
;
}
$categorylist
=
Db
::
name
(
'category'
)
->
where
(
$where
)
->
field
(
'id as value,name'
)
->
order
(
'weigh desc,id desc'
)
->
select
();
}
$this
->
success
(
''
,
null
,
$categorylist
);
}
/**
* 读取省市区数据,联动列表
*/
public
function
area
()
{
$province
=
$this
->
request
->
get
(
'province'
);
$city
=
$this
->
request
->
get
(
'city'
);
$where
=
[
'pid'
=>
0
,
'level'
=>
1
];
$provincelist
=
null
;
if
(
$province
!==
''
)
{
if
(
$province
)
{
$where
[
'pid'
]
=
$province
;
$where
[
'level'
]
=
2
;
}
if
(
$city
!==
''
)
{
if
(
$city
)
{
$where
[
'pid'
]
=
$city
;
$where
[
'level'
]
=
3
;
}
$provincelist
=
Db
::
name
(
'area'
)
->
where
(
$where
)
->
field
(
'id as value,name'
)
->
select
();
}
}
$this
->
success
(
''
,
null
,
$provincelist
);
}
}
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
fast\Random
;
use
think\Cache
;
use
think\Config
;
use
think\Db
;
use
think\Lang
;
/**
* Ajax异步请求接口
* @internal
*/
class
Ajax
extends
Backend
{
protected
$noNeedLogin
=
[
'lang'
];
protected
$noNeedRight
=
[
'*'
];
protected
$layout
=
''
;
public
function
_initialize
()
{
parent
::
_initialize
();
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
,
'htmlspecialchars'
]);
}
/**
* 加载语言包
*/
public
function
lang
()
{
header
(
'Content-Type: application/javascript'
);
$controllername
=
input
(
"controllername"
);
//默认只加载了控制器对应的语言名,你还根据控制器名来加载额外的语言包
$this
->
loadlang
(
$controllername
);
return
jsonp
(
Lang
::
get
(),
200
,
[],
[
'json_encode_param'
=>
JSON_FORCE_OBJECT
|
JSON_UNESCAPED_UNICODE
]);
}
/**
* 上传文件
*/
public
function
upload
()
{
Config
::
set
(
'default_return_type'
,
'json'
);
$file
=
$this
->
request
->
file
(
'file'
);
if
(
empty
(
$file
))
{
$this
->
error
(
"未上传文件或超出服务器上传限制"
);
}
//判断是否已经存在附件
$sha1
=
$file
->
hash
();
$upload
=
Config
::
get
(
'upload'
);
preg_match
(
'/(\d+)(\w+)/'
,
$upload
[
'maxsize'
],
$matches
);
$type
=
strtolower
(
$matches
[
2
]);
$typeDict
=
[
'b'
=>
0
,
'k'
=>
1
,
'kb'
=>
1
,
'm'
=>
2
,
'mb'
=>
2
,
'gb'
=>
3
,
'g'
=>
3
];
$size
=
(
int
)
$upload
[
'maxsize'
]
*
pow
(
1024
,
isset
(
$typeDict
[
$type
])
?
$typeDict
[
$type
]
:
0
);
$fileInfo
=
$file
->
getInfo
();
$suffix
=
strtolower
(
pathinfo
(
$fileInfo
[
'name'
],
PATHINFO_EXTENSION
));
$suffix
=
$suffix
?
$suffix
:
'file'
;
$replaceArr
=
[
'{year}'
=>
date
(
"Y"
),
'{mon}'
=>
date
(
"m"
),
'{day}'
=>
date
(
"d"
),
'{hour}'
=>
date
(
"H"
),
'{min}'
=>
date
(
"i"
),
'{sec}'
=>
date
(
"s"
),
'{random}'
=>
Random
::
alnum
(
16
),
'{random32}'
=>
Random
::
alnum
(
32
),
'{filename}'
=>
$suffix
?
substr
(
$fileInfo
[
'name'
],
0
,
strripos
(
$fileInfo
[
'name'
],
'.'
))
:
$fileInfo
[
'name'
],
'{suffix}'
=>
$suffix
,
'{.suffix}'
=>
$suffix
?
'.'
.
$suffix
:
''
,
'{filemd5}'
=>
md5_file
(
$fileInfo
[
'tmp_name'
]),
];
$savekey
=
$upload
[
'savekey'
];
$savekey
=
str_replace
(
array_keys
(
$replaceArr
),
array_values
(
$replaceArr
),
$savekey
);
$uploadDir
=
substr
(
$savekey
,
0
,
strripos
(
$savekey
,
'/'
)
+
1
);
$fileName
=
substr
(
$savekey
,
strripos
(
$savekey
,
'/'
)
+
1
);
//
$splInfo
=
$file
->
validate
([
'size'
=>
$size
])
->
move
(
ROOT_PATH
.
'/public'
.
$uploadDir
,
$fileName
);
if
(
$splInfo
)
{
$imagewidth
=
$imageheight
=
0
;
if
(
in_array
(
$suffix
,
[
'gif'
,
'jpg'
,
'jpeg'
,
'bmp'
,
'png'
,
'swf'
]))
{
$imgInfo
=
getimagesize
(
$splInfo
->
getPathname
());
$imagewidth
=
isset
(
$imgInfo
[
0
])
?
$imgInfo
[
0
]
:
$imagewidth
;
$imageheight
=
isset
(
$imgInfo
[
1
])
?
$imgInfo
[
1
]
:
$imageheight
;
}
$params
=
array
(
'filesize'
=>
$fileInfo
[
'size'
],
'imagewidth'
=>
$imagewidth
,
'imageheight'
=>
$imageheight
,
'imagetype'
=>
$suffix
,
'imageframes'
=>
0
,
'mimetype'
=>
$fileInfo
[
'type'
],
'url'
=>
$uploadDir
.
$splInfo
->
getSaveName
(),
'uploadtime'
=>
time
(),
'storage'
=>
'local'
,
'sha1'
=>
$sha1
,
);
$attachment
=
model
(
"attachment"
);
$attachment
->
data
(
array_filter
(
$params
));
$attachment
->
save
();
\think\Hook
::
listen
(
"upload_after"
,
$attachment
);
$this
->
success
(
'上传成功'
,
null
,
[
'url'
=>
$uploadDir
.
$splInfo
->
getSaveName
()
]);
}
else
{
// 上传失败获取错误信息
$this
->
error
(
$file
->
getError
());
}
}
/**
* 通用排序
*/
public
function
weigh
()
{
//排序的数组
$ids
=
$this
->
request
->
post
(
"ids"
);
//拖动的记录ID
$changeid
=
$this
->
request
->
post
(
"changeid"
);
//操作字段
$field
=
$this
->
request
->
post
(
"field"
);
//操作的数据表
$table
=
$this
->
request
->
post
(
"table"
);
//排序的方式
$orderway
=
$this
->
request
->
post
(
"orderway"
,
'strtolower'
);
$orderway
=
$orderway
==
'asc'
?
'ASC'
:
'DESC'
;
$sour
=
$weighdata
=
[];
$ids
=
explode
(
','
,
$ids
);
$prikey
=
'id'
;
$pid
=
$this
->
request
->
post
(
"pid"
);
//限制更新的字段
$field
=
in_array
(
$field
,
[
'weigh'
])
?
$field
:
'weigh'
;
// 如果设定了pid的值,此时只匹配满足条件的ID,其它忽略
if
(
$pid
!==
''
)
{
$hasids
=
[];
$list
=
Db
::
name
(
$table
)
->
where
(
$prikey
,
'in'
,
$ids
)
->
where
(
'pid'
,
'in'
,
$pid
)
->
field
(
'id,pid'
)
->
select
();
foreach
(
$list
as
$k
=>
$v
)
{
$hasids
[]
=
$v
[
'id'
];
}
$ids
=
array_values
(
array_intersect
(
$ids
,
$hasids
));
}
//直接修复排序
$one
=
Db
::
name
(
$table
)
->
field
(
"
{
$field
}
,COUNT(*) AS nums"
)
->
group
(
$field
)
->
having
(
'nums > 1'
)
->
find
();
if
(
$one
)
{
$list
=
Db
::
name
(
$table
)
->
field
(
"
$prikey
,
$field
"
)
->
order
(
$field
,
$orderway
)
->
select
();
foreach
(
$list
as
$k
=>
$v
)
{
Db
::
name
(
$table
)
->
where
(
$prikey
,
$v
[
$prikey
])
->
update
([
$field
=>
$k
+
1
]);
}
$this
->
success
();
}
else
{
$list
=
Db
::
name
(
$table
)
->
field
(
"
$prikey
,
$field
"
)
->
where
(
$prikey
,
'in'
,
$ids
)
->
order
(
$field
,
$orderway
)
->
select
();
foreach
(
$list
as
$k
=>
$v
)
{
$sour
[]
=
$v
[
$prikey
];
$weighdata
[
$v
[
$prikey
]]
=
$v
[
$field
];
}
$position
=
array_search
(
$changeid
,
$ids
);
$desc_id
=
$sour
[
$position
];
//移动到目标的ID值,取出所处改变前位置的值
$sour_id
=
$changeid
;
$desc_value
=
$weighdata
[
$desc_id
];
$sour_value
=
$weighdata
[
$sour_id
];
//echo "移动的ID:{$sour_id}\n";
//echo "替换的ID:{$desc_id}\n";
$weighids
=
array
();
$temp
=
array_values
(
array_diff_assoc
(
$ids
,
$sour
));
foreach
(
$temp
as
$m
=>
$n
)
{
if
(
$n
==
$sour_id
)
{
$offset
=
$desc_id
;
}
else
{
if
(
$sour_id
==
$temp
[
0
])
{
$offset
=
isset
(
$temp
[
$m
+
1
])
?
$temp
[
$m
+
1
]
:
$sour_id
;
}
else
{
$offset
=
isset
(
$temp
[
$m
-
1
])
?
$temp
[
$m
-
1
]
:
$sour_id
;
}
}
$weighids
[
$n
]
=
$weighdata
[
$offset
];
Db
::
name
(
$table
)
->
where
(
$prikey
,
$n
)
->
update
([
$field
=>
$weighdata
[
$offset
]]);
}
$this
->
success
();
}
}
/**
* 清空系统缓存
*/
public
function
wipecache
()
{
$wipe_cache_type
=
[
'TEMP_PATH'
,
'LOG_PATH'
,
'CACHE_PATH'
];
foreach
(
$wipe_cache_type
as
$item
)
{
$dir
=
constant
(
$item
);
if
(
!
is_dir
(
$dir
))
continue
;
rmdirs
(
$dir
);
}
Cache
::
clear
();
\think\Hook
::
listen
(
"wipecache_after"
);
$this
->
success
();
}
/**
* 读取分类数据,联动列表
*/
public
function
category
()
{
$type
=
$this
->
request
->
get
(
'type'
);
$pid
=
$this
->
request
->
get
(
'pid'
);
$where
=
[
'status'
=>
'normal'
];
$categorylist
=
null
;
if
(
$pid
!==
''
)
{
if
(
$type
)
{
$where
[
'type'
]
=
$type
;
}
if
(
$pid
)
{
$where
[
'pid'
]
=
$pid
;
}
$categorylist
=
Db
::
name
(
'category'
)
->
where
(
$where
)
->
field
(
'id as value,name'
)
->
order
(
'weigh desc,id desc'
)
->
select
();
}
$this
->
success
(
''
,
null
,
$categorylist
);
}
/**
* 读取省市区数据,联动列表
*/
public
function
area
()
{
$province
=
$this
->
request
->
get
(
'province'
);
$city
=
$this
->
request
->
get
(
'city'
);
$where
=
[
'pid'
=>
0
,
'level'
=>
1
];
$provincelist
=
null
;
if
(
$province
!==
''
)
{
if
(
$province
)
{
$where
[
'pid'
]
=
$province
;
$where
[
'level'
]
=
2
;
}
if
(
$city
!==
''
)
{
if
(
$city
)
{
$where
[
'pid'
]
=
$city
;
$where
[
'level'
]
=
3
;
}
$provincelist
=
Db
::
name
(
'area'
)
->
where
(
$where
)
->
field
(
'id as value,name'
)
->
select
();
}
}
$this
->
success
(
''
,
null
,
$provincelist
);
}
}
...
...
application/admin/controller/Category.php
查看文件 @
a0eca04
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
app\common\model\Category
as
CategoryModel
;
use
fast\Tree
;
/**
* 分类管理
*
* @icon fa fa-list
* @remark 用于统一管理网站的所有分类,分类可进行无限级分类
*/
class
Category
extends
Backend
{
protected
$model
=
null
;
protected
$categorylist
=
[];
protected
$noNeedRight
=
[
'selectpage'
];
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
request
->
filter
([
'strip_tags'
]);
$this
->
model
=
model
(
'Category'
);
$tree
=
Tree
::
instance
();
$tree
->
init
(
collection
(
$this
->
model
->
order
(
'weigh desc,id desc'
)
->
select
())
->
toArray
(),
'pid'
);
$this
->
categorylist
=
$tree
->
getTreeList
(
$tree
->
getTreeArray
(
0
),
'name'
);
$categorydata
=
[
0
=>
[
'type'
=>
'all'
,
'name'
=>
__
(
'None'
)]];
foreach
(
$this
->
categorylist
as
$k
=>
$v
)
{
$categorydata
[
$v
[
'id'
]]
=
$v
;
}
$this
->
view
->
assign
(
"flagList"
,
$this
->
model
->
getFlagList
());
$this
->
view
->
assign
(
"typeList"
,
CategoryModel
::
getTypeList
());
$this
->
view
->
assign
(
"parentList"
,
$categorydata
);
}
/**
* 查看
*/
public
function
index
()
{
if
(
$this
->
request
->
isAjax
())
{
$search
=
$this
->
request
->
request
(
"search"
);
//构造父类select列表选项数据
$list
=
[];
if
(
$search
)
{
foreach
(
$this
->
categorylist
as
$k
=>
$v
)
{
if
(
stripos
(
$v
[
'name'
],
$search
)
!==
false
||
stripos
(
$v
[
'nickname'
],
$search
)
!==
false
)
{
$list
[]
=
$v
;
}
}
}
else
{
$list
=
$this
->
categorylist
;
}
$total
=
count
(
$list
);
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* Selectpage搜索
*
* @internal
*/
public
function
selectpage
()
{
return
parent
::
selectpage
();
}
}
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
app\common\model\Category
as
CategoryModel
;
use
fast\Tree
;
/**
* 分类管理
*
* @icon fa fa-list
* @remark 用于统一管理网站的所有分类,分类可进行无限级分类
*/
class
Category
extends
Backend
{
protected
$model
=
null
;
protected
$categorylist
=
[];
protected
$noNeedRight
=
[
'selectpage'
];
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
request
->
filter
([
'strip_tags'
]);
$this
->
model
=
model
(
'Category'
);
$tree
=
Tree
::
instance
();
$tree
->
init
(
collection
(
$this
->
model
->
order
(
'weigh desc,id desc'
)
->
select
())
->
toArray
(),
'pid'
);
$this
->
categorylist
=
$tree
->
getTreeList
(
$tree
->
getTreeArray
(
0
),
'name'
);
$categorydata
=
[
0
=>
[
'type'
=>
'all'
,
'name'
=>
__
(
'None'
)]];
foreach
(
$this
->
categorylist
as
$k
=>
$v
)
{
$categorydata
[
$v
[
'id'
]]
=
$v
;
}
$this
->
view
->
assign
(
"flagList"
,
$this
->
model
->
getFlagList
());
$this
->
view
->
assign
(
"typeList"
,
CategoryModel
::
getTypeList
());
$this
->
view
->
assign
(
"parentList"
,
$categorydata
);
}
/**
* 查看
*/
public
function
index
()
{
if
(
$this
->
request
->
isAjax
())
{
$search
=
$this
->
request
->
request
(
"search"
);
//构造父类select列表选项数据
$list
=
[];
if
(
$search
)
{
foreach
(
$this
->
categorylist
as
$k
=>
$v
)
{
if
(
stripos
(
$v
[
'name'
],
$search
)
!==
false
||
stripos
(
$v
[
'nickname'
],
$search
)
!==
false
)
{
$list
[]
=
$v
;
}
}
}
else
{
$list
=
$this
->
categorylist
;
}
$total
=
count
(
$list
);
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* Selectpage搜索
*
* @internal
*/
public
function
selectpage
()
{
return
parent
::
selectpage
();
}
}
...
...
application/admin/controller/Dashboard.php
查看文件 @
a0eca04
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
/**
* 控制台
*
* @icon fa fa-dashboard
* @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
*/
class
Dashboard
extends
Backend
{
/**
* 查看
*/
public
function
index
()
{
$seventtime
=
\fast\Date
::
unixtime
(
'day'
,
-
7
);
$paylist
=
$createlist
=
[];
for
(
$i
=
0
;
$i
<
7
;
$i
++
)
{
$day
=
date
(
"Y-m-d"
,
$seventtime
+
(
$i
*
86400
));
$createlist
[
$day
]
=
mt_rand
(
20
,
200
);
$paylist
[
$day
]
=
mt_rand
(
1
,
mt_rand
(
1
,
$createlist
[
$day
]));
}
$hooks
=
config
(
'addons.hooks'
);
$uploadmode
=
isset
(
$hooks
[
'upload_config_init'
])
&&
$hooks
[
'upload_config_init'
]
?
implode
(
','
,
$hooks
[
'upload_config_init'
])
:
'local'
;
$this
->
view
->
assign
([
'totaluser'
=>
35200
,
'totalviews'
=>
219390
,
'totalorder'
=>
32143
,
'totalorderamount'
=>
174800
,
'todayuserlogin'
=>
321
,
'todayusersignup'
=>
430
,
'todayorder'
=>
2324
,
'unsettleorder'
=>
132
,
'sevendnu'
=>
'80%'
,
'sevendau'
=>
'32%'
,
'paylist'
=>
$paylist
,
'createlist'
=>
$createlist
,
'uploadmode'
=>
$uploadmode
]);
return
$this
->
view
->
fetch
();
}
}
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
/**
* 控制台
*
* @icon fa fa-dashboard
* @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
*/
class
Dashboard
extends
Backend
{
/**
* 查看
*/
public
function
index
()
{
$seventtime
=
\fast\Date
::
unixtime
(
'day'
,
-
7
);
$paylist
=
$createlist
=
[];
for
(
$i
=
0
;
$i
<
7
;
$i
++
)
{
$day
=
date
(
"Y-m-d"
,
$seventtime
+
(
$i
*
86400
));
$createlist
[
$day
]
=
mt_rand
(
20
,
200
);
$paylist
[
$day
]
=
mt_rand
(
1
,
mt_rand
(
1
,
$createlist
[
$day
]));
}
$hooks
=
config
(
'addons.hooks'
);
$uploadmode
=
isset
(
$hooks
[
'upload_config_init'
])
&&
$hooks
[
'upload_config_init'
]
?
implode
(
','
,
$hooks
[
'upload_config_init'
])
:
'local'
;
$this
->
view
->
assign
([
'totaluser'
=>
35200
,
'totalviews'
=>
219390
,
'totalorder'
=>
32143
,
'totalorderamount'
=>
174800
,
'todayuserlogin'
=>
321
,
'todayusersignup'
=>
430
,
'todayorder'
=>
2324
,
'unsettleorder'
=>
132
,
'sevendnu'
=>
'80%'
,
'sevendau'
=>
'32%'
,
'paylist'
=>
$paylist
,
'createlist'
=>
$createlist
,
'uploadmode'
=>
$uploadmode
]);
return
$this
->
view
->
fetch
();
}
}
...
...
application/admin/controller/Index.php
查看文件 @
a0eca04
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
think\Validate
;
/**
* 后台首页
* @internal
*/
class
Index
extends
Backend
{
protected
$noNeedLogin
=
[
'login'
];
protected
$noNeedRight
=
[
'index'
,
'logout'
];
protected
$layout
=
''
;
public
function
_initialize
()
{
parent
::
_initialize
();
}
/**
* 后台首页
*/
public
function
index
()
{
//
$menulist
=
$this
->
auth
->
getSidebar
([
'dashboard'
=>
'hot'
,
'addon'
=>
[
'new'
,
'red'
,
'badge'
],
'auth/rule'
=>
'side'
,
'general'
=>
[
'18'
,
'purple'
],
],
$this
->
view
->
site
[
'fixedpage'
]);
$this
->
view
->
assign
(
'menulist'
,
$menulist
);
$this
->
view
->
assign
(
'title'
,
__
(
'Home'
));
return
$this
->
view
->
fetch
();
}
/**
* 管理员登录
*/
public
function
login
()
{
$url
=
$this
->
request
->
get
(
'url'
,
'index/index'
);
if
(
$this
->
auth
->
isLogin
())
{
$this
->
error
(
__
(
"You've logged in, do not login again"
),
$url
);
}
if
(
$this
->
request
->
isPost
())
{
$username
=
$this
->
request
->
post
(
'username'
);
$password
=
$this
->
request
->
post
(
'password'
);
$keeplogin
=
$this
->
request
->
post
(
'keeplogin'
);
$token
=
$this
->
request
->
post
(
'__token__'
);
$rule
=
[
'username'
=>
'require|length:3,30'
,
'password'
=>
'require|length:3,30'
,
'__token__'
=>
'token'
,
];
$data
=
[
'username'
=>
$username
,
'password'
=>
$password
,
'__token__'
=>
$token
,
];
$validate
=
new
Validate
(
$rule
);
$result
=
$validate
->
check
(
$data
);
if
(
!
$result
)
{
$this
->
error
(
$validate
->
getError
(),
$url
,
[
'token'
=>
$this
->
request
->
token
()]);
}
\app\admin\model\AdminLog
::
setTitle
(
__
(
'Login'
));
$result
=
$this
->
auth
->
login
(
$username
,
$password
,
$keeplogin
?
86400
:
0
);
if
(
$result
===
true
)
{
$this
->
success
(
__
(
'Login successful'
),
$url
,
[
'url'
=>
$url
,
'id'
=>
$this
->
auth
->
id
,
'username'
=>
$username
,
'avatar'
=>
$this
->
auth
->
avatar
]);
}
else
{
$this
->
error
(
__
(
'Username or password is incorrect'
),
$url
,
[
'token'
=>
$this
->
request
->
token
()]);
}
}
// 根据客户端的cookie,判断是否可以自动登录
if
(
$this
->
auth
->
autologin
())
{
$this
->
redirect
(
$url
);
}
\think\Hook
::
listen
(
"login_init"
,
$this
->
request
);
return
$this
->
view
->
fetch
();
}
/**
* 注销登录
*/
public
function
logout
()
{
$this
->
auth
->
logout
();
$this
->
success
(
__
(
'Logout successful'
),
'index/login'
);
}
}
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
think\Validate
;
/**
* 后台首页
* @internal
*/
class
Index
extends
Backend
{
protected
$noNeedLogin
=
[
'login'
];
protected
$noNeedRight
=
[
'index'
,
'logout'
];
protected
$layout
=
''
;
public
function
_initialize
()
{
parent
::
_initialize
();
}
/**
* 后台首页
*/
public
function
index
()
{
//
$menulist
=
$this
->
auth
->
getSidebar
([
'dashboard'
=>
'hot'
,
'addon'
=>
[
'new'
,
'red'
,
'badge'
],
'auth/rule'
=>
'side'
,
'general'
=>
[
'18'
,
'purple'
],
],
$this
->
view
->
site
[
'fixedpage'
]);
$this
->
view
->
assign
(
'menulist'
,
$menulist
);
$this
->
view
->
assign
(
'title'
,
__
(
'Home'
));
return
$this
->
view
->
fetch
();
}
/**
* 管理员登录
*/
public
function
login
()
{
$url
=
$this
->
request
->
get
(
'url'
,
'index/index'
);
if
(
$this
->
auth
->
isLogin
())
{
$this
->
error
(
__
(
"You've logged in, do not login again"
),
$url
);
}
if
(
$this
->
request
->
isPost
())
{
$username
=
$this
->
request
->
post
(
'username'
);
$password
=
$this
->
request
->
post
(
'password'
);
$keeplogin
=
$this
->
request
->
post
(
'keeplogin'
);
$token
=
$this
->
request
->
post
(
'__token__'
);
$rule
=
[
'username'
=>
'require|length:3,30'
,
'password'
=>
'require|length:3,30'
,
'__token__'
=>
'token'
,
];
$data
=
[
'username'
=>
$username
,
'password'
=>
$password
,
'__token__'
=>
$token
,
];
$validate
=
new
Validate
(
$rule
);
$result
=
$validate
->
check
(
$data
);
if
(
!
$result
)
{
$this
->
error
(
$validate
->
getError
(),
$url
,
[
'token'
=>
$this
->
request
->
token
()]);
}
\app\admin\model\AdminLog
::
setTitle
(
__
(
'Login'
));
$result
=
$this
->
auth
->
login
(
$username
,
$password
,
$keeplogin
?
86400
:
0
);
if
(
$result
===
true
)
{
$this
->
success
(
__
(
'Login successful'
),
$url
,
[
'url'
=>
$url
,
'id'
=>
$this
->
auth
->
id
,
'username'
=>
$username
,
'avatar'
=>
$this
->
auth
->
avatar
]);
}
else
{
$this
->
error
(
__
(
'Username or password is incorrect'
),
$url
,
[
'token'
=>
$this
->
request
->
token
()]);
}
}
// 根据客户端的cookie,判断是否可以自动登录
if
(
$this
->
auth
->
autologin
())
{
$this
->
redirect
(
$url
);
}
\think\Hook
::
listen
(
"login_init"
,
$this
->
request
);
return
$this
->
view
->
fetch
();
}
/**
* 注销登录
*/
public
function
logout
()
{
$this
->
auth
->
logout
();
$this
->
success
(
__
(
'Logout successful'
),
'index/login'
);
}
}
...
...
application/admin/controller/general/Attachment.php
查看文件 @
a0eca04
<?php
namespace
app\admin\controller\general
;
use
app\common\controller\Backend
;
/**
* 附件管理
*
* @icon fa fa-circle-o
* @remark 主要用于管理上传到又拍云的数据或上传至本服务的上传数据
*/
class
Attachment
extends
Backend
{
protected
$model
=
null
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
model
=
model
(
'Attachment'
);
}
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$cdnurl
=
preg_replace
(
"/\/(\w+)\.php$/i"
,
''
,
$this
->
request
->
root
());
foreach
(
$list
as
$k
=>
&
$v
)
{
$v
[
'fullurl'
]
=
(
$v
[
'storage'
]
==
'local'
?
$cdnurl
:
$this
->
view
->
config
[
'upload'
][
'cdnurl'
])
.
$v
[
'url'
];
}
unset
(
$v
);
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 选择附件
*/
public
function
select
()
{
if
(
$this
->
request
->
isAjax
())
{
return
$this
->
index
();
}
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isAjax
())
{
$this
->
error
();
}
return
$this
->
view
->
fetch
();
}
public
function
del
(
$ids
=
""
)
{
if
(
$ids
)
{
$count
=
$this
->
model
->
destroy
(
$ids
);
if
(
$count
)
{
\think\Hook
::
listen
(
"upload_after"
,
$this
);
$this
->
success
();
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
}
<?php
namespace
app\admin\controller\general
;
use
app\common\controller\Backend
;
/**
* 附件管理
*
* @icon fa fa-circle-o
* @remark 主要用于管理上传到又拍云的数据或上传至本服务的上传数据
*/
class
Attachment
extends
Backend
{
protected
$model
=
null
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
model
=
model
(
'Attachment'
);
}
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$cdnurl
=
preg_replace
(
"/\/(\w+)\.php$/i"
,
''
,
$this
->
request
->
root
());
foreach
(
$list
as
$k
=>
&
$v
)
{
$v
[
'fullurl'
]
=
(
$v
[
'storage'
]
==
'local'
?
$cdnurl
:
$this
->
view
->
config
[
'upload'
][
'cdnurl'
])
.
$v
[
'url'
];
}
unset
(
$v
);
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 选择附件
*/
public
function
select
()
{
if
(
$this
->
request
->
isAjax
())
{
return
$this
->
index
();
}
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isAjax
())
{
$this
->
error
();
}
return
$this
->
view
->
fetch
();
}
public
function
del
(
$ids
=
""
)
{
if
(
$ids
)
{
$count
=
$this
->
model
->
destroy
(
$ids
);
if
(
$count
)
{
\think\Hook
::
listen
(
"upload_after"
,
$this
);
$this
->
success
();
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
}
...
...
application/admin/controller/general/Config.php
查看文件 @
a0eca04
<?php
namespace
app\admin\controller\general
;
use
app\common\controller\Backend
;
use
app\common\library\Email
;
use
app\common\model\Config
as
ConfigModel
;
use
think\Exception
;
/**
* 系统配置
*
* @icon fa fa-circle-o
*/
class
Config
extends
Backend
{
protected
$model
=
null
;
protected
$noNeedRight
=
[
'check'
];
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
model
=
model
(
'Config'
);
}
public
function
index
()
{
$siteList
=
[];
$groupList
=
ConfigModel
::
getGroupList
();
foreach
(
$groupList
as
$k
=>
$v
)
{
$siteList
[
$k
][
'name'
]
=
$k
;
$siteList
[
$k
][
'title'
]
=
$v
;
$siteList
[
$k
][
'list'
]
=
[];
}
foreach
(
$this
->
model
->
all
()
as
$k
=>
$v
)
{
if
(
!
isset
(
$siteList
[
$v
[
'group'
]]))
{
continue
;
}
$value
=
$v
->
toArray
();
$value
[
'title'
]
=
__
(
$value
[
'title'
]);
if
(
in_array
(
$value
[
'type'
],
[
'select'
,
'selects'
,
'checkbox'
,
'radio'
]))
{
$value
[
'value'
]
=
explode
(
','
,
$value
[
'value'
]);
}
if
(
$value
[
'type'
]
==
'array'
)
{
$value
[
'value'
]
=
(
array
)
json_decode
(
$value
[
'value'
],
TRUE
);
}
$value
[
'content'
]
=
json_decode
(
$value
[
'content'
],
TRUE
);
$siteList
[
$v
[
'group'
]][
'list'
][]
=
$value
;
}
$index
=
0
;
foreach
(
$siteList
as
$k
=>
&
$v
)
{
$v
[
'active'
]
=
!
$index
?
true
:
false
;
$index
++
;
}
$this
->
view
->
assign
(
'siteList'
,
$siteList
);
$this
->
view
->
assign
(
'typeList'
,
ConfigModel
::
getTypeList
());
$this
->
view
->
assign
(
'groupList'
,
ConfigModel
::
getGroupList
());
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
foreach
(
$params
as
$k
=>
&
$v
)
{
$v
=
is_array
(
$v
)
?
implode
(
','
,
$v
)
:
$v
;
}
try
{
if
(
in_array
(
$params
[
'type'
],
[
'select'
,
'selects'
,
'checkbox'
,
'radio'
,
'array'
]))
{
$params
[
'content'
]
=
ConfigModel
::
decode
(
$params
[
'content'
]);
}
else
{
$params
[
'content'
]
=
''
;
}
$result
=
$this
->
model
->
create
(
$params
);
if
(
$result
!==
false
)
{
try
{
$this
->
refreshFile
();
$this
->
success
();
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
else
{
$this
->
error
(
$this
->
model
->
getError
());
}
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
public
function
edit
(
$ids
=
NULL
)
{
if
(
$this
->
request
->
isPost
())
{
$row
=
$this
->
request
->
post
(
"row/a"
);
if
(
$row
)
{
$configList
=
[];
foreach
(
$this
->
model
->
all
()
as
$v
)
{
if
(
isset
(
$row
[
$v
[
'name'
]]))
{
$value
=
$row
[
$v
[
'name'
]];
if
(
is_array
(
$value
)
&&
isset
(
$value
[
'field'
]))
{
$value
=
json_encode
(
\app\common\model\Config
::
getArrayData
(
$value
),
JSON_UNESCAPED_UNICODE
);
}
else
{
$value
=
is_array
(
$value
)
?
implode
(
','
,
$value
)
:
$value
;
}
$v
[
'value'
]
=
$value
;
$configList
[]
=
$v
->
toArray
();
}
}
$this
->
model
->
allowField
(
true
)
->
saveAll
(
$configList
);
try
{
$this
->
refreshFile
();
$this
->
success
();
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
}
protected
function
refreshFile
()
{
$config
=
[];
foreach
(
$this
->
model
->
all
()
as
$k
=>
$v
)
{
$value
=
$v
->
toArray
();
if
(
in_array
(
$value
[
'type'
],
[
'selects'
,
'checkbox'
,
'images'
,
'files'
]))
{
$value
[
'value'
]
=
explode
(
','
,
$value
[
'value'
]);
}
if
(
$value
[
'type'
]
==
'array'
)
{
$value
[
'value'
]
=
(
array
)
json_decode
(
$value
[
'value'
],
TRUE
);
}
$config
[
$value
[
'name'
]]
=
$value
[
'value'
];
}
file_put_contents
(
APP_PATH
.
'extra'
.
DS
.
'site.php'
,
'<?php'
.
"
\n\n
return "
.
var_export
(
$config
,
true
)
.
";"
);
}
/**
* @internal
*/
public
function
check
()
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$config
=
$this
->
model
->
get
(
$params
);
if
(
!
$config
)
{
return
json
([
'ok'
=>
''
]);
}
else
{
return
json
([
'error'
=>
__
(
'Name already exist'
)]);
}
}
else
{
return
json
([
'error'
=>
__
(
'Invalid parameters'
)]);
}
}
/**
* 发送测试邮件
* @internal
*/
public
function
emailtest
()
{
$receiver
=
$this
->
request
->
request
(
"receiver"
);
$email
=
new
Email
;
$result
=
$email
->
to
(
$receiver
)
->
subject
(
__
(
"This is a test mail"
))
->
message
(
'<div style="min-height:550px; padding: 100px 55px 200px;">'
.
__
(
'This is a test mail content'
)
.
'</div>'
)
->
send
();
if
(
$result
)
{
$this
->
success
();
}
else
{
$this
->
error
(
$email
->
getError
());
}
}
}
<?php
namespace
app\admin\controller\general
;
use
app\common\controller\Backend
;
use
app\common\library\Email
;
use
app\common\model\Config
as
ConfigModel
;
use
think\Exception
;
/**
* 系统配置
*
* @icon fa fa-circle-o
*/
class
Config
extends
Backend
{
protected
$model
=
null
;
protected
$noNeedRight
=
[
'check'
];
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
model
=
model
(
'Config'
);
}
public
function
index
()
{
$siteList
=
[];
$groupList
=
ConfigModel
::
getGroupList
();
foreach
(
$groupList
as
$k
=>
$v
)
{
$siteList
[
$k
][
'name'
]
=
$k
;
$siteList
[
$k
][
'title'
]
=
$v
;
$siteList
[
$k
][
'list'
]
=
[];
}
foreach
(
$this
->
model
->
all
()
as
$k
=>
$v
)
{
if
(
!
isset
(
$siteList
[
$v
[
'group'
]]))
{
continue
;
}
$value
=
$v
->
toArray
();
$value
[
'title'
]
=
__
(
$value
[
'title'
]);
if
(
in_array
(
$value
[
'type'
],
[
'select'
,
'selects'
,
'checkbox'
,
'radio'
]))
{
$value
[
'value'
]
=
explode
(
','
,
$value
[
'value'
]);
}
if
(
$value
[
'type'
]
==
'array'
)
{
$value
[
'value'
]
=
(
array
)
json_decode
(
$value
[
'value'
],
TRUE
);
}
$value
[
'content'
]
=
json_decode
(
$value
[
'content'
],
TRUE
);
$siteList
[
$v
[
'group'
]][
'list'
][]
=
$value
;
}
$index
=
0
;
foreach
(
$siteList
as
$k
=>
&
$v
)
{
$v
[
'active'
]
=
!
$index
?
true
:
false
;
$index
++
;
}
$this
->
view
->
assign
(
'siteList'
,
$siteList
);
$this
->
view
->
assign
(
'typeList'
,
ConfigModel
::
getTypeList
());
$this
->
view
->
assign
(
'groupList'
,
ConfigModel
::
getGroupList
());
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
foreach
(
$params
as
$k
=>
&
$v
)
{
$v
=
is_array
(
$v
)
?
implode
(
','
,
$v
)
:
$v
;
}
try
{
if
(
in_array
(
$params
[
'type'
],
[
'select'
,
'selects'
,
'checkbox'
,
'radio'
,
'array'
]))
{
$params
[
'content'
]
=
ConfigModel
::
decode
(
$params
[
'content'
]);
}
else
{
$params
[
'content'
]
=
''
;
}
$result
=
$this
->
model
->
create
(
$params
);
if
(
$result
!==
false
)
{
try
{
$this
->
refreshFile
();
$this
->
success
();
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
else
{
$this
->
error
(
$this
->
model
->
getError
());
}
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
public
function
edit
(
$ids
=
NULL
)
{
if
(
$this
->
request
->
isPost
())
{
$row
=
$this
->
request
->
post
(
"row/a"
);
if
(
$row
)
{
$configList
=
[];
foreach
(
$this
->
model
->
all
()
as
$v
)
{
if
(
isset
(
$row
[
$v
[
'name'
]]))
{
$value
=
$row
[
$v
[
'name'
]];
if
(
is_array
(
$value
)
&&
isset
(
$value
[
'field'
]))
{
$value
=
json_encode
(
\app\common\model\Config
::
getArrayData
(
$value
),
JSON_UNESCAPED_UNICODE
);
}
else
{
$value
=
is_array
(
$value
)
?
implode
(
','
,
$value
)
:
$value
;
}
$v
[
'value'
]
=
$value
;
$configList
[]
=
$v
->
toArray
();
}
}
$this
->
model
->
allowField
(
true
)
->
saveAll
(
$configList
);
try
{
$this
->
refreshFile
();
$this
->
success
();
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
}
protected
function
refreshFile
()
{
$config
=
[];
foreach
(
$this
->
model
->
all
()
as
$k
=>
$v
)
{
$value
=
$v
->
toArray
();
if
(
in_array
(
$value
[
'type'
],
[
'selects'
,
'checkbox'
,
'images'
,
'files'
]))
{
$value
[
'value'
]
=
explode
(
','
,
$value
[
'value'
]);
}
if
(
$value
[
'type'
]
==
'array'
)
{
$value
[
'value'
]
=
(
array
)
json_decode
(
$value
[
'value'
],
TRUE
);
}
$config
[
$value
[
'name'
]]
=
$value
[
'value'
];
}
file_put_contents
(
APP_PATH
.
'extra'
.
DS
.
'site.php'
,
'<?php'
.
"
\n\n
return "
.
var_export
(
$config
,
true
)
.
";"
);
}
/**
* @internal
*/
public
function
check
()
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$config
=
$this
->
model
->
get
(
$params
);
if
(
!
$config
)
{
return
json
([
'ok'
=>
''
]);
}
else
{
return
json
([
'error'
=>
__
(
'Name already exist'
)]);
}
}
else
{
return
json
([
'error'
=>
__
(
'Invalid parameters'
)]);
}
}
/**
* 发送测试邮件
* @internal
*/
public
function
emailtest
()
{
$receiver
=
$this
->
request
->
request
(
"receiver"
);
$email
=
new
Email
;
$result
=
$email
->
to
(
$receiver
)
->
subject
(
__
(
"This is a test mail"
))
->
message
(
'<div style="min-height:550px; padding: 100px 55px 200px;">'
.
__
(
'This is a test mail content'
)
.
'</div>'
)
->
send
();
if
(
$result
)
{
$this
->
success
();
}
else
{
$this
->
error
(
$email
->
getError
());
}
}
}
...
...
application/admin/controller/general/Profile.php
查看文件 @
a0eca04
<?php
namespace
app\admin\controller\general
;
use
think\Session
;
use
app\admin\model\AdminLog
;
use
app\common\controller\Backend
;
use
fast\Random
;
/**
* 个人配置
*
* @icon fa fa-user
*/
class
Profile
extends
Backend
{
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
$model
=
model
(
'AdminLog'
);
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$model
->
where
(
$where
)
->
where
(
'admin_id'
,
$this
->
auth
->
id
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$model
->
where
(
$where
)
->
where
(
'admin_id'
,
$this
->
auth
->
id
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 更新个人信息
*/
public
function
update
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
$params
=
array_filter
(
array_intersect_key
(
$params
,
array_flip
(
array
(
'email'
,
'nickname'
,
'password'
,
'avatar'
))));
unset
(
$v
);
if
(
isset
(
$params
[
'password'
]))
{
$params
[
'salt'
]
=
Random
::
alnum
();
$params
[
'password'
]
=
md5
(
md5
(
$params
[
'password'
])
.
$params
[
'salt'
]);
}
if
(
$params
)
{
model
(
'admin'
)
->
where
(
'id'
,
$this
->
auth
->
id
)
->
update
(
$params
);
//因为个人资料面板读取的Session显示,修改自己资料后同时更新Session
$admin
=
Session
::
get
(
'admin'
);
$admin_id
=
$admin
?
$admin
->
id
:
0
;
if
(
$this
->
auth
->
id
==
$admin_id
){
$admin
=
model
(
'admin'
)
->
get
([
'id'
=>
$admin_id
]);
Session
::
set
(
"admin"
,
$admin
);
}
$this
->
success
();
}
$this
->
error
();
}
return
;
}
}
<?php
namespace
app\admin\controller\general
;
use
think\Session
;
use
app\admin\model\AdminLog
;
use
app\common\controller\Backend
;
use
fast\Random
;
/**
* 个人配置
*
* @icon fa fa-user
*/
class
Profile
extends
Backend
{
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
$model
=
model
(
'AdminLog'
);
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$model
->
where
(
$where
)
->
where
(
'admin_id'
,
$this
->
auth
->
id
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$model
->
where
(
$where
)
->
where
(
'admin_id'
,
$this
->
auth
->
id
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 更新个人信息
*/
public
function
update
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
$params
=
array_filter
(
array_intersect_key
(
$params
,
array_flip
(
array
(
'email'
,
'nickname'
,
'password'
,
'avatar'
))));
unset
(
$v
);
if
(
isset
(
$params
[
'password'
]))
{
$params
[
'salt'
]
=
Random
::
alnum
();
$params
[
'password'
]
=
md5
(
md5
(
$params
[
'password'
])
.
$params
[
'salt'
]);
}
if
(
$params
)
{
model
(
'admin'
)
->
where
(
'id'
,
$this
->
auth
->
id
)
->
update
(
$params
);
//因为个人资料面板读取的Session显示,修改自己资料后同时更新Session
$admin
=
Session
::
get
(
'admin'
);
$admin_id
=
$admin
?
$admin
->
id
:
0
;
if
(
$this
->
auth
->
id
==
$admin_id
){
$admin
=
model
(
'admin'
)
->
get
([
'id'
=>
$admin_id
]);
Session
::
set
(
"admin"
,
$admin
);
}
$this
->
success
();
}
$this
->
error
();
}
return
;
}
}
...
...
application/admin/library/traits/Backend.php
查看文件 @
a0eca04
<?php
namespace
app\admin\library\traits
;
trait
Backend
{
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'pkey_name'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 回收站
*/
public
function
recyclebin
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
onlyTrashed
()
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
onlyTrashed
()
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
/*
* 已经弃用,如果为了兼容老版可取消注释
foreach ($params as $k => &$v)
{
$v = is_array($v) ? implode(',', $v) : $v;
}
*/
if
(
$this
->
dataLimit
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
basename
(
str_replace
(
'\\'
,
'/'
,
get_class
(
$this
->
model
)));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.add'
:
true
)
:
$this
->
modelValidate
;
$this
->
model
->
validate
(
$validate
);
}
$result
=
$this
->
model
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
$this
->
model
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
/**
* 编辑
*/
public
function
edit
(
$ids
=
NULL
)
{
$row
=
$this
->
model
->
get
(
$ids
);
if
(
!
$row
)
$this
->
error
(
__
(
'No Results were found'
));
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
if
(
!
in_array
(
$row
[
$this
->
dataLimitField
],
$adminIds
))
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
/*
* 已经弃用,如果为了兼容老版可取消注释
foreach ($params as $k => &$v)
{
$v = is_array($v) ? implode(',', $v) : $v;
}
*/
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
basename
(
str_replace
(
'\\'
,
'/'
,
get_class
(
$this
->
model
)));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.edit'
:
true
)
:
$this
->
modelValidate
;
$row
->
validate
(
$validate
);
}
$result
=
$row
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
$row
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
$this
->
view
->
assign
(
"row"
,
$row
);
return
$this
->
view
->
fetch
();
}
/**
* 删除
*/
public
function
del
(
$ids
=
""
)
{
if
(
$ids
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$count
=
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
$list
=
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
)
->
select
();
$count
=
0
;
foreach
(
$list
as
$k
=>
$v
)
{
$count
+=
$v
->
delete
();
}
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were deleted'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 真实删除
*/
public
function
destroy
(
$ids
=
""
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$count
=
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
if
(
$ids
)
{
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
);
}
$count
=
0
;
$list
=
$this
->
model
->
onlyTrashed
()
->
select
();
foreach
(
$list
as
$k
=>
$v
)
{
$count
+=
$v
->
delete
(
true
);
}
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were deleted'
));
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 还原
*/
public
function
restore
(
$ids
=
""
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
if
(
$ids
)
{
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
);
}
$count
=
$this
->
model
->
restore
(
'1=1'
);
if
(
$count
)
{
$this
->
success
();
}
$this
->
error
(
__
(
'No rows were updated'
));
}
/**
* 批量更新
*/
public
function
multi
(
$ids
=
""
)
{
$ids
=
$ids
?
$ids
:
$this
->
request
->
param
(
"ids"
);
if
(
$ids
)
{
if
(
$this
->
request
->
has
(
'params'
))
{
parse_str
(
$this
->
request
->
post
(
"params"
),
$values
);
$values
=
array_intersect_key
(
$values
,
array_flip
(
is_array
(
$this
->
multiFields
)
?
$this
->
multiFields
:
explode
(
','
,
$this
->
multiFields
)));
if
(
$values
)
{
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
$count
=
$this
->
model
->
where
(
$this
->
model
->
getPk
(),
'in'
,
$ids
)
->
update
(
$values
);
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were updated'
));
}
}
else
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 导入
*/
protected
function
import
()
{
$file
=
$this
->
request
->
request
(
'file'
);
if
(
!
$file
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'file'
));
}
$filePath
=
ROOT_PATH
.
DS
.
'public'
.
DS
.
$file
;
if
(
!
is_file
(
$filePath
))
{
$this
->
error
(
__
(
'No results were found'
));
}
$PHPReader
=
new
\PHPExcel_Reader_Excel2007
();
if
(
!
$PHPReader
->
canRead
(
$filePath
))
{
$PHPReader
=
new
\PHPExcel_Reader_Excel5
();
if
(
!
$PHPReader
->
canRead
(
$filePath
))
{
$PHPReader
=
new
\PHPExcel_Reader_CSV
();
if
(
!
$PHPReader
->
canRead
(
$filePath
))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
}
}
$table
=
$this
->
model
->
getQuery
()
->
getTable
();
$database
=
\think\Config
::
get
(
'database.database'
);
$fieldArr
=
[];
$list
=
db
()
->
query
(
"SELECT COLUMN_NAME,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ? AND TABLE_SCHEMA = ?"
,
[
$table
,
$database
]);
foreach
(
$list
as
$k
=>
$v
)
{
$fieldArr
[
$v
[
'COLUMN_COMMENT'
]]
=
$v
[
'COLUMN_NAME'
];
}
$PHPExcel
=
$PHPReader
->
load
(
$filePath
);
//加载文件
$currentSheet
=
$PHPExcel
->
getSheet
(
0
);
//读取文件中的第一个工作表
$allColumn
=
$currentSheet
->
getHighestColumn
();
//取得最大的列号
$allRow
=
$currentSheet
->
getHighestRow
();
//取得一共有多少行
for
(
$currentRow
=
1
;
$currentRow
<=
1
;
$currentRow
++
)
{
for
(
$currentColumn
=
'A'
;
$currentColumn
<=
$allColumn
;
$currentColumn
++
)
{
$val
=
$currentSheet
->
getCellByColumnAndRow
(
ord
(
$currentColumn
)
-
65
,
$currentRow
)
->
getValue
();
$fields
[]
=
$val
;
}
}
$insert
=
[];
for
(
$currentRow
=
2
;
$currentRow
<=
$allRow
;
$currentRow
++
)
{
$values
=
[];
for
(
$currentColumn
=
'A'
;
$currentColumn
<=
$allColumn
;
$currentColumn
++
)
{
$val
=
$currentSheet
->
getCellByColumnAndRow
(
ord
(
$currentColumn
)
-
65
,
$currentRow
)
->
getValue
();
/* * ord()将字符转为十进制数 */
$values
[]
=
is_null
(
$val
)
?
''
:
$val
;
//echo iconv('utf-8','gb2312', $val)."\t";
}
$row
=
[];
$temp
=
array_combine
(
$fields
,
$values
);
foreach
(
$temp
as
$k
=>
$v
)
{
if
(
isset
(
$fieldArr
[
$k
])
&&
$k
!==
''
)
{
$row
[
$fieldArr
[
$k
]]
=
$v
;
}
}
if
(
$row
)
{
$insert
[]
=
$row
;
}
}
if
(
!
$insert
)
{
$this
->
error
(
__
(
'No rows were updated'
));
}
try
{
$this
->
model
->
saveAll
(
$insert
);
}
catch
(
\think\exception\PDOException
$exception
)
{
$this
->
error
(
$exception
->
getMessage
());
}
$this
->
success
();
}
}
<?php
namespace
app\admin\library\traits
;
trait
Backend
{
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'pkey_name'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 回收站
*/
public
function
recyclebin
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
onlyTrashed
()
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
onlyTrashed
()
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
/*
* 已经弃用,如果为了兼容老版可取消注释
foreach ($params as $k => &$v)
{
$v = is_array($v) ? implode(',', $v) : $v;
}
*/
if
(
$this
->
dataLimit
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
basename
(
str_replace
(
'\\'
,
'/'
,
get_class
(
$this
->
model
)));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.add'
:
true
)
:
$this
->
modelValidate
;
$this
->
model
->
validate
(
$validate
);
}
$result
=
$this
->
model
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
$this
->
model
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
/**
* 编辑
*/
public
function
edit
(
$ids
=
NULL
)
{
$row
=
$this
->
model
->
get
(
$ids
);
if
(
!
$row
)
$this
->
error
(
__
(
'No Results were found'
));
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
if
(
!
in_array
(
$row
[
$this
->
dataLimitField
],
$adminIds
))
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
/*
* 已经弃用,如果为了兼容老版可取消注释
foreach ($params as $k => &$v)
{
$v = is_array($v) ? implode(',', $v) : $v;
}
*/
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
basename
(
str_replace
(
'\\'
,
'/'
,
get_class
(
$this
->
model
)));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.edit'
:
true
)
:
$this
->
modelValidate
;
$row
->
validate
(
$validate
);
}
$result
=
$row
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
$row
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
$this
->
view
->
assign
(
"row"
,
$row
);
return
$this
->
view
->
fetch
();
}
/**
* 删除
*/
public
function
del
(
$ids
=
""
)
{
if
(
$ids
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$count
=
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
$list
=
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
)
->
select
();
$count
=
0
;
foreach
(
$list
as
$k
=>
$v
)
{
$count
+=
$v
->
delete
();
}
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were deleted'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 真实删除
*/
public
function
destroy
(
$ids
=
""
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$count
=
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
if
(
$ids
)
{
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
);
}
$count
=
0
;
$list
=
$this
->
model
->
onlyTrashed
()
->
select
();
foreach
(
$list
as
$k
=>
$v
)
{
$count
+=
$v
->
delete
(
true
);
}
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were deleted'
));
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 还原
*/
public
function
restore
(
$ids
=
""
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
if
(
$ids
)
{
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
);
}
$count
=
$this
->
model
->
restore
(
'1=1'
);
if
(
$count
)
{
$this
->
success
();
}
$this
->
error
(
__
(
'No rows were updated'
));
}
/**
* 批量更新
*/
public
function
multi
(
$ids
=
""
)
{
$ids
=
$ids
?
$ids
:
$this
->
request
->
param
(
"ids"
);
if
(
$ids
)
{
if
(
$this
->
request
->
has
(
'params'
))
{
parse_str
(
$this
->
request
->
post
(
"params"
),
$values
);
$values
=
array_intersect_key
(
$values
,
array_flip
(
is_array
(
$this
->
multiFields
)
?
$this
->
multiFields
:
explode
(
','
,
$this
->
multiFields
)));
if
(
$values
)
{
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
$count
=
$this
->
model
->
where
(
$this
->
model
->
getPk
(),
'in'
,
$ids
)
->
update
(
$values
);
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were updated'
));
}
}
else
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 导入
*/
protected
function
import
()
{
$file
=
$this
->
request
->
request
(
'file'
);
if
(
!
$file
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'file'
));
}
$filePath
=
ROOT_PATH
.
DS
.
'public'
.
DS
.
$file
;
if
(
!
is_file
(
$filePath
))
{
$this
->
error
(
__
(
'No results were found'
));
}
$PHPReader
=
new
\PHPExcel_Reader_Excel2007
();
if
(
!
$PHPReader
->
canRead
(
$filePath
))
{
$PHPReader
=
new
\PHPExcel_Reader_Excel5
();
if
(
!
$PHPReader
->
canRead
(
$filePath
))
{
$PHPReader
=
new
\PHPExcel_Reader_CSV
();
if
(
!
$PHPReader
->
canRead
(
$filePath
))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
}
}
$table
=
$this
->
model
->
getQuery
()
->
getTable
();
$database
=
\think\Config
::
get
(
'database.database'
);
$fieldArr
=
[];
$list
=
db
()
->
query
(
"SELECT COLUMN_NAME,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ? AND TABLE_SCHEMA = ?"
,
[
$table
,
$database
]);
foreach
(
$list
as
$k
=>
$v
)
{
$fieldArr
[
$v
[
'COLUMN_COMMENT'
]]
=
$v
[
'COLUMN_NAME'
];
}
$PHPExcel
=
$PHPReader
->
load
(
$filePath
);
//加载文件
$currentSheet
=
$PHPExcel
->
getSheet
(
0
);
//读取文件中的第一个工作表
$allColumn
=
$currentSheet
->
getHighestColumn
();
//取得最大的列号
$allRow
=
$currentSheet
->
getHighestRow
();
//取得一共有多少行
for
(
$currentRow
=
1
;
$currentRow
<=
1
;
$currentRow
++
)
{
for
(
$currentColumn
=
'A'
;
$currentColumn
<=
$allColumn
;
$currentColumn
++
)
{
$val
=
$currentSheet
->
getCellByColumnAndRow
(
ord
(
$currentColumn
)
-
65
,
$currentRow
)
->
getValue
();
$fields
[]
=
$val
;
}
}
$insert
=
[];
for
(
$currentRow
=
2
;
$currentRow
<=
$allRow
;
$currentRow
++
)
{
$values
=
[];
for
(
$currentColumn
=
'A'
;
$currentColumn
<=
$allColumn
;
$currentColumn
++
)
{
$val
=
$currentSheet
->
getCellByColumnAndRow
(
ord
(
$currentColumn
)
-
65
,
$currentRow
)
->
getValue
();
/* * ord()将字符转为十进制数 */
$values
[]
=
is_null
(
$val
)
?
''
:
$val
;
//echo iconv('utf-8','gb2312', $val)."\t";
}
$row
=
[];
$temp
=
array_combine
(
$fields
,
$values
);
foreach
(
$temp
as
$k
=>
$v
)
{
if
(
isset
(
$fieldArr
[
$k
])
&&
$k
!==
''
)
{
$row
[
$fieldArr
[
$k
]]
=
$v
;
}
}
if
(
$row
)
{
$insert
[]
=
$row
;
}
}
if
(
!
$insert
)
{
$this
->
error
(
__
(
'No rows were updated'
));
}
try
{
$this
->
model
->
saveAll
(
$insert
);
}
catch
(
\think\exception\PDOException
$exception
)
{
$this
->
error
(
$exception
->
getMessage
());
}
$this
->
success
();
}
}
...
...
application/admin/model/Admin.php
查看文件 @
a0eca04
<?php
namespace
app\admin\model
;
use
think\Model
;
use
think\Session
;
class
Admin
extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
'updatetime'
;
/**
* 重置用户密码
* @author baiyouwen
*/
public
function
resetPassword
(
$uid
,
$NewPassword
)
{
$passwd
=
$this
->
encryptPassword
(
$NewPassword
);
$ret
=
$this
->
where
([
'id'
=>
$uid
])
->
update
([
'password'
=>
$passwd
]);
return
$ret
;
}
// 密码加密
protected
function
encryptPassword
(
$password
,
$salt
=
''
,
$encrypt
=
'md5'
)
{
return
$encrypt
(
$password
.
$salt
);
}
}
<?php
namespace
app\admin\model
;
use
think\Model
;
use
think\Session
;
class
Admin
extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
'updatetime'
;
/**
* 重置用户密码
* @author baiyouwen
*/
public
function
resetPassword
(
$uid
,
$NewPassword
)
{
$passwd
=
$this
->
encryptPassword
(
$NewPassword
);
$ret
=
$this
->
where
([
'id'
=>
$uid
])
->
update
([
'password'
=>
$passwd
]);
return
$ret
;
}
// 密码加密
protected
function
encryptPassword
(
$password
,
$salt
=
''
,
$encrypt
=
'md5'
)
{
return
$encrypt
(
$password
.
$salt
);
}
}
...
...
application/admin/model/AdminLog.php
查看文件 @
a0eca04
<?php
namespace
app\admin\model
;
use
think\Model
;
class
AdminLog
extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
''
;
//自定义日志标题
protected
static
$title
=
''
;
//自定义日志内容
protected
static
$content
=
''
;
public
static
function
setTitle
(
$title
)
{
self
::
$title
=
$title
;
}
public
static
function
setContent
(
$content
)
{
self
::
$content
=
$content
;
}
public
static
function
record
(
$title
=
''
)
{
$admin
=
\think\Session
::
get
(
'admin'
);
$admin_id
=
$admin
?
$admin
->
id
:
0
;
$username
=
$admin
?
$admin
->
username
:
__
(
'Unknown'
);
$content
=
self
::
$content
;
if
(
!
$content
)
{
$content
=
request
()
->
param
();
foreach
(
$content
as
$k
=>
$v
)
{
if
(
is_string
(
$v
)
&&
strlen
(
$v
)
>
200
||
stripos
(
$k
,
'password'
)
!==
false
)
{
unset
(
$content
[
$k
]);
}
}
}
$title
=
self
::
$title
;
if
(
!
$title
)
{
$title
=
[];
$breadcrumb
=
\app\admin\library\Auth
::
instance
()
->
getBreadcrumb
();
foreach
(
$breadcrumb
as
$k
=>
$v
)
{
$title
[]
=
$v
[
'title'
];
}
$title
=
implode
(
' '
,
$title
);
}
self
::
create
([
'title'
=>
$title
,
'content'
=>
!
is_scalar
(
$content
)
?
json_encode
(
$content
)
:
$content
,
'url'
=>
request
()
->
url
(),
'admin_id'
=>
$admin_id
,
'username'
=>
$username
,
'useragent'
=>
request
()
->
server
(
'HTTP_USER_AGENT'
),
'ip'
=>
request
()
->
ip
()
]);
}
public
function
admin
()
{
return
$this
->
belongsTo
(
'Admin'
,
'admin_id'
)
->
setEagerlyType
(
0
);
}
}
<?php
namespace
app\admin\model
;
use
think\Model
;
class
AdminLog
extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
''
;
//自定义日志标题
protected
static
$title
=
''
;
//自定义日志内容
protected
static
$content
=
''
;
public
static
function
setTitle
(
$title
)
{
self
::
$title
=
$title
;
}
public
static
function
setContent
(
$content
)
{
self
::
$content
=
$content
;
}
public
static
function
record
(
$title
=
''
)
{
$admin
=
\think\Session
::
get
(
'admin'
);
$admin_id
=
$admin
?
$admin
->
id
:
0
;
$username
=
$admin
?
$admin
->
username
:
__
(
'Unknown'
);
$content
=
self
::
$content
;
if
(
!
$content
)
{
$content
=
request
()
->
param
();
foreach
(
$content
as
$k
=>
$v
)
{
if
(
is_string
(
$v
)
&&
strlen
(
$v
)
>
200
||
stripos
(
$k
,
'password'
)
!==
false
)
{
unset
(
$content
[
$k
]);
}
}
}
$title
=
self
::
$title
;
if
(
!
$title
)
{
$title
=
[];
$breadcrumb
=
\app\admin\library\Auth
::
instance
()
->
getBreadcrumb
();
foreach
(
$breadcrumb
as
$k
=>
$v
)
{
$title
[]
=
$v
[
'title'
];
}
$title
=
implode
(
' '
,
$title
);
}
self
::
create
([
'title'
=>
$title
,
'content'
=>
!
is_scalar
(
$content
)
?
json_encode
(
$content
)
:
$content
,
'url'
=>
request
()
->
url
(),
'admin_id'
=>
$admin_id
,
'username'
=>
$username
,
'useragent'
=>
request
()
->
server
(
'HTTP_USER_AGENT'
),
'ip'
=>
request
()
->
ip
()
]);
}
public
function
admin
()
{
return
$this
->
belongsTo
(
'Admin'
,
'admin_id'
)
->
setEagerlyType
(
0
);
}
}
...
...
application/admin/model/AuthGroup.php
查看文件 @
a0eca04
<?php
namespace
app\admin\model
;
use
think\Model
;
class
AuthGroup
extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
'updatetime'
;
public
function
getNameAttr
(
$value
,
$data
)
{
return
__
(
$value
);
}
}
<?php
namespace
app\admin\model
;
use
think\Model
;
class
AuthGroup
extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
'updatetime'
;
public
function
getNameAttr
(
$value
,
$data
)
{
return
__
(
$value
);
}
}
...
...
application/admin/model/AuthGroupAccess.php
查看文件 @
a0eca04
<?php
namespace
app\admin\model
;
use
think\Model
;
class
AuthGroupAccess
extends
Model
{
//
}
<?php
namespace
app\admin\model
;
use
think\Model
;
class
AuthGroupAccess
extends
Model
{
//
}
...
...
application/admin/model/AuthRule.php
查看文件 @
a0eca04
<?php
namespace
app\admin\model
;
use
think\Model
;
class
AuthRule
extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
'updatetime'
;
public
function
getTitleAttr
(
$value
,
$data
)
{
return
__
(
$value
);
}
}
<?php
namespace
app\admin\model
;
use
think\Model
;
class
AuthRule
extends
Model
{
// 开启自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
'updatetime'
;
public
function
getTitleAttr
(
$value
,
$data
)
{
return
__
(
$value
);
}
}
...
...
application/admin/tags.php
查看文件 @
a0eca04
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用行为扩展定义文件
return
[
// 应用结束
'app_end'
=>
[
'app\\admin\\behavior\\AdminLog'
,
],
];
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用行为扩展定义文件
return
[
// 应用结束
'app_end'
=>
[
'app\\admin\\behavior\\AdminLog'
,
],
];
...
...
application/admin/validate/Category.php
查看文件 @
a0eca04
<?php
namespace
app\admin\validate
;
use
think\Validate
;
class
Category
extends
Validate
{
/**
* 验证规则
*/
protected
$rule
=
[
];
/**
* 提示消息
*/
protected
$message
=
[
];
/**
* 验证场景
*/
protected
$scene
=
[
'add'
=>
[],
'edit'
=>
[],
];
}
<?php
namespace
app\admin\validate
;
use
think\Validate
;
class
Category
extends
Validate
{
/**
* 验证规则
*/
protected
$rule
=
[
];
/**
* 提示消息
*/
protected
$message
=
[
];
/**
* 验证场景
*/
protected
$scene
=
[
'add'
=>
[],
'edit'
=>
[],
];
}
...
...
application/build.php
查看文件 @
a0eca04
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return
[
// 生成应用公共文件
'__file__'
=>
[],
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
'demo'
=>
[
'__file__'
=>
[
'common.php'
],
'__dir__'
=>
[
'behavior'
,
'controller'
,
'model'
,
'view'
],
'controller'
=>
[
'Index'
,
'Test'
,
'UserType'
],
'model'
=>
[
'User'
,
'UserType'
],
'view'
=>
[
'index/index'
],
],
// 其他更多的模块定义
];
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return
[
// 生成应用公共文件
'__file__'
=>
[],
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
'demo'
=>
[
'__file__'
=>
[
'common.php'
],
'__dir__'
=>
[
'behavior'
,
'controller'
,
'model'
,
'view'
],
'controller'
=>
[
'Index'
,
'Test'
,
'UserType'
],
'model'
=>
[
'User'
,
'UserType'
],
'view'
=>
[
'index/index'
],
],
// 其他更多的模块定义
];
...
...
application/command.php
查看文件 @
a0eca04
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return
[
'app\admin\command\Crud'
,
'app\admin\command\Menu'
,
'app\admin\command\Install'
,
'app\admin\command\Min'
,
'app\admin\command\Addon'
,
];
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return
[
'app\admin\command\Crud'
,
'app\admin\command\Menu'
,
'app\admin\command\Install'
,
'app\admin\command\Min'
,
'app\admin\command\Addon'
,
];
...
...
请
注册
或
登录
后发表评论