This commit is contained in:
parent
02b054ac2c
commit
50f90090e3
|
|
@ -21,32 +21,12 @@ use Hyperf\HttpServer\Annotation\PostMapping;
|
||||||
use MathCaptcha\Captcha;
|
use MathCaptcha\Captcha;
|
||||||
use App\Request\Account as aRequest;
|
use App\Request\Account as aRequest;
|
||||||
use function Hyperf\Config\config;
|
use function Hyperf\Config\config;
|
||||||
use Hyperf\Swagger\Annotation as SA;
|
|
||||||
|
|
||||||
#[Controller(prefix: "admin")]
|
#[Controller(prefix: "admin")]
|
||||||
#[SA\HyperfServer('admin')]
|
|
||||||
class Login extends Base
|
class Login extends Base
|
||||||
{
|
{
|
||||||
#[GetMapping(path: "captcha")]
|
#[GetMapping(path: "captcha")]
|
||||||
#[Auth(needLogin: false)]
|
#[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()
|
public function captcha()
|
||||||
{
|
{
|
||||||
// 获取uuid
|
// 获取uuid
|
||||||
|
|
|
||||||
|
|
@ -34,32 +34,12 @@ use Hyperf\HttpServer\Annotation\DeleteMapping;
|
||||||
use Hyperf\HttpServer\Annotation\GetMapping;
|
use Hyperf\HttpServer\Annotation\GetMapping;
|
||||||
use Hyperf\HttpServer\Annotation\PostMapping;
|
use Hyperf\HttpServer\Annotation\PostMapping;
|
||||||
use Hyperf\HttpServer\Annotation\PutMapping;
|
use Hyperf\HttpServer\Annotation\PutMapping;
|
||||||
use Hyperf\Swagger\Annotation as SA;
|
|
||||||
|
|
||||||
#[Controller(prefix: "admin")]
|
#[Controller(prefix: "admin")]
|
||||||
#[SA\HyperfServer('user')]
|
|
||||||
class System extends Base
|
class System extends Base
|
||||||
{
|
{
|
||||||
#[GetMapping(path: "menu/list")]
|
#[GetMapping(path: "menu/list")]
|
||||||
#[Auth(needAuth: false, auth: "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()
|
public function menuList()
|
||||||
{
|
{
|
||||||
return $this->success("菜单列表", mModel::getMenus(1));
|
return $this->success("菜单列表", mModel::getMenus(1));
|
||||||
|
|
@ -421,8 +401,6 @@ class System extends Base
|
||||||
#[Auth(needAuth: false)]
|
#[Auth(needAuth: false)]
|
||||||
public function crontabOption()
|
public function crontabOption()
|
||||||
{
|
{
|
||||||
var_dump(cModel::options());
|
|
||||||
|
|
||||||
return $this->success("任务列表", cModel::options());
|
return $this->success("任务列表", cModel::options());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,12 +76,11 @@ class Account extends Model
|
||||||
public static function getMenu(array $account)
|
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']) {
|
$roles = match ($account['account_type']) {
|
||||||
1 => ["ADMIN"],
|
0 => ["ADMIN"],
|
||||||
2 => ["ORG"],
|
21 => ["ORG"],
|
||||||
3 => ["MERCHANT"],
|
|
||||||
default => []
|
default => []
|
||||||
};
|
};
|
||||||
// 标识
|
// 标识
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ class Menu extends Model
|
||||||
return (new self())->setTable('m')
|
return (new self())->setTable('m')
|
||||||
->from("menu as m")
|
->from("menu as m")
|
||||||
->where("m.account_type", $account_type)
|
->where("m.account_type", $account_type)
|
||||||
->where("m.type", 0)
|
->whereIn("m.type", [0, 3])
|
||||||
->orderByDesc("m.rank")
|
->orderByDesc("m.rank")
|
||||||
->select($field)
|
->select($field)
|
||||||
->get()
|
->get()
|
||||||
|
|
@ -177,7 +177,7 @@ class Menu extends Model
|
||||||
->leftJoin("menu as m", "m.menu_id", "=", "rm.menu_id")
|
->leftJoin("menu as m", "m.menu_id", "=", "rm.menu_id")
|
||||||
->where("ar.account_id", $account_id)
|
->where("ar.account_id", $account_id)
|
||||||
->where("m.account_type", $account_type)
|
->where("m.account_type", $account_type)
|
||||||
->where("m.type", 0)
|
->whereIn("m.type", [0, 3])
|
||||||
->orderByDesc("m.rank")
|
->orderByDesc("m.rank")
|
||||||
->select($field)
|
->select($field)
|
||||||
->get()
|
->get()
|
||||||
|
|
|
||||||
|
|
@ -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',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
Loading…
Reference in New Issue