public function actionSaveInfo() { $a = 1000000000; if ($_POST['basic_neicang1'] != NULL && $a > (int) $_POST['basic_neicang1']) { $a = (int) $_POST['basic_neicang1']; } if ($_POST['classic_neicang1'] != NULL && $a > (int) $_POST['classic_neicang1']) { $a = (int) $_POST['classic_neicang1']; } if ($_POST['basic_haijing1'] != NULL && $a > (int) $_POST['basic_haijing1']) { $a = (int) $_POST['basic_haijing1']; } if ($_POST['classic_haijing1'] != NULL && $a > (int) $_POST['basic_haijing1']) { $a = (int) $_POST['classic_haijing1']; } if ($_POST['basic_yangtai1'] != NULL && $a > (int) $_POST['basic_yangtai1']) { $a = (int) $_POST['basic_yangtai1']; } if ($_POST['classic_yangtai1'] != NULL && $a > (int) $_POST['classic_yangtai1']) { $a = (int) $_POST['classic_yangtai1']; } if ($_POST['basic_taofang1'] != NULL && $a > (int) $_POST['basic_taofang1']) { $a = (int) $_POST['basic_taofang1']; } if ($_POST['classic_taofang1'] != NULL && $a > (int) $_POST['classic_taofang1']) { $a = (int) $_POST['classic_taofang1']; } $a1 = $_POST['basic_neicang1'] . ',' . $_POST['basic_neicang2'] . ',' . $_POST['basic_neicang3']; $a2 = $_POST['classic_neicang1'] . ',' . $_POST['classic_neicang2'] . ',' . $_POST['classic_neicang3']; $b1 = $_POST['basic_haijing1'] . ',' . $_POST['basic_haijing2'] . ',' . $_POST['basic_haijing3']; $b2 = $_POST['classic_haijing1'] . ',' . $_POST['classic_haijing2'] . ',' . $_POST['classic_haijing3']; $c1 = $_POST['basic_yangtai1'] . ',' . $_POST['basic_yangtai2'] . ',' . $_POST['basic_yangtai3']; $c2 = $_POST['classic_yangtai1'] . ',' . $_POST['classic_yangtai2'] . ',' . $_POST['classic_yangtai3']; $d1 = $_POST['basic_taofang1'] . ',' . $_POST['basic_taofang2'] . ',' . $_POST['basic_taofang3']; $d2 = $_POST['classic_taofang1'] . ',' . $_POST['classic_taofang2'] . ',' . $_POST['classic_taofang3']; $var = explode(',', $_POST['id']); $id = $var[0]; $route_id = $var[1]; // echo $route_id; // echo $a; if ($a != 1000000000) { Route::model()->updateByPk($route_id, array('price' => $a)); } Price::model()->updateByPk($id, array('basic_neicang' => $a1, 'classic_neicang' => $a2, 'basic_haijing' => $b1, 'classic_haijing' => $b2, 'basic_yangtai' => $c1, 'classic_yangtai' => $c2, 'basic_taofang' => $d1, 'classic_taofang' => $d2)); $this->redirect(Yii::app()->request->urlReferrer); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Price::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }