multi-store/app/api/validate/VisitValidate.php
2024-06-05 15:42:20 +08:00

60 lines
1022 B
PHP

<?php
namespace app\api\validate;
use app\common\validate\BaseValidate;
/**
* 访问表验证器
* Class VisitValidate
* @package app\admin\validate\order
*/
class VisitValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'product_id' => 'require|number',
'cate_id' => 'require|number',
'url' => 'require',
'stay_time' => 'require|number',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'product_id' => '商品id',
'cate_id' => '分类',
'url' => '路径',
'stay_time' => '页面停留时间(秒)',
];
/**
* @notes 添加场景
* @return VisitValidate
* @author likeadmin
* @date 2024/04/24 10:37
*/
public function sceneAdd()
{
return $this->only(['product_id','cate_id']);
}
public function sceneUserAdd()
{
return $this->only(['url','stay_time']);
}
}