1.提交缺失的东西

This commit is contained in:
2025-05-15 14:56:13 +08:00
parent bbb6ca577e
commit 319c8867e0

View File

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