Exemplo n.º 1
0
 /**
  * 点单
  * 
  */
 public function actionCreateCart()
 {
     $isAddOrder = Yii::app()->request->getPost('isAddOrder');
     $productId = Yii::app()->request->getPost('productId');
     $type = Yii::app()->request->getPost('type');
     //是否是套餐
     $product = array('lid' => $productId, 'type' => $type);
     if ($isAddOrder) {
         //增加
         $createOrder = new CreateOrder($this->companyId, $this->siteNoId, $product);
         if ($createOrder->hasOrderProduct()) {
             echo 0;
         } else {
             if ($createOrder->createOrder()) {
                 echo 1;
             } else {
                 echo 0;
             }
         }
     } else {
         //删除
         $createOrder = new CreateOrder($this->companyId, $this->siteNoId, $product);
         if ($createOrder->deleteOrderProduct()) {
             echo 1;
         } else {
             echo 0;
         }
     }
     exit;
 }