feat: 添加产品购买链接相关接口
This commit is contained in:
45
app/admin/validate/v1/ProductPurchaseLinkValidate.php
Normal file
45
app/admin/validate/v1/ProductPurchaseLinkValidate.php
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user