feat: 添加产品购买链接相关接口

This commit is contained in:
2025-02-18 18:09:11 +08:00
parent 0ec541ab76
commit 8913ec7e5e
5 changed files with 452 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace app\admin\validate\v1;
use think\Validate;
class ProductPurchaseLinkValidate extends Validate
{
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [
'id' => 'require|integer',
'link' => 'url|max:255',
'platform_id' => 'integer'
];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [
'id.require' => 'id不能为空',
'id.integer' => 'id字段类型错误',
'link.url' => '链接格式不正确',
'link.max' => '链接不能超过255个字符',
'platform_id.integer' => '平台id类型错误'
];
/**
* 更新场景
*/
public function sceneUpdate()
{
return $this->only(['id', 'link', 'platform_id'])->remove('id', 'require');
}
}