98 lines
1.8 KiB
PHP
98 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace app\admin\validate\goods;
|
|
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
|
|
/**
|
|
* 商品列表验证器
|
|
* Class GoodsValidate
|
|
* @package app\admin\validate\goods
|
|
*/
|
|
class GoodsValidate extends BaseValidate
|
|
{
|
|
|
|
/**
|
|
* 设置校验规则
|
|
* @var string[]
|
|
*/
|
|
protected $rule = [
|
|
'id' => 'require',
|
|
'name' => 'require',
|
|
'spec' => 'require',
|
|
'class' => 'require',
|
|
'unit' => 'require',
|
|
'sys_labels' => 'require',
|
|
'buy' => 'require',
|
|
'warehouse' => 'require',
|
|
'stocktip' => 'require',
|
|
'imgs' => 'require',
|
|
];
|
|
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
'id' => 'id',
|
|
'name' => '商品名称',
|
|
'class' => '商品分类',
|
|
'spec' => '规格型号',
|
|
'unit' => '商品单位',
|
|
'sys_labels' => '标签',
|
|
'buy' => '购货价格',
|
|
'warehouse' => '默认仓库',
|
|
'stocktip' => '库存阈值',
|
|
'imgs' => '商品图片',
|
|
];
|
|
|
|
|
|
/**
|
|
* @notes 添加场景
|
|
* @return GoodsValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/23 11:28
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->remove('id',true);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return GoodsValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/23 11:28
|
|
*/
|
|
public function sceneEdit()
|
|
{}
|
|
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
* @return GoodsValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/23 11:28
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
* @return GoodsValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/23 11:28
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
} |