初始化版本
This commit is contained in:
parent
7fef1b4af7
commit
b392129706
|
|
@ -0,0 +1,30 @@
|
|||
APP_NAME=skeleton
|
||||
APP_ENV=dev
|
||||
|
||||
DB_DRIVER=mysql
|
||||
DB_HOST=localhost
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=mine
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=root
|
||||
DB_CHARSET=utf8mb4
|
||||
DB_COLLATION=utf8mb4_unicode_ci
|
||||
DB_PREFIX=
|
||||
|
||||
REDIS_HOST=localhost
|
||||
REDIS_AUTH=
|
||||
REDIS_PORT=6379
|
||||
REDIS_DB=0
|
||||
|
||||
AMQP_HOST = 127.0.0.1
|
||||
AMQP_PORT = 5672
|
||||
AMQP_USER = guest
|
||||
AMQP_PASSWORD = guest
|
||||
AMQP_VHOST = /
|
||||
AMQP_ENABLE = false
|
||||
|
||||
SUPER_ADMIN = 1000
|
||||
ADMIN_ROLE = 1000
|
||||
CONSOLE_SQL = true
|
||||
JWT_SECRET = abcdefg
|
||||
JWT_API_SECRET = 654321
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
/.idea
|
||||
/.vscode
|
||||
/vendor
|
||||
/package
|
||||
/runtime
|
||||
*.log
|
||||
.env
|
||||
.gitee
|
||||
public/uploadfile/*
|
||||
/resources
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
# Default Dockerfile
|
||||
|
||||
ARG ALPINE_VERSION=3.15
|
||||
|
||||
FROM alpine:$ALPINE_VERSION
|
||||
|
||||
LABEL maintainer="MineManage Developers <group@stye.cn>" version="1.0" license="MIT" app.name="MineManage"
|
||||
|
||||
ARG ALPINE_VERSION=3.15
|
||||
|
||||
# trust this project public key to trust the packages.
|
||||
ADD https://php.hernandev.com/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub
|
||||
|
||||
##
|
||||
# ---------- building ----------
|
||||
##
|
||||
RUN set -ex \
|
||||
# change apk source repo
|
||||
&& echo "https://php.hernandev.com/v$ALPINE_VERSION/php-8.1" >> /etc/apk/repositories \
|
||||
&& echo "@php https://php.hernandev.com/v$ALPINE_VERSION/php-8.1" >> /etc/apk/repositories \
|
||||
&& apk update \
|
||||
&& apk add --no-cache \
|
||||
# Install base packages ('ca-certificates' will install 'nghttp2-libs')
|
||||
ca-certificates \
|
||||
curl \
|
||||
wget \
|
||||
tar \
|
||||
xz \
|
||||
libressl \
|
||||
tzdata \
|
||||
pcre \
|
||||
php8 \
|
||||
php8-bcmath \
|
||||
php8-curl \
|
||||
php8-ctype \
|
||||
php8-dom \
|
||||
php8-gd \
|
||||
php8-iconv \
|
||||
php8-mbstring \
|
||||
php8-mysqlnd \
|
||||
php8-openssl \
|
||||
php8-pdo \
|
||||
php8-pdo_mysql \
|
||||
php8-pdo_sqlite \
|
||||
php8-phar \
|
||||
php8-posix \
|
||||
php8-redis \
|
||||
php8-sockets \
|
||||
php8-sodium \
|
||||
php8-sysvshm \
|
||||
php8-sysvmsg \
|
||||
php8-sysvsem \
|
||||
php8-zip \
|
||||
php8-zlib \
|
||||
php8-xml \
|
||||
php8-xmlreader \
|
||||
php8-pcntl \
|
||||
php8-opcache \
|
||||
&& ln -sf /usr/bin/php8 /usr/bin/php \
|
||||
&& apk del --purge *-dev \
|
||||
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/share/php8 \
|
||||
&& php -v \
|
||||
&& php -m \
|
||||
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||
|
||||
ARG COMPOSER_VERSION=2.3.10
|
||||
|
||||
# update
|
||||
RUN set -ex \
|
||||
&& apk update \
|
||||
# for extension libaio linux-headers
|
||||
&& apk add --no-cache libstdc++ openssl git bash php8-pear php8-dev autoconf pcre2-dev c-ares-dev zlib-dev re2c gcc g++ make \
|
||||
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS libaio-dev openssl-dev curl-dev \
|
||||
# php extension:swoole
|
||||
&& ln -s /usr/bin/pecl8 /usr/local/bin/pecl \
|
||||
&& pecl channel-update pecl.php.net \
|
||||
&& pecl install --configureoptions 'enable-sockets="no" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="no" enable-swoole-json="yes" enable-swoole-curl="yes" enable-cares="no"' swoole \
|
||||
&& {\
|
||||
echo "memory_limit=1G"; \
|
||||
echo "upload_max_filesize=128M"; \
|
||||
echo "post_max_size=128M"; \
|
||||
echo "memory_limit=1G"; \
|
||||
echo "date.timezone=Asia/Shanghai"; \
|
||||
} | tee /etc/php8/conf.d/00_default.ini \
|
||||
&& echo "opcache.enable_cli = 'On'" >> /etc/php8/conf.d/00_opcache.ini \
|
||||
&&{ \
|
||||
echo "extension=swoole.so";\
|
||||
echo "swoole.use_shortname = 'Off'";\
|
||||
} | tee /etc/php8/conf.d/50_swoole.ini \
|
||||
# install composer
|
||||
&& wget -nv -O /usr/local/bin/composer https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar \
|
||||
&& chmod u+x /usr/local/bin/composer \
|
||||
# php info
|
||||
&& php -v \
|
||||
&& php -m \
|
||||
&& php --ri swoole \
|
||||
&& php --ri Zend\ OPcache \
|
||||
&& composer --version \
|
||||
# ---------- clear works ----------
|
||||
&& apk del .build-deps \
|
||||
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/local/bin/php* \
|
||||
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||
|
||||
##
|
||||
# ---------- env settings ----------
|
||||
##
|
||||
# --build-arg timezone=Asia/Shanghai
|
||||
ARG timezone
|
||||
|
||||
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
|
||||
# APP_ENV=dev \
|
||||
APP_SYSTEM_ENV=docker \
|
||||
SCAN_CACHEABLE=(true)
|
||||
|
||||
# update
|
||||
RUN set -ex \
|
||||
# ---------- some config ----------
|
||||
&& cd /etc/php8 \
|
||||
# - config timezone
|
||||
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
|
||||
&& echo "${TIMEZONE}" > /etc/timezone \
|
||||
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||
|
||||
RUN set -ex apk update \
|
||||
&& apk add --no-cache libstdc++ openssl git bash autoconf pcre2-dev zlib-dev re2c gcc g++ make \
|
||||
php8-pear php8-dev php8-tokenizer php8-fileinfo php8-simplexml php8-xmlwriter \
|
||||
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS zlib-dev libaio-dev openssl-dev curl-dev c-ares-dev \
|
||||
&& pecl channel-update pecl.php.net \
|
||||
&& ln -s /usr/bin/phpize8 /usr/local/bin/phpize \
|
||||
&& ln -s /usr/bin/php-config8 /usr/local/bin/php-config \
|
||||
&& pecl install --configureoptions 'enable-reader="yes"' xlswriter \
|
||||
&& echo "extension=xlswriter.so" >> /etc/php8/conf.d/60-xlswriter.ini \
|
||||
&& php -m \
|
||||
&& php -v \
|
||||
&& php --ri swoole \
|
||||
&& mkdir -p /app-src \
|
||||
# ---------- clear works ----------
|
||||
&& apk del .build-deps \
|
||||
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/local/bin/php* \
|
||||
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||
|
||||
# fix aliyun oss wrong charset: https://github.com/aliyun/aliyun-oss-php-sdk/issues/101
|
||||
# https://github.com/docker-library/php/issues/240#issuecomment-762438977
|
||||
|
||||
RUN apk --no-cache --allow-untrusted --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ add gnu-libiconv gnu-libiconv-dev \
|
||||
# ---------- clear works ----------
|
||||
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/local/bin/php* \
|
||||
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||
|
||||
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so
|
||||
|
||||
WORKDIR /app-src
|
||||
|
||||
EXPOSE 9501 9502 9503
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
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:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) 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
|
||||
|
||||
(d) 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 [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
166
README.md
166
README.md
|
|
@ -1,2 +1,166 @@
|
|||
# hyperf-view
|
||||
# 项目介绍
|
||||
|
||||
<p align="center">
|
||||
<img src="https://doc.mineadmin.com/logo.svg" width="120" />
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://www.mineadmin.com" target="_blank">官网</a> |
|
||||
<a href="https://doc.mineadmin.com" target="_blank">文档</a> |
|
||||
<a href="https://demo.mineadmin.com" target="_blank">演示</a> |
|
||||
<a href="https://hyperf.wiki/2.2/#/" target="_blank">Hyperf官方文档</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://gitee.com/xmo/MineAdmin/badge/star.svg?theme=dark" />
|
||||
<img src="https://gitee.com/xmo/MineAdmin/badge/fork.svg?theme=dark" />
|
||||
<img src="https://svg.hamm.cn/badge.svg?key=License&value=Apache-2.0&color=da4a00" />
|
||||
<img src="https://svg.hamm.cn/badge.svg?key=MineAdmin&value=v1.1.0" />
|
||||
</p>
|
||||
PHP有很多优秀的后台管理系统,但基于Swoole的后台管理系统没找到合适我自己的。
|
||||
所以就开发了一套后台管理系统。系统可以用于网站管理后台、CMS、CRM、OA、ERP等。
|
||||
|
||||
后台系统基于 Hyperf 框架开发。企业级架构分层,轻松支撑创业公司及个人前期发展使用,使用少量的服务器资源媲美静态语言的性能。
|
||||
前端使用Vue3 + Vite3 + Pinia + Arco,一端适配PC、移动端、平板
|
||||
|
||||
如果觉着还不错的话,就请点个 ⭐star 支持一下吧,这将是对我最大的支持和鼓励!
|
||||
|
||||
- 腾讯云特惠专场:[点击进入](http://txy.mineadmin.com)
|
||||
- 阿里云特惠专场:[点击进入](http://aly.mineadmin.com)
|
||||
|
||||
## 配置Json来使用Vue完成CRUD操作
|
||||
在传统的前后端分离架构下,前端必须要配置专业的前端开发人员来完成业务,这对于PHPer习惯前后端一把梭来说比较费事。
|
||||
在JQuery逐渐没落的大趋势下,使用Vue成为趋势,但从JQ到Vue转变最难的是思想。
|
||||
|
||||
MineAdmin强调快速开发,为了适应现代开发模式并且兼顾传统一把梭,特开发出了crud和form两个组件,
|
||||
只需要像过去配置json的方式即可完成对后端的接口联调,从而快速完成CRUD,大大替开发人员节省了时间。
|
||||
让刚接触VUE的同学也能上手vue,体验vue的好处。
|
||||
|
||||
大神则可以自由发挥是决定使用crud组件,还是使用原生UI库来完成功能。
|
||||
|
||||
## 兔小巢
|
||||
给大家提供一个可以交流的地方:[http://ask.mineadmin.com](http://ask.mineadmin.com)
|
||||
|
||||
## 前端仓库地址
|
||||
移步前端仓库
|
||||
|
||||
- [Github MineAdmin-Vue](https://github.com/kanyxmo/MineAdmin-Vue)
|
||||
- [Gitee MineAdmin-Vue](https://gitee.com/xmo/MineAdmin-vue)
|
||||
|
||||
## 非官方交流群
|
||||
> 以下QQ群为 MineAdmin 爱好者建立用于交流学习,请勿相信任何收费事项
|
||||
|
||||
<img src="https://svg.hamm.cn/badge.svg?key=QQ群&value=150105478" />
|
||||
|
||||
## 内置功能
|
||||
|
||||
1. 用户管理,完成用户添加、修改、删除配置,支持不同用户登录后台看到不同的首页
|
||||
2. 部门管理,部门组织机构(公司、部门、小组),树结构展现支持数据权限
|
||||
3. 岗位管理,可以给用户配置所担任职务
|
||||
4. 角色管理,角色菜单权限分配、角色数据权限分配
|
||||
5. 菜单管理,配置系统菜单和按钮等
|
||||
6. 字典管理,对系统中经常使用并且固定的数据可以重复使用和维护
|
||||
7. 系统配置,系统的一些常用设置管理
|
||||
8. 操作日志,用户对系统的一些正常操作的查询
|
||||
9. 登录日志,用户登录系统的记录查询
|
||||
10. 在线用户,查看当前登录的用户
|
||||
11. 服务监控,查看当前服务器状态和PHP环境等信息
|
||||
12. 附件管理,管理当前系统上传的文件及图片等信息
|
||||
13. 数据表维护,对系统的数据表可以进行清理碎片和优化
|
||||
14. 模块管理,管理系统当前所有模块
|
||||
15. 定时任务,在线(添加、修改、删除)任务调度包含执行结果日志
|
||||
16. 代码生成,前后端代码的生成(php、vue、js、sql),支持下载和生成到模块
|
||||
17. 缓存监控,查看Redis信息和系统所使用key的信息
|
||||
18. API管理,对应用和接口管理、接口授权等功能。接口文档自动生成,输入、输出参数检查等
|
||||
19. 队列管理,消息队列管理功能、消息管理、消息发送。使用ws方式即时消息提醒(需安装rabbitMQ)
|
||||
|
||||
## 环境需求
|
||||
|
||||
- Swoole >= 4.6.x 并关闭 `Short Name`
|
||||
- PHP >= 8.0 并开启以下扩展:
|
||||
- mbstring
|
||||
- json
|
||||
- pdo
|
||||
- openssl
|
||||
- redis
|
||||
- pcntl
|
||||
- Mysql >= 5.7
|
||||
- Redis >= 4.0
|
||||
|
||||
|
||||
## 下载项目
|
||||
- MineAdmin没有使用SQL文件导入安装,系统使用Migrates迁移文件形式安装和填充数据,请知悉。
|
||||
|
||||
- 项目下载,请确保已经安装了 `Composer`
|
||||
```shell
|
||||
git clone https://gitee.com/xmo/MineAdmin && cd MineAdmin
|
||||
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
|
||||
composer install
|
||||
```
|
||||
|
||||
## 后端安装
|
||||
|
||||
打开终端,执行安装命令,按照提示,一步步完成`.env`文件的配置
|
||||
```shell
|
||||
php bin/hyperf.php mine:install
|
||||
```
|
||||
|
||||
待提示以下信息后
|
||||
```shell
|
||||
Reset the ".env" file. Please restart the service before running
|
||||
the installation command to continue the installation.
|
||||
```
|
||||
|
||||
再次执行安装命令,执行Migrates数据迁移文件和SQL数据填充,完成安装。
|
||||
```shell
|
||||
php bin/hyperf.php mine:install
|
||||
```
|
||||
|
||||
[点这里 -> 查看运行后De常见问题](https://doc.mineadmin.com/faqs/)
|
||||
|
||||
## 免责声明
|
||||
本软件不得用于开发违反国家有关政策的相关软件和应用,若因使用本软件造成的一切法律责任均与 `MineAdmin` 无关
|
||||
|
||||
## 体验地址
|
||||
|
||||
[体验地址](https://demo.mineadmin.com)
|
||||
- 账号:superAdmin
|
||||
- 密码:admin123
|
||||
|
||||
> 请勿添加脏数据
|
||||
|
||||
## 鸣谢
|
||||
|
||||
> 以下排名不分先后
|
||||
|
||||
[Hyperf 一款高性能企业级协程框架](https://hyperf.io/)
|
||||
|
||||
[Arco 字节跳动出品的企业级设计系统](https://arco.design/)
|
||||
|
||||
[Swoole PHP协程框架](https://www.swoole.com)
|
||||
|
||||
[Vue](https://vuejs.org/)
|
||||
|
||||
[Vite](https://vitejs.cn/)
|
||||
|
||||
[Jetbrains 生产力工具](https://www.jetbrains.com/)
|
||||
|
||||
## 通过 OSCS 安全认证
|
||||
[](https://www.murphysec.com/dr/9ztZvuSN6OLFjCDGVo)
|
||||
|
||||
## 演示图片
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vklKzR.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vklGdO.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vkl8eK.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vkl1L6.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vklwQI.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vkldSA.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vklNJH.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vklJoD.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vkllsx.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vklZoF.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vklUWd.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vkl0yt.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vkltFe.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vkluW9.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vklnJJ.jpg" />
|
||||
<img src="https://s1.ax1x.com/2022/07/31/vklmi4.jpg" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
||||
* ==========================================================
|
||||
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
||||
* ----------------------------------------------------------
|
||||
* 官方网址: https://www.zoomtk.com
|
||||
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
||||
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
||||
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
||||
* ==========================================================
|
||||
*/
|
||||
namespace Addon\Comarea\Api;
|
||||
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
/**
|
||||
* Class IndexController
|
||||
* @package Addon\Comarea\Api
|
||||
*/
|
||||
#[Controller(prefix: "area")]
|
||||
class AreaController
|
||||
{
|
||||
#[GetMapping("getInfo")]
|
||||
public function getInfo($pid = 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
||||
* ==========================================================
|
||||
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
||||
* ----------------------------------------------------------
|
||||
* 官方网址: https://www.zoomtk.com
|
||||
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
||||
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
||||
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
||||
* ==========================================================
|
||||
*/
|
||||
namespace Addon\Comarea\Controller;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
|
||||
use Builder\MineController;
|
||||
use Builder\Entity\UISettingEntity;
|
||||
use Builder\Entity\UserEntity;
|
||||
|
||||
use Builder\Entity\MenuEntity;
|
||||
use Builder\Entity\MenuItemEntity;
|
||||
use Builder\View;
|
||||
/**
|
||||
* Class IndexController
|
||||
* @package Addon\Comarea\Controller
|
||||
*/
|
||||
#[Controller(prefix: "area")]
|
||||
class IndexController extends MineController
|
||||
{
|
||||
#[GetMapping("index")]
|
||||
public function Index(){
|
||||
$setting = new UISettingEntity();
|
||||
$setting->setHomeUrl('index');
|
||||
$user=new UserEntity();
|
||||
$setting->setUser($user);
|
||||
return View::make($setting);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "Comarea",
|
||||
"label": "区域信息",
|
||||
"description": "中国地区区域地址表,坐标表",
|
||||
"installed": true,
|
||||
"enabled": true,
|
||||
"version": "1.0.0",
|
||||
"order": 99
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "Comorder",
|
||||
"label": "订单模块",
|
||||
"description": "公共订单基础模块",
|
||||
"installed": true,
|
||||
"enabled": true,
|
||||
"version": "1.0.0",
|
||||
"order": 99
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "Member",
|
||||
"label": "会员",
|
||||
"description": "用户模块、平台统一用户中心",
|
||||
"installed": true,
|
||||
"enabled": true,
|
||||
"version": "1.0.0",
|
||||
"order": 99
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace Api;
|
||||
|
||||
use App\System\Service\SystemAppService;
|
||||
use Hyperf\HttpServer\Annotation\Middlewares;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Builder\Exception\NormalStatusException;
|
||||
use Builder\Helper\MineCode;
|
||||
use Builder\MineApi;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\RequestMapping;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Api\Middleware\VerifyInterfaceMiddleware;
|
||||
|
||||
/**
|
||||
* Class ApiController
|
||||
* @package Api
|
||||
*/
|
||||
#[Controller(prefix: "api")]
|
||||
class ApiController extends MineApi
|
||||
{
|
||||
public const SIGN_VERSION = '1.0';
|
||||
|
||||
/**
|
||||
* 获取accessToken
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
#[PostMapping("v1/getAccessToken")]
|
||||
public function getAccessToken(): ResponseInterface
|
||||
{
|
||||
$service = container()->get(SystemAppService::class);
|
||||
return $this->success($service->getAccessToken($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* v1 版本
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[RequestMapping("v1/{method}")]
|
||||
#[Middlewares([ VerifyInterfaceMiddleware::class ])]
|
||||
public function v1(): ResponseInterface
|
||||
{
|
||||
$apiData = $this->__init();
|
||||
|
||||
try {
|
||||
$class = make($apiData['class_name']);
|
||||
return $class->{$apiData['method_name']}();
|
||||
} catch (\Throwable $e) {
|
||||
throw new NormalStatusException(
|
||||
t('mineadmin.interface_exception') . $e->getMessage(),
|
||||
MineCode::INTERFACE_EXCEPTION
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
protected function __init()
|
||||
{
|
||||
if (empty($this->request->input('apiData'))) {
|
||||
throw new NormalStatusException(t('mineadmin.access_denied'), MineCode::NORMAL_STATUS);
|
||||
}
|
||||
|
||||
return $this->request->input('apiData');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace Api;
|
||||
|
||||
use App\System\Service\SystemApiService;
|
||||
use App\System\Service\SystemAppService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Builder\Helper\MineCode;
|
||||
use Builder\MineApi;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class ApiDocController
|
||||
* @package Api
|
||||
*/
|
||||
#[Controller(prefix: "apiDoc")]
|
||||
class ApiDocController extends MineApi
|
||||
{
|
||||
/**
|
||||
* @var SystemAppService
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemAppService $systemAppService;
|
||||
|
||||
/**
|
||||
* @var SystemApiService
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemApiService $systemApiService;
|
||||
|
||||
/**
|
||||
* 登录文档
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("login")]
|
||||
public function login(): ResponseInterface
|
||||
{
|
||||
$app_id = $this->request->input('app_id', '');
|
||||
$app_secret = $this->request->input('app_secret', '');
|
||||
|
||||
if (empty($app_id) && empty($app_secret)) {
|
||||
return $this->error(t('mineadmin.api_auth_fail'), MineCode::API_PARAMS_ERROR);
|
||||
}
|
||||
|
||||
if (($code = $this->systemAppService->loginDoc($app_id, $app_secret)) !== MineCode::API_VERIFY_PASS) {
|
||||
return $this->error(t('mineadmin.api_auth_fail'), $code);
|
||||
}
|
||||
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过app id获取接口数据
|
||||
* @param string $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getAppAndInterfaceList/{id}")]
|
||||
public function getAppAndInterfaceList(string $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->systemAppService->getAppAndInterfaceList($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getColumnList/{id}")]
|
||||
public function getColumnList(string $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->systemApiService->getColumnListByApiId($id));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
namespace Api\InterfaceApi\v1;
|
||||
|
||||
use Builder\MineResponse;
|
||||
use App\System\Mapper\SystemDeptMapper;
|
||||
use App\System\Mapper\SystemUserMapper;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 演示,测试专用
|
||||
*/
|
||||
class DemoApi
|
||||
{
|
||||
/**
|
||||
* @var SystemUserMapper
|
||||
*/
|
||||
protected SystemUserMapper $user;
|
||||
|
||||
/**
|
||||
* @var SystemDeptMapper
|
||||
*/
|
||||
protected SystemDeptMapper $dept;
|
||||
|
||||
protected MineResponse $response;
|
||||
|
||||
/**
|
||||
* DemoApi constructor.
|
||||
* @param SystemUserMapper $user
|
||||
* @param SystemDeptMapper $dept
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function __construct(SystemUserMapper $user, SystemDeptMapper $dept)
|
||||
{
|
||||
$this->response = container()->get(MineResponse::class);
|
||||
$this->user = $user;
|
||||
$this->dept = $dept;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表接口
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getUserList(): ResponseInterface
|
||||
{
|
||||
// 第二个参数,不进行数据权限检查,否则会拉起检测是否登录。
|
||||
return $this->response->success('请求成功', $this->user->getPageList([], false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门列表接口
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getDeptList(): ResponseInterface
|
||||
{
|
||||
// 第二个参数,不进行数据权限检查,否则会拉起检测是否登录。
|
||||
return $this->response->success('请求成功', $this->dept->getTreeList([], false));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
namespace Api\Listener;
|
||||
|
||||
use App\System\Service\SystemApiLogService;
|
||||
use Hyperf\Event\Annotation\Listener;
|
||||
use Hyperf\Event\Contract\ListenerInterface;
|
||||
use Builder\Event\ApiAfter;
|
||||
use Builder\Helper\Str;
|
||||
use Builder\MineRequest;
|
||||
|
||||
/**
|
||||
* API访问日志保存
|
||||
*/
|
||||
#[Listener]
|
||||
class ApiLogListener implements ListenerInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* 监听事件
|
||||
* @return string[]
|
||||
*/
|
||||
public function listen(): array
|
||||
{
|
||||
return [
|
||||
ApiAfter::class
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件处理
|
||||
* @param object $event
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
public function process(object $event): void
|
||||
{
|
||||
/* @var $event ApiAfter */
|
||||
$data = $event->getApiData();
|
||||
$request = container()->get(MineRequest::class);
|
||||
$service = container()->get(SystemApiLogService::class);
|
||||
|
||||
if (empty($data)) {
|
||||
// 只记录异常日志,但并不抛出异常,程序正常走下去
|
||||
logger('Api Access Log')->error('API数据为空,访问日志无法记录,以下为 Request 信息:'. json_encode($request));
|
||||
} else {
|
||||
// 保存日志
|
||||
$reqData = $request->getParsedBody();
|
||||
unset($reqData['apiData']);
|
||||
$response = $event->getResult();
|
||||
$service->save([
|
||||
'api_id' => $data['id'],
|
||||
'api_name' => $data['name'],
|
||||
'access_name' => $data['access_name'],
|
||||
'request_data' => [ 'data' => $reqData, 'params' => $request->getQueryParams() ],
|
||||
'response_code' => $response->getStatusCode(),
|
||||
// 返回内容以免过大,暂不保存访问内容
|
||||
// 'response_data' => $response->getBody()->getContents(),
|
||||
'ip' => $request->ip(),
|
||||
'ip_location' => Str::ipToRegion($request->ip()),
|
||||
'access_time' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace Api\Middleware;
|
||||
|
||||
use App\System\Service\SystemAppService;
|
||||
use Builder\Event\ApiAfter;
|
||||
use Builder\Event\ApiBefore;
|
||||
use App\System\Model\SystemApi;
|
||||
use App\System\Service\SystemApiService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\Context\Context;
|
||||
use Builder\Exception\NormalStatusException;
|
||||
use Builder\Helper\MineCode;
|
||||
use Builder\MineRequest;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\MiddlewareInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
class VerifyInterfaceMiddleware implements MiddlewareInterface
|
||||
{
|
||||
/**
|
||||
* 事件调度器
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
#[Inject]
|
||||
protected EventDispatcherInterface $evDispatcher;
|
||||
|
||||
/**
|
||||
* 验证检查接口
|
||||
* @param ServerRequestInterface $request
|
||||
* @param RequestHandlerInterface $handler
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler):ResponseInterface
|
||||
{
|
||||
$this->crossSetting($request);
|
||||
|
||||
return $this->run($request, $handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* 跨域设置
|
||||
* @param $request
|
||||
*/
|
||||
protected function crossSetting($request): void
|
||||
{
|
||||
$crossData = [
|
||||
'Access-Control-Allow-Origin' => '*',
|
||||
'Access-Control-Allow-Methods' => 'POST,GET,PUT,DELETE,OPTIONS',
|
||||
'Access-Control-Allow-Headers' => 'Version, Access-Token, User-Token, Api-Auth, User-Agent, Keep-Alive, Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With',
|
||||
'Access-Control-Allow-Credentials' => 'true'
|
||||
];
|
||||
|
||||
foreach ($crossData as $name => $value) {
|
||||
$request->withHeader($name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 访问接口鉴权处理
|
||||
* @param ServerRequestInterface $request
|
||||
* @return int
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
protected function auth(ServerRequestInterface $request): int
|
||||
{
|
||||
try {
|
||||
/* @var $service SystemAppService */
|
||||
$service = container()->get(SystemAppService::class);
|
||||
$queryParams = $request->getQueryParams();
|
||||
switch ($this->_getApiData()['auth_mode']) {
|
||||
case SystemApi::AUTH_MODE_EASY:
|
||||
if (empty($queryParams['app_id'])) {
|
||||
return MineCode::API_APP_ID_MISSING;
|
||||
}
|
||||
if (empty($queryParams['identity'])) {
|
||||
return MineCode::API_IDENTITY_MISSING;
|
||||
}
|
||||
return $service->verifyEasyMode($queryParams['app_id'], $queryParams['identity']);
|
||||
case SystemApi::AUTH_MODE_NORMAL:
|
||||
|
||||
if (empty($queryParams['access_token'])) {
|
||||
return MineCode::API_ACCESS_TOKEN_MISSING;
|
||||
}
|
||||
return $service->verifyNormalMode($queryParams['access_token']);
|
||||
default:
|
||||
throw new \RuntimeException();
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
throw new NormalStatusException(t('mineadmin.api_auth_exception'), MineCode::API_AUTH_EXCEPTION);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API常规检查
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
*/
|
||||
protected function apiModelCheck($request): ServerRequestInterface
|
||||
{
|
||||
$service = container()->get(SystemApiService::class);
|
||||
$apiModel = $service->mapper->one(function($query) {
|
||||
$request = container()->get(MineRequest::class);
|
||||
$query->where('access_name', $request->route('method'));
|
||||
});
|
||||
|
||||
// 检查接口是否存在
|
||||
if (! $apiModel) {
|
||||
throw new NormalStatusException(t('mineadmin.not_found'), MineCode::NOT_FOUND);
|
||||
}
|
||||
|
||||
// 检查接口是否停用
|
||||
if ($apiModel['status'] == SystemApi::DISABLE) {
|
||||
throw new NormalStatusException(t('mineadmin.api_stop'), MineCode::RESOURCE_STOP);
|
||||
}
|
||||
|
||||
// 检查接口请求方法
|
||||
if ($apiModel['request_mode'] !== SystemApi::METHOD_ALL && $request->getMethod()[0] !== $apiModel['request_mode']) {
|
||||
throw new NormalStatusException(
|
||||
t('mineadmin.not_allow_method', ['method' => $request->getMethod()]),
|
||||
MineCode::METHOD_NOT_ALLOW
|
||||
);
|
||||
}
|
||||
|
||||
$this->_setApiData($apiModel->toArray());
|
||||
|
||||
// 合并入参
|
||||
return $request->withParsedBody(array_merge(
|
||||
$request->getParsedBody(), ['apiData' => $apiModel->toArray()]
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行
|
||||
* @param ServerRequestInterface $request
|
||||
* @param RequestHandlerInterface $handler
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
protected function run(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
$this->evDispatcher->dispatch(new ApiBefore());
|
||||
|
||||
$request = $this->apiModelCheck($request);
|
||||
|
||||
if (($code = $this->auth($request)) !== MineCode::API_VERIFY_PASS) {
|
||||
throw new NormalStatusException(t('mineadmin.api_auth_fail'), $code);
|
||||
}
|
||||
|
||||
$result = $handler->handle($request);
|
||||
|
||||
$event = new ApiAfter($this->_getApiData(), $result);
|
||||
$this->evDispatcher->dispatch($event);
|
||||
|
||||
return $event->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置协程上下文
|
||||
* @param array $data
|
||||
*/
|
||||
private function _setApiData(array $data)
|
||||
{
|
||||
Context::set('apiData', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取协程上下文
|
||||
* @return array
|
||||
*/
|
||||
private function _getApiData(): array
|
||||
{
|
||||
return Context::get('apiData', []);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace Api\Middleware;
|
||||
|
||||
use App\System\Model\SystemApi;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\MiddlewareInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
class VerifyParamsMiddleware implements MiddlewareInterface
|
||||
{
|
||||
/**
|
||||
* 验证接口参数
|
||||
* @param ServerRequestInterface $request
|
||||
* @param RequestHandlerInterface $handler
|
||||
* @return ResponseInterface
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler):ResponseInterface
|
||||
{
|
||||
$apiData = $request->getParsedBody()['apiData'];
|
||||
$requestData = $this->getRequestData($request, $apiData);
|
||||
|
||||
$columns = container()->get(\App\System\Service\SystemApiService::class)
|
||||
->getColumnListByApiId((string) $apiData['id'])['api_column'];
|
||||
|
||||
|
||||
// todo...
|
||||
|
||||
return $handler->handle($request);
|
||||
}
|
||||
|
||||
protected function getRequestData(ServerRequestInterface $request, &$apiData): array
|
||||
{
|
||||
$bodyData = $request->getParsedBody(); unset($bodyData['apiData']);
|
||||
|
||||
if ($apiData['request_mode'] === SystemApi::METHOD_GET) {
|
||||
$params = $request->getQueryParams();
|
||||
} else if ($apiData['request_mode'] === SystemApi::METHOD_ALL) {
|
||||
$params = array_merge($request->getQueryParams(), $bodyData);
|
||||
} else {
|
||||
$params = &$bodyData;
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
||||
* ==========================================================
|
||||
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
||||
* ----------------------------------------------------------
|
||||
* 官方网址: https://www.zoomtk.com
|
||||
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
||||
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
||||
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
||||
* ==========================================================
|
||||
*/
|
||||
namespace App\Mall\Controller;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Builder\MineController;
|
||||
use Builder\Entity\UISettingEntity;
|
||||
use Builder\Entity\UserEntity;
|
||||
|
||||
use Builder\Entity\MenuEntity;
|
||||
use Builder\Entity\MenuItemEntity;
|
||||
use Builder\View;
|
||||
/**
|
||||
* Class IndexController
|
||||
* @package App\Mall\Controller
|
||||
*/
|
||||
#[Controller(prefix: "mall")]
|
||||
class IndexController extends MineController
|
||||
{
|
||||
#[GetMapping("index")]
|
||||
public function Index(){
|
||||
$setting = new UISettingEntity();
|
||||
$setting->setHomeUrl('index');
|
||||
$user=new UserEntity();
|
||||
$setting->setUser($user);
|
||||
return View::make($setting);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "Mall",
|
||||
"label": "商城",
|
||||
"description": "多用户商城,进销存,多功能供应集采系统",
|
||||
"installed": false,
|
||||
"enabled": true,
|
||||
"version": "1.0.0",
|
||||
"order": 1
|
||||
}
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Api;
|
||||
|
||||
use App\System\Request\SystemApiColumnRequest;
|
||||
use App\System\Service\SystemApiColumnService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineCollection;
|
||||
use Builder\MineController;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 接口控制器
|
||||
* Class SystemApiColumnController
|
||||
*/
|
||||
#[Controller(prefix: "system/apiColumn"), Auth]
|
||||
class SystemApiColumnController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemApiColumnService $service;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:api, system:api:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:api:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param SystemApiColumnRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:api:save"), OperationLog("新增接口参数")]
|
||||
public function save(SystemApiColumnRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取数据
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:api:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param int $id
|
||||
* @param SystemApiColumnRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:api:update"), OperationLog("更新接口参数")]
|
||||
public function update(int $id, SystemApiColumnRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除数据到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:api:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除数据 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:api:realDelete"), OperationLog("真实删除接口参数")]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:api:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 字段导出
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
#[PostMapping("export")]
|
||||
public function export(): ResponseInterface
|
||||
{
|
||||
return $this->service->export($this->request->all(), \App\System\Dto\ApiColumnDto::class, '字段列表');
|
||||
}
|
||||
|
||||
/**
|
||||
* 字段导入
|
||||
* @return ResponseInterface
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("import")]
|
||||
public function import(): ResponseInterface
|
||||
{
|
||||
return $this->service->import(\App\System\Dto\ApiColumnDto::class) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载导入模板
|
||||
* @return ResponseInterface
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("downloadTemplate")]
|
||||
public function downloadTemplate(): ResponseInterface
|
||||
{
|
||||
return (new MineCollection)->export(\App\System\Dto\ApiColumnDto::class, '模板下载', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改状态
|
||||
* @param SystemApiColumnRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:api:update"), OperationLog("更改接口状态")]
|
||||
public function changeStatus(SystemApiColumnRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $this->request->input('id'), (string) $this->request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Api;
|
||||
|
||||
use App\System\Request\SystemApiRequest;
|
||||
use App\System\Service\SystemApiService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 接口管理控制器
|
||||
* Class SystemApiController
|
||||
*/
|
||||
#[Controller(prefix: "system/api"), Auth]
|
||||
class SystemApiController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemApiService $service;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:api, system:api:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模块列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getModuleList")]
|
||||
public function getModuleList(): ResponseInterface
|
||||
{
|
||||
$this->mine->scanModule();
|
||||
return $this->success($this->mine->getModuleInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:api:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param SystemApiRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:api:save"), OperationLog]
|
||||
public function save(SystemApiRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取数据
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:api:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param int $id
|
||||
* @param SystemApiRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:api:update"), OperationLog]
|
||||
public function update(int $id, SystemApiRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除数据到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:api:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除数据 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:api:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:api:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改状态
|
||||
* @param SystemApiRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:api:update"), OperationLog]
|
||||
public function changeStatus(SystemApiRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $this->request->input('id'), (string) $this->request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Api;
|
||||
|
||||
use App\System\Request\SystemApiGroupRequest;
|
||||
use App\System\Service\SystemApiGroupService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 接口分组控制器
|
||||
* Class SystemApiGroupController
|
||||
*/
|
||||
#[Controller(prefix: "system/apiGroup"), Auth]
|
||||
class SystemApiGroupController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemApiGroupService $service;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:apiGroup, system:apiGroup:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表,无分页
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("list")]
|
||||
public function list(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:apiGroup:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param SystemApiGroupRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:apiGroup:save"), OperationLog]
|
||||
public function save(SystemApiGroupRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取数据
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:apiGroup:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param int $id
|
||||
* @param SystemApiGroupRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:apiGroup:update"), OperationLog]
|
||||
public function update(int $id, SystemApiGroupRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除数据到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:apiGroup:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除数据 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:apiGroup:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:apiGroup:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改状态
|
||||
* @param SystemApiGroupRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:apiGroup:update"), OperationLog]
|
||||
public function changeStatus(SystemApiGroupRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $this->request->input('id'), (string) $this->request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\App;
|
||||
|
||||
use App\System\Request\SystemAppRequest;
|
||||
use App\System\Service\SystemAppService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 应用管理控制器
|
||||
* Class SystemAppController
|
||||
*/
|
||||
#[Controller(prefix: "system/app"), Auth]
|
||||
class SystemAppController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemAppService $service;
|
||||
|
||||
/**
|
||||
* 获取APP ID
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Exception
|
||||
*/
|
||||
#[GetMapping("getAppId")]
|
||||
public function getAppId(): ResponseInterface
|
||||
{
|
||||
return $this->success(['app_id' => $this->service->getAppId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取APP SECRET
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Exception
|
||||
*/
|
||||
#[GetMapping("getAppSecret")]
|
||||
public function getAppSecret(): ResponseInterface
|
||||
{
|
||||
return $this->success(['app_secret' => $this->service->getAppSecret()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:app, system:app:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定接口列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getApiList")]
|
||||
public function getApiList(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getApiList((int) $this->request->input('id', null)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:app:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param SystemAppRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:app:save"), OperationLog]
|
||||
public function save(SystemAppRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取数据
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:app:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param int $id
|
||||
* @param SystemAppRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:app:update"), OperationLog]
|
||||
public function update(int $id, SystemAppRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定接口
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("bind/{id}"), Permission("system:app:bind"), OperationLog]
|
||||
public function bind(int $id): ResponseInterface
|
||||
{
|
||||
return $this->service->bind($id, $this->request->input('apiIds', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除数据到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:app:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除数据 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:app:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:app:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改状态
|
||||
* @param SystemAppRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:apiGroup:update"), OperationLog]
|
||||
public function changeStatus(SystemAppRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $this->request->input('id'), (string) $this->request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\App;
|
||||
|
||||
use App\System\Request\SystemAppGroupRequest;
|
||||
use App\System\Service\SystemAppGroupService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 应用分组控制器
|
||||
* Class SystemAppGroupController
|
||||
*/
|
||||
#[Controller(prefix: "system/appGroup"), Auth]
|
||||
class SystemAppGroupController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemAppGroupService $service;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:appGroup, system:appGroup:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表,无分页
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("list")]
|
||||
public function list(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:appGroup:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param SystemAppGroupRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:appGroup:save"), OperationLog]
|
||||
public function save(SystemAppGroupRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取数据
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:appGroup:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param int $id
|
||||
* @param SystemAppGroupRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:appGroup:update"), OperationLog]
|
||||
public function update(int $id, SystemAppGroupRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除数据到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:appGroup:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除数据 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:appGroup:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:appGroup:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改状态
|
||||
* @param SystemAppGroupRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:appGroup:update"), OperationLog]
|
||||
public function changeStatus(SystemAppGroupRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $this->request->input('id'), (string) $this->request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller;
|
||||
|
||||
use App\System\Service\SystemDeptService;
|
||||
use App\System\Service\SystemLoginLogService;
|
||||
use App\System\Service\SystemNoticeService;
|
||||
use App\System\Service\SystemOperLogService;
|
||||
use App\System\Service\SystemPostService;
|
||||
use App\System\Service\SystemRoleService;
|
||||
use App\System\Service\SystemUserService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 公共方法控制器
|
||||
* Class CommonController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
#[Controller(prefix: "system/common"), Auth]
|
||||
class CommonController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemUserService $userService;
|
||||
|
||||
#[Inject]
|
||||
protected SystemDeptService $deptService;
|
||||
|
||||
#[Inject]
|
||||
protected SystemRoleService $roleService;
|
||||
|
||||
#[Inject]
|
||||
protected SystemPostService $postService;
|
||||
|
||||
#[Inject]
|
||||
protected SystemNoticeService $noticeService;
|
||||
|
||||
#[Inject]
|
||||
protected SystemLoginLogService $loginLogService;
|
||||
|
||||
#[Inject]
|
||||
protected SystemOperLogService $operLogService;
|
||||
|
||||
|
||||
/**
|
||||
* 返回模块信息及表前缀
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getModuleList")]
|
||||
public function getModuleList(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->mine->getModuleInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getUserList")]
|
||||
public function getUserList(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->userService->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 列表获取用户基础信息
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("getUserInfoByIds")]
|
||||
public function getUserInfoByIds(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->userService->getUserInfoByIds((array) $this->request->input('ids', [])));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getDeptTreeList")]
|
||||
public function getDeptTreeList(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->deptService->getSelectTree());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getRoleList")]
|
||||
public function getRoleList(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->roleService->getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getPostList")]
|
||||
public function getPostList(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->postService->getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公告列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getNoticeList")]
|
||||
public function getNoticeList(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->noticeService->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录日志列表
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getLoginLogList")]
|
||||
public function getLoginLogPageList(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->loginLogService->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取操作日志列表
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getOperationLogList")]
|
||||
public function getOperLogPageList(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->operLogService->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除所有缓存
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("clearAllCache")]
|
||||
public function clearAllCache(): ResponseInterface
|
||||
{
|
||||
$this->userService->clearCache((string) user()->getId());
|
||||
return $this->success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\DataCenter;
|
||||
|
||||
use App\System\Service\SystemUploadFileService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
|
||||
/**
|
||||
* 文件管理控制器
|
||||
* Class UploadFileController
|
||||
* @package App\System\Controller\DataCenter
|
||||
*/
|
||||
#[Controller(prefix: "system/attachment"), Auth]
|
||||
class AttachmentController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemUploadFileService $service;
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:attachment, system:attachment:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:attachment:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除附件
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:attachment:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除文件 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:attachment:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的文件
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:attachment:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\System\Controller\DataCenter;
|
||||
|
||||
|
||||
use App\System\Service\DataMaintainService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class DataMaintainController
|
||||
* @package App\System\Controller\DataCenter
|
||||
*/
|
||||
#[Controller(prefix: "system/dataMaintain"), Auth]
|
||||
class DataMaintainController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected DataMaintainService $service;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:dataMaintain, system:dataMaintain:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("detailed"), Permission("system:dataMaintain:detailed")]
|
||||
public function detailed(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getColumnList($this->request->input('table', null)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 优化表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("optimize"), Permission("system:dataMaintain:optimize"), OperationLog]
|
||||
public function optimize(): ResponseInterface
|
||||
{
|
||||
$tables = $this->request->input('tables', []);
|
||||
return $this->service->optimize($tables) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理表碎片
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("fragment"), Permission("system:dataMaintain:fragment"), OperationLog]
|
||||
public function fragment(): ResponseInterface
|
||||
{
|
||||
$tables = $this->request->input('tables', []);
|
||||
return $this->service->fragment($tables) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\DataCenter;
|
||||
|
||||
use App\System\Request\SystemDictDataRequest;
|
||||
use App\System\Service\SystemDictDataService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 字典类型控制器
|
||||
* Class LogsController
|
||||
* @package App\System\Controller\DataCenter
|
||||
*/
|
||||
#[Controller(prefix: "system/dataDict"), Auth]
|
||||
class DictDataController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemDictDataService $service;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:dict, system:dict:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 快捷查询一个字典
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("list")]
|
||||
public function list(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 快捷查询多个字典
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("lists")]
|
||||
public function lists(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getLists($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除字典缓存
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("clearCache"), Permission("system:dict:clearCache"), OperationLog]
|
||||
public function clearCache(): ResponseInterface
|
||||
{
|
||||
return $this->service->clearCache() ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:dict:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
* @param SystemDictDataRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:dict:save"), OperationLog]
|
||||
public function save(SystemDictDataRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个字典类型数据
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:dict:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新一个字典类型
|
||||
* @param int $id
|
||||
* @param SystemDictDataRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:dict:update"), OperationLog]
|
||||
public function update(int $id, SystemDictDataRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量字典数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:dict:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除字典 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:dict:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的字典
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:dict:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改字典状态
|
||||
* @param SystemDictDataRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:dict:update"), OperationLog]
|
||||
public function changeStatus(SystemDictDataRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $request->input('id'), (string) $request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字运算操作
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("numberOperation"), Permission("system:dict:update"), OperationLog]
|
||||
public function numberOperation(): ResponseInterface
|
||||
{
|
||||
return $this->service->numberOperation(
|
||||
(int) $this->request->input('id'),
|
||||
(string) $this->request->input('numberName'),
|
||||
(int) $this->request->input('numberValue', 1),
|
||||
) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\DataCenter;
|
||||
|
||||
use App\System\Request\SystemDictTypeRequest;
|
||||
use App\System\Service\SystemDictTypeService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 字典类型控制器
|
||||
* Class LogsController
|
||||
* @package App\System\Controller\DataCenter
|
||||
* @Controller(prefix="system/dictType")
|
||||
* @Auth
|
||||
*/
|
||||
#[Controller(prefix: "system/dictType"), Auth]
|
||||
class DictTypeController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemDictTypeService $service;
|
||||
|
||||
/**
|
||||
* 获取字典列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:dict, system:dict:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:dict:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
* @param SystemDictTypeRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:dict:save"), OperationLog("新增字典类型")]
|
||||
public function save(SystemDictTypeRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个字典类型数据
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:dict:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新一个字典类型
|
||||
* @param int $id
|
||||
* @param SystemDictTypeRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:dict:update"), OperationLog("更新字典类型")]
|
||||
public function update(int $id, SystemDictTypeRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量字典数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:dict:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除字典数据 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:dict:realDelete"), OperationLog("删除字典类型")]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的用户
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:dict:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改字典类型状态
|
||||
* @param SystemDictTypeRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:dict:update"), OperationLog("修改字典类型状态")]
|
||||
public function changeStatus(SystemDictTypeRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $this->request->input('id'), (string) $this->request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\DataCenter;
|
||||
|
||||
use App\System\Request\SystemNoticeRequest;
|
||||
use App\System\Service\SystemNoticeService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 通知管理控制器
|
||||
* Class NoticeController
|
||||
*/
|
||||
#[Controller(prefix: "system/notice"), Auth]
|
||||
class NoticeController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemNoticeService $service;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:notice, system:notice:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:notice:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param SystemNoticeRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Throwable
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:notice:save"), OperationLog]
|
||||
public function save(SystemNoticeRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取数据
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:notice:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param int $id
|
||||
* @param SystemNoticeRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:notice:update"), OperationLog]
|
||||
public function update(int $id, SystemNoticeRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除数据到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:notice:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除数据 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:notice:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:notice:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\DataCenter;
|
||||
|
||||
use App\System\Request\MessageRequest;
|
||||
use App\System\Service\SystemQueueMessageService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 信息管理控制器
|
||||
* Class MessageController
|
||||
*/
|
||||
#[Controller(prefix: "system/queueMessage"), Auth]
|
||||
class QueueMessageController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemQueueMessageService $service;
|
||||
|
||||
/**
|
||||
* 接收消息列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("receiveList")]
|
||||
public function receiveList(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getReceiveMessage($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发送消息列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("sendList")]
|
||||
public function sendList(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getSendMessage($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发私信
|
||||
* @param MessageRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Throwable
|
||||
*/
|
||||
#[PostMapping("sendPrivateMessage")]
|
||||
public function sendPrivateMessage(MessageRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->sendPrivateMessage($request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取接收人列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getReceiveUser")]
|
||||
public function getReceiveUser(): ResponseInterface
|
||||
{
|
||||
return $this->success(
|
||||
$this->service->getReceiveUserList(
|
||||
(int) $this->request->input('id', 0),
|
||||
$this->request->all()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除数据到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("deletes")]
|
||||
public function deletes(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态到已读
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("updateReadStatus")]
|
||||
public function updateReadStatus(): ResponseInterface
|
||||
{
|
||||
return $this->service->updateDataStatus((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
||||
* ==========================================================
|
||||
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
||||
* ----------------------------------------------------------
|
||||
* 官方网址: https://www.zoomtk.com
|
||||
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
||||
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
||||
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
||||
* ==========================================================
|
||||
*/
|
||||
namespace App\System\Controller;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Builder\Entity\UISettingEntity;
|
||||
use Builder\Entity\UserEntity;
|
||||
use Builder\MineController;
|
||||
use Builder\View;
|
||||
/**
|
||||
* Class IndexController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
#[Controller(prefix: "system")]
|
||||
class IndexController extends MineController
|
||||
{
|
||||
#[GetMapping("index")]
|
||||
public function Index(){
|
||||
$setting = new UISettingEntity();
|
||||
$setting->setHomeUrl('index');
|
||||
$user=new UserEntity();
|
||||
$setting->setUser($user);
|
||||
return View::make($setting);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller;
|
||||
|
||||
use App\System\Request\SystemUserRequest;
|
||||
use App\System\Service\SystemUserService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Helper\LoginUser;
|
||||
use Builder\Interfaces\UserServiceInterface;
|
||||
use Builder\MineController;
|
||||
use Builder\Vo\UserServiceVo;
|
||||
|
||||
/**
|
||||
* Class LoginController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
#[Controller(prefix: "system")]
|
||||
class LoginController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemUserService $systemUserService;
|
||||
|
||||
#[Inject]
|
||||
protected UserServiceInterface $userService;
|
||||
|
||||
|
||||
public function index(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SystemUserRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
#[PostMapping("login")]
|
||||
public function login(SystemUserRequest $request): ResponseInterface
|
||||
{
|
||||
$requestData = $request->validated();
|
||||
$vo = new UserServiceVo();
|
||||
$vo->setUsername($requestData['username']);
|
||||
$vo->setPassword($requestData['password']);
|
||||
return $this->success(['token' => $this->userService->login($vo)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
#[PostMapping("logout"), Auth]
|
||||
public function logout(): ResponseInterface
|
||||
{
|
||||
$this->userService->logout();
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getInfo"), Auth]
|
||||
public function getInfo(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->systemUserService->getInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
* @param LoginUser $user
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
#[PostMapping("refresh")]
|
||||
public function refresh(LoginUser $user): ResponseInterface
|
||||
{
|
||||
return $this->success(['token' => $user->refresh()]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Logs;
|
||||
|
||||
use App\System\Service\SystemApiLogService;
|
||||
use App\System\Service\SystemLoginLogService;
|
||||
use App\System\Service\SystemOperLogService;
|
||||
use App\System\Service\SystemQueueLogService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
|
||||
/**
|
||||
* 日志控制器
|
||||
* Class LogsController
|
||||
* @package App\System\Controller\Logs
|
||||
*/
|
||||
#[Controller(prefix: "system/logs"), Auth]
|
||||
class LogsController extends MineController
|
||||
{
|
||||
/**
|
||||
* 登录日志服务
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemLoginLogService $loginLogService;
|
||||
|
||||
/**
|
||||
* 操作日志服务
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemOperLogService $operLogService;
|
||||
|
||||
/**
|
||||
* 接口日志服务
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemApiLogService $apiLogService;
|
||||
|
||||
/**
|
||||
* 队列日志服务
|
||||
*/
|
||||
#[Inject]
|
||||
protected SystemQueueLogService $queueLogService;
|
||||
|
||||
/**
|
||||
* 获取登录日志列表
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getLoginLogPageList"), Permission("system:loginLog")]
|
||||
public function getLoginLogPageList(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->loginLogService->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取操作日志列表
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getOperLogPageList"), Permission("system:operLog")]
|
||||
public function getOperLogPageList(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->operLogService->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取接口日志列表
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getApiLogPageList"), Permission("system:apiLog")]
|
||||
public function getApiLogPageList(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->apiLogService->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取队列日志列表
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getQueueLogPageList"), Permission("system:queueLog")]
|
||||
public function getQueueLogPageList(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->queueLogService->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除队列日志
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("deleteQueueLog"), Permission("system:queueLog:delete"), OperationLog]
|
||||
public function deleteQueueLog(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->queueLogService->delete((array)$this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除操作日志
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("deleteOperLog"), Permission("system:operLog:delete"), OperationLog]
|
||||
public function deleteOperLog(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->operLogService->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除登录日志
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("deleteLoginLog"), Permission("system:loginLog:delete"), OperationLog]
|
||||
public function deleteLoginLog(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->loginLogService->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除API访问日志
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("deleteApiLog"), Permission("system:apiLog:delete"), OperationLog]
|
||||
public function deleteApiLog(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->apiLogService->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Modules;
|
||||
|
||||
use App\System\Request\ModuleRequest;
|
||||
use App\System\Service\ModuleService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 本地模块管理
|
||||
* Class ModuleController
|
||||
* @package App\System\Controller\Modules
|
||||
*/
|
||||
#[Controller(prefix: "system/setting/module"), Auth]
|
||||
class ModuleController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected ModuleService $service;
|
||||
|
||||
/**
|
||||
* 本地模块列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("setting:module, setting:module:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增本地模块
|
||||
* @param ModuleRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("save"), Permission("setting:module:save"), OperationLog]
|
||||
public function save(ModuleRequest $request): ResponseInterface
|
||||
{
|
||||
$this->service->createModule($request->validated());
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启停用模块
|
||||
* @param ModuleRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("modifyStatus"), Permission("setting:module:status"), OperationLog]
|
||||
public function modifyStatus(ModuleRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->modifyStatus($request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 安装模块
|
||||
* @param string $name
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("install"), Permission("setting:module:install"), OperationLog]
|
||||
public function install(): ResponseInterface
|
||||
{
|
||||
return $this->service->installModuleData($this->request->input('name')) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸载删除模块
|
||||
* @param string $name
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Throwable
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("setting:module:delete"), OperationLog]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->uninstallModule($this->request->input('name')) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Monitor;
|
||||
|
||||
use App\System\Service\CacheMonitorService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 缓存监控
|
||||
* Class CacheMonitorController
|
||||
* @package App\System\Controller\Monitor
|
||||
*/
|
||||
#[Controller(prefix: "system/cache"), Auth]
|
||||
class CacheMonitorController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected CacheMonitorService $service;
|
||||
|
||||
/**
|
||||
* 获取Redis服务器信息
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("monitor"), Permission("system:cache, system:cache:monitor")]
|
||||
public function getCacheInfo(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getCacheServerInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看key内容
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("view")]
|
||||
public function view(): ResponseInterface
|
||||
{
|
||||
return $this->success(['content' => $this->service->view($this->request->input('key'))]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个缓存
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:cache:delete"), OperationLog]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete($this->request->input('key', null))
|
||||
? $this->success()
|
||||
: $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空所有缓存
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("clear"), Permission("system:cache:clear"), OperationLog]
|
||||
public function clear(): ResponseInterface
|
||||
{
|
||||
return $this->service->clear() ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
namespace App\System\Controller\Monitor;
|
||||
|
||||
use App\System\Service\SystemUserService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
* Class OnlineUserMonitorController
|
||||
* @package App\System\Controller\Monitor
|
||||
*/
|
||||
#[Controller(prefix: "system/onlineUser"), Auth]
|
||||
class OnlineUserMonitorController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemUserService $service;
|
||||
|
||||
/**
|
||||
* 获取在线用户列表
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:onlineUser, system:onlineUser:index")]
|
||||
public function getPageList(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getOnlineUserPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退用户
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
#[PostMapping("kick"), Permission("system:onlineUser:kick")]
|
||||
public function kickUser(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->service->kickUser((string) $this->request->input('id')) ?
|
||||
$this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
namespace App\System\Controller\Monitor;
|
||||
|
||||
|
||||
use App\System\Service\ServerMonitorService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
|
||||
/**
|
||||
* Class ServerMonitorController
|
||||
* @package App\System\Controller\Monitor
|
||||
*/
|
||||
#[Controller(prefix: "system/server"), Auth]
|
||||
class ServerMonitorController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected ServerMonitorService $service;
|
||||
|
||||
/**
|
||||
* 获取服务器信息
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("monitor"), Permission("system:monitor:server")]
|
||||
public function getServerInfo(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success([
|
||||
'cpu' => $this->service->getCpuInfo(),
|
||||
'memory' => $this->service->getMemInfo(),
|
||||
'phpenv' => $this->service->getPhpAndEnvInfo(),
|
||||
'disk' => $this->service->getDiskInfo()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
namespace App\System\Controller\Permission;
|
||||
|
||||
use App\System\Request\SystemDeptRequest;
|
||||
use App\System\Service\SystemDeptService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class DeptController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
#[Controller(prefix: "system/dept"), Auth]
|
||||
class DeptController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemDeptService $service;
|
||||
|
||||
/**
|
||||
* 部门树列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:dept, system:dept:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getTreeList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站部门树列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:dept:recycle")]
|
||||
public function recycleTree():ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getTreeListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端选择树(不需要权限)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("tree")]
|
||||
public function tree(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getSelectTree());
|
||||
}
|
||||
|
||||
#[GetMapping("getLeaderList"), Permission("system:dept, system:dept:index")]
|
||||
public function getLeaderList()
|
||||
{
|
||||
return $this->success($this->service->getLeaderList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
* @param SystemDeptRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:dept:save"), OperationLog]
|
||||
public function save(SystemDeptRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门领导
|
||||
* @param SystemDeptRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("addLeader"), Permission("system:dept:update"), OperationLog("新增部门领导")]
|
||||
public function addLeader(SystemDeptRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->addLeader($request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门领导
|
||||
* @param SystemDeptRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delLeader"), Permission("system:dept:delete"), OperationLog("删除部门领导")]
|
||||
public function delLeader(): ResponseInterface
|
||||
{
|
||||
return $this->service->delLeader($this->request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新部门
|
||||
* @param int $id
|
||||
* @param SystemDeptRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:dept:update"), OperationLog]
|
||||
public function update(int $id, SystemDeptRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除部门到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:dept:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除部门 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:dept:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
$data = $this->service->realDel((array) $this->request->input('ids', []));
|
||||
return is_null($data) ?
|
||||
$this->success() :
|
||||
$this->success(t('system.exists_children_ctu', ['names' => implode(',', $data)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的部门
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:dept:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改部门状态
|
||||
* @param SystemDeptRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:dept:changeStatus"), OperationLog]
|
||||
public function changeStatus(SystemDeptRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $request->input('id'), (string) $request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字运算操作
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("numberOperation"), Permission("system:dept:update"), OperationLog]
|
||||
public function numberOperation(): ResponseInterface
|
||||
{
|
||||
return $this->service->numberOperation(
|
||||
(int) $this->request->input('id'),
|
||||
(string) $this->request->input('numberName'),
|
||||
(int) $this->request->input('numberValue', 1),
|
||||
) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
declare(strict_types = 1);
|
||||
namespace App\System\Controller\Permission;
|
||||
|
||||
use App\System\Request\SystemMenuRequest;
|
||||
use App\System\Service\SystemMenuService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class MenuController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
#[Controller(prefix: "system/menu"), Auth]
|
||||
class MenuController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemMenuService $service;
|
||||
|
||||
/**
|
||||
* 菜单树列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:menu, system:menu:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getTreeList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站菜单树列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:menu:recycle")]
|
||||
public function recycle():ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getTreeListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端选择树(不需要权限)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("tree")]
|
||||
public function tree(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getSelectTree($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
* @param SystemMenuRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:menu:save"), OperationLog]
|
||||
public function save(SystemMenuRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新菜单
|
||||
* @param int $id
|
||||
* @param SystemMenuRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:menu:update"), OperationLog]
|
||||
public function update(int $id, SystemMenuRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all())
|
||||
? $this->success() : $this->error(t('mineadmin.data_no_change'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除菜单到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:menu:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除菜单 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:menu:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
$menus = $this->service->realDel((array) $this->request->input('ids', []));
|
||||
return is_null($menus) ?
|
||||
$this->success() :
|
||||
$this->success(t('system.exists_children_ctu', ['names' => implode(',', $menus)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的菜单
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:menu:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改菜单状态
|
||||
* @param SystemMenuRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:menu:update"), OperationLog]
|
||||
public function changeStatus(SystemMenuRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $this->request->input('id'), (string) $this->request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字运算操作
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("numberOperation"), Permission("system:menu:update"), OperationLog]
|
||||
public function numberOperation(): ResponseInterface
|
||||
{
|
||||
return $this->service->numberOperation(
|
||||
(int) $this->request->input('id'),
|
||||
(string) $this->request->input('numberName'),
|
||||
(int) $this->request->input('numberValue', 1),
|
||||
) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
namespace App\System\Controller\Permission;
|
||||
|
||||
use App\System\Request\SystemPostRequest;
|
||||
use App\System\Service\SystemPostService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class PostController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
#[Controller(prefix: "system/post"), Auth]
|
||||
class PostController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemPostService $service;
|
||||
|
||||
/**
|
||||
* 岗位分页列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:post, system:post:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位回收站分页列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:post:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("list")]
|
||||
public function list(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param SystemPostRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:post:save"), OperationLog]
|
||||
public function save(SystemPostRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一条数据信息
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:post:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据
|
||||
* @param int $id
|
||||
* @param SystemPostRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:post:update"), OperationLog]
|
||||
public function update(int $id, SystemPostRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除数据到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:post:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除数据 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:post:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:post:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改岗位状态
|
||||
* @param SystemPostRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:post:changeStatus"), OperationLog]
|
||||
public function changeStatus(SystemPostRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $request->input('id'), (string) $request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字运算操作
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("numberOperation"), Permission("system:post:update"), OperationLog]
|
||||
public function numberOperation(): ResponseInterface
|
||||
{
|
||||
return $this->service->numberOperation(
|
||||
(int) $this->request->input('id'),
|
||||
(string) $this->request->input('numberName'),
|
||||
(int) $this->request->input('numberValue', 1),
|
||||
) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
namespace App\System\Controller\Permission;
|
||||
|
||||
use App\System\Request\SystemRoleRequest;
|
||||
use App\System\Service\SystemRoleService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class RoleController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
#[Controller(prefix: "system/role"), Auth]
|
||||
class RoleController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemRoleService $service;
|
||||
|
||||
/**
|
||||
* 角色分页列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:role, system:role:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站角色分页列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:role:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色获取菜单
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getMenuByRole/{id}")]
|
||||
public function getMenuByRole(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getMenuByRole($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色获取部门
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getDeptByRole/{id}")]
|
||||
public function getDeptByRole(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getDeptByRole($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色列表 (不验证权限)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("list")]
|
||||
public function list(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
* @param SystemRoleRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:role:save"), OperationLog]
|
||||
public function save(SystemRoleRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新角色
|
||||
* @param int $id
|
||||
* @param SystemRoleRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:role:update"), OperationLog]
|
||||
public function update(int $id, SystemRoleRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户菜单权限
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("menuPermission/{id}"), Permission("system:role:menuPermission"), OperationLog]
|
||||
public function menuPermission(int $id): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $this->request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户数据权限
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("dataPermission/{id}"), Permission("system:role:dataPermission"), OperationLog]
|
||||
public function dataPermission(int $id): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $this->request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除数据到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:role:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除数据 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:role:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:role:recovery")]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改角色状态
|
||||
* @param SystemRoleRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:role:changeStatus"), OperationLog]
|
||||
public function changeStatus(SystemRoleRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $request->input('id'), (string) $request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字运算操作
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("numberOperation"), Permission("system:role:update"), OperationLog]
|
||||
public function numberOperation(): ResponseInterface
|
||||
{
|
||||
return $this->service->numberOperation(
|
||||
(int) $this->request->input('id'),
|
||||
(string) $this->request->input('numberName'),
|
||||
(int) $this->request->input('numberValue', 1),
|
||||
) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,246 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Permission;
|
||||
|
||||
use App\System\Request\SystemUserRequest;
|
||||
use App\System\Service\SystemUserService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineCollection;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class UserController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
#[Controller(prefix: "system/user"), Auth]
|
||||
class UserController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemUserService $service;
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("system:user, system:user:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站列表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("recycle"), Permission("system:user:recycle")]
|
||||
public function recycle(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageListByRecycle($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增一个用户
|
||||
* @param SystemUserRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("system:user:save"), OperationLog]
|
||||
public function save(SystemUserRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个用户信息
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("system:user:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新一个用户信息
|
||||
* @param int $id
|
||||
* @param SystemUserRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("system:user:update"), OperationLog]
|
||||
public function update(int $id, SystemUserRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除用户到回收站
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("system:user:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量真实删除用户 (清空回收站)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("realDelete"), Permission("system:user:realDelete"), OperationLog]
|
||||
public function realDelete(): ResponseInterface
|
||||
{
|
||||
return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量恢复在回收站的用户
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("recovery"), Permission("system:user:recovery"), OperationLog]
|
||||
public function recovery(): ResponseInterface
|
||||
{
|
||||
return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改用户状态
|
||||
* @param SystemUserRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("system:user:changeStatus"), OperationLog]
|
||||
public function changeStatus(SystemUserRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $request->input('id'), (string) $request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除用户缓存
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("clearCache"), Permission("system:user:cache")]
|
||||
public function clearCache(): ResponseInterface
|
||||
{
|
||||
$this->service->clearCache((string) $this->request->input('id', null));
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户首页
|
||||
* @param SystemUserRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("setHomePage"), Permission("system:user:homePage")]
|
||||
public function setHomePage(SystemUserRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->setHomePage($request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化用户密码
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("initUserPassword"), Permission("system:user:initUserPassword"), OperationLog]
|
||||
public function initUserPassword(): ResponseInterface
|
||||
{
|
||||
return $this->service->initUserPassword((int) $this->request->input('id')) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改用户资料,含修改头像 (不验证权限)
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("updateInfo")]
|
||||
public function updateInfo(): ResponseInterface
|
||||
{
|
||||
return $this->service->updateInfo($this->request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码 (不验证权限)
|
||||
* @param SystemUserRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("modifyPassword")]
|
||||
public function modifyPassword(SystemUserRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->modifyPassword($request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户导出
|
||||
* @return ResponseInterface
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("export"), Permission("system:user:export"), OperationLog]
|
||||
public function export(): ResponseInterface
|
||||
{
|
||||
return $this->service->export($this->request->all(), \App\System\Dto\UserDto::class, '用户列表');
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户导入
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
|
||||
*/
|
||||
#[PostMapping("import"), Permission("system:user:import")]
|
||||
public function import(): ResponseInterface
|
||||
{
|
||||
return $this->service->import(\App\System\Dto\UserDto::class) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载导入模板
|
||||
* @return ResponseInterface
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("downloadTemplate")]
|
||||
public function downloadTemplate(): ResponseInterface
|
||||
{
|
||||
return (new MineCollection)->export(\App\System\Dto\UserDto::class, '模板下载', []);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
namespace App\System\Controller;
|
||||
|
||||
use App\System\Service\SystemQueueMessageService;
|
||||
use Hyperf\Contract\OnCloseInterface;
|
||||
use Hyperf\Contract\OnMessageInterface;
|
||||
use Hyperf\Contract\OnOpenInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Swoole\Http\Request;
|
||||
use Swoole\Http\Response;
|
||||
use Swoole\WebSocket\Frame;
|
||||
use Swoole\WebSocket\Server;
|
||||
|
||||
/**
|
||||
* Class ServerController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
class ServerController implements OnMessageInterface, OnOpenInterface, OnCloseInterface
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $uid;
|
||||
|
||||
/**
|
||||
* 成功连接到 ws 回调
|
||||
* @param Response|Server $server
|
||||
* @param Request $request
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
public function onOpen($server, $request): void
|
||||
{
|
||||
$this->uid = user()->getUserInfo(
|
||||
container()->get(ServerRequestInterface::class)->getQueryParams()['token']
|
||||
)['id'];
|
||||
|
||||
console()->info(
|
||||
"WebSocket [ user connection to message server: id > {$this->uid}, ".
|
||||
"fd > {$request->fd}, time > ". date('Y-m-d H:i:s') .' ]'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息回调
|
||||
* @param Response|Server $server
|
||||
* @param Frame $frame
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
public function onMessage($server, $frame): void
|
||||
{
|
||||
$data = json_decode($frame->data, true);
|
||||
switch($data['event']) {
|
||||
case 'get_unread_message':
|
||||
$service = container()->get(SystemQueueMessageService::class);
|
||||
$server->push($frame->fd, json_encode([
|
||||
'event' => 'ev_new_message',
|
||||
'message' => 'success',
|
||||
'data' => $service->getUnreadMessage($this->uid)['items']
|
||||
]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭 ws 连接回调
|
||||
* @param Response|\Swoole\Server $server
|
||||
* @param int $fd
|
||||
* @param int $reactorId
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
public function onClose($server, int $fd, int $reactorId): void
|
||||
{
|
||||
console()->info(
|
||||
"WebSocket [ user close connect for message server: id > {$this->uid}, ".
|
||||
"fd > {$fd}, time > ". date('Y-m-d H:i:s') .' ]'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Settings;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
|
||||
use App\System\Request\SettingConfigRequest;
|
||||
use App\System\Service\SettingConfigService;
|
||||
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
|
||||
/**
|
||||
* 系统配置控制器
|
||||
* Class SystemConfigController
|
||||
* @package App\System\Controller\Settings
|
||||
*/
|
||||
#[Controller(prefix: "system/setting/config"), Auth]
|
||||
class SystemConfigController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SettingConfigService $service;
|
||||
|
||||
/**
|
||||
* 获取配置列表
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("setting:config, setting:config:index")]
|
||||
public function index(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配置
|
||||
* @param SettingConfigRequest $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("setting:config:save"), OperationLog]
|
||||
public function save(SettingConfigRequest $request): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->service->save($request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新配置
|
||||
* @param SettingConfigRequest $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("update"), Permission("setting:config:update"), OperationLog]
|
||||
public function update(SettingConfigRequest $request): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->service->updated($this->request->input('key'), $request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 按 keys 更新配置
|
||||
* @param SettingConfigRequest $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("updateByKeys"), Permission("setting:config:update"), OperationLog]
|
||||
public function updateByKeys(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->service->updatedByKeys($this->request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配置
|
||||
* @param string $key
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("setting:config:delete"), OperationLog]
|
||||
public function delete(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除配置缓存
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("clearCache"), Permission("setting:config:clearCache"), OperationLog]
|
||||
public function clearCache(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->service->clearCache() ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Settings;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
|
||||
use App\System\Request\SettingConfigGroupRequest;
|
||||
use App\System\Service\SettingConfigGroupService;
|
||||
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
|
||||
/**
|
||||
* 系统配置组控制器
|
||||
* Class SystemConfigGroupController
|
||||
* @package App\System\Controller\Settings
|
||||
*/
|
||||
#[Controller(prefix: "system/setting/configGroup"), Auth]
|
||||
class SystemConfigGroupController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SettingConfigGroupService $service;
|
||||
|
||||
|
||||
/**
|
||||
* 获取系统组配置
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("setting:config, setting:config:index")]
|
||||
public function index(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配置组
|
||||
* @param SettingConfigGroupRequest $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("setting:config:save"), OperationLog("保存配置组")]
|
||||
public function save(SettingConfigGroupRequest $request): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->service->save($request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新配置组
|
||||
* @param SettingConfigGroupRequest $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("update"), Permission("setting:config:update"), OperationLog("更新配置组")]
|
||||
public function update(SettingConfigGroupRequest $request): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->service->update((int) $this->request->input('id'), $request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配置组
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("setting:config:delete"), OperationLog("删除配置组")]
|
||||
public function delete(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->service->deleteConfigGroup((int) $this->request->input('id')) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller\Tools;
|
||||
|
||||
use App\System\Request\SettingCrontabRequest;
|
||||
use App\System\Service\SettingCrontabLogService;
|
||||
use App\System\Service\SettingCrontabService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* 定时任务控制器
|
||||
* Class CrontabController
|
||||
* @package App\System\Controller\Tools
|
||||
*/
|
||||
#[Controller(prefix: "system/setting/crontab"), Auth]
|
||||
class CrontabController extends MineController
|
||||
{
|
||||
/**
|
||||
* 计划任务服务
|
||||
*/
|
||||
#[Inject]
|
||||
protected SettingCrontabService $service;
|
||||
|
||||
/**
|
||||
* 计划任务日志服务
|
||||
*/
|
||||
#[Inject]
|
||||
protected SettingCrontabLogService $logService;
|
||||
|
||||
/**
|
||||
* 获取列表分页数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("setting:crontab, setting:crontab:index")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取日志列表分页数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("logPageList")]
|
||||
public function logPageList(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->logService->getPageList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param SettingCrontabRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("save"), Permission("setting:crontab:save"), OperationLog]
|
||||
public function save(SettingCrontabRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->success(['id' => $this->service->save($request->all())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 立即执行定时任务
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("run"), Permission("setting:crontab:run"), OperationLog]
|
||||
public function run(): ResponseInterface
|
||||
{
|
||||
$id = $this->request->input('id', null);
|
||||
if (is_null($id)) {
|
||||
return $this->error();
|
||||
} else {
|
||||
return $this->service->run($id) ? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一条数据信息
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("read/{id}"), Permission("setting:crontab:read")]
|
||||
public function read(int $id): ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据
|
||||
* @param int $id
|
||||
* @param SettingCrontabRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("update/{id}"), Permission("setting:crontab:update"), OperationLog]
|
||||
public function update(int $id, SettingCrontabRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->service->update($id, $request->all()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个或批量删除
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("setting:crontab:delete")]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时任务日志
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("deleteCrontabLog"), Permission("setting:crontab:deleteCrontabLog"), OperationLog("删除定时任务日志")]
|
||||
public function deleteCrontabLog(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->logService->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改状态
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("changeStatus"), Permission("setting:crontab:update"), OperationLog]
|
||||
public function changeStatus(): ResponseInterface
|
||||
{
|
||||
return $this->service->changeStatus((int) $this->request->input('id'), (string) $this->request->input('status'))
|
||||
? $this->success() : $this->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
namespace App\System\Controller\Tools;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
use App\System\Request\GenerateRequest;
|
||||
use App\System\Service\SettingGenerateColumnsService;
|
||||
use App\System\Service\SettingGenerateTablesService;
|
||||
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\Annotation\OperationLog;
|
||||
use Builder\Annotation\Permission;
|
||||
use Builder\MineController;
|
||||
|
||||
|
||||
/**
|
||||
* 代码生成器控制器
|
||||
* Class CodeController
|
||||
* @package App\System\Controller\Tools
|
||||
*/
|
||||
#[Controller(prefix: "system/setting/code"), Auth]
|
||||
class GenerateCodeController extends MineController
|
||||
{
|
||||
/**
|
||||
* 信息表服务
|
||||
*/
|
||||
#[Inject]
|
||||
protected SettingGenerateTablesService $tableService;
|
||||
|
||||
/**
|
||||
* 信息字段表服务
|
||||
*/
|
||||
#[Inject]
|
||||
protected SettingGenerateColumnsService $columnService;
|
||||
|
||||
/**
|
||||
* 代码生成列表分页
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("index"), Permission("setting:code")]
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->tableService->getPageList($this->request->All()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务表字段信息
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getTableColumns")]
|
||||
public function getTableColumns(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->columnService->getList($this->request->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览代码
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Exception
|
||||
*/
|
||||
#[GetMapping("preview"), Permission("setting:code:preview")]
|
||||
public function preview(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->tableService->preview((int) $this->request->input('id', 0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取表数据
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("readTable")]
|
||||
public function readTable(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->tableService->read((int) $this->request->input('id')));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新业务表信息
|
||||
* @param GenerateRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("update"), Permission("setting:code:update")]
|
||||
public function update(GenerateRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->tableService->updateTableAndColumns($request->validated()) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成代码
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("generate"), Permission("setting:code:generate"), OperationLog]
|
||||
public function generate(): ResponseInterface
|
||||
{
|
||||
return $this->_download(
|
||||
$this->tableService->generate((array) $this->request->input('ids', [])),
|
||||
'mineadmin.zip'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据表
|
||||
* @param GenerateRequest $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("loadTable"), Permission("setting:code:loadTable"), OperationLog]
|
||||
public function loadTable(GenerateRequest $request): ResponseInterface
|
||||
{
|
||||
return $this->tableService->loadTable($request->input('names')) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除代码生成表
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[DeleteMapping("delete"), Permission("setting:code:delete"), OperationLog]
|
||||
public function delete(): ResponseInterface
|
||||
{
|
||||
return $this->tableService->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步数据库中的表信息跟字段
|
||||
* @param int $id
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PutMapping("sync/{id}"), Permission("setting:code:sync"), OperationLog]
|
||||
public function sync(int $id): ResponseInterface
|
||||
{
|
||||
return $this->tableService->sync($id) ? $this->success() : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有启用状态模块下的所有模型
|
||||
* @return ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getModels")]
|
||||
public function getModels(): ResponseInterface
|
||||
{
|
||||
return $this->success($this->tableService->getModels());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Controller;
|
||||
|
||||
use App\System\Request\UploadRequest;
|
||||
use App\System\Service\SystemUploadFileService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||
use Builder\Annotation\Auth;
|
||||
use Builder\MineController;
|
||||
|
||||
/**
|
||||
* Class UploadController
|
||||
* @package App\System\Controller
|
||||
*/
|
||||
#[Controller(prefix: "system")]
|
||||
class UploadController extends MineController
|
||||
{
|
||||
#[Inject]
|
||||
protected SystemUploadFileService $service;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param UploadRequest $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \League\Flysystem\FileExistsException
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("uploadFile"), Auth]
|
||||
public function uploadFile(UploadRequest $request): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
if ($request->validated() && $request->file('file')->isValid()) {
|
||||
$data = $this->service->upload(
|
||||
$request->file('file'), $request->all()
|
||||
);
|
||||
return empty($data) ? $this->error() : $this->success($data);
|
||||
} else {
|
||||
return $this->error(t('system.upload_file_verification_fail'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图片
|
||||
* @param UploadRequest $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \League\Flysystem\FileExistsException
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("uploadImage"), Auth]
|
||||
public function uploadImage(UploadRequest $request): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
if ($request->validated() && $request->file('image')->isValid()) {
|
||||
$data = $this->service->upload(
|
||||
$request->file('image'), $request->all()
|
||||
);
|
||||
return empty($data) ? $this->error() : $this->success($data);
|
||||
} else {
|
||||
return $this->error(t('system.upload_image_verification_fail'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分块上传
|
||||
* @param UploadRequest $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[PostMapping("chunkUpload"), Auth]
|
||||
public function chunkUpload(UploadRequest $request): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return ($data = $this->service->chunkUpload($request->validated())) ? $this->success($data) : $this->error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存网络图片
|
||||
* @param UploadRequest $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Exception
|
||||
*/
|
||||
#[PostMapping("saveNetworkImage"), Auth]
|
||||
public function saveNetworkImage(UploadRequest $request): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->saveNetworkImage($request->validated()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前目录所有文件和目录
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getAllFiles"), Auth]
|
||||
public function getAllFile(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success(
|
||||
$this->service->getAllFile($this->request->all())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID获取文件信息
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getFileInfoById")]
|
||||
public function getFileInfoByid(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->read((int) $this->request->input('id', null)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过HASH获取文件信息
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("getFileInfoByHash")]
|
||||
public function getFileInfoByHash(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
return $this->success($this->service->readByHash($this->request->input('hash', null)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id下载文件
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("downloadById")]
|
||||
public function downloadById(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
$id = $this->request->input('id');
|
||||
if (empty($id)) {
|
||||
return $this->error("附件ID必填");
|
||||
}
|
||||
$model = $this->service->read((int) $id);
|
||||
if (! $model) {
|
||||
throw new \Builder\Exception\MineException('附件不存在', 500);
|
||||
}
|
||||
return $this->_download(BASE_PATH . '/public' . $model->url, $model->origin_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据hash下载文件
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
#[GetMapping("downloadByHash")]
|
||||
public function downloadByHash(): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
$hash = $this->request->input('hash');
|
||||
if (empty($hash)) {
|
||||
return $this->error("附件hash必填");
|
||||
}
|
||||
$model = $this->service->readByHash($hash);
|
||||
if (! $model) {
|
||||
throw new \Builder\Exception\MineException('附件不存在', 500);
|
||||
}
|
||||
return $this->_download(BASE_PATH . '/public' . $model->url, $model->origin_name);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\System\Crontab;
|
||||
|
||||
use App\System\Model\SystemApiLog;
|
||||
use App\System\Model\SystemLoginLog;
|
||||
use App\System\Model\SystemOperLog;
|
||||
use App\System\Model\SystemQueueLog;
|
||||
use Builder\Annotation\Transaction;
|
||||
|
||||
class ClearLogCrontab
|
||||
{
|
||||
/**
|
||||
* 清理所有日志
|
||||
* @return string
|
||||
*/
|
||||
#[Transaction]
|
||||
public function execute(): string
|
||||
{
|
||||
SystemOperLog::truncate();
|
||||
SystemLoginLog::truncate();
|
||||
SystemQueueLog::truncate();
|
||||
SystemApiLog::truncate();
|
||||
|
||||
return 'Clear logs successfully';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemUserTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_user', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('用户信息表');
|
||||
$table->bigIncrements('id')->comment('用户ID,主键');
|
||||
$table->addColumn('string', 'username', ['length' => 20, 'comment' => '用户名']);
|
||||
$table->addColumn('string', 'password', ['length' => 100, 'comment' => '密码']);
|
||||
$table->addColumn('string', 'user_type', ['length' => 3, 'comment' => '用户类型:(100系统用户)', 'default' => '100'])->nullable();
|
||||
$table->addColumn('string', 'nickname', ['length' => 30, 'comment' => '用户昵称'])->nullable();
|
||||
$table->addColumn('string', 'phone', ['length' => 11, 'comment' => '手机'])->nullable();
|
||||
$table->addColumn('string', 'email', ['length' => 50, 'comment' => '用户邮箱'])->nullable();
|
||||
$table->addColumn('string', 'avatar', ['length' => 255, 'comment' => '用户头像'])->nullable();
|
||||
$table->addColumn('string', 'signed', ['length' => 255, 'comment' => '个人签名'])->nullable();
|
||||
$table->addColumn('string', 'dashboard', ['length' => 100, 'comment' => '后台首页类型'])->nullable();
|
||||
$table->addColumn('bigInteger', 'dept_id', ['unsigned' => true, 'comment' => '部门ID'])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('ipAddress', 'login_ip', ['comment' => '最后登陆IP'])->nullable();
|
||||
$table->addColumn('timestamp', 'login_time', ['comment' => '最后登陆时间'])->nullable();
|
||||
$table->addColumn('string', 'backend_setting', ['length' => 500, 'comment' => '后台设置数据'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->unique('username');
|
||||
$table->index('dept_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_user');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemMenuTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_menu', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('菜单信息表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'parent_id', ['unsigned' => true, 'comment' => '父ID']);
|
||||
$table->addColumn('string', 'level', ['length' => 500, 'comment' => '组级集合']);
|
||||
$table->addColumn('string', 'name', ['length' => 50, 'comment' => '菜单名称']);
|
||||
$table->addColumn('string', 'code', ['length' => 100, 'comment' => '菜单标识代码']);
|
||||
$table->addColumn('string', 'icon', ['length' => 50, 'comment' => '菜单图标'])->nullable();
|
||||
$table->addColumn('string', 'route', ['length' => 200, 'comment' => '路由地址'])->nullable();
|
||||
$table->addColumn('string', 'component', ['length' => 255, 'comment' => '组件路径'])->nullable();
|
||||
$table->addColumn('string', 'redirect', ['length' => 255, 'comment' => '跳转地址'])->nullable();
|
||||
$table->addColumn('smallInteger', 'is_hidden', ['default' => 1, 'comment' => '是否隐藏 (1是 2否)']);
|
||||
$table->addColumn('char', 'type', ['length' => 1, 'default' => '', 'comment' => '菜单类型, (M菜单 B按钮 L链接 I iframe)']);
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('smallInteger', 'sort', ['unsigned' => true, 'default' => 0, 'comment' => '排序'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_menu');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemRoleTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_role', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('角色信息表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'name', ['length' => 30, 'comment' => '角色名称']);
|
||||
$table->addColumn('string', 'code', ['length' => 100, 'comment' => '角色代码']);
|
||||
$table->addColumn(
|
||||
'smallInteger', 'data_scope',
|
||||
[
|
||||
'length' => 1,
|
||||
'default' => 1,
|
||||
'comment' => '数据范围(1:全部数据权限 2:自定义数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:本人数据权限)'
|
||||
])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('smallInteger', 'sort', ['unsigned' => true, 'default' => 0, 'comment' => '排序'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_role');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemUserRoleTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_user_role', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('用户与角色关联表');
|
||||
$table->addColumn('bigInteger', 'user_id', ['unsigned' => true, 'comment' => '用户主键']);
|
||||
$table->addColumn('bigInteger', 'role_id', ['unsigned' => true, 'comment' => '角色主键']);
|
||||
$table->primary(['user_id', 'role_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_user_role');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemRoleMenuTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_role_menu', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('角色与菜单关联表');
|
||||
$table->addColumn('bigInteger', 'role_id', ['unsigned' => true, 'comment' => '角色主键']);
|
||||
$table->addColumn('bigInteger', 'menu_id', ['unsigned' => true, 'comment' => '菜单主键']);
|
||||
$table->primary(['role_id', 'menu_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_role_menu');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingConfigTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('setting_config', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('参数配置信息表');
|
||||
$table->addColumn('bigInteger', 'group_id', ['comment' => '组id']);
|
||||
$table->addColumn('string', 'key', ['length'=> 32, 'comment' => '配置键名'])->nullable();
|
||||
$table->addColumn('string', 'value', ['length'=> 255, 'comment' => '配置值'])->nullable();
|
||||
$table->addColumn('string', 'name', ['length'=> 255, 'comment' => '配置名称'])->nullable();
|
||||
$table->addColumn('string', 'input_type', ['length'=> 32, 'comment' => '数据输入类型'])->nullable();
|
||||
$table->addColumn('string', 'config_select_data', ['length'=> 500, 'comment' => '配置选项数据'])->nullable();
|
||||
$table->addColumn('smallInteger', 'sort', ['unsigned' => true, 'default' => 0, 'comment' => '排序'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->primary('key');
|
||||
$table->index('group_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_config');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemDictDataTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_dict_data', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('字典数据表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'type_id', ['unsigned' => true, 'comment' => '字典类型ID']);
|
||||
$table->addColumn('string', 'label', ['length' => 50, 'comment' => '字典标签'])->nullable();
|
||||
$table->addColumn('string', 'value', ['length' => 100, 'comment' => '字典值'])->nullable();
|
||||
$table->addColumn('string', 'code', ['length' => 100, 'comment' => '字典标示'])->nullable();
|
||||
$table->addColumn('smallInteger', 'sort', ['unsigned' => true, 'default' => 0, 'comment' => '排序'])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index('type_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_dict_data');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemDictTypeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_dict_type', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('字典类型表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'name', ['length' => 50, 'comment' => '字典名称'])->nullable();
|
||||
$table->addColumn('string', 'code', ['length' => 100, 'comment' => '字典标示'])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_dict_type');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemDeptTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_dept', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('部门信息表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'parent_id', ['unsigned' => true, 'comment' => '父ID']);
|
||||
$table->addColumn('string', 'level', ['length' => 500, 'comment' => '组级集合']);
|
||||
$table->addColumn('string', 'name', ['length' => 30, 'comment' => '部门名称']);
|
||||
$table->addColumn('string', 'leader', ['length' => 20, 'comment' => '负责人'])->nullable();
|
||||
$table->addColumn('string', 'phone', ['length' => 11, 'comment' => '联系电话'])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('smallInteger', 'sort', ['unsigned' => true, 'default' => 0, 'comment' => '排序'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index('parent_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_dept');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemPostTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_post', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('岗位信息表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'name', ['length' => 50, 'comment' => '岗位名称']);
|
||||
$table->addColumn('string', 'code', ['length' => 100, 'comment' => '岗位代码']);
|
||||
$table->addColumn('smallInteger', 'sort', ['unsigned' => true, 'default' => 0, 'comment' => '排序'])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_job');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemLoginLogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_login_log', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('登录日志表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'username', ['length' => 20, 'comment' => '用户名']);
|
||||
$table->addColumn('ipAddress', 'ip', ['comment' => '登录IP地址'])->nullable();
|
||||
$table->addColumn('string', 'ip_location', ['length' => 255, 'comment' => 'IP所属地'])->nullable();
|
||||
$table->addColumn('string', 'os', ['length' => 50, 'comment' => '操作系统'])->nullable();
|
||||
$table->addColumn('string', 'browser', ['length' => 50, 'comment' => '浏览器'])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '登录状态 (1成功 2失败)']);
|
||||
$table->addColumn('string', 'message', ['length' => 50, 'comment' => '提示消息'])->nullable();
|
||||
$table->addColumn('timestamp', 'login_time', ['comment' => '登录时间']);
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index('username');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_login_log');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemOperLogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_oper_log', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('操作日志表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'username', ['length' => 20, 'comment' => '用户名']);
|
||||
$table->addColumn('string', 'method', ['length' => 20, 'comment' => '请求方式']);
|
||||
$table->addColumn('string', 'router', ['length' => 500, 'comment' => '请求路由']);
|
||||
$table->addColumn('string', 'service_name', ['length' => 30, 'comment' => '业务名称']);
|
||||
$table->addColumn('ipAddress', 'ip', ['comment' => '请求IP地址'])->nullable();
|
||||
$table->addColumn('string', 'ip_location', ['length' => 255, 'comment' => 'IP所属地'])->nullable();
|
||||
$table->addColumn('text', 'request_data', ['comment' => '请求数据'])->nullable();
|
||||
$table->addColumn('string', 'response_code', ['length' => 5, 'comment' => '响应状态码'])->nullable();
|
||||
$table->addColumn('text', 'response_data', ['comment' => '响应数据'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index('username');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_oper_log');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingCrontabTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('setting_crontab', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('定时任务信息表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'name', ['length' => 100, 'comment' => '任务名称'])->nullable();
|
||||
$table->addColumn(
|
||||
'smallInteger', 'type',
|
||||
['default' => 4, 'comment' => '任务类型 (1 command, 2 class, 3 url, 4 eval)']
|
||||
)->nullable();
|
||||
$table->addColumn('string', 'target', ['length' => 500, 'comment' => '调用任务字符串'])->nullable();
|
||||
$table->addColumn('string', 'parameter', ['length' => 1000, 'comment' => '调用任务参数'])->nullable();
|
||||
$table->addColumn('string', 'rule', ['length' => 32, 'comment' => '任务执行表达式'])->nullable();
|
||||
$table->addColumn(
|
||||
'smallInteger', 'singleton',
|
||||
['default' => 1, 'comment' => '是否单次执行 (1 是 2 不是)']
|
||||
)->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_task');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingCrontabLogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('setting_crontab_log', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('定时任务执行日志表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'crontab_id', ['unsigned' => true, 'comment' => '任务ID']);
|
||||
$table->addColumn('string', 'name', ['length'=> 255, 'comment' => '任务名称'])->nullable();
|
||||
$table->addColumn('string', 'target', ['length'=> 500, 'comment' => '任务调用目标字符串'])->nullable();
|
||||
$table->addColumn('string', 'parameter', ['length'=> 1000, 'comment' => '任务调用参数'])->nullable();
|
||||
$table->addColumn('string', 'exception_info', ['length'=> 2000, 'comment' => '异常信息'])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '执行状态 (1成功 2失败)'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('setting_crontab_log');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingGenerateColumnsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('setting_generate_columns', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('代码生成业务字段信息表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'table_id', ['unsigned' => true, 'comment' => '所属表ID']);
|
||||
$table->addColumn('string', 'column_name', ['length' => 200, 'comment' => '字段名称'])->nullable();
|
||||
$table->addColumn('string', 'column_comment', ['length' => 255, 'comment' => '字段注释'])->nullable();
|
||||
$table->addColumn('string', 'column_type', ['length' => 50, 'comment' => '字段类型'])->nullable();
|
||||
$table->addColumn('smallInteger', 'is_pk', ['default' => 1, 'comment' => '1 非主键 2 主键'])->nullable();
|
||||
$table->addColumn('smallInteger', 'is_required', ['default' => 1, 'comment' => '1 非必填 2 必填'])->nullable();
|
||||
$table->addColumn('smallInteger', 'is_insert', ['default' => 1, 'comment' => '1 非插入字段 2 插入字段'])->nullable();
|
||||
$table->addColumn('smallInteger', 'is_edit', ['default' => 1, 'comment' => '1 非编辑字段 2 编辑字段'])->nullable();
|
||||
$table->addColumn('smallInteger', 'is_list', ['default' => 1, 'comment' => '1 非列表显示字段 2 列表显示字段'])->nullable();
|
||||
$table->addColumn('smallInteger', 'is_query', ['default' => 1, 'comment' => '1 非查询字段 2 查询字段'])->nullable();
|
||||
$table->addColumn(
|
||||
'string', 'query_type',
|
||||
[
|
||||
'length' => 100,
|
||||
'default' => 'eq',
|
||||
'comment' => '查询方式 eq 等于, neq 不等于, gt 大于, lt 小于, like 范围'
|
||||
]
|
||||
)->nullable();
|
||||
$table->addColumn(
|
||||
'string', 'view_type',
|
||||
[
|
||||
'length' => 100,
|
||||
'default' => 'text',
|
||||
'comment' => '页面控件,text, textarea, password, select, checkbox, radio, date, upload, ma-upload(封装的上传控件)'
|
||||
]
|
||||
)->nullable();
|
||||
$table->addColumn('string', 'dict_type', ['length' => 200, 'comment' => '字典类型'])->nullable();
|
||||
$table->addColumn('string', 'allow_roles', ['length' => 255, 'comment' => '允许查看该字段的角色'])->nullable();
|
||||
$table->addColumn('string', 'options', ['length' => 1000, 'comment' => '字段其他设置'])->nullable();
|
||||
$table->addColumn('tinyInteger', 'sort', ['unsigned' => true, 'default' => 0, 'comment' => '排序'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('setting_generate_columns');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingGenerateTablesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('setting_generate_tables', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('代码生成业务信息表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'table_name', ['length' => 200, 'comment' => '表名称'])->nullable();
|
||||
$table->addColumn('string', 'table_comment', ['length' => 500, 'comment' => '表注释'])->nullable();
|
||||
$table->addColumn('string', 'module_name', ['length' => 100, 'comment' => '所属模块'])->nullable();
|
||||
$table->addColumn('string', 'namespace', ['length' => 255, 'comment' => '命名空间'])->nullable();
|
||||
$table->addColumn('string', 'menu_name', ['length' => 100, 'comment' => '生成菜单名'])->nullable();
|
||||
$table->addColumn('bigInteger', 'belong_menu_id', ['length' => 100, 'comment' => '所属菜单'])->nullable();
|
||||
$table->addColumn('string', 'package_name', ['length' => 100, 'comment' => '控制器包名'])->nullable();
|
||||
$table->addColumn(
|
||||
'string', 'type',
|
||||
['length' => 100, 'comment' => '生成类型,single 单表CRUD,tree 树表CRUD,parent_sub父子表CRUD'])
|
||||
->nullable();
|
||||
$table->addColumn('smallInteger', 'generate_type', ['default' => 1, 'comment' => '1 压缩包下载 2 生成到模块'])->nullable();
|
||||
$table->addColumn('string', 'generate_menus', ['length' => 255, 'comment' => '生成菜单列表'])->nullable();
|
||||
$table->addColumn('smallInteger', 'build_menu', ['default' => 1, 'comment' => '是否构建菜单'])->nullable();
|
||||
$table->addColumn('smallInteger', 'component_type', ['default' => 1, 'comment' => '组件显示方式'])->nullable();
|
||||
$table->addColumn('string', 'options', ['length' => 1500, 'comment' => '其他业务选项'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('setting_generate_tables');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemUserPostTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_user_post', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('用户与岗位关联表');
|
||||
$table->addColumn('bigInteger', 'user_id', ['unsigned' => true, 'comment' => '用户主键']);
|
||||
$table->addColumn('bigInteger', 'post_id', ['unsigned' => true, 'comment' => '岗位主键']);
|
||||
$table->primary(['user_id', 'post_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_user_job');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemRoleDeptTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_role_dept', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('角色与部门关联表');
|
||||
$table->addColumn('bigInteger', 'role_id', ['unsigned' => true, 'comment' => '角色主键']);
|
||||
$table->addColumn('bigInteger', 'dept_id', ['unsigned' => true, 'comment' => '部门主键']);
|
||||
$table->primary(['role_id', 'dept_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_role_dept');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemUploadfileTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_uploadfile', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('上传文件信息表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('smallInteger', 'storage_mode', ['default' => 1, 'comment' => '存储模式 (1 本地 2 阿里云 3 七牛云 4 腾讯云)'])->nullable();
|
||||
$table->addColumn('string', 'origin_name', ['length' => 255, 'comment' => '原文件名'])->nullable();
|
||||
$table->addColumn('string', 'object_name', ['length' => 50, 'comment' => '新文件名'])->nullable();
|
||||
$table->addColumn('string', 'hash', ['length' => 64, 'comment' => '文件hash'])->nullable();
|
||||
$table->addColumn('string', 'mime_type', ['length' => 255, 'comment' => '资源类型'])->nullable();
|
||||
$table->addColumn('string', 'storage_path', ['length' => 100, 'comment' => '存储目录'])->nullable();
|
||||
$table->addColumn('string', 'suffix', ['length' => 10, 'comment' => '文件后缀'])->nullable();
|
||||
$table->addColumn('bigInteger', 'size_byte', ['length' => 20, 'comment' => '字节数'])->nullable();
|
||||
$table->addColumn('string', 'size_info', ['length' => 50, 'comment' => '文件大小'])->nullable();
|
||||
$table->addColumn('string', 'url', ['length' => 255, 'comment' => 'url地址'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index('storage_path');
|
||||
$table->unique('hash');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_uploadfile');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemAppTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_app', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('应用表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'group_id', ['unsigned' => true, 'comment' => '应用组ID']);
|
||||
$table->addColumn('string', 'app_name', ['length' => 32, 'comment' => '应用名称']);
|
||||
$table->addColumn('string', 'app_id', ['length' => 16, 'comment' => '应用ID']);
|
||||
$table->addColumn('string', 'app_secret', ['length' => 128, 'comment' => '应用密钥']);
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('text', 'description', ['comment' => '应用介绍'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index(['group_id', 'app_id', 'app_secret']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_app');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemAppGroupTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_app_group', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('应用分组表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'name', ['length' => 32, 'comment' => '应用组名称']);
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_app_group');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemApiTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_api', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('接口表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'group_id', ['unsigned' => true, 'comment' => '接口组ID']);
|
||||
$table->addColumn('string', 'name', ['length' => 32, 'comment' => '接口名称']);
|
||||
$table->addColumn('string', 'access_name', ['length' => 64, 'comment' => '接口访问名称']);
|
||||
$table->addColumn('string', 'class_name', ['length' => 128, 'comment' => '类命名空间']);
|
||||
$table->addColumn('string', 'method_name', ['length' => 128, 'comment' => '方法名']);
|
||||
$table->addColumn('smallInteger', 'auth_mode', ['default' => 1, 'comment' => '认证模式 (1简易 2复杂)']);
|
||||
$table->addColumn('char', 'request_mode', ['length' => 1, 'default' => 'A', 'comment' => '请求模式 (A 所有 P POST G GET)']);
|
||||
$table->addColumn('text', 'description', ['comment' => '接口说明介绍'])->nullable();
|
||||
$table->addColumn('text', 'response', ['comment' => '返回内容示例'])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index('group_id');
|
||||
$table->index('access_name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_api');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemApiGroupTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_api_group', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('接口分组表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'name', ['length' => 32, 'comment' => '接口组名称']);
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_api_group');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemApiColumnTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_api_column', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('接口字段表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'api_id', ['unsigned' => true, 'comment' => '接口主键']);
|
||||
$table->addColumn('string', 'name', ['length' => 64, 'comment' => '字段名称']);
|
||||
$table->addColumn('smallInteger', 'type', ['default' => 1, 'comment' => '字段类型 1 请求 2 返回']);
|
||||
$table->addColumn('string', 'data_type', ['length' => 16, 'comment' => '数据类型']);
|
||||
$table->addColumn('smallInteger', 'is_required', ['default' => 1, 'comment' => '是否必填 1 非必填 2 必填']);
|
||||
$table->addColumn('string', 'default_value', ['length' => 500, 'comment' => '默认值'])->nullable();
|
||||
$table->addColumn('smallInteger', 'status', ['default' => 1, 'comment' => '状态 (1正常 2停用)'])->nullable();
|
||||
$table->addColumn('string', 'description', ['length' => 500, 'comment' => '字段说明'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index(['api_id', 'type', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_api_column');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemAppApiTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_app_api', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('应用和api关联表');
|
||||
$table->addColumn('bigInteger', 'app_id', ['unsigned' => true, 'comment' => '应用ID']);
|
||||
$table->addColumn('bigInteger', 'api_id', ['unsigned' => true, 'comment' => 'API—ID']);
|
||||
$table->primary(['app_id', 'api_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_app_api');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemApiLogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_api_log', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('接口日志表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'api_id', ['unsigned' => true, 'comment' => 'api ID']);
|
||||
$table->addColumn('string', 'api_name', ['length' => 32, 'comment' => '接口名称']);
|
||||
$table->addColumn('string', 'access_name', ['length' => 64, 'comment' => '接口访问名称']);
|
||||
$table->addColumn('text', 'request_data', ['comment' => '请求数据'])->nullable();
|
||||
$table->addColumn('string', 'response_code', ['length' => 5, 'comment' => '响应状态码'])->nullable();
|
||||
$table->addColumn('text', 'response_data', ['comment' => '响应数据'])->nullable();
|
||||
$table->addColumn('ipAddress', 'ip', ['comment' => '访问IP地址'])->nullable();
|
||||
$table->addColumn('string', 'ip_location', ['length' => 255, 'comment' => 'IP所属地'])->nullable();
|
||||
$table->addColumn('timestamp', 'access_time', ['precision' => 0, 'comment' => '访问时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index(['api_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_api_log');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemNoticeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_notice', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('系统公告表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'message_id')->comment('消息ID');
|
||||
$table->addColumn('string', 'title', ['length' => 255, 'comment' => '标题']);
|
||||
$table->addColumn('smallInteger', 'type', ['comment' => '公告类型(1通知 2公告)']);
|
||||
$table->addColumn('text', 'content', ['length' => 1, 'comment' => '公告内容'])->nullable();
|
||||
$table->addColumn('integer', 'click_num', ['comment' => '浏览次数', 'default' => 0])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'deleted_at', ['precision' => 0, 'comment' => '删除时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index('message_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_notice');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemQueueMessageTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_queue_message', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('队列消息表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('bigInteger', 'content_id', ['unsigned' => true, 'comment' => '内容ID'])->nullable();
|
||||
$table->addColumn('string', 'content_type', ['length' => 64, 'comment' => '内容类型'])->nullable();
|
||||
$table->addColumn('string', 'title', ['length' => 255, 'comment' => '消息标题'])->nullable();
|
||||
$table->addColumn('bigInteger', 'send_by', ['unsigned' => true, 'comment' => '发送人'])->nullable();
|
||||
$table->addColumn('longtext', 'content', ['comment' => '消息内容'])->nullable();
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
$table->index(['content_type']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_queue_message');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemQueueLogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_queue_log', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('队列日志表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'exchange_name', ['length' => 32, 'comment' => '交换机名称']);
|
||||
$table->addColumn('string', 'routing_key_name', ['length' => 32, 'comment' => '路由名称']);
|
||||
$table->addColumn('string', 'queue_name', ['length' => 64, 'comment' => '队列名称']);
|
||||
$table->addColumn('longtext', 'queue_content', ['comment' => '队列数据'])->nullable();
|
||||
$table->addColumn('text', 'log_content', ['comment' => '队列日志'])->nullable();
|
||||
$table->addColumn('smallInteger', 'produce_status', ['default' => 1, 'comment' => '生产状态 1:未生产 2:生产中 3:生产成功 4:生产失败 5:生产重复'])->nullable();
|
||||
$table->addColumn('smallInteger', 'consume_status', ['default' => 1, 'comment' => '消费状态 1:未消费 2:消费中 3:消费成功 4:消费失败 5:消费重复'])->nullable();
|
||||
$table->addColumn('integer', 'delay_time', ['unsigned' => true, 'comment' => '延迟时间(秒)']);
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_queue_log');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSystemQueueMessageReceiveTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_queue_message_receive', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('队列消息接收人表');
|
||||
$table->addColumn('bigInteger', 'message_id', ['unsigned' => true, 'comment' => '队列消息主键']);
|
||||
$table->addColumn('bigInteger', 'user_id', ['unsigned' => true, 'comment' => '接收用户主键']);
|
||||
$table->addColumn('smallInteger', 'read_status', ['default' => 1, 'comment' => '已读状态 (1未读 2已读)'])->nullable();
|
||||
$table->primary(['message_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_queue_message_receive');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingConfigGroupTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('setting_config_group', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('参数配置分组表');
|
||||
$table->bigIncrements('id')->comment('主键');
|
||||
$table->addColumn('string', 'name', ['length' => 32, 'comment' => '配置组名称']);
|
||||
$table->addColumn('string', 'code', ['length' => 64, 'comment' => '配置组标识']);
|
||||
$table->addColumn('bigInteger', 'created_by', ['comment' => '创建者'])->nullable();
|
||||
$table->addColumn('bigInteger', 'updated_by', ['comment' => '更新者'])->nullable();
|
||||
$table->addColumn('timestamp', 'created_at', ['precision' => 0, 'comment' => '创建时间'])->nullable();
|
||||
$table->addColumn('timestamp', 'updated_at', ['precision' => 0, 'comment' => '更新时间'])->nullable();
|
||||
$table->addColumn('string', 'remark', ['length' => 255, 'comment' => '备注'])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_config_group');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class UpdateVersion101 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('setting_generate_columns', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('setting_generate_columns','is_sort')) {
|
||||
$table->addColumn('smallInteger','is_sort')
|
||||
->comment('1 不排序 2 排序字段')
|
||||
->default(1)
|
||||
->after('is_query')
|
||||
->nullable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('setting_generate_columns', function (Blueprint $table) {
|
||||
$table->dropColumn(['is_sort']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class UpdateVersion102 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// 删除用户表 dept_id 字段
|
||||
Schema::table('system_user', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('system_user','dept_id')) {
|
||||
$table->dropColumn(['dept_id']);
|
||||
}
|
||||
});
|
||||
|
||||
// 新增用户部门中间表
|
||||
Schema::create('system_user_dept', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('用户与部门关联表');
|
||||
$table->addColumn('bigInteger', 'user_id', ['unsigned' => true, 'comment' => '用户主键']);
|
||||
$table->addColumn('bigInteger', 'dept_id', ['unsigned' => true, 'comment' => '部门主键']);
|
||||
$table->primary(['user_id', 'dept_id']);
|
||||
});
|
||||
|
||||
// 新增部门领导表
|
||||
Schema::create('system_dept_leader', function (Blueprint $table) {
|
||||
$table->engine = 'Innodb';
|
||||
$table->comment('部门领导表');
|
||||
$table->addColumn('bigInteger', 'dept_id', ['unsigned' => true, 'comment' => '部门主键']);
|
||||
$table->addColumn('bigInteger', 'user_id', ['unsigned' => true, 'comment' => '用户主键']);
|
||||
$table->addColumn('string', 'username', ['length' => 20, 'comment' => '用户名']);
|
||||
$table->timestamp('created_at')->comment('添加时间');
|
||||
$table->primary(['dept_id', 'user_id']);
|
||||
});
|
||||
|
||||
// 设置超管默认部门
|
||||
Db::table('system_user_dept')->insert([ 'user_id' => env('SUPER_ADMIN', 1), 'dept_id' => 1 ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('system_user', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('system_user','dept_id')) {
|
||||
$table->addColumn('bigInteger', 'dept_id', ['unsigned' => true, 'comment' => '部门ID'])->nullable();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Seeders\Seeder;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class SettingConfigGroupSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Db::table('setting_config_group')->truncate();
|
||||
$tableName = env('DB_PREFIX') . \App\Setting\Model\SettingConfigGroup::getModel()->getTable();
|
||||
$sql = [
|
||||
"INSERT INTO `{$tableName}`(`id`, `name`, `code`, `created_by`, `updated_by`, `created_at`, `updated_at`, `remark`) VALUES (1, '站点配置', 'site_config', 1, 1, '2022-07-23 15:08:44', '2022-07-23 15:08:44', NULL)",
|
||||
"INSERT INTO `{$tableName}`(`id`, `name`, `code`, `created_by`, `updated_by`, `created_at`, `updated_at`, `remark`) VALUES (2, '上传配置', 'upload_config', 1, 1, '2022-07-23 15:09:31', '2022-07-23 15:09:33', NULL)",
|
||||
|
||||
];
|
||||
foreach ($sql as $item) {
|
||||
Db::insert($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Seeders\Seeder;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class SettingConfigSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Db::table('setting_config')->truncate();
|
||||
$tableName = env('DB_PREFIX') . \App\Setting\Model\SettingConfig::getModel()->getTable();
|
||||
$sql = [
|
||||
"INSERT INTO `{$tableName}`(`group_id`, `key`, `value`, `name`, `input_type`, `config_select_data`, `sort`, `remark`) VALUES (1, 'site_copyright', NULL, '版权信息', 'textarea', NULL, 96, NULL)",
|
||||
"INSERT INTO `{$tableName}`(`group_id`, `key`, `value`, `name`, `input_type`, `config_select_data`, `sort`, `remark`) VALUES (1, 'site_desc', NULL, '网站描述', 'textarea', NULL, 97, NULL)",
|
||||
"INSERT INTO `{$tableName}`(`group_id`, `key`, `value`, `name`, `input_type`, `config_select_data`, `sort`, `remark`) VALUES (1, 'site_keywords', '后台管理系统', '网站关键字', 'input', NULL, 98, NULL)",
|
||||
"INSERT INTO `{$tableName}`(`group_id`, `key`, `value`, `name`, `input_type`, `config_select_data`, `sort`, `remark`) VALUES (1, 'site_name', 'MineAdmin', '网站名称', 'input', NULL, 99, NULL)",
|
||||
"INSERT INTO `{$tableName}`(`group_id`, `key`, `value`, `name`, `input_type`, `config_select_data`, `sort`, `remark`) VALUES (1, 'site_record_number', NULL, '网站备案号', 'input', NULL, 95, NULL)",
|
||||
"INSERT INTO `{$tableName}`(`group_id`, `key`, `value`, `name`, `input_type`, `config_select_data`, `sort`, `remark`) VALUES (2, 'upload_allow_file', 'txt,doc,docx,xls,xlsx,ppt,pptx,rar,zip,7z,gz,pdf,wps,md', '文件类型', 'input', NULL, 0, NULL)",
|
||||
"INSERT INTO `{$tableName}`(`group_id`, `key`, `value`, `name`, `input_type`, `config_select_data`, `sort`, `remark`) VALUES (2, 'upload_allow_image', 'jpg,jpeg,png,gif,svg,bmp', '图片类型', 'input', NULL, 0, NULL)",
|
||||
"INSERT INTO `{$tableName}`(`group_id`, `key`, `value`, `name`, `input_type`, `config_select_data`, `sort`, `remark`) VALUES (2, 'upload_mode', '1', '上传模式', 'select', '[{\"label\":\"本地上传\",\"value\":\"1\"},{\"label\":\"阿里云OSS\",\"value\":\"2\"},{\"label\":\"七牛云\",\"value\":\"3\"},{\"label\":\"腾讯云COS\",\"value\":\"4\"}]', 99, NULL)",
|
||||
];
|
||||
foreach ($sql as $item) {
|
||||
Db::insert($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Seeders\Seeder;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class SettingCrontab extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Db::table('setting_crontab')->truncate();
|
||||
foreach ($this->getData() as $item) {
|
||||
Db::insert($item);
|
||||
}
|
||||
}
|
||||
|
||||
public function getData(): array
|
||||
{
|
||||
$tableName = env('DB_PREFIX').\App\Setting\Model\SettingCrontab::getModel()->getTable();
|
||||
return [
|
||||
"INSERT INTO `{$tableName}` VALUES (1, 'urlCrontab', '3', 'http://127.0.0.1:9501/', '', '59 */1 * * * *', 2, 2, NULL, NULL, '2021-08-07 23:28:28', '2021-08-07 23:44:55', '请求127.0.0.1')",
|
||||
"INSERT INTO `{$tableName}` VALUES (2, '每月1号清理所有日志', '2', 'App\System\Crontab\ClearLogCrontab', '', '0 0 0 1 * *', 2, 2, NULL, NULL, '2022-04-11 11:15:48', '2022-04-11 11:15:48', '')"
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Seeders\Seeder;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class SystemDeptSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Db::table('system_dept')->truncate();
|
||||
Db::table('system_dept')->insert(
|
||||
[
|
||||
'parent_id' => 0,
|
||||
'level' => '0',
|
||||
'name' => '曼艺科技',
|
||||
'leader' => '曼艺',
|
||||
'phone' => '16888888888',
|
||||
'created_by' => env('SUPER_ADMIN', 1),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Seeders\Seeder;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class SystemDictDataSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Db::table('system_dict_data')->truncate();
|
||||
|
||||
foreach ($this->getData() as $item) {
|
||||
Db::insert($item);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getData(): array
|
||||
{
|
||||
$tableName = env('DB_PREFIX') . \App\System\Model\SystemDictData::getModel()->getTable();
|
||||
return [
|
||||
"INSERT INTO `{$tableName}` VALUES (1, 1, 'InnoDB', 'InnoDB', 'table_engine', 0, 1, NULL, NULL, '2021-06-27 00:37:11', '2021-06-27 13:33:29', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (2, 1, 'MyISAM', 'MyISAM', 'table_engine', 0, 1, NULL, NULL, '2021-06-27 00:37:21', '2021-06-27 13:33:29', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (3, 2, '本地存储', '1', 'upload_mode', 99, 1, NULL, NULL, '2021-06-27 13:33:43', '2021-06-27 13:33:43', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (4, 2, '阿里云OSS', '2', 'upload_mode', 98, 1, NULL, NULL, '2021-06-27 13:33:55', '2021-06-27 13:33:55', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (5, 2, '七牛云', '3', 'upload_mode', 97, 1, NULL, NULL, '2021-06-27 13:34:07', '2021-06-27 13:34:07', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (6, 2, '腾讯云COS', '4', 'upload_mode', 96, 1, NULL, NULL, '2021-06-27 13:34:19', '2021-06-27 13:34:19', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (7, 3, '正常', '1', 'data_status', 0, 1, NULL, NULL, '2021-06-27 13:36:51', '2021-06-27 13:37:01', NULL, '0为正常')",
|
||||
"INSERT INTO `{$tableName}` VALUES (8, 3, '停用', '2', 'data_status', 0, 1, NULL, NULL, '2021-06-27 13:37:10', '2021-06-27 13:37:10', NULL, '1为停用')",
|
||||
"INSERT INTO `{$tableName}` VALUES (9, 4, '统计页面', 'statistics', 'dashboard', 0, 1, NULL, NULL, '2021-08-09 12:53:53', '2021-08-09 12:53:53', NULL, '管理员用')",
|
||||
"INSERT INTO `{$tableName}` VALUES (10, 4, '工作台', 'work', 'dashboard', 0, 1, NULL, NULL, '2021-08-09 12:54:18', '2021-08-09 12:54:18', NULL, '员工使用')",
|
||||
"INSERT INTO `{$tableName}` VALUES (11, 5, '男', '1', 'sex', 0, 1, NULL, NULL, '2021-08-09 12:55:00', '2021-08-09 12:55:00', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (12, 5, '女', '2', 'sex', 0, 1, NULL, NULL, '2021-08-09 12:55:08', '2021-08-09 12:55:08', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (13, 5, '未知', '3', 'sex', 0, 1, NULL, NULL, '2021-08-09 12:55:16', '2021-08-09 12:55:16', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (14, 6, 'String', '1', 'api_data_type', 7, 1, NULL, NULL, '2021-11-23 10:49:00', '2021-11-23 10:49:00', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (15, 6, 'Integer', '2', 'api_data_type', 6, 1, NULL, NULL, '2021-11-23 10:49:29', '2021-11-23 10:49:29', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (16, 6, 'Array', '3', 'api_data_type', 5, 1, NULL, NULL, '2021-11-23 10:49:38', '2021-11-23 10:49:38', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (17, 6, 'Float', '4', 'api_data_type', 4, 1, NULL, NULL, '2021-11-23 10:49:46', '2021-11-23 10:49:46', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (18, 6, 'Boolean', '5', 'api_data_type', 3, 1, NULL, NULL, '2021-11-23 10:49:54', '2021-11-23 10:49:54', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (19, 6, 'Enum', '6', 'api_data_type', 2, 1, NULL, NULL, '2021-11-23 10:50:17', '2021-11-23 10:50:17', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (20, 6, 'Object', '7', 'api_data_type', 1, 1, NULL, NULL, '2021-11-23 10:50:26', '2021-11-23 10:50:26', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (21, 6, 'File', '8', 'api_data_type', 0, 1, NULL, NULL, '2021-12-25 18:32:48', '2021-12-25 18:32:48', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (22, 7, '通知', '1', 'backend_notice_type', 2, 1, NULL, NULL, '2021-11-11 17:29:27', '2021-11-11 17:30:51', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (23, 7, '公告', '2', 'backend_notice_type', 1, 1, NULL, NULL, '2021-11-11 17:31:42', '2021-11-11 17:31:42', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (24, 8, '所有', 'A', 'request_mode', 5, 1, NULL, NULL, '2021-11-14 17:23:25', '2021-11-14 17:23:25', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (25, 8, 'GET', 'G', 'request_mode', 4, 1, NULL, NULL, '2021-11-14 17:23:45', '2021-11-14 17:23:45', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (26, 8, 'POST', 'P', 'request_mode', 3, 1, NULL, NULL, '2021-11-14 17:23:38', '2021-11-14 17:23:38', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (27, 8, 'PUT', 'U', 'request_mode', 2, 1, NULL, NULL, '2021-11-14 17:23:45', '2021-11-14 17:23:45', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (28, 8, 'DELETE', 'D', 'request_mode', 1, 1, NULL, NULL, '2021-11-14 17:23:45', '2021-11-14 17:23:45', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (29, 9, '未生产', '1', 'queue_produce_status', 5, 1, NULL, NULL, '2021-12-25 18:25:28', '2021-12-25 18:25:28', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (30, 9, '生产中', '2', 'queue_produce_status', 4, 1, NULL, NULL, '2021-12-25 18:25:38', '2021-12-25 18:25:38', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (31, 9, '生产成功', '3', 'queue_produce_status', 3, 1, NULL, NULL, '2021-12-25 18:25:50', '2021-12-25 18:25:50', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (32, 9, '生产失败', '4', 'queue_produce_status', 2, 1, NULL, NULL, '2021-12-25 18:26:14', '2021-12-25 18:26:14', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (33, 9, '生产重复', '5', 'queue_produce_status', 1, 1, NULL, NULL, '2021-12-25 18:26:30', '2021-12-25 18:26:30', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (34, 10, '未消费', '1', 'queue_consume_status', 5, 1, NULL, NULL, '2021-12-25 18:26:57', '2021-12-25 18:26:57', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (35, 10, '消费中', '2', 'queue_consume_status', 4, 1, NULL, NULL, '2021-12-25 18:27:07', '2021-12-25 18:27:07', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (36, 10, '消费成功', '3', 'queue_consume_status', 3, 1, NULL, NULL, '2021-12-25 18:27:16', '2021-12-25 18:27:16', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (37, 10, '消费失败', '4', 'queue_consume_status', 2, 1, NULL, NULL, '2021-12-25 18:27:24', '2021-12-25 18:27:24', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (38, 10, '消费重复', '5', 'queue_consume_status', 1, 1, NULL, NULL, '2021-12-25 18:27:35', '2021-12-25 18:27:35', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (39, 11, '通知', 'notice', 'queue_msg_type', 1, 1, NULL, NULL, '2021-12-25 18:30:31', '2021-12-25 18:30:31', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (40, 11, '公告', 'announcement', 'queue_msg_type', 2, 1, NULL, NULL, '2021-12-25 18:31:00', '2021-12-25 18:31:00', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (41, 11, '待办', 'todo', 'queue_msg_type', 3, 1, NULL, NULL, '2021-12-25 18:31:26', '2021-12-25 18:31:26', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (42, 11, '抄送我的', 'carbon_copy_mine', 'queue_msg_type', 4, 1, NULL, NULL, '2021-12-25 18:31:26', '2021-12-25 18:31:26', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (43, 11, '私信', 'private_message', 'queue_msg_type', 5, 1, NULL, NULL, '2021-12-25 18:31:26', '2021-12-25 18:31:26', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (44, 12, '图片', 'image', 'attachment_type', 10, 1, NULL, NULL, '2022-03-17 14:49:59', '2022-03-17 14:49:59', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (45, 12, '文档', 'text', 'attachment_type', 9, 1, NULL, NULL, '2022-03-17 14:50:20', '2022-03-17 14:50:49', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (46, 12, '音频', 'audio', 'attachment_type', 8, 1, NULL, NULL, '2022-03-17 14:50:37', '2022-03-17 14:50:52', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (47, 12, '视频', 'video', 'attachment_type', 7, 1, NULL, NULL, '2022-03-17 14:50:45', '2022-03-17 14:50:57', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (48, 12, '应用程序', 'application', 'attachment_type', 6, 1, NULL, NULL, '2022-03-17 14:50:52', '2022-03-17 14:50:59', NULL, NULL)",
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Seeders\Seeder;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class SystemDictTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Db::table('system_dict_type')->truncate();
|
||||
|
||||
foreach ($this->getData() as $item) {
|
||||
Db::insert($item);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getData(): array
|
||||
{
|
||||
$tableName = env('DB_PREFIX') . \App\System\Model\SystemDictType::getModel()->getTable();
|
||||
return [
|
||||
"INSERT INTO `{$tableName}` VALUES (1, '数据表引擎', 'table_engine', 1, NULL, NULL, '2021-06-27 00:36:42', '2021-06-27 13:33:29', NULL, '数据表引擎字典')",
|
||||
"INSERT INTO `{$tableName}` VALUES (2, '存储模式', 'upload_mode', 1, NULL, NULL, '2021-06-27 13:33:11', '2021-06-27 13:33:11', NULL, '上传文件存储模式')",
|
||||
"INSERT INTO `{$tableName}` VALUES (3, '数据状态', 'data_status', 1, NULL, NULL, '2021-06-27 13:36:16', '2021-06-27 13:36:34', NULL, '通用数据状态')",
|
||||
"INSERT INTO `{$tableName}` VALUES (4, '后台首页', 'dashboard', 1, NULL, NULL, '2021-08-09 12:53:17', '2021-08-09 12:53:17', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (5, '性别', 'sex', 1, NULL, NULL, '2021-08-09 12:54:40', '2021-08-09 12:54:40', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (6, '接口数据类型', 'api_data_type', 1, NULL, NULL, '2021-11-22 20:56:03', '2021-11-22 20:56:03', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (7, '后台公告类型', 'backend_notice_type', 1, NULL, NULL, '2021-11-11 17:29:05', '2021-11-11 17:29:14', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (8, '请求方式', 'request_mode', 1, NULL, NULL, '2021-11-14 17:22:52', '2021-11-14 17:22:52', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (9, '队列生产状态', 'queue_produce_status', 1, NULL, NULL, '2021-12-25 18:22:38', '2021-12-25 18:22:38', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (10, '队列消费状态', 'queue_consume_status', 1, NULL, NULL, '2021-12-25 18:23:19', '2021-12-25 18:23:19', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (11, '队列消息类型', 'queue_msg_type', 1, NULL, NULL, '2021-12-25 18:28:40', '2021-12-25 18:28:40', NULL, NULL)",
|
||||
"INSERT INTO `{$tableName}` VALUES (12, '附件类型', 'attachment_type', 1, NULL, NULL, '2022-03-17 14:49:23', '2022-03-17 14:49:23', NULL, NULL)",
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,235 @@
|
|||
<?php
|
||||
/**
|
||||
* MineAdmin is committed to providing solutions for quickly building web applications
|
||||
* Please view the LICENSE file that was distributed with this source code,
|
||||
* For the full copyright and license information.
|
||||
* Thank you very much for using MineAdmin.
|
||||
*
|
||||
* @Author X.Mo<root@imoi.cn>
|
||||
* @Link https://gitee.com/xmo/MineAdmin
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Seeders\Seeder;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class SystemMenuSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Db::table('system_menu')->truncate();
|
||||
foreach ($this->getData() as $item) {
|
||||
Db::insert($item);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getData(): array
|
||||
{
|
||||
$model = env('DB_PREFIX') . \App\System\Model\SystemMenu::getModel()->getTable();
|
||||
return [
|
||||
"INSERT INTO `{$model}` VALUES (1000, 0, '0', '权限', 'permission', 'ma-icon-permission', 'permission', '', NULL, '2', 'M', 1, 99, NULL, NULL, '2021-07-25 18:48:47', '2021-07-25 18:48:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1100, 1000, '0,1000', '用户管理', 'system:user', 'ma-icon-user', 'user', 'system/user/index', NULL, '2', 'M', 1, 99, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1101, 1100, '0,1000,1100', '用户列表', 'system:user:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1102, 1100, '0,1000,1100', '用户回收站列表', 'system:user:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1103, 1100, '0,1000,1100', '用户保存', 'system:user:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1104, 1100, '0,1000,1100', '用户更新', 'system:user:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1105, 1100, '0,1000,1100', '用户删除', 'system:user:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1106, 1100, '0,1000,1100', '用户读取', 'system:user:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1107, 1100, '0,1000,1100', '用户恢复', 'system:user:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1108, 1100, '0,1000,1100', '用户真实删除', 'system:user:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1109, 1100, '0,1000,1100', '用户导入', 'system:user:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1110, 1100, '0,1000,1100', '用户导出', 'system:user:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:50:15', '2021-07-25 18:50:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1111, 1100, '0,1000,1100', '用户状态改变', 'system:user:changeStatus', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:53:02', '2021-07-25 18:53:02', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1112, 1100, '0,1000,1100', '用户初始化密码', 'system:user:initUserPassword', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 18:55:55', '2021-07-25 18:55:55', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1113, 1100, '0,1000,1100', '更新用户缓存', 'system:user:cache', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-08 18:30:57', '2021-08-08 18:30:57', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1114, 1100, '0,1000,1100', '设置用户首页', 'system:user:homePage', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-08 18:34:30', '2021-08-08 18:34:30', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1200, 1000, '0,1000', '菜单管理', 'system:menu', 'icon-menu', 'menu', 'system/menu/index', NULL, '2', 'M', 1, 96, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1201, 1200, '0,1000,1200', '菜单列表', 'system:menu:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1202, 1200, '0,1000,1200', '菜单回收站', 'system:menu:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1203, 1200, '0,1000,1200', '菜单保存', 'system:menu:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1204, 1200, '0,1000,1200', '菜单更新', 'system:menu:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1205, 1200, '0,1000,1200', '菜单删除', 'system:menu:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1206, 1200, '0,1000,1200', '菜单读取', 'system:menu:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1207, 1200, '0,1000,1200', '菜单恢复', 'system:menu:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1208, 1200, '0,1000,1200', '菜单真实删除', 'system:menu:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1209, 1200, '0,1000,1200', '菜单导入', 'system:menu:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1210, 1200, '0,1000,1200', '菜单导出', 'system:menu:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:01:47', '2021-07-25 19:01:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1300, 1000, '0,1000', '部门管理', 'system:dept', 'ma-icon-dept', 'dept', 'system/dept/index', NULL, '2', 'M', 1, 97, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1301, 1300, '0,1000,1300', '部门列表', 'system:dept:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1302, 1300, '0,1000,1300', '部门回收站', 'system:dept:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1303, 1300, '0,1000,1300', '部门保存', 'system:dept:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1304, 1300, '0,1000,1300', '部门更新', 'system:dept:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1305, 1300, '0,1000,1300', '部门删除', 'system:dept:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1306, 1300, '0,1000,1300', '部门读取', 'system:dept:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1307, 1300, '0,1000,1300', '部门恢复', 'system:dept:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1308, 1300, '0,1000,1300', '部门真实删除', 'system:dept:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1309, 1300, '0,1000,1300', '部门导入', 'system:dept:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1310, 1300, '0,1000,1300', '部门导出', 'system:dept:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:16:33', '2021-07-25 19:16:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1400, 1000, '0,1000', '角色管理', 'system:role', 'ma-icon-role', 'role', 'system/role/index', NULL, '2', 'M', 1, 98, NULL, NULL, '2021-07-25 19:17:37', '2021-07-25 19:17:37', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1401, 1400, '0,1000,1400', '角色列表', 'system:role:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:37', '2021-07-25 19:17:37', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1402, 1400, '0,1000,1400', '角色回收站', 'system:role:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:38', '2021-07-25 19:17:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1403, 1400, '0,1000,1400', '角色保存', 'system:role:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:38', '2021-07-25 19:17:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1404, 1400, '0,1000,1400', '角色更新', 'system:role:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:38', '2021-07-25 19:17:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1405, 1400, '0,1000,1400', '角色删除', 'system:role:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:38', '2021-07-25 19:17:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1406, 1400, '0,1000,1400', '角色读取', 'system:role:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:38', '2021-07-25 19:17:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1407, 1400, '0,1000,1400', '角色恢复', 'system:role:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:38', '2021-07-25 19:17:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1408, 1400, '0,1000,1400', '角色真实删除', 'system:role:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:38', '2021-07-25 19:17:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1409, 1400, '0,1000,1400', '角色导入', 'system:role:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:38', '2021-07-25 19:17:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1410, 1400, '0,1000,1400', '角色导出', 'system:role:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 19:17:38', '2021-07-25 19:17:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1411, 1400, '0,1000,1400', '角色状态改变', 'system:role:changeStatus', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-30 11:21:24', '2021-07-30 11:21:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1412, 1400, '0,1000,1400', '更新菜单权限', 'system:role:menuPermission', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-09 11:52:33', '2021-08-09 11:52:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1413, 1400, '0,1000,1400', '更新数据权限', 'system:role:dataPermission', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-09 11:52:52', '2021-08-09 11:52:52', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1500, 1000, '0,1000', '岗位管理', 'system:post', 'ma-icon-post', 'post', 'system/post/index', NULL, '2', 'M', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1501, 1500, '0,1000,1500', '岗位列表', 'system:post:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1502, 1500, '0,1000,1500', '岗位回收站', 'system:post:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1503, 1500, '0,1000,1500', '岗位保存', 'system:post:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1504, 1500, '0,1000,1500', '岗位更新', 'system:post:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1505, 1500, '0,1000,1500', '岗位删除', 'system:post:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1506, 1500, '0,1000,1500', '岗位读取', 'system:post:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1507, 1500, '0,1000,1500', '岗位恢复', 'system:post:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1508, 1500, '0,1000,1500', '岗位真实删除', 'system:post:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1509, 1500, '0,1000,1500', '岗位导入', 'system:post:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1510, 1500, '0,1000,1500', '岗位导出', 'system:post:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-25 20:46:38', '2021-07-25 20:46:38', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2000, 0, '0', '数据', 'dataCenter', 'icon-storage', 'dataCenter', '', NULL, '2', 'M', 1, 98, NULL, NULL, '2021-07-31 17:17:03', '2021-07-31 17:17:03', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2100, 2000, '0,2000', '数据字典', 'system:dict', 'ma-icon-dict', 'dict', 'system/dict/index', NULL, '2', 'M', 1, 99, NULL, NULL, '2021-07-31 18:33:45', '2021-07-31 18:33:45', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2101, 2100, '0,2000,2100', '数据字典列表', 'system:dict:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:45', '2021-07-31 18:33:45', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2102, 2100, '0,2000,2100', '数据字典回收站', 'system:dict:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:45', '2021-07-31 18:33:45', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2103, 2100, '0,2000,2100', '数据字典保存', 'system:dict:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:45', '2021-07-31 18:33:45', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2104, 2100, '0,2000,2100', '数据字典更新', 'system:dict:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:45', '2021-07-31 18:33:45', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2105, 2100, '0,2000,2100', '数据字典删除', 'system:dict:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:45', '2021-07-31 18:33:45', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2106, 2100, '0,2000,2100', '数据字典读取', 'system:dict:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:46', '2021-07-31 18:33:46', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2107, 2100, '0,2000,2100', '数据字典恢复', 'system:dict:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:46', '2021-07-31 18:33:46', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2108, 2100, '0,2000,2100', '数据字典真实删除', 'system:dict:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:46', '2021-07-31 18:33:46', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2109, 2100, '0,2000,2100', '数据字典导入', 'system:dict:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:46', '2021-07-31 18:33:46', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2110, 2100, '0,2000,2100', '数据字典导出', 'system:dict:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:33:46', '2021-07-31 18:33:46', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2200, 2000, '0,2000', '附件管理', 'system:attachment', 'ma-icon-attach', 'attachment', 'system/attachment/index', NULL, '2', 'M', 1, 98, NULL, NULL, '2021-07-31 18:36:34', '2021-07-31 18:36:34', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2201, 2300, '0,2000,2200', '附件删除', 'system:attachment:delete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:37:20', '2021-07-31 18:37:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2202, 2200, '0,2000,2200', '附件列表', 'system:attachment:index', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:38:05', '2021-07-31 18:38:05', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2203, 2200, '0,2000,2200', '附件回收站', 'system:attachment:recycle', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:38:57', '2021-07-31 18:38:57', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2204, 2200, '0,2000,2200', '附件真实删除', 'system:attachment:realDelete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:40:44', '2021-07-31 18:40:44', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2300, 2000, '0,2000', '数据表维护', 'system:dataMaintain', 'ma-icon-db', 'dataMaintain', 'system/dataMaintain/index', NULL, '2', 'M', 1, 95, NULL, NULL, '2021-07-31 18:43:20', '2021-07-31 18:43:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2301, 2300, '0,2000,2300', '数据表列表', 'system:dataMaintain:index', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:44:03', '2021-07-31 18:44:03', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2302, 2300, '0,2000,2300', '数据表详细', 'system:dataMaintain:detailed', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:45:17', '2021-07-31 18:45:17', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2303, 2300, '0,2000,2300', '数据表清理碎片', 'system:dataMaintain:fragment', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:46:04', '2021-07-31 18:46:04', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2304, 2300, '0,2000,2300', '数据表优化', 'system:dataMaintain:optimize', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:46:31', '2021-07-31 18:46:31', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3000, 0, '0', '监控', 'monitor', 'icon-desktop', 'monitor', '', NULL, '2', 'M', 1, 97, NULL, NULL, '2021-07-31 18:49:24', '2021-07-31 18:49:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3200, 3000, '0,3000', '服务监控', 'system:monitor:server', 'icon-thunderbolt', 'server', 'system/monitor/server/index', NULL, '2', 'M', 1, 99, NULL, NULL, '2021-07-31 18:52:46', '2021-07-31 18:52:46', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3300, 3000, '0,3000', '日志监控', 'logs', 'icon-book', 'logs', '', NULL, '2', 'M', 1, 95, NULL, NULL, '2021-07-31 18:54:01', '2021-07-31 18:54:01', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3400, 3300, '0,3000,3200', '登录日志', 'system:loginLog', 'icon-idcard', 'loginLog', 'system/logs/loginLog', NULL, '2', 'M', 1, 0, NULL, NULL, '2021-07-31 18:54:55', '2021-07-31 18:54:55', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3401, 3400, '0,3000,3200,3300', '登录日志删除', 'system:loginLog:delete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:56:43', '2021-07-31 18:56:43', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3500, 3300, '0,3000,3200', '操作日志', 'system:operLog', 'icon-robot', 'operLog', 'system/logs/operLog', NULL, '2', 'M', 1, 0, NULL, NULL, '2021-07-31 18:55:40', '2021-07-31 18:55:40', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3501, 3500, '0,3000,3200,3400', '操作日志删除', 'system:operLog:delete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 18:56:19', '2021-07-31 18:56:19', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3600, 3000, '0,3000', '在线用户', 'system:onlineUser', 'ma-icon-online', 'onlineUser', 'system/monitor/onlineUser/index', NULL, '2', 'M', 1, 98, NULL, NULL, '2021-08-08 18:26:31', '2021-08-08 18:26:31', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3601, 3500, '0,3000,3500', '在线用户列表', 'system:onlineUser:index', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-08 18:26:55', '2021-08-08 18:26:55', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3602, 3500, '0,3000,3500', '强退用户', 'system:onlineUser:kick', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-08 18:27:21', '2021-08-08 18:27:21', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4000, 0, '0', '工具', 'devTools', 'ma-icon-tool', 'devTools', '', NULL, '2', 'M', 1, 95, NULL, NULL, '2021-07-31 19:03:32', '2021-07-31 19:03:32', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4100, 4000, '0,4000', '模块管理', 'setting:module', 'icon-folder', 'module', 'setting/module/index', NULL, '2', 'M', 1, 99, NULL, NULL, '2021-07-31 19:33:49', '2021-07-31 19:33:49', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4101, 4100, '0,4000,4100', '新增模块', 'setting:module:save', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:45:29', '2021-07-31 19:45:29', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4102, 4100, '0,4000,4100', '模块删除', 'setting:module:delete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:34:15', '2021-07-31 19:34:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4103, 4100, '0,4000,4100', '模块列表', 'setting:module:index', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-09 11:48:27', '2021-08-09 11:48:27', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4200, 4000, '0,4000', '代码生成器', 'setting:code', 'ma-icon-code', 'code', 'setting/code/index', NULL, '2', 'M', 1, 98, NULL, NULL, '2021-07-31 19:36:17', '2021-07-31 19:36:17', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4201, 4200, '0,4000,4200', '预览代码', 'setting:code:preview', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:36:44', '2021-07-31 19:36:44', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4202, 4200, '0,4000,4200', '装载数据表', 'setting:code:loadTable', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:38:03', '2021-07-31 19:38:03', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4203, 4200, '0,4000,4200', '删除业务表', 'setting:code:delete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:38:53', '2021-07-31 19:38:53', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4204, 4200, '0,4000,4200', '同步业务表', 'setting:code:sync', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:39:18', '2021-07-31 19:39:18', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4205, 4200, '0,4000,4200', '生成代码', 'setting:code:generate', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:39:48', '2021-07-31 19:39:48', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4400, 4000, '0,4000', '定时任务', 'setting:crontab', 'icon-schedule', 'crontab', 'setting/crontab/index', '', '2', 'M', 1, 0, NULL, NULL, '2021-07-31 19:47:49', '2021-07-31 19:47:49', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4401, 4400, '0,4000,4400', '定时任务列表', 'setting:crontab:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:47:49', '2021-07-31 19:47:49', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4402, 4400, '0,4000,4400', '定时任务保存', 'setting:crontab:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:47:49', '2021-07-31 19:47:49', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4403, 4400, '0,4000,4400', '定时任务更新', 'setting:crontab:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:47:49', '2021-07-31 19:47:49', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4404, 4400, '0,4000,4400', '定时任务删除', 'setting:crontab:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:47:49', '2021-07-31 19:47:49', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4405, 4400, '0,4000,4400', '定时任务读取', 'setting:crontab:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:47:49', '2021-07-31 19:47:49', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4406, 4400, '0,4000,4400', '定时任务导入', 'setting:crontab:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:47:49', '2021-07-31 19:47:49', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4407, 4400, '0,4000,4400', '定时任务导出', 'setting:crontab:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-07-31 19:47:49', '2021-07-31 19:47:49', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4408, 4400, '0,4000,4400', '定时任务执行', 'setting:crontab:run', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-07 23:44:06', '2021-08-07 23:44:06', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4500, 0, '0', '系统设置', 'setting:config', 'icon-settings', 'system', 'setting/config/index', '', '2', 'M', 1, 0, NULL, NULL, '2021-07-31 19:58:57', '2021-07-31 19:58:57', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4502, 4500, '0,4500', '配置列表', 'setting:config:index', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-10 13:09:18', '2021-08-10 13:09:18', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4504, 4500, '0,4500', '新增配置 ', 'setting:config:save', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-10 13:11:56', '2021-08-10 13:11:56', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4505, 4500, '0,4500', '更新配置', 'setting:config:update', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-10 13:12:25', '2021-08-10 13:12:25', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4506, 4500, '0,4500', '删除配置', 'setting:config:delete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-10 13:13:33', '2021-08-10 13:13:33', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4507, 4500, '0,4500', '清除配置缓存', 'setting:config:clearCache', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-08-10 13:13:59', '2021-08-10 13:13:59', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2500, 2000, '0,2000', '应用中心', 'apps', 'icon-apps', 'apps', '', NULL, '2', 'M', 1, 90, NULL, NULL, '2021-11-11 21:16:47', '2021-11-11 21:16:47', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2510, 2500, '0,2000,2500', '应用分组', 'system:appGroup', 'ma-icon-group', 'appGroup', 'system/appGroup/index', NULL, '2', 'M', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2511, 2510, '0,2000,2500,2510', '应用分组列表', 'system:appGroup:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2512, 2510, '0,2000,2500,2510', '应用分组回收站', 'system:appGroup:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2513, 2510, '0,2000,2500,2510', '应用分组保存', 'system:appGroup:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2514, 2510, '0,2000,2500,2510', '应用分组更新', 'system:appGroup:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2515, 2510, '0,2000,2500,2510', '应用分组删除', 'system:appGroup:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2516, 2510, '0,2000,2500,2510', '应用分组读取', 'system:appGroup:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2517, 2510, '0,2000,2500,2510', '应用分组恢复', 'system:appGroup:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2518, 2510, '0,2000,2500,2510', '应用分组真实删除', 'system:appGroup:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2519, 2510, '0,2000,2500,2510', '应用分组导入', 'system:appGroup:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2520, 2510, '0,2000,2500,2510', '应用分组导出', 'system:appGroup:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:31:28', '2021-11-11 21:31:28', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2530, 2500, '0,2000,2500', '应用管理', 'system:app', 'icon-archive', 'app', 'system/app/index', NULL, '2', 'M', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2531, 2530, '0,2000,2500,2530', '应用列表', 'system:app:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2532, 2530, '0,2000,2500,2530', '应用回收站', 'system:app:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2533, 2530, '0,2000,2500,2530', '应用保存', 'system:app:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2534, 2530, '0,2000,2500,2530', '应用更新', 'system:app:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2535, 2530, '0,2000,2500,2530', '应用删除', 'system:app:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2536, 2530, '0,2000,2500,2530', '应用读取', 'system:app:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2537, 2530, '0,2000,2500,2530', '应用恢复', 'system:app:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2538, 2530, '0,2000,2500,2530', '应用真实删除', 'system:app:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2539, 2530, '0,2000,2500,2530', '应用导入', 'system:app:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2540, 2530, '0,2000,2500,2530', '应用导出', 'system:app:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:35:35', '2021-11-11 21:35:35', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2541, 2530, '0,2000,2500,2530', '应用绑定接口', 'system:app:bind', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2600, 2000, '0,2000', '应用接口', 'apis', 'icon-common', 'apis', '', NULL, '2', 'M', 1, 80, NULL, NULL, '2021-11-11 21:23:57', '2021-11-11 21:23:57', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2610, 2600, '0,2000,2600', '接口分组', 'system:apiGroup', 'ma-icon-group', 'apiGroup', 'system/apiGroup/index', NULL, '2', 'M', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2611, 2610, '0,2000,2600,2610', '接口分组列表', 'system:apiGroup:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2612, 2610, '0,2000,2600,2610', '接口分组回收站', 'system:apiGroup:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2613, 2610, '0,2000,2600,2610', '接口分组保存', 'system:apiGroup:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2614, 2610, '0,2000,2600,2610', '接口分组更新', 'system:apiGroup:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2615, 2610, '0,2000,2600,2610', '接口分组删除', 'system:apiGroup:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2616, 2610, '0,2000,2600,2610', '接口分组读取', 'system:apiGroup:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2617, 2610, '0,2000,2600,2610', '接口分组恢复', 'system:apiGroup:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2618, 2610, '0,2000,2600,2610', '接口分组真实删除', 'system:apiGroup:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2619, 2610, '0,2000,2600,2610', '接口分组导入', 'system:apiGroup:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2620, 2610, '0,2000,2600,2610', '接口分组导出', 'system:apiGroup:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:37:54', '2021-11-11 21:37:54', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2630, 2600, '0,2000,2600', '接口管理', 'system:api', 'icon-mind-mapping', 'api', 'system/api/index', NULL, '2', 'M', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2631, 2630, '0,2000,2600,2630', '接口列表', 'system:api:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2632, 2630, '0,2000,2600,2630', '接口回收站', 'system:api:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2633, 2630, '0,2000,2600,2630', '接口保存', 'system:api:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2634, 2630, '0,2000,2600,2630', '接口更新', 'system:api:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2635, 2630, '0,2000,2600,2630', '接口删除', 'system:api:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2636, 2630, '0,2000,2600,2630', '接口读取', 'system:api:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2637, 2630, '0,2000,2600,2630', '接口恢复', 'system:api:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2638, 2630, '0,2000,2600,2630', '接口真实删除', 'system:api:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2639, 2630, '0,2000,2600,2630', '接口导入', 'system:api:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2640, 2630, '0,2000,2600,2630', '接口导出', 'system:api:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-11 21:44:24', '2021-11-11 21:44:24', NULL, NULL)",
|
||||
|
||||
"INSERT INTO `{$model}` VALUES (3800, 3300, '0,3000,3300', '接口日志', 'system:apiLog', 'icon-calendar', 'apiLog', 'system/logs/apiLog', NULL, '2', 'M', 1, 0, NULL, NULL, '2021-12-06 21:50:05', '2021-12-06 21:50:05', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3801, 3800, '0,3000,3300,3800', '接口日志删除', 'system:apiLog:delete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-06 21:50:40', '2021-12-06 21:50:40', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4409, 4400, '0,4000,4400', '定时任务日志删除', 'setting:crontab:deleteLog', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-06 22:06:12', '2021-12-06 22:06:12', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3700, 3000, '0,3000', '缓存监控', 'system:cache', 'icon-dice', 'cache', 'system/monitor/cache/index', NULL, '2', 'M', 1, 98, NULL, NULL, '2021-10-26 20:50:31', '2021-10-26 20:50:31', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3701, 3700, '0,3000,3700', '获取Redis信息', 'system:cache:monitor', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-10-26 20:50:31', '2021-10-26 20:50:31', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3702, 3700, '0,3000,3700', '删除一个缓存', 'system:cache:delete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-10-26 20:50:31', '2021-10-26 20:50:31', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3703, 3700, '0,3000,3700', '清空所有缓存', 'system:cache:clear', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-10-26 20:50:31', '2021-10-26 20:50:31', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1311, 1300, '0,1000,1300', '部门状态改变', 'system:dept:changeStatus', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-09 18:26:15', '2021-11-09 18:26:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (1511, 1500, '0,1000,1500', '岗位状态改变', 'system:post:changeStatus', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-09 18:26:15', '2021-11-09 18:26:15', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2112, 2100, '0,2000,2100', '字典状态改变', 'system:dataDict:changeStatus', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-11-09 18:26:15', '2021-11-09 18:26:15', NULL, NULL)",
|
||||
|
||||
"INSERT INTO `{$model}` VALUES (3850, 3300, '0,3000,3300', '队列日志', 'system:queueLog', 'icon-layers', 'queueLog', 'system/logs/queueLog', NULL, '2', 'M', 1, 0, NULL, NULL, '2021-12-25 16:41:14', '2021-12-25 16:41:14', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3851, 3850, '0,3000,3300,3850', '删除队列日志', 'system:queueLog:delete', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 16:42:42', '2021-12-25 16:42:42', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (3852, 3850, '0,3000,3300,3850', '更新队列状态', 'system:queueLog:updateStatus', '', NULL, '', NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 16:45:03', '2021-12-25 16:47:16', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2700, 2000, '0,2000', '系统公告', 'system:notice', 'icon-bulb', 'notice', 'system/notice/index', NULL, '2', 'M', 1, 94, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2701, 2700, '0,2000,2700', '系统公告列表', 'system:notice:index', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2702, 2700, '0,2000,2700', '系统公告回收站', 'system:notice:recycle', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2703, 2700, '0,2000,2700', '系统公告保存', 'system:notice:save', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2704, 2700, '0,2000,2700', '系统公告更新', 'system:notice:update', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2705, 2700, '0,2000,2700', '系统公告删除', 'system:notice:delete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2706, 2700, '0,2000,2700', '系统公告读取', 'system:notice:read', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2707, 2700, '0,2000,2700', '系统公告恢复', 'system:notice:recovery', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2708, 2700, '0,2000,2700', '系统公告真实删除', 'system:notice:realDelete', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2709, 2700, '0,2000,2700', '系统公告导入', 'system:notice:import', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (2710, 2700, '0,2000,2700', '系统公告导出', 'system:notice:export', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2021-12-25 18:10:20', '2021-12-25 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4104, 4100, '0,4000,4100', '模块启停用', 'setting:module:status', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2022-02-13 18:10:20', '2022-02-13 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4105, 4100, '0,4000,4100', '安装模块', 'setting:module:install', NULL, NULL, NULL, NULL, '1', 'B', 1, 0, NULL, NULL, '2022-02-13 18:10:20', '2022-02-13 18:10:20', NULL, NULL)",
|
||||
"INSERT INTO `{$model}` VALUES (4600, 4000, '0,4000', '系统接口', 'systemInterface', 'icon-compass', 'systemInterface', 'setting/systemInterface/index', NULL, '2', 'M', 1, 0, NULL, NULL, '2022-03-30 10:00:28', '2022-03-30 10:00:28', NULL, NULL)",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
namespace App\System\Dto;
|
||||
|
||||
use Builder\Interfaces\MineModelExcel;
|
||||
use Builder\Annotation\ExcelData;
|
||||
use Builder\Annotation\ExcelProperty;
|
||||
|
||||
/**
|
||||
* 接口字段DTO
|
||||
*/
|
||||
#[ExcelData]
|
||||
class ApiColumnDto implements MineModelExcel
|
||||
{
|
||||
#[ExcelProperty(value: "所属接口ID", index: 0)]
|
||||
public string $api_id;
|
||||
|
||||
#[ExcelProperty(value: "接口名称", index: 1)]
|
||||
public string $name;
|
||||
|
||||
#[ExcelProperty(value: "类型 0 请求 1 响应", index: 2)]
|
||||
public string $type;
|
||||
|
||||
#[ExcelProperty(value: "数据类型", index: 3)]
|
||||
public string $data_type;
|
||||
|
||||
#[ExcelProperty(value: "是否必填 0 非必填 1 必填", index: 4)]
|
||||
public string $is_required;
|
||||
|
||||
#[ExcelProperty(value: "默认值", index: 5)]
|
||||
public string $default_value;
|
||||
|
||||
#[ExcelProperty(value: "字段说明", index: 6)]
|
||||
public string $description;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
namespace App\System\Dto;
|
||||
|
||||
use Builder\Interfaces\MineModelExcel;
|
||||
use Builder\Annotation\ExcelData;
|
||||
use Builder\Annotation\ExcelProperty;
|
||||
|
||||
/**
|
||||
* 用户DTO
|
||||
*/
|
||||
#[ExcelData]
|
||||
class UserDto implements MineModelExcel
|
||||
{
|
||||
#[ExcelProperty(value: "用户名", index: 0)]
|
||||
public string $username;
|
||||
|
||||
#[ExcelProperty(value: "密码", index: 3)]
|
||||
public string $password;
|
||||
|
||||
#[ExcelProperty(value: "昵称", index: 1)]
|
||||
public string $nickname;
|
||||
|
||||
#[ExcelProperty(value: "手机", index: 2)]
|
||||
public string $phone;
|
||||
|
||||
#[ExcelProperty(value: "状态", index: 4, dictName: "data_status")]
|
||||
public string $status;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Listener;
|
||||
|
||||
use App\System\Model\SystemUploadfile;
|
||||
use Hyperf\Event\Annotation\Listener;
|
||||
use Hyperf\Event\Contract\ListenerInterface;
|
||||
use League\Flysystem\FileNotFoundException;
|
||||
use Builder\Event\RealDeleteUploadFile;
|
||||
|
||||
/**
|
||||
* Class DeleteUploadFileListener
|
||||
* @package App\System\Listener
|
||||
*/
|
||||
#[Listener]
|
||||
class DeleteUploadFileListener implements ListenerInterface
|
||||
{
|
||||
public function listen(): array
|
||||
{
|
||||
return [
|
||||
RealDeleteUploadFile::class
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RealDeleteUploadFile $event
|
||||
*/
|
||||
public function process(object $event): void
|
||||
{
|
||||
$filePath = $this->getFilePath($event->getModel());
|
||||
try {
|
||||
$event->getFilesystem()->delete($filePath);
|
||||
} catch (FileNotFoundException $e) {
|
||||
// 文件删除失败,跳过删除数据
|
||||
$event->setConfirm(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件路径
|
||||
* @param SystemUploadfile $model
|
||||
* @return string
|
||||
*/
|
||||
public function getFilePath(SystemUploadfile $model): string
|
||||
{
|
||||
return $model->storage_path.'/'.$model->object_name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Listener;
|
||||
|
||||
use App\System\Model\SystemLoginLog;
|
||||
use App\System\Model\SystemUser;
|
||||
use App\System\Service\SystemLoginLogService;
|
||||
use Hyperf\Event\Annotation\Listener;
|
||||
use Hyperf\Event\Contract\ListenerInterface;
|
||||
use Builder\Event\UserLoginAfter;
|
||||
use Builder\Helper\Str;
|
||||
use Builder\MineRequest;
|
||||
|
||||
/**
|
||||
* Class LoginListener
|
||||
*/
|
||||
#[Listener]
|
||||
class LoginListener implements ListenerInterface
|
||||
{
|
||||
public function listen(): array
|
||||
{
|
||||
return [
|
||||
UserLoginAfter::class
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UserLoginAfter $event
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
public function process(object $event): void
|
||||
{
|
||||
$request = container()->get(MineRequest::class);
|
||||
$service = container()->get(SystemLoginLogService::class);
|
||||
$redis = redis();
|
||||
|
||||
$agent = $request->getHeader('user-agent')[0];
|
||||
$ip = $request->ip();
|
||||
$service->save([
|
||||
'username' => $event->userinfo['username'],
|
||||
'ip' => $ip,
|
||||
'ip_location' => Str::ipToRegion($ip),
|
||||
'os' => $this->os($agent),
|
||||
'browser' => $this->browser($agent),
|
||||
'status' => $event->loginStatus ? SystemLoginLog::SUCCESS : SystemLoginLog::FAIL,
|
||||
'message' => $event->message,
|
||||
'login_time' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
$key = sprintf("%sToken:%s", config('cache.default.prefix'), $event->userinfo['id']);
|
||||
|
||||
$redis->del($key);
|
||||
($event->loginStatus && $event->token) && $redis->set( $key, $event->token, config('jwt.ttl') );
|
||||
|
||||
if ($event->loginStatus) {
|
||||
$event->userinfo['login_ip'] = $ip;
|
||||
$event->userinfo['login_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
SystemUser::query()->where('id', $event->userinfo['id'])->update([
|
||||
'login_ip' => $ip,
|
||||
'login_time' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $agent
|
||||
* @return string
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
private function os($agent): string
|
||||
{
|
||||
if (false !== stripos($agent, 'win') && preg_match('/nt 6.1/i', $agent)) {
|
||||
return 'Windows 7';
|
||||
}
|
||||
if (false !== stripos($agent, 'win') && preg_match('/nt 6.2/i', $agent)) {
|
||||
return 'Windows 8';
|
||||
}
|
||||
if(false !== stripos($agent, 'win') && preg_match('/nt 10.0/i', $agent)) {
|
||||
return 'Windows 10';
|
||||
}
|
||||
if(false !== stripos($agent, 'win') && preg_match('/nt 11.0/i', $agent)) {
|
||||
return 'Windows 11';
|
||||
}
|
||||
if (false !== stripos($agent, 'win') && preg_match('/nt 5.1/i', $agent)) {
|
||||
return 'Windows XP';
|
||||
}
|
||||
if (false !== stripos($agent, 'linux')) {
|
||||
return 'Linux';
|
||||
}
|
||||
if (false !== stripos($agent, 'mac')) {
|
||||
return 'Mac';
|
||||
}
|
||||
return t('jwt.unknown');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $agent
|
||||
* @return string
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
private function browser($agent): string
|
||||
{
|
||||
if (false !== stripos($agent, "MSIE")) {
|
||||
return 'MSIE';
|
||||
}
|
||||
if (false !== stripos($agent, "Edg")) {
|
||||
return 'Edge';
|
||||
}
|
||||
if (false !== stripos($agent, "Chrome")) {
|
||||
return 'Chrome';
|
||||
}
|
||||
if (false !== stripos($agent, "Firefox")) {
|
||||
return 'Firefox';
|
||||
}
|
||||
if (false !== stripos($agent, "Safari")) {
|
||||
return 'Safari';
|
||||
}
|
||||
if (false !== stripos($agent, "Opera")) {
|
||||
return 'Opera';
|
||||
}
|
||||
return t('jwt.unknown');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Listener;
|
||||
|
||||
use Hyperf\Event\Annotation\Listener;
|
||||
use Hyperf\Event\Contract\ListenerInterface;
|
||||
use Builder\Event\UserDelete;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\SimpleCache\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Class UserDeleteListener
|
||||
* @package App\System\Listener
|
||||
*/
|
||||
#[Listener]
|
||||
class UserDeleteListener implements ListenerInterface
|
||||
{
|
||||
public function listen(): array
|
||||
{
|
||||
return [
|
||||
UserDelete::class
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws InvalidArgumentException
|
||||
* @throws \RedisException
|
||||
*/
|
||||
public function process(object $event): void
|
||||
{
|
||||
$redis = redis();
|
||||
$prefix = config('cache.default.prefix') . 'Token:';
|
||||
$user = user();
|
||||
|
||||
/* @var $event UserDelete */
|
||||
foreach ($event->ids as $uid) {
|
||||
$token = $redis->get($prefix . $uid);
|
||||
$token && $user->getJwt()->logout($token);
|
||||
$redis->del([$prefix . $uid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Mapper;
|
||||
|
||||
use App\System\Model\SettingConfigGroup;
|
||||
use Builder\Abstracts\AbstractMapper;
|
||||
|
||||
class SettingConfigGroupMapper extends AbstractMapper
|
||||
{
|
||||
/**
|
||||
* @var SettingConfigGroup
|
||||
*/
|
||||
public $model;
|
||||
|
||||
public function assignModel()
|
||||
{
|
||||
$this->model = SettingConfigGroup::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组和所属配置
|
||||
* @param int $id
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function deleteGroupAndConfig(int $id): bool
|
||||
{
|
||||
/* @var $model SettingConfigGroup */
|
||||
$model = $this->read($id);
|
||||
$model->configs()->delete();
|
||||
return $model->delete();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Mapper;
|
||||
|
||||
use App\System\Model\SettingConfig;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Builder\Abstracts\AbstractMapper;
|
||||
|
||||
class SettingConfigMapper extends AbstractMapper
|
||||
{
|
||||
/**
|
||||
* @var SettingConfig
|
||||
*/
|
||||
public $model;
|
||||
|
||||
public function assignModel()
|
||||
{
|
||||
$this->model = SettingConfig::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按Key获取配置
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
public function getConfigByKey(string $key): array
|
||||
{
|
||||
$model = $this->model::query()->find($key, [
|
||||
'group_id', 'name', 'key', 'value', 'sort', 'input_type', 'config_select_data'
|
||||
]);
|
||||
return $model ? $model->toArray() : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新配置
|
||||
* @param string $key
|
||||
* @param array $data
|
||||
* @return bool
|
||||
*/
|
||||
public function updateConfig(string $key, array $data): bool
|
||||
{
|
||||
return $this->model::query()->where('key', $key)->update($data) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按 keys 更新配置
|
||||
* @param string $key
|
||||
* @param string|int|bool $value
|
||||
* @return bool
|
||||
*/
|
||||
public function updateByKey(string $key, string|int|bool|null $value = null): bool
|
||||
{
|
||||
return $this->model::query()->where('key', $key)->update(['value' => $value]) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配置
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public function save(array $data): int
|
||||
{
|
||||
$this->filterExecuteAttributes($data);
|
||||
$model = $this->model::create($data);
|
||||
return ($model->{$model->getKeyName()}) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索处理器
|
||||
*/
|
||||
public function handleSearch(Builder $query, array $params): Builder
|
||||
{
|
||||
if (isset($params['group_id']) && !empty($params['group_id'])) {
|
||||
$query->where('group_id', $params['group_id']);
|
||||
}
|
||||
if (isset($params['name']) && !empty($params['name'])) {
|
||||
$query->where('name', $params['name']);
|
||||
}
|
||||
if (isset($params['key']) && !empty($params['key'])) {
|
||||
$query->where('key', 'like', '%'.$params['key'].'%');
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Mapper;
|
||||
|
||||
|
||||
use App\System\Model\SettingCrontabLog;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Builder\Abstracts\AbstractMapper;
|
||||
|
||||
class SettingCrontabLogMapper extends AbstractMapper
|
||||
{
|
||||
/**
|
||||
* @var SettingCrontabLog
|
||||
*/
|
||||
public $model;
|
||||
|
||||
public function assignModel()
|
||||
{
|
||||
$this->model = SettingCrontabLog::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索处理器
|
||||
* @param Builder $query
|
||||
* @param array $params
|
||||
* @return Builder
|
||||
*/
|
||||
public function handleSearch(Builder $query, array $params): Builder
|
||||
{
|
||||
if ($params['crontab_id'] ?? false) {
|
||||
$query->where('crontab_id', $params['crontab_id']);
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Mapper;
|
||||
|
||||
use App\System\Model\SettingCrontab;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Builder\Abstracts\AbstractMapper;
|
||||
use Builder\Annotation\Transaction;
|
||||
|
||||
class SettingCrontabMapper extends AbstractMapper
|
||||
{
|
||||
/**
|
||||
* @var SettingCrontab
|
||||
*/
|
||||
public $model;
|
||||
|
||||
public function assignModel()
|
||||
{
|
||||
$this->model = SettingCrontab::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $ids
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
#[Transaction]
|
||||
public function delete(array $ids): bool
|
||||
{
|
||||
foreach ($ids as $id) {
|
||||
$model = $this->model::find($id);
|
||||
if ($model) {
|
||||
$model->logs()->delete();
|
||||
$model->delete();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索处理器
|
||||
* @param Builder $query
|
||||
* @param array $params
|
||||
* @return Builder
|
||||
*/
|
||||
public function handleSearch(Builder $query, array $params): Builder
|
||||
{
|
||||
if (isset($params['name'])) {
|
||||
$query->where('name', 'like', '%'.$params['name'].'%');
|
||||
}
|
||||
if (isset($params['status'])) {
|
||||
$query->where('status', $params['status']);
|
||||
}
|
||||
if (isset($params['type'])) {
|
||||
$query->where('type', $params['type']);
|
||||
}
|
||||
if (isset($params['created_at']) && is_array($params['created_at']) && count($params['created_at']) == 2) {
|
||||
$query->whereBetween(
|
||||
'created_at',
|
||||
[ $params['created_at'][0] . ' 00:00:00', $params['created_at'][1] . ' 23:59:59' ]
|
||||
);
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Mapper;
|
||||
|
||||
use App\System\Model\SettingGenerateColumns;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Builder\Abstracts\AbstractMapper;
|
||||
|
||||
/**
|
||||
* 生成业务字段信息表查询类
|
||||
* Class SettingGenerateColumnsMapper
|
||||
* @package App\Setting\Mapper
|
||||
*/
|
||||
class SettingGenerateColumnsMapper extends AbstractMapper
|
||||
{
|
||||
/**
|
||||
* @var SettingGenerateColumns
|
||||
*/
|
||||
public $model;
|
||||
|
||||
public function assignModel()
|
||||
{
|
||||
$this->model = SettingGenerateColumns::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索处理器
|
||||
* @param Builder $query
|
||||
* @param array $params
|
||||
* @return Builder
|
||||
*/
|
||||
public function handleSearch(Builder $query, array $params): Builder
|
||||
{
|
||||
if ($params['table_id'] ?? false) {
|
||||
$query->where('table_id', (int) $params['table_id']);
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace App\System\Mapper;
|
||||
|
||||
use App\System\Model\SettingGenerateTables;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Builder\Abstracts\AbstractMapper;
|
||||
use Builder\Annotation\Transaction;
|
||||
|
||||
/**
|
||||
* 生成业务信息表查询类
|
||||
* Class SettingGenerateTablesMapper
|
||||
* @package App\Setting\Mapper
|
||||
*/
|
||||
class SettingGenerateTablesMapper extends AbstractMapper
|
||||
{
|
||||
/**
|
||||
* @var SettingGenerateTables
|
||||
*/
|
||||
public $model;
|
||||
|
||||
public function assignModel()
|
||||
{
|
||||
$this->model = SettingGenerateTables::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除业务信息表和字段信息表
|
||||
* @throws \Exception
|
||||
*/
|
||||
#[Transaction]
|
||||
public function delete(array $ids): bool
|
||||
{
|
||||
/* @var SettingGenerateTables $model */
|
||||
foreach ($this->model::query()->whereIn('id', $ids)->get() as $model) {
|
||||
if ($model) {
|
||||
$model->columns()->delete();
|
||||
$model->delete();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索处理器
|
||||
* @param Builder $query
|
||||
* @param array $params
|
||||
* @return Builder
|
||||
*/
|
||||
public function handleSearch(Builder $query, array $params): Builder
|
||||
{
|
||||
if (isset($params['table_name'])) {
|
||||
$query->where('table_name', 'like', '%'.$params['table_name'].'%');
|
||||
}
|
||||
if (isset($params['minDate']) && isset($params['maxDate'])) {
|
||||
$query->whereBetween(
|
||||
'created_at',
|
||||
[$params['minDate'] . ' 00:00:00', $params['maxDate'] . ' 23:59:59']
|
||||
);
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue