96 lines
1.8 KiB
PHP
96 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace app\psi\validate;
|
|
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
|
|
/**
|
|
* PsiWarehouseProduct验证器
|
|
* Class WarehouseProductValidate
|
|
* @package app\psi\validate
|
|
*/
|
|
class WarehouseProductValidate extends BaseValidate
|
|
{
|
|
|
|
/**
|
|
* 设置校验规则
|
|
* @var string[]
|
|
*/
|
|
protected $rule = [
|
|
'id' => 'require',
|
|
'product_id' => 'require',
|
|
'batch' => 'require',
|
|
'nums' => 'require',
|
|
'price' => 'require',
|
|
'total_price' => 'require',
|
|
'status' => 'require',
|
|
|
|
];
|
|
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
'id' => 'id',
|
|
'product_id' => '商品',
|
|
'batch' => '批次',
|
|
'nums' => '数量',
|
|
'price' => '零售价格',
|
|
'total_price' => '总价格',
|
|
'status' => '状态',
|
|
|
|
];
|
|
|
|
|
|
/**
|
|
* @notes 添加场景
|
|
* @return WarehouseProductValidate
|
|
* @author admin
|
|
* @date 2025/03/10 11:08
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->only(['product_id','batch','nums','price','total_price','status']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return WarehouseProductValidate
|
|
* @author admin
|
|
* @date 2025/03/10 11:08
|
|
*/
|
|
public function sceneEdit()
|
|
{
|
|
return $this->only(['id','product_id','batch','nums','price','total_price','status']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
* @return WarehouseProductValidate
|
|
* @author admin
|
|
* @date 2025/03/10 11:08
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
* @return WarehouseProductValidate
|
|
* @author admin
|
|
* @date 2025/03/10 11:08
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
} |