<?php
/**
 * 购物车
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author xiaol <1094186793@qq.com>
 */

namespace Mobile\Controller;
use Think\Controller;
class PurCartController extends BaseController {
    public function _initialize(){
        parent::_initialize ();
        if (!checksiteauth('DingHuo,MenDian|GongHuoShang|CangKu')) {
            exit;
        }
        $this->assign('tplseo_title','购物车_'.C('WEB_SITE_TITLE'));
        $this->assign('page_title','购物车');
    }
    public function index(){
        $data=D('Common/Cart')->cart_indexp();
        $this->assign($data);
        $this->assign('tplseo_title','购物车_'.C('WEB_SITE_TITLE'));
        if($data['status']==0 || $data['data']['status']==0) $this->display('empty_cart');
        else $this->display();
    }
	public function change_act(){
        $cart_id=I('post.cart_id');
        $pro_id=I('post.act_id');
        $data=D('Common/Cart')->change_act($cart_id,$pro_id);
        $this->ajaxReturn($data);
    }

    public function del_cart(){
        $id=I('post.id');
        $data=D('Common/Cart')->del_purcart($id);
        $this->ajaxReturn($data);
    }
    public function sub_cart(){
        $data=I('post.');
        $id=$data['id'];
        $number=array_combine($data['id'],$data['number']);
        $return=D('Common/Cart')->sub_pcart($id,$number);
        $this->ajaxReturn($return);
    }
}
?>