Cart.php 626 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\shop\controller;
  3. use app\common\controller\Frontend;
  4. class Cart extends Frontend{
  5. protected $noNeedLogin = [''];
  6. protected $noNeedRight = '*';
  7. protected $layout = '';
  8. public function _initialize()
  9. {
  10. parent::_initialize();
  11. }
  12. /* 分类 */
  13. function index()
  14. {
  15. $cart=db('goods_cart')->where(['userid'=>$this->auth->id])->order('id asc')->select();
  16. if(empty($cart))
  17. {
  18. return $this->fetch('emptycart');
  19. }
  20. db('goods_cart')->where(['userid'=>$this->auth->id])->update(['isselected'=>0]);
  21. $this->view->assign("cart",$cart);
  22. return $this->fetch();
  23. }
  24. }