102 lines
2.0 KiB
PHP
102 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace app\api\validate;
|
|
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
|
|
/**
|
|
* 购物车表验证器
|
|
* Class CartValidate
|
|
* @package app\admin\validate\order
|
|
*/
|
|
class CartValidate extends BaseValidate
|
|
{
|
|
|
|
/**
|
|
* 设置校验规则
|
|
* @var string[]
|
|
*/
|
|
protected $rule = [
|
|
'cart_num' => 'require',
|
|
'product_attr_unique' => 'require',
|
|
'store_id' => 'require|number',
|
|
'staff_id' => 'require|number',
|
|
'product_id' => 'require|number',
|
|
];
|
|
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
'cart_num' => '数量',
|
|
'store_id' => '店铺id',
|
|
'staff_id' => '员工id',
|
|
'product_id' => '商品id',
|
|
'product_attr_unique' => '商品规格',
|
|
];
|
|
|
|
|
|
/**
|
|
* @notes 添加场景
|
|
* @return CartValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/24 10:37
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->only(['cart_num','store_id','product_id']);
|
|
}
|
|
public function sceneStoreAdd()
|
|
{
|
|
return $this->only(['cart_num','product_id']);
|
|
}
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return CartValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/24 10:37
|
|
*/
|
|
public function sceneChange()
|
|
{
|
|
return $this->only(['cart_num','store_id','product_id']);
|
|
}
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return CartValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/24 10:37
|
|
*/
|
|
public function sceneStoreChange()
|
|
{
|
|
return $this->only(['cart_num','product_id']);
|
|
}
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
* @return CartValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/24 10:37
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
* @return CartValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/24 10:37
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['']);
|
|
}
|
|
|
|
} |