mirror of
http://124.126.16.154:8888/singularity/hyperf-admin.git
synced 2026-01-15 07:15:06 +08:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44105f8e47 | ||
|
|
db34c59acc | ||
|
|
43275f365c | ||
|
|
ff7e959daa | ||
|
|
55e2b0477a | ||
|
|
21ddc159aa | ||
|
|
98ba4a13dc | ||
|
|
bb438b5996 | ||
|
|
5f75dc1afb | ||
|
|
0d4e80fe15 | ||
|
|
5e327fbbc5 | ||
|
|
e60d9174e5 | ||
|
|
6330f5e390 | ||
|
|
dfd814c817 | ||
|
|
27b5f54d57 | ||
|
|
dabfbdf861 | ||
|
|
e9e6084e97 | ||
|
|
3c5b77dda6 | ||
|
|
c2b56cf978 | ||
|
|
254989e992 | ||
|
|
8f5592ecc8 | ||
|
|
710eefc4c6 | ||
|
|
c6ab3dbad4 | ||
|
|
a780c3b3b8 | ||
|
|
2b579e8c5f | ||
|
|
5084d4596d | ||
|
|
4b9cea60ff | ||
|
|
c881a36788 | ||
|
|
a1c0372828 | ||
|
|
572c8a1065 | ||
|
|
c8a049faeb | ||
|
|
cb2b2b5428 | ||
|
|
8b44c279c1 | ||
|
|
8f1df241a4 | ||
|
|
9abd51cc6b | ||
|
|
f4c429ea28 | ||
|
|
839bd1e0b9 | ||
|
|
4ccb7200eb | ||
|
|
d79fdca30b | ||
|
|
11f249669e | ||
|
|
a707dae623 | ||
|
|
d5a7a584df | ||
|
|
c0379e5137 | ||
|
|
bde50ad7e2 | ||
|
|
e4dd791a66 |
30
.gitea/workflows/publish_on_tagged.yml
Normal file
30
.gitea/workflows/publish_on_tagged.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
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: |
|
||||
sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list
|
||||
sed -i 's|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list
|
||||
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
7
.gitignore
vendored
@@ -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
23
.php-cs-fixer.dist.php
Normal 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
68
.versionrc
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
85
CHANGELOG.md
Normal file
85
CHANGELOG.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# 版本更新日志
|
||||
### [0.5.1](http://124.126.16.154:8888/singularity/hyperf-admin/compare/v0.5.0...v0.5.1) (2025-09-26)
|
||||
|
||||
|
||||
### 🚀 Chore | 构建/工程依赖/工具
|
||||
|
||||
* **workflow:** 更新发布工作流配置 ([db34c59](http://124.126.16.154:8888/singularity/hyperf-admin/commit/db34c59acc7825f6f10298b4a3ce34500639fe24))
|
||||
|
||||
## [0.5.0](http://124.126.16.154:8888/singularity/hyperf-admin/compare/v0.4.3...v0.5.0) (2025-09-26)
|
||||
|
||||
|
||||
### 🚀 Chore | 构建/工程依赖/工具
|
||||
|
||||
* **workflow:** 修改发布任务名称 ([ff7e959](http://124.126.16.154:8888/singularity/hyperf-admin/commit/ff7e959daaec12a3f8fa5b52054f3ab2b5d13612))
|
||||
|
||||
### [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))
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
> 演示站点部署在`亚马逊免费主机`, 国内访问可能会慢
|
||||
|
||||

|
||||

|
||||
|
||||
前端为`vue multiple page`多页模式, 可以按模块打包, 默认包含两个模块`default` 默认模块, `system`系统管理模块, 绝大部分业务组件在`src/components`目录
|
||||
|
||||
|
||||
1
VERSION_TRACKER.txt
Normal file
1
VERSION_TRACKER.txt
Normal file
@@ -0,0 +1 @@
|
||||
0.5.1
|
||||
30
bin/split.sh
30
bin/split.sh
@@ -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
|
||||
@@ -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.3",
|
||||
"php": ">=7.4",
|
||||
"ext-json": "*",
|
||||
"ext-pdo": "*",
|
||||
"ext-swoole": ">=4.4",
|
||||
"aliyuncs/oss-sdk-php": "^2.3",
|
||||
"box/spout": "^3.1",
|
||||
"hyperf/amqp": "~2.1.0",
|
||||
"hyperf/async-queue": "~2.1.0",
|
||||
"hyperf/cache": "~2.1.0",
|
||||
"hyperf/command": "~2.1.0",
|
||||
"hyperf/config": "~2.1.0",
|
||||
"hyperf/constants": "~2.1.0",
|
||||
"hyperf/crontab": "~2.1.0",
|
||||
"hyperf/database": "~2.1.0",
|
||||
"hyperf/db-connection": "~2.1.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.1.0",
|
||||
"hyperf/guzzle": "~2.1.0",
|
||||
"hyperf/http-server": "~2.1.0",
|
||||
"hyperf/logger": "~2.1.0",
|
||||
"hyperf/memory": "~2.1.0",
|
||||
"hyperf/metric": "~2.1.0",
|
||||
"hyperf/nsq": "~2.1.0",
|
||||
"hyperf/process": "~2.1.0",
|
||||
"hyperf/redis": "~2.1.0",
|
||||
"hyperf/snowflake": "~2.1.0",
|
||||
"hyperf/validation": "~2.1.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.5.1"
|
||||
}
|
||||
|
||||
6134
composer.lock
generated
Normal file
6134
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -112,7 +112,7 @@ type:表单项类型,以下是支持的组件列表,以下所有组件 pro
|
||||
"field_name|字段名" => [
|
||||
"type" => "textarea",
|
||||
"props" => [
|
||||
"row" => 6, // 行数, 默认6
|
||||
"rows" => 6, // 行数, 默认6
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
@@ -70,7 +70,7 @@ composer require hyperf-admin/hyperf-admin
|
||||
|
||||
如果存在依赖包的版本号问题, 注意, 请使用 composer2
|
||||
```shell
|
||||
composer require hyperf-admin/hyperf-admin:0.2.0 --with-all-dependencies
|
||||
composer require hyperf-admin/hyperf-admin -W
|
||||
```
|
||||
|
||||
!> hyperf-admin 为分包模式, 实际应用中请根据情况安装
|
||||
|
||||
128
guide.md
Normal file
128
guide.md
Normal 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
13
phpstan.dist.neon
Normal 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
10
phpunit.xml
Normal 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
10
scripts/docker-env.sh
Executable 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
5
scripts/release.sh
Executable 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
|
||||
28
src/admin/.gitea/workflows/publish_on_tagged.yml
Normal file
28
src/admin/.gitea/workflows/publish_on_tagged.yml
Normal 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
68
src/admin/.versionrc
Normal 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
0
src/admin/README.md
Normal file → Executable file
4
src/admin/composer.json
Normal file → Executable file
4
src/admin/composer.json
Normal file → Executable 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
src/admin/scripts/docker-env.sh
Executable file
9
src/admin/scripts/docker-env.sh
Executable 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
5
src/admin/scripts/release.sh
Executable 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
0
src/admin/src/ConfigProvider.php
Normal file → Executable file
0
src/admin/src/Controller/AdminAbstractController.php
Normal file → Executable file
0
src/admin/src/Controller/AdminAbstractController.php
Normal file → Executable file
0
src/admin/src/Controller/CommonConfigController.php
Normal file → Executable file
0
src/admin/src/Controller/CommonConfigController.php
Normal file → Executable file
0
src/admin/src/Controller/LogController.php
Normal file → Executable file
0
src/admin/src/Controller/LogController.php
Normal file → Executable file
2
src/admin/src/Controller/MenuController.php
Normal file → Executable file
2
src/admin/src/Controller/MenuController.php
Normal file → Executable 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
0
src/admin/src/Controller/RoleController.php
Normal file → Executable file
0
src/admin/src/Controller/SystemController.php
Normal file → Executable file
0
src/admin/src/Controller/SystemController.php
Normal file → Executable file
0
src/admin/src/Controller/UploadController.php
Normal file → Executable file
0
src/admin/src/Controller/UploadController.php
Normal file → Executable file
4
src/admin/src/Controller/UserController.php
Normal file → Executable file
4
src/admin/src/Controller/UserController.php
Normal file → Executable 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
0
src/admin/src/Crontab/ExportTask.php
Normal file → Executable file
0
src/admin/src/Install/InstallCommand.php
Normal file → Executable file
0
src/admin/src/Install/InstallCommand.php
Normal file → Executable file
0
src/admin/src/Install/UpdateCommand.php
Normal file → Executable file
0
src/admin/src/Install/UpdateCommand.php
Normal file → Executable file
2
src/admin/src/Install/install.sql
Normal file → Executable file
2
src/admin/src/Install/install.sql
Normal file → Executable 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
0
src/admin/src/Middleware/AuthMiddleware.php
Normal file → Executable file
0
src/admin/src/Middleware/PermissionMiddleware.php
Normal file → Executable file
0
src/admin/src/Middleware/PermissionMiddleware.php
Normal file → Executable file
0
src/admin/src/Model/CommonConfig.php
Normal file → Executable file
0
src/admin/src/Model/CommonConfig.php
Normal file → Executable file
0
src/admin/src/Model/ExportTasks.php
Normal file → Executable file
0
src/admin/src/Model/ExportTasks.php
Normal file → Executable file
0
src/admin/src/Model/FrontRoutes.php
Normal file → Executable file
0
src/admin/src/Model/FrontRoutes.php
Normal file → Executable file
0
src/admin/src/Model/GlobalConfig.php
Normal file → Executable file
0
src/admin/src/Model/GlobalConfig.php
Normal file → Executable file
0
src/admin/src/Model/OperatorLog.php
Normal file → Executable file
0
src/admin/src/Model/OperatorLog.php
Normal file → Executable file
0
src/admin/src/Model/RequestLog.php
Normal file → Executable file
0
src/admin/src/Model/RequestLog.php
Normal file → Executable file
0
src/admin/src/Model/Role.php
Normal file → Executable file
0
src/admin/src/Model/Role.php
Normal file → Executable file
0
src/admin/src/Model/RoleMenu.php
Normal file → Executable file
0
src/admin/src/Model/RoleMenu.php
Normal file → Executable file
0
src/admin/src/Model/User.php
Normal file → Executable file
0
src/admin/src/Model/User.php
Normal file → Executable file
0
src/admin/src/Model/UserRole.php
Normal file → Executable file
0
src/admin/src/Model/UserRole.php
Normal file → Executable file
0
src/admin/src/Model/Version.php
Normal file → Executable file
0
src/admin/src/Model/Version.php
Normal file → Executable file
0
src/admin/src/Model/Versionable.php
Normal file → Executable file
0
src/admin/src/Model/Versionable.php
Normal file → Executable file
0
src/admin/src/Service/AuthService.php
Normal file → Executable file
0
src/admin/src/Service/AuthService.php
Normal file → Executable file
0
src/admin/src/Service/CommonConfig.php
Normal file → Executable file
0
src/admin/src/Service/CommonConfig.php
Normal file → Executable file
0
src/admin/src/Service/ExportService.php
Normal file → Executable file
0
src/admin/src/Service/ExportService.php
Normal file → Executable file
0
src/admin/src/Service/GlobalConfig.php
Normal file → Executable file
0
src/admin/src/Service/GlobalConfig.php
Normal file → Executable file
0
src/admin/src/Service/Menu.php
Normal file → Executable file
0
src/admin/src/Service/Menu.php
Normal file → Executable file
0
src/admin/src/Service/ModuleProxy.php
Normal file → Executable file
0
src/admin/src/Service/ModuleProxy.php
Normal file → Executable file
0
src/admin/src/Service/OperatorLogService.php
Normal file → Executable file
0
src/admin/src/Service/OperatorLogService.php
Normal file → Executable file
0
src/admin/src/Service/PermissionService.php
Normal file → Executable file
0
src/admin/src/Service/PermissionService.php
Normal file → Executable file
0
src/admin/src/Service/UserService.php
Normal file → Executable file
0
src/admin/src/Service/UserService.php
Normal file → Executable file
0
src/admin/src/config/config.php
Normal file → Executable file
0
src/admin/src/config/config.php
Normal file → Executable file
0
src/admin/src/config/routes.php
Normal file → Executable file
0
src/admin/src/config/routes.php
Normal file → Executable file
0
src/admin/src/funcs/common.php
Normal file → Executable file
0
src/admin/src/funcs/common.php
Normal file → Executable file
@@ -9,8 +9,8 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"hyperf/async-queue": "~2.1.0",
|
||||
"hyperf/process": "~2.1.0",
|
||||
"hyperf/async-queue": "~2.2.0",
|
||||
"hyperf/process": "~2.2.0",
|
||||
"hyperf-admin/rule-engine": "dev-master"
|
||||
},
|
||||
"autoload": {
|
||||
|
||||
@@ -16,31 +16,31 @@
|
||||
"ext-yaml": "*",
|
||||
"aliyuncs/oss-sdk-php": "^2.3",
|
||||
"box/spout": "^3.1",
|
||||
"hyperf/amqp": "~2.1.0",
|
||||
"hyperf/cache": "~2.1.0",
|
||||
"hyperf/command": "~2.1.0",
|
||||
"hyperf/config": "~2.1.0",
|
||||
"hyperf/constants": "~2.1.0",
|
||||
"hyperf/database": "~2.1.0",
|
||||
"hyperf/db-connection": "~2.1.0",
|
||||
"hyperf/filesystem": "~2.1.0",
|
||||
"hyperf/framework": "~2.1.0",
|
||||
"hyperf/guzzle": "~2.1.0",
|
||||
"hyperf/http-server": "~2.1.0",
|
||||
"hyperf/logger": "~2.1.0",
|
||||
"hyperf/memory": "~2.1.0",
|
||||
"hyperf/metric": "~2.1.0",
|
||||
"hyperf/nsq": "~2.1.0",
|
||||
"hyperf/process": "~2.1.0",
|
||||
"hyperf/redis": "~2.1.0",
|
||||
"hyperf/snowflake": "~2.1.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.1.0",
|
||||
"hyperf/testing": "~2.1.0",
|
||||
"hyperf/devtool": "~2.2.0",
|
||||
"hyperf/testing": "~2.2.0",
|
||||
"daodao97/hyperf-watch": "dev-master",
|
||||
"symfony/var-dumper": "^5.0"
|
||||
},
|
||||
|
||||
@@ -85,7 +85,9 @@ if (!function_exists('move_local_file_to_filesystem')) {
|
||||
if ($private) {
|
||||
$filesystem->setVisibility($save_file_path, AdapterInterface::VISIBILITY_PRIVATE);
|
||||
}
|
||||
$filesystem->chmod($save_file_path, 0644);
|
||||
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:
|
||||
|
||||
@@ -203,11 +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');
|
||||
@@ -215,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');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,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);
|
||||
@@ -390,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;
|
||||
@@ -811,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;
|
||||
@@ -899,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'], [
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"hyperf/crontab": "~2.1.0",
|
||||
"hyperf/process": "~2.1.0",
|
||||
"hyperf/command": "~2.1.0",
|
||||
"hyperf/event": "~2.1.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": {
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"hyperf/process": "~2.1.0",
|
||||
"hyperf/amqp": "~2.1.0"
|
||||
"hyperf/process": "~2.2.0",
|
||||
"hyperf/amqp": "~2.2.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"hyperf/amqp": "~2.1.0",
|
||||
"hyperf/crontab": "~2.1.0",
|
||||
"hyperf/nsq": "~2.1.0",
|
||||
"hyperf/process": "~2.1.0"
|
||||
"hyperf/amqp": "~2.2.0",
|
||||
"hyperf/crontab": "~2.2.0",
|
||||
"hyperf/nsq": "~2.2.0",
|
||||
"hyperf/process": "~2.2.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"hyperf/validation": "~2.1.0",
|
||||
"hyperf/validation": "~2.2.0",
|
||||
"hyperf-admin/base-utils": "dev-master"
|
||||
},
|
||||
"autoload": {
|
||||
|
||||
Reference in New Issue
Block a user