This commit is contained in:
zhang zhuo 2025-11-11 09:06:54 +08:00
parent 02b054ac2c
commit 50f90090e3
5 changed files with 5 additions and 93 deletions

View File

@ -21,32 +21,12 @@ use Hyperf\HttpServer\Annotation\PostMapping;
use MathCaptcha\Captcha;
use App\Request\Account as aRequest;
use function Hyperf\Config\config;
use Hyperf\Swagger\Annotation as SA;
#[Controller(prefix: "admin")]
#[SA\HyperfServer('admin')]
class Login extends Base
{
#[GetMapping(path: "captcha")]
#[Auth(needLogin: false)]
#[SA\Post(path: '/captcha', summary: '登录接口', tags: ['登录接口'])]
#[SA\RequestBody(
description: '请求参数',
content: [
new SA\MediaType(
mediaType: 'application/json',
schema: new SA\Schema(
required: ['username', 'age'],
properties: [
new SA\Property(property: 'username', description: '用户名字段描述', type: 'string'),
new SA\Property(property: 'age', description: '年龄字段描述', type: 'string'),
new SA\Property(property: 'city', description: '城市字段描述', type: 'string'),
]
),
),
],
)]
#[SA\Response(response: 200, description: '返回值的描述')]
public function captcha()
{
// 获取uuid

View File

@ -34,32 +34,12 @@ use Hyperf\HttpServer\Annotation\DeleteMapping;
use Hyperf\HttpServer\Annotation\GetMapping;
use Hyperf\HttpServer\Annotation\PostMapping;
use Hyperf\HttpServer\Annotation\PutMapping;
use Hyperf\Swagger\Annotation as SA;
#[Controller(prefix: "admin")]
#[SA\HyperfServer('user')]
class System extends Base
{
#[GetMapping(path: "menu/list")]
#[Auth(needAuth: false, auth: "menu:list")]
#[SA\Post(path: '/menu/list', summary: '菜单接口', tags: ['菜单接口'])]
#[SA\RequestBody(
description: '请求参数',
content: [
new SA\MediaType(
mediaType: 'application/json',
schema: new SA\Schema(
required: ['username', 'age'],
properties: [
new SA\Property(property: 'username', description: '用户名字段描述', type: 'string'),
new SA\Property(property: 'age', description: '年龄字段描述', type: 'string'),
new SA\Property(property: 'city', description: '城市字段描述', type: 'string'),
]
),
),
],
)]
#[SA\Response(response: 200, description: '返回值的描述')]
public function menuList()
{
return $this->success("菜单列表", mModel::getMenus(1));
@ -421,8 +401,6 @@ class System extends Base
#[Auth(needAuth: false)]
public function crontabOption()
{
var_dump(cModel::options());
return $this->success("任务列表", cModel::options());
}

View File

@ -76,12 +76,11 @@ class Account extends Model
public static function getMenu(array $account)
{
// 总后台账号
$field = ['m.title', 'm.path', 'm.pid', 'm.name', 'm.menu_id', 'm.icon', 'm.hidden'];
$field = ['m.title', 'm.path', 'm.pid', 'm.name', 'm.menu_id', 'm.icon', 'm.hidden', 'm.type'];
// 获取角色
$roles = match ($account['account_type']) {
1 => ["ADMIN"],
2 => ["ORG"],
3 => ["MERCHANT"],
0 => ["ADMIN"],
21 => ["ORG"],
default => []
};
// 标识

View File

@ -142,7 +142,7 @@ class Menu extends Model
return (new self())->setTable('m')
->from("menu as m")
->where("m.account_type", $account_type)
->where("m.type", 0)
->whereIn("m.type", [0, 3])
->orderByDesc("m.rank")
->select($field)
->get()
@ -177,7 +177,7 @@ class Menu extends Model
->leftJoin("menu as m", "m.menu_id", "=", "rm.menu_id")
->where("ar.account_id", $account_id)
->where("m.account_type", $account_type)
->where("m.type", 0)
->whereIn("m.type", [0, 3])
->orderByDesc("m.rank")
->select($field)
->get()

View File

@ -1,45 +0,0 @@
<?php
declare(strict_types=1);
use function Hyperf\Support\env;
return [
'enable' => true,
'port' => (int)env("SWAGGER_PORT", 9500),
'json_dir' => BASE_PATH . '/static/swagger',
'auto_generate' => true,
'scan' => [
'paths' => [
BASE_PATH . '/app/Controller/Admin'
],
],
'server' => [
'admin' => [
'servers' => [
[
'url' => env('DOMAIN') . '/admin',
'description' => '后台接口',
],
],
'info' => [
'title' => '里派基础接口',
'description' => '管理端接口',
'version' => '1.0.0',
],
],
'user' => [
'servers' => [
[
'url' => env('DOMAIN') . '/user',
'description' => '用户接口',
],
],
'info' => [
'title' => '里派基础接口',
'description' => '用户端接口',
'version' => '1.0.0',
],
],
],
];