83 lines
2.8 KiB
PHP
83 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Request;
|
|
|
|
use App\Constants\HttpEnumCode;
|
|
use Hyperf\Validation\Request\FormRequest;
|
|
|
|
class BasicDataRequest extends FormRequest
|
|
{
|
|
protected array $scenes = [
|
|
'getHospital' => [ // 获取医院数据
|
|
'province_id',
|
|
'city_id',
|
|
'county_id',
|
|
],
|
|
'getDiseaseSearch' => [ // 搜索疾病分类
|
|
// 'disease_class_name',
|
|
],
|
|
'getProductSearch' => [ // 搜索商品
|
|
'product_keyword',
|
|
],
|
|
'getDiseaseIcdSearch' => [ // 搜索平台疾病分类
|
|
'icd_keyword',
|
|
],
|
|
'getHotSearchKeyword' => [ // 获取热门搜索关键词
|
|
'client_type',
|
|
'keyword_place',
|
|
],
|
|
'getDetectionDiseaseList' => [ // 获取检测疾病分类列表
|
|
'detection_project_id',
|
|
],
|
|
'getProductPage' => [ // 获取商品数据-分页
|
|
'keyword',
|
|
],
|
|
];
|
|
|
|
/**
|
|
* 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 [
|
|
'province_id' => 'required_with:city_id,county_id',
|
|
'city_id' => 'required_with:county_id',
|
|
'disease_class_name' => 'required',
|
|
'client_type' => 'required|integer|min:1|max:1',
|
|
'keyword_place' => 'required|integer|min:1|max:1',
|
|
'detection_project_id' => 'required',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取已定义验证规则的错误消息.
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'province_id.required_with' => "请选择省份",
|
|
'city_id.required_with' => "请选择城市",
|
|
'disease_class_name.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
'client_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
'client_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
'client_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
'client_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
'keyword_place.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
'keyword_place.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
'keyword_place.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
'keyword_place.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
'detection_project_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
|
];
|
|
}
|
|
}
|