初始化提交
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class AreaRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getCity' => ['area_id'],
|
||||
'getCounty' => ['area_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 [
|
||||
'area_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'area_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'province_id.required_with' => "请选择省份",
|
||||
'city_id.required_with' => "请选择城市",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class CodeRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getPhoneCode' => ['phone','scene'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'phone' => ['required','regex:/0?(13|14|15|17|18|19)[0-9]{9}/'],
|
||||
'scene' => 'required|integer|min:1|max:1',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'phone.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'phone.regex' => HttpEnumCode::getMessage(HttpEnumCode::MOBILE_FORMAT_ERROR),
|
||||
'user_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'scene.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class DiseaseRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getDiseaseSearch' => [ // 搜索疾病分类
|
||||
'disease_class_name',
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'disease_class_name' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'disease_class_name.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class DoctorAuthRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'addAuthReal' => [ // 新增实名认证
|
||||
'card_name',
|
||||
'card_num'
|
||||
],
|
||||
'addAuthIden' => [ // 新增身份认证信息
|
||||
'avatar',
|
||||
'hospital_id',
|
||||
'department_custom_id',
|
||||
'department_custom_name',
|
||||
'department_custom_mobile',
|
||||
'doctor_title',
|
||||
'brief_introduction',
|
||||
'be_good_at',
|
||||
'license_cert',
|
||||
'qualification_cert',
|
||||
'work_cert',
|
||||
'doctor_expertise',
|
||||
],
|
||||
'addAuthMulti' => [ // 新增多点执业认证信息
|
||||
'id_card_front',
|
||||
'id_card_back',
|
||||
'sign_image'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'card_name' => 'required',
|
||||
'card_num' => 'required',
|
||||
'avatar' => 'required|url',
|
||||
'hospital_id' => 'required',
|
||||
'department_custom_id' => 'required',
|
||||
'department_custom_mobile' => 'required',
|
||||
'doctor_title' => 'required|min:1|max:4',
|
||||
'brief_introduction' => 'required',
|
||||
'be_good_at' => 'required',
|
||||
'license_cert' => 'required|array|min:1',
|
||||
'qualification_cert' => 'required|array|min:1',
|
||||
'work_cert' => 'required|array|min:1',
|
||||
'doctor_expertise' => 'required|array|min:1',
|
||||
'id_card_front' => 'required|url',
|
||||
'id_card_back' => 'required|url',
|
||||
'sign_image' => 'required|url',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'card_name.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'card_num.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'avatar.required' => "请上传头像",
|
||||
'avatar.url' => "头像错误",
|
||||
'hospital_id.required' => "请选择医院",
|
||||
'department_custom_id.required' => "请选择科室",
|
||||
'department_custom_mobile.required' => "请输入科室电话",
|
||||
'doctor_title.required' => "请选择职称",
|
||||
'doctor_title.min' => "职称错误",
|
||||
'doctor_title.max' => "职称错误",
|
||||
'brief_introduction.required' => "请填写个人简介",
|
||||
'be_good_at.required' => "请填写擅长领域",
|
||||
'license_cert.required' => "请上传医师执业证",
|
||||
'license_cert.array' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'qualification_cert.required' => "请上传医师资格证",
|
||||
'qualification_cert.array' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_cert.required' => "请上传职称证",
|
||||
'work_cert.array' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'doctor_expertise.required' => "请选择专长",
|
||||
'doctor_expertise.array' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'id_card_front.required' => "请上传身份证正面",
|
||||
'id_card_front.url' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'id_card_back.required' => "请上传身份证反面",
|
||||
'id_card_back.url' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'sign_image.required' => "请上传签名",
|
||||
'sign_image.url' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class LoginRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'wechatMobileLogin' => ['phone_code','wx_code','user_type'],
|
||||
'mobileLogin' => ['code','phone','user_type'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'phone_code' => 'required',
|
||||
'wx_code' => 'required',
|
||||
'user_type' => 'required|integer|min:1|max:3',
|
||||
'code' => 'required',
|
||||
'phone' => ['required','regex:/0?(13|14|15|17|18|19)[0-9]{9}/'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'phone_code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'wx_code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'phone.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'phone.regex' => HttpEnumCode::getMessage(HttpEnumCode::MOBILE_FORMAT_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class OrderInquiryRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'addInquiryOrder' => [
|
||||
'patient_id',
|
||||
'family_id',
|
||||
'disease_class_id',
|
||||
'diagnosis_date',
|
||||
'disease_desc',
|
||||
'is_allergy_history',// 过敏史
|
||||
'allergy_history',
|
||||
'is_family_history', // 家族病史
|
||||
'family_history',
|
||||
'is_pregnant',// 备孕、妊娠、哺乳期
|
||||
'pregnant',
|
||||
'product.product_ids', // 商品id
|
||||
'product.product_num', // 药品数量
|
||||
'height',
|
||||
'weight',
|
||||
'inquiry_type', // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
'inquiry_mode', // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'patient_id' => 'required',
|
||||
'family_id' => 'required',
|
||||
'disease_class_id' => 'required',
|
||||
'diagnosis_date' => 'date',
|
||||
'disease_desc' => 'required',
|
||||
'is_allergy_history' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_family_history' => ['sometimes','numeric','min:0','max:1'],
|
||||
'is_pregnant' => ['sometimes','numeric','min:0','max:1'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'patient_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'family_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'disease_class_id.required' => "请您选择疾病",
|
||||
'diagnosis_date.date' => HttpEnumCode::getMessage(HttpEnumCode::DATE_FORMAT_ERROR),
|
||||
'disease_desc.required' => "请您输入病情主诉",
|
||||
'is_allergy_history.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_allergy_history.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_allergy_history.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_family_history.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_pregnant.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class PatientDoctorRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getInquiryDoctorList' => ['expertise_id','province_id','city_id','sort_order','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 [
|
||||
'sort_order' => 'sometimes|integer|min:1|max:5',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'sort_order.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'sort_order.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'sort_order.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Contract\ValidatorFactoryInterface;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
use Hyperf\Validation\Rule;
|
||||
|
||||
class PatientFamilyRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* @Inject
|
||||
* @var ValidatorFactoryInterface
|
||||
*/
|
||||
protected ValidatorFactoryInterface $validationFactory;
|
||||
|
||||
protected array $scenes = [
|
||||
'addFamily' => [ // 新增家庭成员
|
||||
'relation',
|
||||
'is_default',
|
||||
'card_name',
|
||||
'mobile',
|
||||
'type',
|
||||
'id_number',
|
||||
'province_id',
|
||||
'city_id',
|
||||
'county_id',
|
||||
'height',
|
||||
'weight',
|
||||
'marital_status',
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'card_name' => 'required',
|
||||
'type' => ['required',Rule::in(['1', '2', '3', '4'])],
|
||||
'id_number' => "required",
|
||||
'mobile' => ['required','regex:/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/'],
|
||||
'relation' => ['required',Rule::in(['1', '2', '3', '4', '5', '6'])],
|
||||
'city_id' => 'required_with:province_id',
|
||||
'province_id' => 'required_with:city_id,county_id',
|
||||
'is_default' => ['sometimes',Rule::in(['0', '1'])],
|
||||
'height' => ['sometimes','numeric'], // 身高
|
||||
'weight' => ['sometimes','numeric'], // 体重
|
||||
'marital_status' => ['sometimes',Rule::in(['0', '1'])], // 婚姻状况(0:未婚 1:已婚)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'type.required' => "请选择证件类型",
|
||||
'type.in' => "证件类型错误",
|
||||
'id_number.required' => "请选择证件号",
|
||||
'mobile.required' => "手机号不能为空",
|
||||
'mobile.regex' => "手机号格式错误",
|
||||
'relation.required' => "请选择患者关系",
|
||||
'relation.in' => "患者关系错误",
|
||||
'city_id.required_with' => "请选择城市",
|
||||
'province_id.required_with' => "请选择省份",
|
||||
'is_default.in' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'height.numeric' => "身高错误",
|
||||
'weight.numeric' => "体重错误",
|
||||
'blood_type.in' => "血型错误",
|
||||
'marital_status.in' => "婚姻状况错误",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class SafeRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getOssSign' => ['user_type'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'user_type' => 'required|integer|min:1|max:3',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'user_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
use Hyperf\Validation\Rule;
|
||||
|
||||
class UserDoctorRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'getInquiryConfig' => [ // 获取医生问诊配置
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
],
|
||||
'putInquiryOpen' => [ // 医生问诊开关
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
'is_open',
|
||||
],
|
||||
'putInquiryConfig' => [ // 修改医生问诊配置
|
||||
'inquiry_type',
|
||||
'inquiry_mode',
|
||||
'inquiry_price',
|
||||
'work_num_day',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'inquiry_type' => 'required|integer|min:1|max:3',
|
||||
'inquiry_mode' => 'required|integer|min:1|max:5',
|
||||
'is_open' => "required|boolean",
|
||||
'inquiry_price' => "required|min:0|numeric",
|
||||
'work_num_day' => "required|min:0|numeric",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'inquiry_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_open.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'is_open.boolean' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_price.required' => "请填写价格",
|
||||
'inquiry_price.min' => "价格填写错误",
|
||||
'inquiry_price.numeric' => "价格填写错误",
|
||||
'inquiry_mode.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_mode.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'inquiry_mode.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class UserRequest extends FormRequest
|
||||
{
|
||||
protected array $scenes = [
|
||||
'wechatMobileLogin' => ['phone_code','wx_code','user_type'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'phone_code' => 'required',
|
||||
'wx_code' => 'required',
|
||||
'user_type' => 'required|integer|min:1|max:3',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已定义验证规则的错误消息.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'phone_code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'wx_code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'user_type.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user