public function actionAjaxUpdate() { $model = new Pay(); $val1 = $_POST['val_id']; sscanf($val1, "js:_id=%d;_exp=%d;", $id, $exp); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Pay'])) { $model->attributes = $_POST['Pay']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } // $this->redirect(array('admin')); } $row = $model->with('exp')->findByAttributes(array('id' => $id, 'exp_id' => $exp)); if (!($row == null)) { echo $this->renderPartial('_form', array('model' => $model)); } }
public function createPay() { $pay = new Pay(); $pay->user_id = $this->user_id; $pay->type = Pay::TYPE_REGISTRATION; $pay->type_id = $this->competition_id; $pay->sub_type_id = $this->id; $pay->amount = $this->total_fee * 100; $pay->order_name = $this->competition->name_zh . '报名费'; $r = $pay->save(); return $pay; }