63 lines
1.4 KiB
PHP
Executable File
63 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\adminapi\validate\tcm;
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
/**
|
|
* 处方库验证器
|
|
*/
|
|
class PrescriptionLibraryValidate extends BaseValidate
|
|
{
|
|
protected $rule = [
|
|
'id' => 'require|number',
|
|
'prescription_name' => 'require|max:100',
|
|
'herbs' => 'require|array',
|
|
'is_public' => 'in:0,1'
|
|
];
|
|
|
|
protected $message = [
|
|
'id.require' => '处方ID不能为空',
|
|
'id.number' => '处方ID必须为数字',
|
|
'prescription_name.require' => '处方名称不能为空',
|
|
'prescription_name.max' => '处方名称最多100个字符',
|
|
'herbs.require' => '药材列表不能为空',
|
|
'herbs.array' => '药材列表格式错误',
|
|
'is_public.in' => '是否公开参数错误'
|
|
];
|
|
|
|
/**
|
|
* @notes 添加场景
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->only(['prescription_name', 'herbs', 'is_public']);
|
|
}
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
*/
|
|
public function sceneEdit()
|
|
{
|
|
return $this->only(['id', 'prescription_name', 'herbs', 'is_public']);
|
|
}
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
}
|