1.提交缺失的东西
This commit is contained in:
@ -43,28 +43,28 @@ class UserAddressController extends BaseApiController
|
||||
public function detail()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$result = $this->validate($get, 'app\api\validate\UserAddress.one');
|
||||
$result = $this->validate($get, 'app\api\validate\UserAddressValidate.one');
|
||||
if ($result === true) {
|
||||
$user_id = $this->user_id;
|
||||
$user_id = $this->userId;
|
||||
$result = UserAddressLogic::getOneAddress($user_id, $get);
|
||||
if ($result) {
|
||||
$this->success('获取成功', $result);
|
||||
return $this->success('获取成功', $result);
|
||||
}
|
||||
$result = '获取失败';
|
||||
}
|
||||
$this->_error($result);
|
||||
return $this->fail($result);
|
||||
}
|
||||
|
||||
|
||||
//获取默认地址
|
||||
public function getDefault()
|
||||
{
|
||||
$user_id = $this->user_id;
|
||||
$user_id = $this->userId;
|
||||
$result = UserAddressLogic::getDefaultAddress($user_id);
|
||||
if ($result) {
|
||||
$this->_success('获取成功', $result);
|
||||
return $this->success('获取成功', $result);
|
||||
}
|
||||
$this->_error('获取失败');
|
||||
return $this->fail('获取失败');
|
||||
}
|
||||
|
||||
|
||||
@ -72,16 +72,16 @@ class UserAddressController extends BaseApiController
|
||||
public function setDefault()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$result = $this->validate($post, 'app\api\validate\UserAddress.set');
|
||||
$result = $this->validate($post, 'app\api\validate\UserAddressValidate.set');
|
||||
if ($result === true) {
|
||||
$user_id = $this->user_id;
|
||||
$user_id = $this->userId;
|
||||
$result = UserAddressLogic::setDefaultAddress($user_id, $post);
|
||||
if ($result) {
|
||||
$this->_success('设置成功', $result);
|
||||
return $this->success('设置成功');
|
||||
}
|
||||
$result = '设置失败';
|
||||
}
|
||||
$this->_error($result);
|
||||
return $this->fail($result);
|
||||
}
|
||||
|
||||
|
||||
@ -90,15 +90,15 @@ class UserAddressController extends BaseApiController
|
||||
public function add()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$result = $this->validate($post, 'app\api\validate\UserAddressValidate.add');
|
||||
if ($result === true) {
|
||||
// $result = $this->validate($post, 'app\api\validate\UserAddressValidate.add');
|
||||
// if ($result === true) {
|
||||
$user_id = $this->userId;
|
||||
$result = UserAddressLogic::addUserAddress($user_id, $post);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
}
|
||||
$result = '添加失败';
|
||||
}
|
||||
// }
|
||||
return $this->fail($result);
|
||||
}
|
||||
|
||||
@ -107,16 +107,16 @@ class UserAddressController extends BaseApiController
|
||||
public function update()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$result = $this->validate($post, 'app\api\validate\UserAddress.edit');
|
||||
$result = $this->validate($post, 'app\api\validate\UserAddressValidate.edit');
|
||||
if ($result === true) {
|
||||
$user_id = $this->user_id;
|
||||
$user_id = $this->userId;
|
||||
$result = UserAddressLogic::editUserAddress($user_id, $post);
|
||||
if ($result) {
|
||||
$this->_success('修改成功', $result);
|
||||
return $this->success('修改成功');
|
||||
}
|
||||
$result = '修改失败';
|
||||
}
|
||||
$this->_error($result);
|
||||
return $this->fail($result);
|
||||
}
|
||||
|
||||
|
||||
@ -124,16 +124,16 @@ class UserAddressController extends BaseApiController
|
||||
public function del()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$result = $this->validate($post, 'app\api\validate\UserAddress.del');
|
||||
$result = $this->validate($post, 'app\api\validate\UserAddressValidate.del');
|
||||
if ($result === true) {
|
||||
$user_id = $this->user_id;
|
||||
$user_id = $this->userId;
|
||||
$result = UserAddressLogic::delUserAddress($user_id, $post);
|
||||
if ($result) {
|
||||
$this->_success('删除成功', $result);
|
||||
return $this->success('删除成功');
|
||||
}
|
||||
$result = '删除失败';
|
||||
}
|
||||
$this->_error($result);
|
||||
return $this->fail($result);
|
||||
}
|
||||
|
||||
|
||||
@ -141,18 +141,18 @@ class UserAddressController extends BaseApiController
|
||||
public function handleRegion()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$result = $this->validate($post, 'app\api\validate\UserAddress.handleRegion');
|
||||
$result = $this->validate($post, 'app\api\validate\UserAddressValidate.handleRegion');
|
||||
if ($result === true) {
|
||||
$province = $this->request->post('province');
|
||||
$city = $this->request->post('city');
|
||||
$district = $this->request->post('district');
|
||||
$res = UserAddressLogic::handleRegion($province, $city, $district);
|
||||
if ($res) {
|
||||
$this->_success('获取成功', $res);
|
||||
return $this->success('获取成功', $res);
|
||||
}
|
||||
$result = '获取失败';
|
||||
}
|
||||
$this->_error($result);
|
||||
return $this->fail($result);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user