public function actionSetdetail()
 {
     $id = Yii::app()->request->getParam('id', 0);
     $criteria = new CDbCriteria();
     $criteria->with = array('product');
     $criteria->condition = 't.dpid=' . $this->companyId . ' and t.set_id=' . $id . ' and t.delete_flag=0 and product.delete_flag=0';
     $criteria->order = ' t.group_no ASC,t.is_select DESC';
     $models = ProductSetDetail::model()->findAll($criteria);
     $modelsp = Yii::app()->db->createCommand('select product_id from nb_order_product t where t.dpid=' . $this->companyId . ' and t.set_id=' . $id . ' and t.delete_flag=0')->queryAll();
     $modelspt = array_column($modelsp, 'product_id');
     //var_dump($modelspt);exit;
     foreach ($models as $m) {
         //$m->is_select='0';
         if (in_array($m->product_id, $modelspt)) {
             $m->is_select = '1';
         }
     }
     //set select
     $this->renderPartial('setdetail', array('models' => $models));
 }
 public function actionIsDoubleSetDetail()
 {
     $productId = Yii::app()->request->getParam('productid', 0);
     $productSetId = Yii::app()->request->getParam('productSetId', 0);
     $companyId = Yii::app()->request->getParam('companyId', 0);
     $treeDataSource = array('data' => FALSE, 'delay' => 400);
     $product = ProductSetDetail::model()->find('t.dpid = :dpid and t.set_id = :setid and t.product_id = :productid and t.delete_flag=0', array(':dpid' => $companyId, ':setid' => $productSetId, ':productid' => $productId));
     //var_dump($productId,$productSetId,$companyId,$product);exit;
     if (!empty($product)) {
         $treeDataSource['data'] = TRUE;
     }
     Yii::app()->end(json_encode($treeDataSource));
 }