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

namespace Home\Controller;
use Think\Controller;
class CartController extends BaseController {
    public function index(){
        $data=D('Common/Cart')->cart_index();
        $data['data']['promot_lists_json']=(empty($data['data']['promot_lists_json']) || $data['data']['promot_lists_json']=='null')?0:$data['data']['promot_lists_json'];
        $this->assign($data);//print_r($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_cart($id);
        //print_r($data);exit;
        $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_cart($id,$number);
        $this->ajaxReturn($return);
    }
	public function addorder(){
		$param = I('param.');
		$data=D('Common/OrderInfo')->addorder($param);
		print_r($data);exit;
	}
}
?>