1.提交缺失的东西

This commit is contained in:
2025-05-16 15:58:56 +08:00
parent ea5ecc2e47
commit 084f479002

View File

@ -43,28 +43,28 @@ class UserAddressController extends BaseApiController
public function detail() public function detail()
{ {
$get = $this->request->get(); $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) { if ($result === true) {
$user_id = $this->user_id; $user_id = $this->userId;
$result = UserAddressLogic::getOneAddress($user_id, $get); $result = UserAddressLogic::getOneAddress($user_id, $get);
if ($result) { if ($result) {
$this->success('获取成功', $result); return $this->success('获取成功', $result);
} }
$result = '获取失败'; $result = '获取失败';
} }
$this->_error($result); return $this->fail($result);
} }
//获取默认地址 //获取默认地址
public function getDefault() public function getDefault()
{ {
$user_id = $this->user_id; $user_id = $this->userId;
$result = UserAddressLogic::getDefaultAddress($user_id); $result = UserAddressLogic::getDefaultAddress($user_id);
if ($result) { 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() public function setDefault()
{ {
$post = $this->request->post(); $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) { if ($result === true) {
$user_id = $this->user_id; $user_id = $this->userId;
$result = UserAddressLogic::setDefaultAddress($user_id, $post); $result = UserAddressLogic::setDefaultAddress($user_id, $post);
if ($result) { if ($result) {
$this->_success('设置成功', $result); return $this->success('设置成功');
} }
$result = '设置失败'; $result = '设置失败';
} }
$this->_error($result); return $this->fail($result);
} }
@ -90,15 +90,15 @@ class UserAddressController extends BaseApiController
public function add() public function add()
{ {
$post = $this->request->post(); $post = $this->request->post();
$result = $this->validate($post, 'app\api\validate\UserAddressValidate.add'); // $result = $this->validate($post, 'app\api\validate\UserAddressValidate.add');
if ($result === true) { // if ($result === true) {
$user_id = $this->userId; $user_id = $this->userId;
$result = UserAddressLogic::addUserAddress($user_id, $post); $result = UserAddressLogic::addUserAddress($user_id, $post);
if ($result) { if ($result) {
return $this->success('添加成功'); return $this->success('添加成功');
} }
$result = '添加失败'; $result = '添加失败';
} // }
return $this->fail($result); return $this->fail($result);
} }
@ -107,16 +107,16 @@ class UserAddressController extends BaseApiController
public function update() public function update()
{ {
$post = $this->request->post(); $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) { if ($result === true) {
$user_id = $this->user_id; $user_id = $this->userId;
$result = UserAddressLogic::editUserAddress($user_id, $post); $result = UserAddressLogic::editUserAddress($user_id, $post);
if ($result) { if ($result) {
$this->_success('修改成功', $result); return $this->success('修改成功');
} }
$result = '修改失败'; $result = '修改失败';
} }
$this->_error($result); return $this->fail($result);
} }
@ -124,16 +124,16 @@ class UserAddressController extends BaseApiController
public function del() public function del()
{ {
$post = $this->request->post(); $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) { if ($result === true) {
$user_id = $this->user_id; $user_id = $this->userId;
$result = UserAddressLogic::delUserAddress($user_id, $post); $result = UserAddressLogic::delUserAddress($user_id, $post);
if ($result) { if ($result) {
$this->_success('删除成功', $result); return $this->success('删除成功');
} }
$result = '删除失败'; $result = '删除失败';
} }
$this->_error($result); return $this->fail($result);
} }
@ -141,18 +141,18 @@ class UserAddressController extends BaseApiController
public function handleRegion() public function handleRegion()
{ {
$post = $this->request->post(); $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) { if ($result === true) {
$province = $this->request->post('province'); $province = $this->request->post('province');
$city = $this->request->post('city'); $city = $this->request->post('city');
$district = $this->request->post('district'); $district = $this->request->post('district');
$res = UserAddressLogic::handleRegion($province, $city, $district); $res = UserAddressLogic::handleRegion($province, $city, $district);
if ($res) { if ($res) {
$this->_success('获取成功', $res); return $this->success('获取成功', $res);
} }
$result = '获取失败'; $result = '获取失败';
} }
$this->_error($result); return $this->fail($result);
} }
} }