public function actionUpdate() { $lid = Yii::app()->request->getParam('lid'); //echo 'ddd'; $model = ProductAddition::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $lid, ':dpid' => $this->companyId)); Until::isUpdateValid(array($lid), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 if (Yii::app()->request->isPostRequest) { $model->attributes = Yii::app()->request->getPost('ProductAddition'); $model->update_at = date('Y-m-d H:i:s', time()); //var_dump($model);var_dump(Yii::app()->request->getPost('ProductSetDetail'));exit; if ($model->save()) { Yii::app()->user->setFlash('success', yii::t('app', '修改成功')); $this->redirect(array('productAddition/detail', 'companyId' => $this->companyId, 'lid' => $model->mproduct_id)); } } //$printers = $this->getPrinters(); $categories = $this->getCategories(); $categoryId = $this->getCategoryId($model->sproduct_id, $this->companyId); $products = $this->getProducts($categoryId); $productslist = CHtml::listData($products, 'lid', 'product_name'); $this->render('detailupdate', array('model' => $model, 'categories' => $categories, 'categoryId' => $categoryId, 'products' => $productslist)); }
public static function getAdditionProducts($productId, $companyId) { $products = ProductAddition::model()->with('sproduct')->findAll('t.dpid=:companyId and t.mproduct_id=:mproductId and t.delete_flag=0', array(':companyId' => $companyId, ':mproductId' => $productId)); $products = $products ? $products : array(); //var_dump($products);exit; return $products; //return CHtml::listData($products, 'lid', 'product_name'); }