Files
sbnews/server/app/adminapi/controller/community/CommunityPostController.php
2026-06-11 12:15:29 +08:00

71 lines
2.2 KiB
PHP

<?php
namespace app\adminapi\controller\community;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\community\CommunityPostLists;
use app\adminapi\logic\community\CommunityPostLogic;
use app\adminapi\validate\community\CommunityPostValidate;
class CommunityPostController extends BaseAdminController
{
public function lists()
{
return $this->dataLists(new CommunityPostLists());
}
public function detail()
{
$params = (new CommunityPostValidate())->goCheck('detail');
$result = CommunityPostLogic::detail($params);
return $this->data($result);
}
public function updateStatus()
{
$params = (new CommunityPostValidate())->post()->goCheck('status');
$result = CommunityPostLogic::updateStatus($params);
if (true === $result) {
return $this->success('修改成功', [], 1, 1);
}
return $this->fail(CommunityPostLogic::getError());
}
public function setTop()
{
$params = (new CommunityPostValidate())->post()->goCheck('top');
$result = CommunityPostLogic::setTop($params);
if (true === $result) {
return $this->success('设置成功', [], 1, 1);
}
return $this->fail(CommunityPostLogic::getError());
}
public function setHot()
{
$params = (new CommunityPostValidate())->post()->goCheck('hot');
$result = CommunityPostLogic::setHot($params);
if (true === $result) {
return $this->success('设置成功', [], 1, 1);
}
return $this->fail(CommunityPostLogic::getError());
}
public function setRecommend()
{
$params = (new CommunityPostValidate())->post()->goCheck('recommend');
$result = CommunityPostLogic::setRecommend($params);
if (true === $result) {
return $this->success('设置成功', [], 1, 1);
}
return $this->fail(CommunityPostLogic::getError());
}
public function delete()
{
$params = (new CommunityPostValidate())->post()->goCheck('delete');
CommunityPostLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
}