feat: 新增产品属性增/删/改/查接口
This commit is contained in:
43
app/admin/validate/v1/ProductAttrValidate.php
Normal file
43
app/admin/validate/v1/ProductAttrValidate.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\validate\v1;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class ProductAttrValidate extends Validate
|
||||
{
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'language_id' => 'require|number',
|
||||
'attr_name' => 'require|max:64',
|
||||
'is_system' => 'in:0,1',
|
||||
'props.*.prop_type' => 'in:1,2',
|
||||
'props.*.prop_name' => 'require|max:64',
|
||||
'props.*.prop_value' => 'require|max:64',
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'language_id.require' => '语言ID不能为空',
|
||||
'language_id.number' => '语言ID必须是数字',
|
||||
'attr_name.require' => '属性名称不能为空',
|
||||
'attr_name.max' => '属性名称不能超过64个字符',
|
||||
'is_system.in' => '是否系统属性只能是0或1',
|
||||
'props.*.prop_type.in' => '属性特征类型只能是1或2',
|
||||
'props.*.prop_name.require' => '属性特征名称不能为空',
|
||||
'props.*.prop_name.max' => '属性特征名称不能超过64个字符',
|
||||
'props.*.prop_value.require' => '属性特征值不能为空',
|
||||
'props.*.prop_value.max' => '属性特征值不能超过64个字符',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user