You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
1 year ago
|
<?php
|
||
|
|
||
1 year ago
|
namespace Plugins\ApiDoc\Admin\Attributes;
|
||
1 year ago
|
|
||
|
use JetBrains\PhpStorm\ExpectedValues;
|
||
|
|
||
|
/**
|
||
|
* Query 参数
|
||
|
*
|
||
|
* Class ApiQuery
|
||
|
*
|
||
|
* @author chenlong<vip_chenlong@163.com>
|
||
|
* @date 2022/5/17 10:02
|
||
|
*/
|
||
|
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
||
|
class ApiQuery extends Params
|
||
|
{
|
||
|
/**
|
||
|
* @param string|array $name 参数名
|
||
|
* @param string $type 参数类型
|
||
|
* @param string $describe 参数描述
|
||
|
* @param bool $required 是否必填
|
||
|
* @param float $version 参数版本, 版本废弃用负数表示,例 2.0 版本废弃了 id参数:-2.0
|
||
|
*/
|
||
|
public function __construct(public string|array $name,
|
||
|
#[ExpectedValues(["String", "Integer", "Float", 'Bool',])]
|
||
|
public string $type = "Integer",
|
||
|
public string $describe = '',
|
||
|
public bool $required = false,
|
||
|
public float $version = 0
|
||
|
)
|
||
|
{
|
||
|
if (is_array($name)) {
|
||
|
foreach ($name as $key => $info) {
|
||
|
$this->{$key} = $info;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|