80 lines
1.4 KiB
PHP
80 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace app\api\validate;
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
class CartValidate extends BaseValidate
|
|
{
|
|
|
|
/**
|
|
* 设置校验规则
|
|
* @var string[]
|
|
*/
|
|
protected $rule = [
|
|
'id' => 'require',
|
|
'uid' => 'require',
|
|
'dishes_id' => 'require',
|
|
// 'project_id' => 'require',
|
|
// 'cart_num' => 'require',
|
|
// 'paid' => 'require',
|
|
'buy_now' => 'require',
|
|
];
|
|
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
'id' => 'id',
|
|
'uid' => '用户id',
|
|
'dishes_id' => '菜品id',
|
|
'project_id' => '项目id',
|
|
'cart_num' => '购买数量',
|
|
'paid' => '支付状态',
|
|
'buy_now' => '立即购买',
|
|
];
|
|
|
|
|
|
/**
|
|
* @notes 添加场景
|
|
* @return CartValidate
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->remove('id', true);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return CartValidate
|
|
*/
|
|
public function sceneEdit()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
* @return CartValidate
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
* @return CartValidate
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
}
|