feat: 新增产品兼容数据、产品兼容数据配件类型相关接口
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 5s
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 5s
This commit is contained in:
66
app/admin/validate/v1/ProductCompatValidate.php
Normal file
66
app/admin/validate/v1/ProductCompatValidate.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\validate\v1;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class ProductCompatValidate extends Validate
|
||||
{
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'language_id' => 'require|integer',
|
||||
'part_id' => 'require|integer',
|
||||
'label_name' =>'max: 128',
|
||||
'brand_name' => 'max:128',
|
||||
'level_name' => 'max:32',
|
||||
'class_name' => 'max:128',
|
||||
'series_name' => 'max:128',
|
||||
'model' => 'require|max:128',
|
||||
'capacity' => 'max:32',
|
||||
'interface_type' => 'max:64',
|
||||
'compat_status' => 'max:64'
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => 'ID不能为空',
|
||||
'id.integer' => 'ID必须为整数',
|
||||
'language_id.require' => '语言ID必须',
|
||||
'language_id.integer' => '语言ID必须为整数',
|
||||
'part_id.require' => '零件ID必须',
|
||||
'part_id.integer' => '零件ID必须为整数',
|
||||
'label_name.max' => '标签名称不能超过:rule个字符',
|
||||
'brand_name.max' => '品牌名称不能超过:rule个字符',
|
||||
'level_name.max' => '等级名称不能超过:rule个字符',
|
||||
'class_name.max' => '类型名称不能超过:rule个字符',
|
||||
'series_name.max' => '系列名称不能超过:rule个字符',
|
||||
'model.require' => '型号必须',
|
||||
'model.max' => '型号不能超过:rule个字符',
|
||||
'capacity.max' => '容量不能超过:rule个字符',
|
||||
'interface_type.max' => '接口类型不能超过:rule个字符',
|
||||
'compat_status.max' => '兼容状态不能超过:rule个字符',
|
||||
];
|
||||
|
||||
// 新增场景
|
||||
protected function sceneAdd()
|
||||
{
|
||||
return $this->remove("id", "require|integer");
|
||||
}
|
||||
|
||||
// 编辑场景
|
||||
protected function sceneEdit()
|
||||
{
|
||||
return $this->append("id", "require|integer");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user