public function actionCreate() { $model = new Shops(); //处理图片 if ($_FILES['logo'] && !$_FILES['logo']['error']) { $imgInfo = Yii::app()->material->upload('logo'); if ($imgInfo) { $_POST['Shops']['logo'] = $imgInfo['id']; } } if (isset($_POST['Shops'])) { $model->attributes = $_POST['Shops']; $model->create_time = time(); $model->update_time = time(); if ($model->save()) { $model->order_id = $model->id; $model->save(); $this->redirect(array('index')); } else { throw new CHttpException(404, '创建失败'); } } else { throw new CHttpException(404, 'no post param'); } }