58 Commits

Author SHA1 Message Date
李东云
55e2b0477a chore(release): 0.4.3 2025-09-26 16:52:03 +08:00
李东云
21ddc159aa chore(release): 0.4.2 2025-09-26 16:48:36 +08:00
李东云
98ba4a13dc feat(ci): 添加基于标签的自动发布工作流
- 创建了在打标签时触发的 Gitea 工作流
- 实现了代码检出和文件列表步骤
- 添加了将项目文件打包为 ZIP 的功能
- 配置了向私有注册表发布包的步骤
- 使用环境变量传递版本号和认证信息
- 添加了工作流状态输出便于调试追踪
2025-09-26 16:48:00 +08:00
李东云
bb438b5996 chore: 更新文件权限并添加发布脚本和CI配置
将多个文件的权限从644更改为755以允许执行
添加release.sh和docker-env.sh脚本以支持发布流程
添加Gitea工作流配置文件以实现自动化发布
添加.versionrc文件以规范版本更新日志格式
2025-04-19 09:23:26 +08:00
李东云
5f75dc1afb chore(release): 0.3.4 2023-04-19 03:13:06 +00:00
李东云
0d4e80fe15 docs(admin): 修改了登录的验证文案 2023-04-19 11:11:02 +08:00
李东云
5e327fbbc5 chore(release): 0.3.3 2023-04-18 03:04:22 +00:00
李东云
e60d9174e5 chore(release): 0.4.1 2023-04-18 02:11:07 +00:00
李东云
6330f5e390 fix(scaffold): 修复级联时菜单显示有误的问题 2023-04-18 10:10:16 +08:00
李东云
dfd814c817 chore(release): 0.4.0 2023-04-07 08:36:52 +00:00
李东云
27b5f54d57 build(semver): 初始化版本记录文件 2023-04-07 16:36:48 +08:00
李东云
dabfbdf861 build(hdk): 引入 hdk-core 2023-04-07 16:35:34 +08:00
李东云
e9e6084e97 build(composer): 限制 flysystem-oss 的版本 2023-04-07 16:23:23 +08:00
李东云
3c5b77dda6 build(composer): 限制 flysystem-oss 的版本 2023-04-07 16:15:33 +08:00
李东云
c2b56cf978 build: 工程化项目 2023-04-07 16:14:58 +08:00
李东云
254989e992 build(composer): 最低依赖版本改为 php7.4 2022-08-26 11:02:01 +08:00
李东云
8f5592ecc8 fix(menu): 修复添加菜单不选择权限时候的报错 2022-08-25 14:30:00 +08:00
李东云
710eefc4c6 build(composer): 更新包名 2022-08-25 14:23:00 +08:00
刀刀
c6ab3dbad4 Update README.md 2022-02-17 11:09:12 +08:00
刀刀
a780c3b3b8 Update README.md 2021-12-02 19:31:10 +08:00
刀刀
2b579e8c5f Merge pull request #57 from laoguoyandong/upd_admin_install_install_sql
修改install.sql文件
2021-11-18 17:24:41 +08:00
guoyandong
5084d4596d 修改install.sql文件 2021-11-18 17:09:23 +08:00
daodao97
4b9cea60ff perf: 更新分包中的 hyperf 版本指 2.2 2021-08-30 19:35:13 +08:00
刀刀
c881a36788 Merge pull request #55 from jyiL/patch-5
Update AbstractController.php
2021-08-14 16:09:59 +08:00
daodao97
a1c0372828 perf: upcode 2021-08-14 16:08:56 +08:00
jyiL
572c8a1065 Update AbstractController.php
设置filter的select默认值不生效问题
2021-08-07 10:51:13 +08:00
daodao97
c8a049faeb perf: upgrade to hyperf/* 2.2.0 2021-07-19 16:03:03 +08:00
daodao97
cb2b2b5428 Merge branch 'master' of github.com:hyperf-admin/hyperf-admin 2021-06-26 11:28:27 +08:00
daodao97
8b44c279c1 docs: website 2021-06-26 11:28:11 +08:00
刀刀
8f1df241a4 Merge pull request #53 from AKMCC-hub/master
feat: 脚手架增加group_by语法支持
2021-06-16 09:57:28 +08:00
刀刀
9abd51cc6b Update AbstractController.php 2021-06-16 09:56:41 +08:00
七戒
f4c429ea28 feat: 脚手架增加group_by语法支持 2021-06-15 15:52:14 +08:00
daodao97
839bd1e0b9 fix: tree child api 2021-05-18 17:49:55 +08:00
daodao97
4ccb7200eb Merge branch 'master' of github.com:hyperf-admin/hyperf-admin 2021-05-18 11:47:14 +08:00
daodao97
d79fdca30b fix: move_local_file_to_filesystem chmod 2021-05-18 11:46:30 +08:00
刀刀
11f249669e Update form.md 2021-04-26 09:46:10 +08:00
刀刀
a707dae623 Update README.md 2021-04-22 19:56:56 +08:00
刀刀
d5a7a584df Update install.md 2021-04-22 19:54:31 +08:00
刀刀
c0379e5137 Update README.md 2021-04-22 10:51:12 +08:00
刀刀
bde50ad7e2 Update README.md 2021-04-22 10:31:40 +08:00
daodao97
e4dd791a66 perf: tools 2021-04-21 16:54:21 +08:00
daodao97
5f1bdc834e fix: support custom sort cloumn 2021-04-21 16:25:24 +08:00
daodao97
0798685e90 feat: set readable by all user 2021-04-21 16:22:34 +08:00
三刀
1891c2053b docs: update images 2021-04-12 10:05:55 +08:00
刀刀
89505d63c3 Update AbstractController.php 2021-03-05 22:02:37 +08:00
刀刀
165bfe1a2a Update AbstractController.php 2021-03-05 22:00:29 +08:00
刀刀
5e2314292b Update install.md 2021-02-05 18:04:28 +08:00
daodoa97
c5ee5692f9 docs: add qa 2021-02-05 15:20:57 +08:00
daodoa97
de939c1c42 docs: add qa 2021-02-04 11:43:16 +08:00
daodoa97
5dedcff854 merge: branch 'master' of https://github.com/hyperf-admin/hyperf-admin 2021-02-04 11:23:59 +08:00
daodoa97
7727dd95cf fix: metric default disable 2021-02-04 11:22:47 +08:00
刀刀
1d9e2401fa Update install.md 2021-01-28 14:52:02 +08:00
刀刀
d6216f1830 Merge pull request #41 from wxfjamdc/patch-2
Update User.php
2021-01-23 18:46:30 +08:00
刀刀
78b06154bb Merge pull request #46 from wxfjamdc/patch-4
Update SystemController.php
2021-01-23 18:44:42 +08:00
WxAmd
20b2cb0a70 Update SystemController.php
返回有权限的 system_module
2021-01-23 16:19:08 +08:00
WxAmd
fceeda8203 Update User.php
保存用户信息时 realname 为空自动填充
2020-12-31 15:28:31 +08:00
daodao97
c4ba9db9a5 perf: support hyperf 2.1 2020-12-30 15:44:00 +08:00
daodao97
e614556a31 perf: support hyperf 2.1 2020-12-30 15:39:58 +08:00
84 changed files with 6845 additions and 136 deletions

View File

@@ -0,0 +1,28 @@
name: Release development version to registry
on:
push:
tags:
- '**.**'
jobs:
Publish on Tagged:
runs-on: ubuntu-latest
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Zip files in the repository
run: |
apt-get update
apt-get install zip
zip -r dist.zip *
- name: Publish to registry
run: |
curl --user ch4o5:4fd300672472e666014314c1c94c604c634165a9 \
--upload-file ./dist.zip \
https://nest.doylee.cn/api/packages/HDK/composer?version=${{ gitea.ref_name }}
- run: echo "🍏 This job's status is ${{ job.status }}."

7
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.idea
composer.lock
vendor
.idea/
vendor/
.phpunit.result.cache
.php-cs-fixer.cache

23
.php-cs-fixer.dist.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
/**
* .php-cs-fixer.dist.php@HDK-Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/1/9
*/
$finder = PhpCsFixer\Finder::create()->in([
__DIR__ . '/publish',
__DIR__ . '/src',
__DIR__ . '/tests',
]);
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'strict_param' => true,
'array_syntax' => ['syntax' => 'short'],
])
->setUsingCache(false)
->setFinder($finder);

68
.versionrc Normal file
View File

@@ -0,0 +1,68 @@
{
"header": "# 版本更新日志",
"preMajor": true,
"types": [
{
"type": "feat",
"section": "✨ Features | 新功能"
},
{
"type": "fix",
"section": "🐛 Bug Fixes | Bug 修复"
},
{
"type": "init",
"section": "🎉 Init | 初始化"
},
{
"type": "docs",
"section": "✏️ Documentation | 文档"
},
{
"type": "style",
"section": "💄 Styles | 风格"
},
{
"type": "refactor",
"section": "♻️ Code Refactoring | 代码重构"
},
{
"type": "perf",
"section": "⚡ Performance Improvements | 性能优化"
},
{
"type": "tests",
"section": "✅ Tests | 测试"
},
{
"type": "test",
"section": "✅ Tests | 测试"
},
{
"type": "revert",
"section": "⏪ Revert | 回退"
},
{
"type": "build",
"section": "📦‍ Build System | 打包构建"
},
{
"type": "chore",
"section": "🚀 Chore | 构建/工程依赖/工具"
},
{
"type": "ci",
"section": "👷 Continuous Integration | CI 配置"
}
],
"bumpFiles": [
{
"filename": "VERSION_TRACKER.txt",
"type": "plain-text"
},
{
"filename": "composer.json",
"type": "json"
}
]
}

71
CHANGELOG.md Normal file
View File

@@ -0,0 +1,71 @@
# 版本更新日志
### [0.4.3](http://124.126.16.154:8888/singularity/hyperf-admin/compare/v0.4.2...v0.4.3) (2025-09-26)
### [0.4.2](http://124.126.16.154:8888/singularity/hyperf-admin/compare/v0.3.4...v0.4.2) (2025-09-26)
### 🚀 Chore | 构建/工程依赖/工具
* 更新文件权限并添加发布脚本和CI配置 ([bb438b5](http://124.126.16.154:8888/singularity/hyperf-admin/commit/bb438b59963bb2a1906fc33311bbce85c60db5ce))
### ✨ Features | 新功能
* **ci:** 添加基于标签的自动发布工作流 ([98ba4a1](http://124.126.16.154:8888/singularity/hyperf-admin/commit/98ba4a13dc9d3317351c0c549a94d017ee48d6e0))
### [0.3.4](http://124.126.16.154:8888/singularity/hyperf-admin/compare/v0.3.3...v0.3.4) (2023-04-19)
### ✏️ Documentation | 文档
* **admin:** 修改了登录的验证文案 ([0d4e80f](http://124.126.16.154:8888/singularity/hyperf-admin/commit/0d4e80fe15e0e9a3de447012669ec2045323f1a5))
### [0.3.3](http://124.126.16.154:8888/singularity/hyperf-admin/compare/v0.3.2...v0.3.3) (2023-04-18)
### 📦‍ Build System | 打包构建
* **composer:** 最低依赖版本改为 php7.4 ([254989e](http://124.126.16.154:8888/singularity/hyperf-admin/commit/254989e9922bdb333e57e2cbd69e31464d4de1bf))
* **composer:** 更新包名 ([710eefc](http://124.126.16.154:8888/singularity/hyperf-admin/commit/710eefc4c6a3305c5653841c8f851e0b613f54e2))
* **composer:** 限制 flysystem-oss 的版本 ([e9e6084](http://124.126.16.154:8888/singularity/hyperf-admin/commit/e9e6084e97620dda06cc9bde7fbe5e5162bbf894))
* **composer:** 限制 flysystem-oss 的版本 ([3c5b77d](http://124.126.16.154:8888/singularity/hyperf-admin/commit/3c5b77dda68973e2fac9ce4c32a8cf8803129d33))
* **hdk:** 引入 hdk-core ([dabfbdf](http://124.126.16.154:8888/singularity/hyperf-admin/commit/dabfbdf8612188043b7a4354bbe5c6e518422af9))
* **semver:** 初始化版本记录文件 ([27b5f54](http://124.126.16.154:8888/singularity/hyperf-admin/commit/27b5f54d575ccc26747b00bf8c549c0935fb41d3))
* 工程化项目 ([c2b56cf](http://124.126.16.154:8888/singularity/hyperf-admin/commit/c2b56cf9783cca6f69067a5434d2a0fd19ec89d6))
### 🐛 Bug Fixes | Bug 修复
* **menu:** 修复添加菜单不选择权限时候的报错 ([8f5592e](http://124.126.16.154:8888/singularity/hyperf-admin/commit/8f5592ecc8a93e4749558ba2362ca357151bcf1c))
* **scaffold:** 修复级联时菜单显示有误的问题 ([6330f5e](http://124.126.16.154:8888/singularity/hyperf-admin/commit/6330f5e390f432e2541724219a3297cdcea6fb5a))
### 🚀 Chore | 构建/工程依赖/工具
* **release:** 0.4.0 ([dfd814c](http://124.126.16.154:8888/singularity/hyperf-admin/commit/dfd814c817d38521c764d83cec765ca0886e0467))
* **release:** 0.4.1 ([e60d917](http://124.126.16.154:8888/singularity/hyperf-admin/commit/e60d9174e571a5d71f5a1b5280b336f0b6d05abb))
### [0.4.1](http://124.126.16.154:8888/singularity/hyperf-admin/compare/v0.4.0...v0.4.1) (2023-04-18)
### 🐛 Bug Fixes | Bug 修复
* **scaffold:** 修复级联时菜单显示有误的问题 ([6330f5e](http://124.126.16.154:8888/singularity/hyperf-admin/commit/6330f5e390f432e2541724219a3297cdcea6fb5a))
## [0.4.0](http://124.126.16.154:8888/singularity/hyperf-admin/compare/v0.3.2...v0.4.0) (2023-04-07)
### 🐛 Bug Fixes | Bug 修复
* **menu:** 修复添加菜单不选择权限时候的报错 ([8f5592e](http://124.126.16.154:8888/singularity/hyperf-admin/commit/8f5592ecc8a93e4749558ba2362ca357151bcf1c))
### 📦‍ Build System | 打包构建
* **composer:** 最低依赖版本改为 php7.4 ([254989e](http://124.126.16.154:8888/singularity/hyperf-admin/commit/254989e9922bdb333e57e2cbd69e31464d4de1bf))
* **composer:** 更新包名 ([710eefc](http://124.126.16.154:8888/singularity/hyperf-admin/commit/710eefc4c6a3305c5653841c8f851e0b613f54e2))
* **composer:** 限制 flysystem-oss 的版本 ([e9e6084](http://124.126.16.154:8888/singularity/hyperf-admin/commit/e9e6084e97620dda06cc9bde7fbe5e5162bbf894))
* **composer:** 限制 flysystem-oss 的版本 ([3c5b77d](http://124.126.16.154:8888/singularity/hyperf-admin/commit/3c5b77dda68973e2fac9ce4c32a8cf8803129d33))
* **hdk:** 引入 hdk-core ([dabfbdf](http://124.126.16.154:8888/singularity/hyperf-admin/commit/dabfbdf8612188043b7a4354bbe5c6e518422af9))
* **semver:** 初始化版本记录文件 ([27b5f54](http://124.126.16.154:8888/singularity/hyperf-admin/commit/27b5f54d575ccc26747b00bf8c549c0935fb41d3))
* 工程化项目 ([c2b56cf](http://124.126.16.154:8888/singularity/hyperf-admin/commit/c2b56cf9783cca6f69067a5434d2a0fd19ec89d6))

View File

@@ -6,7 +6,7 @@
> 演示站点部署在`亚马逊免费主机`, 国内访问可能会慢
![HyperfAdmin架构](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/sJaJti.png)
![HyperfAdmin架构](https://gitee.com/daodao97/asset/raw/master/uPic/sJaJti.png)
前端为`vue multiple page`多页模式, 可以按模块打包, 默认包含两个模块`default` 默认模块, `system`系统管理模块, 绝大部分业务组件在`src/components`目录

1
VERSION_TRACKER.txt Normal file
View File

@@ -0,0 +1 @@
0.4.3

View File

@@ -1,30 +0,0 @@
#!/usr/bin/env bash
set -e
set -x
CURRENT_BRANCH="master"
BASEPATH=$(cd `dirname $0`; cd ../src/; pwd)
REPOS=$@
function split()
{
SHA1=`splitsh-lite --prefix=$1`
git push $2 "$SHA1:refs/heads/$CURRENT_BRANCH" -f
}
function remote()
{
git remote add $1 $2 || true
}
if [[ $# -eq 0 ]]; then
REPOS=$(ls $BASEPATH)
fi
for REPO in $REPOS ; do
remote $REPO git@github.com:hyperf-admin/$REPO.git
split "src/$REPO" $REPO
done
git pull origin $CURRENT_BRANCH

View File

@@ -1,42 +1,47 @@
{
"name": "hyperf-admin/hyperf-admin",
"name": "singularity/hyperf-admin",
"description": "hyperf-admin",
"authors": [
{
"name": "ch4o5",
"email": "dongyun.li@luxcreo.ai"
},
{
"name": "daodao97",
"email": "daodao97@foxmail.com"
}
],
"require": {
"php": ">=7.2",
"php": ">=7.4",
"ext-json": "*",
"ext-pdo": "*",
"ext-swoole": ">=4.4",
"aliyuncs/oss-sdk-php": "^2.3",
"box/spout": "^3.1",
"hyperf/amqp": "~2.0.0",
"hyperf/async-queue": "~2.0.0",
"hyperf/cache": "~2.0.0",
"hyperf/command": "~2.0.0",
"hyperf/config": "~2.0.0",
"hyperf/constants": "~2.0.0",
"hyperf/crontab": "~2.0.0",
"hyperf/database": "~2.0.0",
"hyperf/db-connection": "~2.0.0",
"hyperf/amqp": "~2.2.0",
"hyperf/async-queue": "~2.2.0",
"hyperf/cache": "~2.2.0",
"hyperf/command": "~2.2.0",
"hyperf/config": "~2.2.0",
"hyperf/constants": "~2.2.0",
"hyperf/crontab": "~2.2.0",
"hyperf/database": "~2.2.0",
"hyperf/db-connection": "~2.2.0",
"hyperf/filesystem": "^2.0",
"hyperf/framework": "~2.0.0",
"hyperf/guzzle": "~2.0.0",
"hyperf/http-server": "~2.0.0",
"hyperf/logger": "~2.0.0",
"hyperf/memory": "~2.0.0",
"hyperf/metric": "~2.0.0",
"hyperf/nsq": "~2.0.0",
"hyperf/process": "~2.0.0",
"hyperf/redis": "~2.0.0",
"hyperf/snowflake": "~2.0.0",
"hyperf/validation": "~2.0.0",
"hyperf/framework": "~2.2.0",
"hyperf/guzzle": "~2.2.0",
"hyperf/http-server": "~2.2.0",
"hyperf/logger": "~2.2.0",
"hyperf/memory": "~2.2.0",
"hyperf/metric": "~2.2.0",
"hyperf/nsq": "~2.2.0",
"hyperf/process": "~2.2.0",
"hyperf/redis": "~2.2.0",
"hyperf/snowflake": "~2.2.0",
"hyperf/validation": "~2.2.0",
"nette/php-generator": "^3.4",
"xxtime/flysystem-aliyun-oss": "^1.5",
"singularity/hdk-core": "^0.1.6",
"xxtime/flysystem-aliyun-oss": "~1.5.0",
"yadakhov/insert-on-duplicate-key": "^1.2",
"zoujingli/ip2region": "^1.0"
},
@@ -99,6 +104,30 @@
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
}
"sort-packages": true,
"secure-http": false
},
"scripts": {
"post-root-package-install": [],
"test": "vendor/bin/pest $1",
"cs-fix": "vendor/bin/php-cs-fixer fix $1 --rules=@PSR12 --allow-risky=yes",
"analyse": "vendor/bin/phpstan analyse $1",
"ci": [
"@analyse publish/ src/ tests/",
"@cs-fix",
"@test --ci",
"echo CI Success"
]
},
"repositories": {
"lux-map": {
"type": "composer",
"url": "https://satis.luxcreo.cn/"
},
"packagist": {
"type": "composer",
"url": "https://mirrors.cloud.tencent.com/composer/"
}
},
"version": "0.4.3"
}

6134
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
`hyperf-admin`是前后端分离的后台管理系统, 前端基于`vue``vue-admin-template`, 针对后台业务`列表`, `表单`等场景封装了大量业务组件, 后端基于`hyperf`实现, 整体思路是后端定义页面渲染规则, 前端页面渲染时首先拉取配置, 然后组件根据具体配置完成页面渲染, 方便开发者仅做少量的配置工作就能完成常见的`CRUD`工作, 同时支持自定义组件和自定义页面, 以开发更为复杂的页面.
![hyperf-admin架构](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/sJaJti.png)
![hyperf-admin架构](https://gitee.com/daodao97/asset/raw/master/uPic/sJaJti.png)
前端为`vue multiple page`多页模式, 可以按模块打包, 默认包含两个模块`default` 默认模块, `system`系统管理模块, 绝大部分业务组件在`src/components`目录, 前端文档详见 [这里](/frontend/form)
@@ -22,7 +22,7 @@
后端的详细文档见[这里](/backend/scaffold)
### UI预览
![样式预览](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/FW2cCN.png)
![样式预览](https://gitee.com/daodao97/asset/raw/master/uPic/FW2cCN.png)
## 依赖 & 参考

View File

@@ -4,6 +4,7 @@
* [安装](guide/install.md)
* [开发样例](guide/dev_example.md)
* [线上交流](guide/communication.md)
* [常见问题](guide/qa.md)
* 后端
* [脚手架](backend/scaffold.md)
* [表单详解](backend/form.md)

View File

@@ -1,14 +1,57 @@
### 为什么要做 CronCenter
#### 当前定时任务管理的解放方案及问题
1. 系统原生 crontab
- 需要有服务器权限, 有改动都要登录服务器手动操作
2. hyperf/crontab 提供的 基于 swoole/timer 的模拟 crontab
- 定时任务的编排以硬编码的方式放置在配置文件中
- 如果有变动需要 `编码->改配置->CodeReview->部署` 走一遍完整的上限流程
3. AirFlow 等工具
- 诚然也是一种很优秀的解决方案, 但对轻量级的定时任务需求来说有显得过重
### 如何规避上面的问题?
`CronCenter` 的思路是, 在 `hyperf/crontab` 的基础上, 将 `config/autoload/crontab.php` 中的定时任务配置, 迁移到数据库中, 提供后台, 以方便的管理所有定时任务的 `启动`, `停止`, `运行参数`, `单例/多例` 等等, 这样将极大的方便我们对定时任务的管理, 也相对轻量.
#### 具体实现
`hyperf-admin/cron-center` 重载了 `hyperf/crontab` 的关键类 `Hyperf/Crontab/Strategy/Executor`, 具体源码 [cron-center](https://github.com/hyperf-admin/hyperf-admin/blob/master/src/cron-center/src/ConfigProvider.php#L31)
#### 后台概览
![list](https://gitee.com/daodao97/asset/raw/master/imgs/8ynybw.png)
![lQJf50](https://gitee.com/daodao97/asset/raw/master/imgs/lQJf50.png)
#### 使用细节
脚本作业的管理中心, 可以在代码中实现`class`类型, `command`类型的脚本作业, 在后台添加相关任务, 即可在相应脚本机上执行
可以对任务的入口, 执行规划, 执行节点, 执行参数 等进行配置, 也可在列表主动触发任务
作业必须基于`App\Util\CronCenter\ClassJobAbstract`, 或`App/Util/CronCenter/CommandJobAbstract.php`抽象类进行实现, 才可进行执行状态的跟踪
作业必须基于`HyperfAdmin/CronCenter/ClassJobAbstract`, 或`HyperfAdmin/CronCenter/CommandJobAbstract.php`抽象类进行实现, 才可进行执行状态的跟踪
`CronCenter`的实现基于`hyperf-crontab`进行实现, 具体代码在`src/CronCenter`, 更多细节可查看[文档](https://hyperf.wiki/#/zh-cn/crontab)
### 相关配置
开启`cron-center` `config/autoload/crontab.php`
1. 首先要启用 `hyperf/crotnab`
`config/autoload/crontab.php`
```php
[
"enable" => true
// config/autoload/crontab.php
return [
"enable" => true,
...
]
```
2. 启用 `CronCenter`
```php
// config/config.php
return [
"cron_center" => [
"enable" => true,
],
...
]
```
### 此方案的问题
此种模拟式的 `crontab` 有一个很明显的弊端, 也就是任务的 `派遣`, `运行` 等都依赖于服务进程, 也就是服务一旦重启, 运行中的任务都会停止, 如果对任务的运行中断极度敏感, 则不建议使用此种方式.

View File

@@ -60,7 +60,7 @@ php bin/hyperf.php
可以查看到相关安装命令
![qIKtC8](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/qIKtC8.png)
![qIKtC8](https://gitee.com/daodao97/asset/raw/master/uPic/qIKtC8.png)
开发环境执行相应命令, 安装依赖的`db`结构即可, 在此之前请先确认`.env` 中已配置好相应连接信息.

View File

@@ -2,7 +2,7 @@
针对 数据库, `Model`, `Controller` 通用模型, 可以使用后台提供的`代码生成工具`来初始化大部分代码.
![9fnAUL(1)](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/9fnAUL%20%281%29.png)
![9fnAUL(1)](https://gitee.com/daodao97/asset/raw/master/uPic/9fnAUL%20%281%29.png)
连接池对应`config.autoload.databases` 中配置的可用链接, 选择好`连接池`, `数据库`, `表` 后下方表单会根据表结构字段渲染, 完成具体字段的配置, 点击提交.

View File

@@ -36,7 +36,7 @@ CREATE TABLE `config_center` (
#### 2. 创建 `Controller`, `Model`
![wlXctg](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/wlXctg.png)
![wlXctg](https://gitee.com/daodao97/asset/raw/master/uPic/wlXctg.png)
此时基础文件已经生成在`lib/` 下, 作为一个`composer`包模式开发, 我们将其转移至 `/opt/hyperf-admin/config-center`目录
@@ -73,7 +73,7 @@ CREATE TABLE `config_center` (
#### 3. 添加菜单 注册路由
![uAR5lj](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/uAR5lj.png)
![uAR5lj](https://gitee.com/daodao97/asset/raw/master/uPic/uAR5lj.png)
```php
<?php
@@ -87,7 +87,7 @@ register_route('/config_center', ConfigCenterController::class);
?> 若配置有不生效的情况, 执行 `rm vendor/hyperf-admin/config-center && composer require hyperf-admin/config-center` 重新安装即可
![EFvajy](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/EFvajy.png)
![EFvajy](https://gitee.com/daodao97/asset/raw/master/uPic/EFvajy.png)
至此已经完成了, 配置的`CRUD`.

View File

@@ -112,7 +112,7 @@ type表单项类型以下是支持的组件列表以下所有组件 pro
"field_name|字段名" => [
"type" => "textarea",
"props" => [
"row" => 6, // 行数, 默认6
"rows" => 6, // 行数, 默认6
]
]
]

View File

@@ -8,16 +8,16 @@
所以我们的服务一步步的变得膨胀, 变得不稳定, 是时候做出改变了
![Biv9dV](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/Biv9dV.png)
![Biv9dV](https://gitee.com/daodao97/asset/raw/master/uPic/Biv9dV.png)
我们将一些业务边界比较明显, 比较独立的功能, 以微服务的方式拆分出去, 然后注册到主项目上去, 这样我们就可以达到, 既使用一套ui, 又进行服务拆分的目的啦.
`remote_module`的注册也十分简单, `http://localhost:9528/system/#/cconf/cconf_website_config` 在站点管理中增加相应模块的配置即可
![1DIbj0](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/1DIbj0.png)
![1DIbj0](https://gitee.com/daodao97/asset/raw/master/uPic/1DIbj0.png)
然后在`菜单管理`中, 增加相应的模块菜单即可使用啦.
?> 注意 `remote_module` 必须基于`hyperf-admin/admin` 组件构建哦
?> 另外, 主的`HyperfAdmin`项目, 默认包含两个本地模块, `default`, `system`
?> 另外, 主的`HyperfAdmin`项目, 默认包含两个本地模块, `default`, `system`

View File

@@ -3,9 +3,9 @@
我们以 `用户管理` 这个页面功能为例, 讲解如何使用此功能.
先上效果图
![MXURtd](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/MXURtd.png)
![MXURtd](https://gitee.com/daodao97/asset/raw/master/uPic/MXURtd.png)
![rs0BhV](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/rs0BhV.png)
![rs0BhV](https://gitee.com/daodao97/asset/raw/master/uPic/rs0BhV.png)
此时我们只用配置好脚手架配置,即可为第三方服务提供后台页面的管理功能
```json

View File

@@ -1,4 +1,4 @@
我们使用微信群进行交流, 由于群二维码经常过期, 请添加下方个人微信, 拉你进群.
![WechatIMG7](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/WechatIMG7.jpeg ':size=50%')
![WechatIMG7](https://gitee.com/daodao97/asset/raw/master/uPic/WechatIMG7.jpeg ':size=50%')

View File

@@ -2,7 +2,7 @@
### 架构
![hyperf-admin架构](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/sJaJti.png)
![hyperf-admin架构](https://gitee.com/daodao97/asset/raw/master/uPic/sJaJti.png)
前端为`vue multiple page`多页模式, 可以按模块打包, 默认包含两个模块`default` 默认模块, `system`系统管理模块, 绝大部分业务组件在`src/components`目录, 前端文档详见 [这里](/frontend/form)
@@ -24,7 +24,7 @@
后端的详细文档见[这里](/backend/scaffold)
### UI预览
![样式预览](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/FW2cCN.png)
![样式预览](https://gitee.com/daodao97/asset/raw/master/uPic/FW2cCN.png)
### 依赖 & 参考

View File

@@ -48,13 +48,13 @@ CREATE TABLE `student_score` (
2. 通过`DevTools`开发者工具创建 `student_score` 相关的 `Model`, `Controller`
![YPdEli](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/YPdEli.png)
![YPdEli](https://gitee.com/daodao97/asset/raw/master/uPic/YPdEli.png)
选择好相应的表后, 点击提交, 此时工具已经帮我们创建好相应的`app/Controller/StudentScoreController.php`和`app/Model/Test/StudentScore.php`
3. 添加目录和菜单
![cs0SYX](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/cs0SYX.png)
![cs0SYX](https://gitee.com/daodao97/asset/raw/master/uPic/cs0SYX.png)
注册路由
@@ -65,7 +65,7 @@ CREATE TABLE `student_score` (
此时我们也已经完成了基础的`CRUD`开发
![MEoM4p](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/MEoM4p.png)
![MEoM4p](https://gitee.com/daodao97/asset/raw/master/uPic/MEoM4p.png)
哦对了, 还有各种筛选条件呢? 也很简单, 在 `scaffoldOptions` 中增加 `filter`配置即可
@@ -84,7 +84,7 @@ CREATE TABLE `student_score` (
}
```
![u68v1D](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/u68v1D.png)
![u68v1D](https://gitee.com/daodao97/asset/raw/master/uPic/u68v1D.png)
还有, 大家别忘了, 需求中还要去可以按页签显示, 改怎么办呢, 这个ui可有点复杂啊, 不过在`hyperf-admin`里也同样简单
@@ -112,7 +112,7 @@ CREATE TABLE `student_score` (
}
```
![Ax0WWD](https://cdn.jsdelivr.net/gh/daodao97/FigureBed@master/uPic/Ax0WWD.png)
![Ax0WWD](https://gitee.com/daodao97/asset/raw/master/uPic/Ax0WWD.png)
至此我们已经完成了绝大部分的功能开发, 如果使用熟练, 我们应该能在十分钟内完成整个功能的前后端开发, 而且还支持复杂的前端效果.

View File

@@ -30,6 +30,8 @@ cd hyperf-admin
```
#### 2. 移除`hyperf-skeleton`中的日志配置, 因为 `admin` 底层已配置
底层的日志配置见 [base-utils/ConfigProvider](https://github.com/hyperf-admin/hyperf-admin/blob/master/src/base-utils/src/ConfigProvider.php#L22)
```shell
rm config/autoload/logger.php
```
@@ -65,6 +67,12 @@ LOCAL_DB_HOST=localhost
```shell
composer require hyperf-admin/hyperf-admin
```
如果存在依赖包的版本号问题, 注意, 请使用 composer2
```shell
composer require hyperf-admin/hyperf-admin -W
```
!> hyperf-admin 为分包模式, 实际应用中请根据情况安装
#### 6. 初始化`validation`的依赖文档
@@ -79,6 +87,7 @@ php bin/hyperf.php vendor:publish hyperf/validation
'password' => [
'salt' => env('HYPERF_ADMIN_PWD_SALT', 'c093d70f088499c3a837cae00c042f14'), // 用 md5(time()) 获取 salt
]
```
#### 8. 启动
@@ -87,7 +96,7 @@ php bin/hyperf.php vendor:publish hyperf/validation
composer watch
```
## nginx配置
## 生产环境nginx配置
```nginx
upstream backend {

22
docs/guide/qa.md Normal file
View File

@@ -0,0 +1,22 @@
#### 1. 导出服务的进度一直是0
导出任务没有默认启动,有两种方式可以启用他
1. 使用croncenter 的话,在 定时任务的管理后台 增加 export-task 任务即可, 参见[cron-center](http://daodao97.gitee.io/hyperf-admin/#/backend/components/business/cron-center)
2. 未使用croncenter 自己起个进程或定时任务 启动 `HyperfAdmin/Admin/Service/ExportService` 即可
#### 2. 前端页面点击菜单, 不能正常跳转
打开控制台可见如下错
![X6ijLg](https://gitee.com/daodao97/asset/raw/master/imgs/X6ijLg.png)
此时, 保证本地的 `node`, `npm` 为最新版本, 安装依赖时, 不要使用 `cnpm`
然后 `npm i``yarn` 重新安装并启动
#### 3. 点击下载中心的文件链接跳转地址提示需要登录
这里的逻辑是先跳转到 http://hyperf-admin.daodao.run/api/upload/ossprivateurl?key=oss/1/export_task/xxxxx.csv, 由接口 `api/upload/ossprivateurl` 生成临时的下载地址, 也就是我们需要此接口的权限, 如下操作即可
![KwtN0f](https://gitee.com/daodao97/asset/raw/master/imgs/KwtN0f.png)
勾选接口后, 点击提交, 并清理权限缓存
![EsMcs5](https://gitee.com/daodao97/asset/raw/master/imgs/EsMcs5.png)
同理, 其他接口的权限问题也可在此管理

128
guide.md Normal file
View File

@@ -0,0 +1,128 @@
# PHP Package boilerplate project explanation
PHP is a general-purpose server-side scripting language primarily used in web development. Originally created by Rasmus Lerdorf in 1994, it is now by The PHP Development Team.
PHP originally stood for "Personal Home Page", but now stands for "PHP: Hypertext Preprocessor".
## Further Material
- Homepage: [php.net](https://secure.php.net/)
- Documentation: [php.net/docs.php](https://secure.php.net/docs.php)
- PHP: The Right Way: [phptherightway.com](http://www.phptherightway.com/)
- Interactive PHP Tutorial: [learn-php.org](http://www.learn-php.org/)
## Topics, Tools and Terms
PHP packages were traditionally installed via PEAR (PHP Extension and Application Repository), but more recently the standard package and dependency management tool is Composer.
Composer lets us run install commands to add packages to our system, for example `composer require phpunit` would add the unit testing framework PHPUnit to our system.
For instructions on how to install Composer visit [getcomposer.org](https://getcomposer.org/download/).
### Dependency Management
Managing dependencies manually is time-consuming, fortunately Composer can automate this.
We can list our dependencies in a `composer.json` file and run `composer install` to bring these into our project.
An example `composer.json` file looks like this:
```json
{
"name": "example-project",
"require": {
"twig/twig": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^8.4"
}
}
```
The "require" block tells Composer that the Twig templating package is required for production use and can install Twig with a version of 3.x.x (ie. up to, but not including, version 4).
The "require-dev" block tells Composer that PHPUnit is required in development, but not in production.
Dependencies can be added to `composer.json` by
```bash
composer require author/package-name
```
Development dependencies can be added by
```bash
composer require author/package-name --dev
```
Dependencies can be updated to their latest maximum version by running
```bash
composer update
```
Composer will also generate a `composer.lock` file on each `composer update` and the initial `composer install`. This is not meant to be edited directly, it tells Composer to use specific versions of packages - particularly useful when hyhou want your development dependencies to match what you will push to production.
### Testing Tools
There are a number of testing tools available for PHP. The most popular one is [PHPUnit](https://phpunit.de/). PHPUnit follows the classic xUnit approach.
[Behat](http://behat.org/en/latest/) is the most popular behaviour-driven development (BDD) testing framework.
[Codeception](http://codeception.com/) is a framework combining BDD, unit testing, and integration testing, and is cross-compatible with PHPUnit.
In this guide we will be using PHPUnit as the testing framework.
## Directory Structure
A typical directory structure for a PHP project consists of a `src` directory that contains all source files and a `tests` directory that includes all tests. For web applications the publicly accessible files (eg. `index.php`) would reside in a `public` directory which would then be your webservers document root.
Another common convention is having a `bin` directory that may contain executable files to start your application.
- src/
- test/
- public/
- composer.json
- composer.lock
### Naming Conventions
Directory names are in lower case. Class and interface files should be in upper case and match the class or interface names.
Configuration, routes, and publicly accessible files should be in lower case.
For example the class `Example` should be contained in file `Example.php`, the publicly accessible route to the application should be `index.php`.
Tests match their production code file names with a `Test` suffix, e.g. tests for code in `src/Example.php` should be written in `test/ExampleTest.php`.
## Example Project
The main application consists of basically two files:
- `public/example.php` is the main executable that instantiates and runs:
- `src/Example/Greeting.php` contains the main application.
### Running the Tests
All tests can be run by executing
```bash
vendor/phpunit/phpunit/phpunit
```
`phpunit` will automatically find all tests inside the `test` directory and run them based on the configuration in the `phpunit.xml` file.
#### Testing Approach
The test for the class `Greeting` verifies that the return value of the `sayHello` method returns the string "Hello {name}", where {name} is the value passed through to the constructor.
### Running the Application
PHP has an in-built server for local development. To run this change into the directory `public` and run
```bash
php -S localhost:8000
```
Then open your browser at `http://localhost:8000/example.php`
You should see the text "Hello Ada Lovelace" being printed.

13
phpstan.dist.neon Normal file
View File

@@ -0,0 +1,13 @@
parameters:
level: 6
reportUnmatchedIgnoredErrors: false
checkGenericClassInNonGenericObjectType: false
paths:
- publish
- src
- tests
ignoreErrors:
- '#Constant BASE_PATH not found#'
- '#Property [a-zA-Z0-9\\_]+::\$[a-zA-Z0-9]+ is never written, only read\.#'
- '#Method [a-zA-Z0-9\\_]+::[a-zA-Z0-9]+\(\) is unused\.#'
- '#Method [a-zA-Z0-9\\_]+::[a-zA-Z0-9]+\(\) has parameter \$response with no value type specified in iterable type array\.#'

10
phpunit.xml Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php"
colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
<coverage/>
<testsuites>
<testsuite name="Unit">
<directory>./tests/Unit/</directory>
</testsuite>
</testsuites>
</phpunit>

10
scripts/docker-env.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env sh
docker run \
--pull always \
-ti --rm --name "hdk-admin" \
-w "/srv/www" \
-v "$(pwd)":/srv/www \
-v ~/.ssh:/root/.ssh \
-v ~/.gitconfig:/root/.gitconfig \
harbor.luxcreo.cn/library/hyperf:7.4-swoole /bin/ash

5
scripts/release.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
docker run --rm -it \
-v $(pwd):/app -e "GIT_AUTHOR_NAME=$(git config user.name)" -e "EMAIL=$(git config user.email)" \
detouched/standard-version:latest $1

View File

@@ -0,0 +1,28 @@
name: Release development version to registry
on:
push:
tags:
- '**.**'
jobs:
Publish on Tagged:
runs-on: ubuntu-latest
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Zip files in the repository
run: |
apt-get update
apt-get install zip
zip -r dist.zip *
- name: Publish to registry
run: |
curl --user ch4o5:4fd300672472e666014314c1c94c604c634165a9 \
--upload-file ./dist.zip \
https://nest.doylee.cn/api/packages/HDK/composer?version=${{ gitea.ref_name }}
- run: echo "🍏 This job's status is ${{ job.status }}."

68
src/admin/.versionrc Normal file
View File

@@ -0,0 +1,68 @@
{
"header": "# 版本更新日志",
"preMajor": true,
"types": [
{
"type": "feat",
"section": "✨ Features | 新功能"
},
{
"type": "fix",
"section": "🐛 Bug Fixes | Bug 修复"
},
{
"type": "init",
"section": "🎉 Init | 初始化"
},
{
"type": "docs",
"section": "✏️ Documentation | 文档"
},
{
"type": "style",
"section": "💄 Styles | 风格"
},
{
"type": "refactor",
"section": "♻️ Code Refactoring | 代码重构"
},
{
"type": "perf",
"section": "⚡ Performance Improvements | 性能优化"
},
{
"type": "tests",
"section": "✅ Tests | 测试"
},
{
"type": "test",
"section": "✅ Tests | 测试"
},
{
"type": "revert",
"section": "⏪ Revert | 回退"
},
{
"type": "build",
"section": "📦‍ Build System | 打包构建"
},
{
"type": "chore",
"section": "🚀 Chore | 构建/工程依赖/工具"
},
{
"type": "ci",
"section": "👷 Continuous Integration | CI 配置"
}
],
"bumpFiles": [
{
"filename": "VERSION_TRACKER.txt",
"type": "plain-text"
},
{
"filename": "composer.json",
"type": "json"
}
]
}

0
src/admin/README.md Normal file → Executable file
View File

4
src/admin/composer.json Normal file → Executable file
View File

@@ -1,5 +1,5 @@
{
"name": "hyperf-admin/admin",
"name": "hdk/hdk-admin",
"type": "project",
"license": "MIT",
"authors": [
@@ -28,4 +28,4 @@
"config": "HyperfAdmin\\Admin\\ConfigProvider"
}
}
}
}

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env sh
docker run \
--pull always \
-ti --rm --name "hdk-admin" \
-w "/srv/www" \
-v "$(pwd)":/srv/www \
-v ~/.ssh:/root/.ssh \
harbor.luxcreo.cn/library/hyperf:7.4-swoole /bin/ash

5
src/admin/scripts/release.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
docker run --rm -it \
-v $(pwd):/app -e "GIT_AUTHOR_NAME=ch4o5" -e "EMAIL=li_dongyun@outlook.com" \
detouched/standard-version:latest $1

0
src/admin/src/ConfigProvider.php Normal file → Executable file
View File

0
src/admin/src/Controller/AdminAbstractController.php Normal file → Executable file
View File

0
src/admin/src/Controller/CommonConfigController.php Normal file → Executable file
View File

0
src/admin/src/Controller/LogController.php Normal file → Executable file
View File

2
src/admin/src/Controller/MenuController.php Normal file → Executable file
View File

@@ -201,7 +201,7 @@ class MenuController extends AdminAbstractController
],
'permission|权限标识' => [
'type' => 'select',
'default' => [],
'default' => '',
'props' => [
'multiple' => true,
'selectApi' => '/system/routes?module={module}'

0
src/admin/src/Controller/RoleController.php Normal file → Executable file
View File

2
src/admin/src/Controller/SystemController.php Normal file → Executable file
View File

@@ -30,7 +30,7 @@ class SystemController extends AdminAbstractController
$user_id = $this->auth_service->get('id');
$modules = $this->permission_service->getModules($user_id);
$config['system_module'] = array_filter($config['system_module'], function ($item) use ($modules) {
return !in_array($item['name'], $modules);
return in_array($item['name'], $modules);
});
}

0
src/admin/src/Controller/UploadController.php Normal file → Executable file
View File

4
src/admin/src/Controller/UserController.php Normal file → Executable file
View File

@@ -205,10 +205,10 @@ class UserController extends AdminAbstractController
}
$user = $this->getModel()->where('username', $username)->first();
if (!$user || $user['status'] !== YES) {
return $this->fail(ErrorCode::CODE_ERR_PARAM, '该用户不存在或已被禁用');
return $this->fail(ErrorCode::CODE_ERR_PARAM, 'Incorrect or invalid username');
}
if ($user->password !== $this->passwordHash($password)) {
return $this->fail(ErrorCode::CODE_ERR_PARAM);
return $this->fail(ErrorCode::CODE_ERR_PARAM, 'Incorrect password');
}
$data = [
'iat' => Carbon::now()->timestamp,

0
src/admin/src/Crontab/ExportTask.php Normal file → Executable file
View File

0
src/admin/src/Install/InstallCommand.php Normal file → Executable file
View File

0
src/admin/src/Install/UpdateCommand.php Normal file → Executable file
View File

2
src/admin/src/Install/install.sql Normal file → Executable file
View File

@@ -56,7 +56,7 @@ CREATE TABLE `front_routes` (
`scaffold_action` varchar(255) NOT NULL DEFAULT '' COMMENT '脚手架预置权限',
`config` text COMMENT '配置化脚手架',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8mb4 COMMENT='前端路由(菜单)';;
) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8mb4 COMMENT='前端路由(菜单)';
CREATE TABLE `global_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,

0
src/admin/src/Middleware/AuthMiddleware.php Normal file → Executable file
View File

0
src/admin/src/Middleware/PermissionMiddleware.php Normal file → Executable file
View File

0
src/admin/src/Model/CommonConfig.php Normal file → Executable file
View File

0
src/admin/src/Model/ExportTasks.php Normal file → Executable file
View File

0
src/admin/src/Model/FrontRoutes.php Normal file → Executable file
View File

0
src/admin/src/Model/GlobalConfig.php Normal file → Executable file
View File

0
src/admin/src/Model/OperatorLog.php Normal file → Executable file
View File

0
src/admin/src/Model/RequestLog.php Normal file → Executable file
View File

0
src/admin/src/Model/Role.php Normal file → Executable file
View File

0
src/admin/src/Model/RoleMenu.php Normal file → Executable file
View File

5
src/admin/src/Model/User.php Normal file → Executable file
View File

@@ -82,4 +82,9 @@ class User extends BaseModel
{
return $value ?: $this->username;
}
public function setRealnameAttribute($value)
{
$this->attributes['realname'] = $value ?: $this->username;
}
}

0
src/admin/src/Model/UserRole.php Normal file → Executable file
View File

0
src/admin/src/Model/Version.php Normal file → Executable file
View File

0
src/admin/src/Model/Versionable.php Normal file → Executable file
View File

0
src/admin/src/Service/AuthService.php Normal file → Executable file
View File

0
src/admin/src/Service/CommonConfig.php Normal file → Executable file
View File

0
src/admin/src/Service/ExportService.php Normal file → Executable file
View File

0
src/admin/src/Service/GlobalConfig.php Normal file → Executable file
View File

0
src/admin/src/Service/Menu.php Normal file → Executable file
View File

0
src/admin/src/Service/ModuleProxy.php Normal file → Executable file
View File

0
src/admin/src/Service/OperatorLogService.php Normal file → Executable file
View File

0
src/admin/src/Service/PermissionService.php Normal file → Executable file
View File

0
src/admin/src/Service/UserService.php Normal file → Executable file
View File

0
src/admin/src/config/config.php Normal file → Executable file
View File

0
src/admin/src/config/routes.php Normal file → Executable file
View File

0
src/admin/src/funcs/common.php Normal file → Executable file
View File

View File

@@ -9,8 +9,8 @@
}
],
"require": {
"hyperf/async-queue": "~2.0.0",
"hyperf/process": "~2.0.0",
"hyperf/async-queue": "~2.2.0",
"hyperf/process": "~2.2.0",
"hyperf-admin/rule-engine": "dev-master"
},
"autoload": {

View File

@@ -9,38 +9,38 @@
}
],
"require": {
"php": ">=7.2",
"php": ">=7.3",
"ext-json": "*",
"ext-pdo": "*",
"ext-swoole": ">=4.4",
"ext-yaml": "*",
"aliyuncs/oss-sdk-php": "^2.3",
"box/spout": "^3.1",
"hyperf/amqp": "~2.0.0",
"hyperf/cache": "~2.0.0",
"hyperf/command": "~2.0.0",
"hyperf/config": "~2.0.0",
"hyperf/constants": "~2.0.0",
"hyperf/database": "~2.0.0",
"hyperf/db-connection": "~2.0.0",
"hyperf/filesystem": "~2.0.0",
"hyperf/framework": "~2.0.0",
"hyperf/guzzle": "~2.0.0",
"hyperf/http-server": "~2.0.0",
"hyperf/logger": "~2.0.0",
"hyperf/memory": "~2.0.0",
"hyperf/metric": "~2.0.0",
"hyperf/nsq": "~2.0.0",
"hyperf/process": "~2.0.0",
"hyperf/redis": "~2.0.0",
"hyperf/snowflake": "~2.0.0",
"hyperf/amqp": "~2.2.0",
"hyperf/cache": "~2.2.0",
"hyperf/command": "~2.2.0",
"hyperf/config": "~2.2.0",
"hyperf/constants": "~2.2.0",
"hyperf/database": "~2.2.0",
"hyperf/db-connection": "~2.2.0",
"hyperf/filesystem": "~2.2.0",
"hyperf/framework": "~2.2.0",
"hyperf/guzzle": "~2.2.0",
"hyperf/http-server": "~2.2.0",
"hyperf/logger": "~2.2.0",
"hyperf/memory": "~2.2.0",
"hyperf/metric": "~2.2.0",
"hyperf/nsq": "~2.2.0",
"hyperf/process": "~2.2.0",
"hyperf/redis": "~2.2.0",
"hyperf/snowflake": "~2.2.0",
"yadakhov/insert-on-duplicate-key": "^1.2"
},
"require-dev": {
"swoft/swoole-ide-helper": "^4.2",
"phpstan/phpstan": "^0.11.2",
"hyperf/devtool": "~2.0.0",
"hyperf/testing": "~2.0.0",
"hyperf/devtool": "~2.2.0",
"hyperf/testing": "~2.2.0",
"daodao97/hyperf-watch": "dev-master",
"symfony/var-dumper": "^5.0"
},

View File

@@ -88,6 +88,9 @@ class ConfigProvider
HttpLogMiddleware::class,
],
],
'metric' => [
'use_standalone_process' => false
],
'redis' => [
'metric' => [
'host' => env('REDIS_ALERT_MANAGER_HOST', 'localhost'),

View File

@@ -85,6 +85,9 @@ if (!function_exists('move_local_file_to_filesystem')) {
if ($private) {
$filesystem->setVisibility($save_file_path, AdapterInterface::VISIBILITY_PRIVATE);
}
if (method_exists($filesystem, 'chmod')) {
$filesystem->chmod($save_file_path, 0644);
}
$meta = $filesystem->getMetadata($save_file_path);
switch (config("file.storage.{$bucket}.driver")) {
case \Hyperf\Filesystem\Adapter\LocalAdapterFactory::class:

View File

@@ -148,7 +148,10 @@ abstract class AbstractController extends Controller
if (isset($item[0])) {
$buttons[$key] = $this->buttonConfigConvert($item);
}
}
if (isset($item['method'])) {
$buttons[$key]['method'] = $item['method'];
}
}
return $buttons;
}
@@ -200,8 +203,12 @@ abstract class AbstractController extends Controller
}
}
$order_by = $this->options['order_by'] ?? '';
$group_by = $this->options['group_by'] ?? '';
if ($sortColumn = $this->request->input('_sort_column') && $sortType = $this->request->input('_sort_type')) {
$order_by = $sortColumn . ' ' . $sortType;
}
if (empty($conditions) && !($this->options['defaultList'] ?? true)) {
return compact('page', 'size', 'conditions', 'order_by', 'columns', 'table_options');
return compact('page', 'size', 'conditions', 'order_by', 'columns', 'table_options', 'group_by');
}
if (method_exists($this, 'beforeListQuery')) {
$hook_params = get_class_method_params_name($this, 'beforeListQuery');
@@ -209,9 +216,11 @@ abstract class AbstractController extends Controller
$this->beforeListQuery($conditions, $order_by);
} elseif (count($hook_params) === 1) {
$this->beforeListQuery($conditions);
} elseif (count($hook_params) === 4) {
$this->beforeListQuery($conditions, $order_by, $group_by, $columns);
}
}
return compact('page', 'size', 'conditions', 'order_by', 'columns', 'table_options');
return compact('page', 'size', 'conditions', 'order_by', 'columns', 'table_options', 'group_by');
}
/**
@@ -226,13 +235,25 @@ abstract class AbstractController extends Controller
$order_by,
$columns,
$tableOptions,
$group_by
] = array_values($this->makeWhere());
$entity = $this->getEntity();
$count = $entity->count($conditions);
if ($group_by) {
$entity->getModel()->groupBy($group_by);
$count_query = clone $entity;
$count = $count_query->getModel()->select(
gettype($group_by) == 'array' ? $group_by[0] : $group_by,
DB::raw('count(*) as total')
)->get()->count();
} else {
$count = $entity->count($conditions);
}
$list = [];
if ($count) {
$attr['select'] = $columns;
$order_by && $attr['order_by'] = $order_by;
$group_by && $attr['group_by'] = $group_by;
$list = $entity->list($conditions, $attr, $page, $size);
}
$list = $this->listFilter($list, $tableOptions);
@@ -384,7 +405,8 @@ abstract class AbstractController extends Controller
$order_by = $this->options['order_by'] ?? '';
$attr['select'] = $columns;
$order_by && $attr['order_by'] = $order_by;
$childs = $this->getEntity()->list(['pid' => $id], $attr);
$parent_key = $this->options['table']['tree']['pid'] ?? 'pid';
$childs = $this->getEntity()->list([$parent_key => $id], $attr);
foreach ($tableOptions as $item) {
if (!isset($item['render'])) {
continue;
@@ -805,7 +827,8 @@ abstract class AbstractController extends Controller
switch ($_form['type']) {
case 'checkbox':
case 'cascader':
$_form['value'] = array_map('intval', is_array($_form['value']) ? $_form['value'] : (array)$_form['value']);
// $_form['value'] = array_map('intval', is_array($_form['value']) ? $_form['value'] : (array)$_form['value']);
$_form['value'] = (array)$_form['value'];
break;
case 'image':
$biz['props']['limit'] = $biz['props']['limit'] ?? 1;
@@ -893,7 +916,6 @@ abstract class AbstractController extends Controller
])
&& isset($_form['options'])) {
$_form['type'] = 'select';
unset($_form['value']);
$options_labels = array_column($_form['options'], 'label');
if (!isset($_form['props']['selectApi']) && !in_array('全部', $options_labels)) {
array_unshift($_form['options'], [

View File

@@ -44,7 +44,7 @@ class ProviderConfig
$providers = array_values($package);
usort($providers, function ($a, $b) {
return $a['weight'] > $b['weight'];
return intval($a['weight'] > $b['weight']);
});
$providers = array_column($providers, 'provider');
static::$providerConfigs = static::loadProviders($providers);

View File

@@ -10,10 +10,10 @@
}
],
"require": {
"hyperf/crontab": "~2.0.0",
"hyperf/process": "~2.0.0",
"hyperf/command": "~2.0.0",
"hyperf/event": "~2.0.0",
"hyperf/crontab": "~2.2.0",
"hyperf/process": "~2.2.0",
"hyperf/command": "~2.2.0",
"hyperf/event": "~2.2.0",
"hyperf-admin/base-utils": "dev-master"
},
"autoload": {

View File

@@ -9,8 +9,8 @@
}
],
"require": {
"hyperf/process": "~2.0.0",
"hyperf/amqp": "~2.0.0"
"hyperf/process": "~2.2.0",
"hyperf/amqp": "~2.2.0"
},
"autoload": {
"psr-4": {

View File

@@ -9,11 +9,11 @@
}
],
"require": {
"php": ">=7.2",
"hyperf/amqp": "~2.0.0",
"hyperf/crontab": "~2.0.0",
"hyperf/nsq": "~2.0.0",
"hyperf/process": "~2.0.0"
"php": ">=7.3",
"hyperf/amqp": "~2.2.0",
"hyperf/crontab": "~2.2.0",
"hyperf/nsq": "~2.2.0",
"hyperf/process": "~2.2.0"
},
"autoload": {
"psr-4": {

View File

@@ -9,7 +9,7 @@
}
],
"require": {
"hyperf/validation": "~2.0.0",
"hyperf/validation": "~2.2.0",
"hyperf-admin/base-utils": "dev-master"
},
"autoload": {