93 lines
1.7 KiB
PHP
93 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace app\api\validate;
|
|
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
|
|
/**
|
|
* UserAddress验证器
|
|
* Class UserAddressValidate
|
|
* @package app\admin\validate
|
|
*/
|
|
class UserAddressValidate extends BaseValidate
|
|
{
|
|
|
|
/**
|
|
* 设置校验规则
|
|
* @var string[]
|
|
*/
|
|
protected $rule = [
|
|
'real_name' => 'require',
|
|
'phone' => 'require',
|
|
'detail' => 'require',
|
|
'address_id' => 'require',
|
|
"is_default"=>"require|in:0,1"
|
|
|
|
];
|
|
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
|
|
'real_name' => '收货人姓名',
|
|
'phone' => '收货人电话',
|
|
'detail' => '收货人详细地址',
|
|
'address_id' => '地址id',
|
|
"is_default"=>"默认地址"
|
|
|
|
];
|
|
|
|
|
|
/**
|
|
* @notes 添加场景
|
|
* @return UserAddressValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/28 17:28
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->only(['real_name','phone','detail']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return UserAddressValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/28 17:28
|
|
*/
|
|
public function sceneEdit()
|
|
{
|
|
return $this->only(['real_name','phone','id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
* @return UserAddressValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/28 17:28
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['address_id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
* @return UserAddressValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/28 17:28
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['address_id']);
|
|
}
|
|
|
|
} |