public function actionProductAttrAdd() { if (empty($_POST)) { $select = ProductAttributes::model()->getProductAttrTree(); $viewData = array(); $viewData['select'] = $select; $this->render('/productAttr/add', $viewData); exit; } $res = array('statusCode' => 200, 'message' => '添加成功!'); try { $model = new ProductAttributes(); $model->parent_id = $_REQUEST['parent_id']; $model->attr_name = $_REQUEST['attr_name']; $model->add_time = time(); $flag = $model->save(); if (empty($flag)) { throw new exception('添加失败!'); } } catch (Exception $e) { $res['statusCode'] = 300; $res['message'] = '失败【' . $e->getMessage() . '】'; } $res['callbackType'] = 'reloadTab'; $res['forwardUrl'] = '/manage/product/Attrlist'; $this->ajaxDwzReturn($res); }