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:
46
app/admin/validate/v1/ProductCompatPartsValidate.php
Normal file
46
app/admin/validate/v1/ProductCompatPartsValidate.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\validate\v1;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class ProductCompatPartsValidate extends Validate
|
||||
{
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'language_id' => 'require|integer',
|
||||
'name' => 'max:128'
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => 'ID不能为空',
|
||||
'id.integer' => 'ID必须为整数',
|
||||
'language_id.require' => '语言ID不能为空',
|
||||
'language_id.integer' => '语言ID必须是整数',
|
||||
'name.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