public function actionUpdate() { $lid = Yii::app()->request->getParam('lid'); //echo 'ddd'; $model = ProductSet::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('ProductSet'); $py = new Pinyin(); $model->simple_code = $py->py($model->set_name); $model->update_at = date('Y-m-d H:i:s', time()); //var_dump($model->attributes);var_dump(Yii::app()->request->getPost('ProductSet'));exit; if ($model->save()) { Yii::app()->user->setFlash('success', yii::t('app', '修改成功')); $this->redirect(array('productSet/index', 'companyId' => $this->companyId)); } } $this->render('update', array('model' => $model)); }
public function actionUpdate() { $id = Yii::app()->request->getParam('id'); $model = Product::model()->find('lid=:productId and dpid=:dpid', array(':productId' => $id, ':dpid' => $this->companyId)); $model->dpid = $this->companyId; Until::isUpdateValid(array($id), $this->companyId, $this); //0,表示企业任何时候都在云端更新。 if (Yii::app()->request->isPostRequest) { $model->attributes = Yii::app()->request->getPost('Product'); $py = new Pinyin(); $model->simple_code = $py->py($model->product_name); $model->update_at = date('Y-m-d H:i:s', time()); if ($model->save()) { Yii::app()->user->setFlash('success', yii::t('app', '修改成功!')); $this->redirect(array('product/index', 'companyId' => $this->companyId)); } } $categories = $this->getCategoryList(); //$departments = $this->getDepartments(); $this->render('update', array('model' => $model, 'categories' => $categories)); }