Cart.php 819 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace addons\shopro\controller;
  3. use addons\shopro\model\Cart as CartModel;
  4. class Cart extends Base
  5. {
  6. protected $noNeedLogin = [];
  7. protected $noNeedRight = ['*'];
  8. public function index()
  9. {
  10. $data = CartModel::info();
  11. $this->success('我的购物车', $data);
  12. }
  13. public function add()
  14. {
  15. $params = $this->request->post();
  16. // 表单验证
  17. $this->shoproValidate($params, get_class(), 'add');
  18. $goodsList = $params['goods_list'];
  19. $this->success('已添加', CartModel::add($goodsList));
  20. }
  21. public function edit()
  22. {
  23. $params = $this->request->post();
  24. // 表单验证
  25. $this->shoproValidate($params, get_class(), 'edit');
  26. $this->success('', CartModel::edit($params));
  27. }
  28. }