/** * 新增数据 * */ public function actionCreate() { $model = new GoodsPlan(); if (isset($_POST['GoodsPlan'])) { $model->attributes = $_POST['GoodsPlan']; //添加时间 $model->create_time = time(); if ($model->save()) { $this->message('success', Yii::t('admin', 'Add Success'), $this->createUrl('index')); } } //判断有无商品栏目 $goods = Goods::model()->find(); if (!$goods) { $this->message('error', '请先添加商品信息', $this->createUrl('index')); } $this->render('update', array('model' => $model)); }