pull/1/head
wanghousheng 10 months ago
parent 55f10809c3
commit 5ed1641aae
  1. 16
      app/api/controller/Article.php

@ -61,7 +61,7 @@ class Article extends Controller
*/ */
public function add(): Json public function add(): Json
{ {
if (!UserService::isStore()) { if (UserService::isStore()) {
throwError("无权限", 403); throwError("无权限", 403);
} }
$title = $this->request->post('title'); $title = $this->request->post('title');
@ -97,7 +97,7 @@ class Article extends Controller
*/ */
public function edit(): Json public function edit(): Json
{ {
if (!UserService::isStore()) { if (UserService::isStore()) {
throwError("无权限", 403); throwError("无权限", 403);
} }
$articleId = intval($this->request->post('article_id')); $articleId = intval($this->request->post('article_id'));
@ -135,10 +135,14 @@ class Article extends Controller
/** /**
* @notes:删除文章 * @notes:删除文章
* @return Json * @return Json
* @throws BaseException
* @author: wanghousheng * @author: wanghousheng
*/ */
public function delete(): Json public function delete(): Json
{ {
if (UserService::isStore()) {
throwError("无权限", 403);
}
$articleId = intval($this->request->post('article_id')); $articleId = intval($this->request->post('article_id'));
if (!$articleId) { if (!$articleId) {
return $this->renderError('缺少必要参数'); return $this->renderError('缺少必要参数');
@ -159,7 +163,7 @@ class Article extends Controller
*/ */
public function addCategory(): Json public function addCategory(): Json
{ {
if (!UserService::isStore()) { if (UserService::isStore()) {
throwError("无权限", 403); throwError("无权限", 403);
} }
$name = $this->request->post('name'); $name = $this->request->post('name');
@ -187,7 +191,7 @@ class Article extends Controller
*/ */
public function editCategory(): Json public function editCategory(): Json
{ {
if (!UserService::isStore()) { if (UserService::isStore()) {
throwError("无权限", 403); throwError("无权限", 403);
} }
$categoryId = intval($this->request->post('category_id')); $categoryId = intval($this->request->post('category_id'));
@ -222,7 +226,7 @@ class Article extends Controller
*/ */
public function delCategory(): Json public function delCategory(): Json
{ {
if (!UserService::isStore()) { if (UserService::isStore()) {
throwError("无权限", 403); throwError("无权限", 403);
} }
$categoryId = intval($this->request->post('category_id')); $categoryId = intval($this->request->post('category_id'));
@ -246,7 +250,7 @@ class Article extends Controller
*/ */
public function categoryList(): Json public function categoryList(): Json
{ {
if (!UserService::isStore()) { if (UserService::isStore()) {
throwError("无权限", 403); throwError("无权限", 403);
} }
$model = new \app\api\model\article\Category; $model = new \app\api\model\article\Category;

Loading…
Cancel
Save