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