Esempio n. 1
0
 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;
 }
 /**
  * Helper method to add a {@link CardType}.
  *
  * @param CardType $type
  *
  * @return $this
  */
 public function addCardType(CardType $type)
 {
     $this->type = $type->getType();
     return $this;
 }
Esempio n. 3
0
 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'));
     }
 }