1.提交缺失的东西

This commit is contained in:
2025-05-15 14:54:20 +08:00
parent c8eae468be
commit bbb6ca577e

View File

@ -55,13 +55,13 @@ class CartController extends BaseApiController
$post = $this->request->post(); $post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\Cart.change'); $check = $this->validate($post, 'app\api\validate\Cart.change');
if ($check !== true) { if ($check !== true) {
$this->_error($check); $this->fail($check);
} }
$res = CartLogic::change($post['cart_id'], $post['goods_num']); $res = CartLogic::change($post['cart_id'], $post['goods_num']);
if ($res === true) { if ($res === true) {
$this->_success(); $this->success();
} }
$this->_error($res); $this->fail($res);
} }
@ -70,12 +70,12 @@ class CartController extends BaseApiController
$post = $this->request->post(); $post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\Cart.del'); $check = $this->validate($post, 'app\api\validate\Cart.del');
if (true !== $check) { if (true !== $check) {
$this->_error($check); $this->fail($check);
} }
if (CartLogic::del($post['cart_id'], $this->user_id)) { if (CartLogic::del($post['cart_id'], $this->userId)) {
$this->_success('删除成功'); $this->success('删除成功');
} }
$this->_error('删除失败'); $this->fail('删除失败');
} }
@ -84,15 +84,15 @@ class CartController extends BaseApiController
$post = $this->request->post(); $post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\Cart.selected'); $check = $this->validate($post, 'app\api\validate\Cart.selected');
if (true !== $check) { if (true !== $check) {
$this->_error($check); $this->fail($check);
} }
CartLogic::selected($post, $this->user_id); CartLogic::selected($post, $this->userId);
$this->_success(); $this->success();
} }
public function num() public function num()
{ {
$this->_success('',CartLogic::cartNum($this->user_id)); $this->success('',CartLogic::cartNum($this->userId));
} }
} }