public function cards($params = array()) { extract($params); if (isset($key)) { $result = CardType::model()->getTypeCards($key); if ($result) { $ret = $this->notice('OK', 0, '成功', $result); } else { $ret = $this->notice('OK', 0, '成功', []); } } else { $ret = $this->notice('ERR', 301, '缺少参数', []); } return $ret; }
public function actionChangeCard() { $id = $this->_get("id"); if ($id) { $model = Card::model()->findByPk($id); if ($_POST['Card']) { $model->attributes = $_POST['Card']; if ($model->validate() && $model->save()) { Yii::app()->user->setFlash('Card', '修改成功'); $this->redirect(array('card/card')); } } $getTypes = CardType::model()->getType(); $this->render('change', ['model' => $model, 'getTypes' => $getTypes]); } else { $this->redirect(array('card/card')); } }