1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-28 21:31:37 +08:00

1.修复添加文章时未定义referer报错

2.修正后台添加文章未定义category_id
This commit is contained in:
koogua 2021-05-15 15:25:18 +08:00
parent cc19004c12
commit 141993a93c
2 changed files with 4 additions and 3 deletions

View File

@ -127,14 +127,12 @@ class Article extends Service
$validator = new ArticleValidator(); $validator = new ArticleValidator();
$category = $validator->checkCategory($post['category_id']);
$title = $validator->checkTitle($post['title']); $title = $validator->checkTitle($post['title']);
$article = new ArticleModel(); $article = new ArticleModel();
$article->published = ArticleModel::PUBLISH_APPROVED; $article->published = ArticleModel::PUBLISH_APPROVED;
$article->owner_id = $user->id; $article->owner_id = $user->id;
$article->category_id = $category->id;
$article->title = $title; $article->title = $title;
$article->create(); $article->create();

View File

@ -64,10 +64,13 @@ class ArticleController extends Controller
$this->seo->prependTitle('写文章'); $this->seo->prependTitle('写文章');
$referer = $this->request->getHTTPReferer();
$this->view->pick('article/edit'); $this->view->pick('article/edit');
$this->view->setVar('source_types', $sourceTypes); $this->view->setVar('source_types', $sourceTypes);
$this->view->setVar('article', $article);
$this->view->setVar('xm_tags', $xmTags); $this->view->setVar('xm_tags', $xmTags);
$this->view->setVar('article', $article);
$this->view->setVar('referer', $referer);
} }
/** /**