102 lines
2.0 KiB
PHP
102 lines
2.0 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',
|
|
'city' => 'require',
|
|
'area' => 'require',
|
|
'street' => 'require',
|
|
'village' => 'require',
|
|
'brigade' => 'require',
|
|
'address_id' => 'require',
|
|
"is_default"=>"require|in:0,1"
|
|
|
|
];
|
|
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
|
|
'real_name' => '收货人姓名',
|
|
'phone' => '收货人电话',
|
|
'detail' => '收货人详细地址',
|
|
'address_id' => '地址id',
|
|
"is_default"=>"默认地址",
|
|
'city'=>'城市',
|
|
'area'=>'区',
|
|
'street'=>'街道',
|
|
'village'=>'村',
|
|
'brigade'=>'队'
|
|
|
|
];
|
|
|
|
|
|
/**
|
|
* @notes 添加场景
|
|
* @return UserAddressValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/28 17:28
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->only(['real_name','phone','city','area','street','village','brigade']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return UserAddressValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/28 17:28
|
|
*/
|
|
public function sceneEdit()
|
|
{
|
|
return $this->only(['real_name','phone','id','city','area','street','village','brigade']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @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']);
|
|
}
|
|
|
|
} |