feat: add community post categories and channels
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller\community;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\community\CommunityCategoryLists;
|
||||
use app\adminapi\logic\community\CommunityCategoryLogic;
|
||||
use app\adminapi\validate\community\CommunityCategoryValidate;
|
||||
|
||||
class CommunityCategoryController extends BaseAdminController
|
||||
{
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new CommunityCategoryLists());
|
||||
}
|
||||
|
||||
public function all()
|
||||
{
|
||||
return $this->data(CommunityCategoryLogic::all());
|
||||
}
|
||||
|
||||
public function detail()
|
||||
{
|
||||
$params = (new CommunityCategoryValidate())->goCheck('detail');
|
||||
return $this->data(CommunityCategoryLogic::detail($params));
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$params = (new CommunityCategoryValidate())->post()->goCheck('add');
|
||||
if (CommunityCategoryLogic::add($params)) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CommunityCategoryLogic::getError());
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$params = (new CommunityCategoryValidate())->post()->goCheck('edit');
|
||||
if (CommunityCategoryLogic::edit($params)) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CommunityCategoryLogic::getError());
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CommunityCategoryValidate())->post()->goCheck('delete');
|
||||
if (CommunityCategoryLogic::delete($params)) {
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CommunityCategoryLogic::getError());
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,26 @@ class CommunityPostController extends BaseAdminController
|
||||
return $this->fail(CommunityPostLogic::getError());
|
||||
}
|
||||
|
||||
public function setTopic()
|
||||
{
|
||||
$params = (new CommunityPostValidate())->post()->goCheck('topic');
|
||||
$result = CommunityPostLogic::setTopic($params);
|
||||
if (true === $result) {
|
||||
return $this->success('设置成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CommunityPostLogic::getError());
|
||||
}
|
||||
|
||||
public function setCategory()
|
||||
{
|
||||
$params = (new CommunityPostValidate())->post()->goCheck('category');
|
||||
$result = CommunityPostLogic::setCategory($params);
|
||||
if (true === $result) {
|
||||
return $this->success('设置成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CommunityPostLogic::getError());
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CommunityPostValidate())->post()->goCheck('delete');
|
||||
|
||||
Reference in New Issue
Block a user