新增了获取科普文章列表的接口

This commit is contained in:
2024-10-18 17:04:32 +08:00
parent ba91b80fb4
commit bed64ae079
7 changed files with 435 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace App\Request;
use App\Constants\HttpEnumCode;
use Hyperf\Validation\Request\FormRequest;
class ArticleRequest extends FormRequest
{
protected array $scenes = [
'getArticleScienceList' => [
'keyword',
'is_top',
'source_id',
'basic_class_id',
],
];
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'is_top' => ['sometimes','numeric','min:0','max:1'],
];
}
/**
* 获取已定义验证规则的错误消息.
*/
public function messages(): array
{
return [
'is_top.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
'is_top.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
'is_top.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
'is_top.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
];
}
}