其余文件

This commit is contained in:
2026-04-14 17:46:22 +08:00
parent 294b68fe37
commit 3691f4db22
1343 changed files with 189847 additions and 0 deletions

View File

@ -0,0 +1,108 @@
<?php
namespace app\admin\controller\community;
use app\admin\logic\community\CommunityArticleLogic;
use app\admin\validate\community\CommunityArticleValidate;
use app\common\basics\AdminBase;
use app\common\enum\CommunityArticleEnum;
use app\common\server\JsonServer;
/**
* 种草社区文章
* Class CommunityArticle
* @package app\admin\controller\community
*/
class CommunityArticle extends AdminBase
{
/**
* @notes 文章列表
* @return \think\response\Json|\think\response\View
* @author 段誉
* @date 2022/5/10 11:08
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = CommunityArticleLogic::lists($get);
return JsonServer::success("获取成功", $lists);
}
return view('', [
'status' => CommunityArticleEnum::getStatusDesc()
]);
}
/**
* @notes 审核文章
* @return \think\response\Json|\think\response\View
* @author 段誉
* @date 2022/5/10 17:45
*/
public function audit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
(new CommunityArticleValidate())->goCheck('audit', $post);
$result = CommunityArticleLogic::audit($post);
if (false === $result) {
return JsonServer::error(CommunityArticleLogic::getError() ?: '操作失败');
}
return JsonServer::success('编辑成功');
}
$id = $this->request->get('id');
return view('', [
'detail' => CommunityArticleLogic::detail($id)
]);
}
/**
* @notes 文章详情
* @return \think\response\Json|\think\response\View
* @author 段誉
* @date 2022/5/10 19:05
*/
public function detail()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$result = CommunityArticleLogic::getRelationData($get);
return JsonServer::success('', $result);
}
$id = $this->request->get('id');
return view('', [
'detail' => CommunityArticleLogic::detail($id)
]);
}
/**
* @notes 删除文章
* @return \think\response\Json|void
* @author 段誉
* @date 2022/5/10 16:46
*/
public function del()
{
if ($this->request->isAjax()) {
(new CommunityArticleValidate())->goCheck('id');
$id = $this->request->post('id');
$result = CommunityArticleLogic::del($id);
if (false === $result) {
return JsonServer::error(CommunityArticleLogic::getError() ?: '删除失败');
}
return JsonServer::success('删除成功');
}
}
}

View File

@ -0,0 +1,120 @@
<?php
namespace app\admin\controller\community;
use app\admin\logic\community\CommunityCategoryLogic;
use app\admin\validate\community\CommunityCategoryValidate;
use app\common\basics\AdminBase;
use app\common\server\JsonServer;
/**
* 种草社区分类
* Class CommunityCategory
* @package app\admin\controller\content
*/
class CommunityCategory extends AdminBase
{
/**
* @notes 获取分类列表
* @return \think\response\Json|\think\response\View
* @throws \think\db\exception\DbException
* @author 段誉
* @date 2022/4/28 10:41
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = CommunityCategoryLogic::lists($get);
return JsonServer::success("获取成功", $lists);
}
return view();
}
/**
* @notes 新增分类
* @return \think\response\Json|\think\response\View
* @author 段誉
* @date 2022/4/28 10:39
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
(new CommunityCategoryValidate())->goCheck('add', $post);
CommunityCategoryLogic::add($post);
return JsonServer::success('新增成功');
}
return view();
}
/**
* @notes 编辑分类
* @return \think\response\Json|\think\response\View
* @author 段誉
* @date 2022/4/28 10:40
*/
public function edit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
(new CommunityCategoryValidate())->goCheck('edit', $post);
CommunityCategoryLogic::edit($post);
return JsonServer::success('编辑成功');
}
$id = $this->request->get('id');
return view('', [
'detail' => CommunityCategoryLogic::detail($id)
]);
}
/**
* @notes 删除分类
* @return \think\response\Json
* @author 段誉
* @date 2022/4/28 10:40
*/
public function del()
{
if ($this->request->isAjax()) {
(new CommunityCategoryValidate())->goCheck('id');
$id = $this->request->post('id');
$result = CommunityCategoryLogic::del($id);
if (false === $result) {
return JsonServer::error(CommunityCategoryLogic::getError() ?: '删除失败');
}
return JsonServer::success('删除成功');
}
return JsonServer::error('异常');
}
/**
* @notes 设置显示z状态
* @return \think\response\Json
* @author 段誉
* @date 2022/4/28 10:41
*/
public function status()
{
if ($this->request->isAjax()) {
(new CommunityCategoryValidate())->goCheck('status');
$post = $this->request->post();
CommunityCategoryLogic::setShowStatus($post);
return JsonServer::success('操作成功');
}
return JsonServer::success('异常');
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace app\admin\controller\community;
use app\admin\logic\community\CommunityCommentLogic;
use app\admin\validate\community\CommunityCommentValidate;
use app\common\basics\AdminBase;
use app\common\enum\CommunityCommentEnum;
use app\common\server\JsonServer;
/**
* 种草社区评论
* Class CommunityComment
* @package app\admin\controller\community
*/
class CommunityComment extends AdminBase
{
/**
* @notes 评论列表
* @return \think\response\Json|\think\response\View
* @author 段誉
* @date 2022/5/10 12:05
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = CommunityCommentLogic::lists($get);
return JsonServer::success("获取成功", $lists);
}
return view('', [
'status' => CommunityCommentEnum::getStatusDesc()
]);
}
/**
* @notes 审核评论
* @return \think\response\Json|\think\response\View
* @author 段誉
* @date 2022/5/10 15:12
*/
public function audit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
(new CommunityCommentValidate())->goCheck('audit', $post);
CommunityCommentLogic::audit($post);
return JsonServer::success('审核成功');
}
$id = $this->request->get('id');
return view('', [
'detail' => CommunityCommentLogic::detail($id)
]);
}
/**
* @notes 删除评论
* @return \think\response\Json|void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/5/10 15:42
*/
public function del()
{
if ($this->request->isAjax()) {
(new CommunityCommentValidate())->goCheck('id');
$id = $this->request->post('id/d');
CommunityCommentLogic::del($id);
return JsonServer::success('删除成功');
}
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace app\admin\controller\community;
use app\admin\logic\community\CommunitySettingLogic;
use app\common\basics\AdminBase;
use app\common\server\JsonServer;
/**
* 种草社区设置
* Class CommunityTopic
* @package app\admin\controller\content
*/
class CommunitySetting extends AdminBase
{
/**
* @notes 社区配置
* @return \think\response\Json|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/4/28 16:16
*/
public function setting()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
CommunitySettingLogic::setConfig($post);
return JsonServer::success('操作成功');
}
$config = CommunitySettingLogic::getConfig();
return view('', ['config' => $config]);
}
}

View File

@ -0,0 +1,120 @@
<?php
namespace app\admin\controller\community;
use app\admin\logic\community\CommunityCategoryLogic;
use app\admin\logic\community\CommunityTopicLogic;
use app\admin\validate\community\CommunityTopicValidate;
use app\common\basics\AdminBase;
use app\common\server\JsonServer;
/**
* 种草社区话题
* Class CommunityTopic
* @package app\admin\controller\content
*/
class CommunityTopic extends AdminBase
{
/**
* @notes 获取话题列表
* @return \think\response\Json|\think\response\View
* @throws \think\db\exception\DbException
* @author 段誉
* @date 2022/4/28 10:41
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = CommunityTopicLogic::lists($get);
return JsonServer::success("获取成功", $lists);
}
return view('', ['cate' => CommunityCategoryLogic::getCategory()]);
}
/**
* @notes 新增话题
* @return \think\response\Json|\think\response\View
* @author 段誉
* @date 2022/4/28 10:39
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
(new CommunityTopicValidate())->goCheck('add', $post);
CommunityTopicLogic::add($post);
return JsonServer::success('新增成功');
}
return view('', ['cate' => CommunityCategoryLogic::getCategory()]);
}
/**
* @notes 编辑话题
* @return \think\response\Json|\think\response\View
* @author 段誉
* @date 2022/4/28 10:40
*/
public function edit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
(new CommunityTopicValidate())->goCheck('edit', $post);
CommunityTopicLogic::edit($post);
return JsonServer::success('编辑成功');
}
$id = $this->request->get('id');
return view('', [
'detail' => CommunityTopicLogic::detail($id),
'cate' => CommunityCategoryLogic::getCategory()
]);
}
/**
* @notes 删除话题
* @return \think\response\Json
* @author 段誉
* @date 2022/4/28 10:40
*/
public function del()
{
if ($this->request->isAjax()) {
(new CommunityTopicValidate())->goCheck('id');
$id = $this->request->post('id');
$result = CommunityTopicLogic::del($id);
if (false === $result) {
return JsonServer::error(CommunityTopicLogic::getError() ?: '删除失败');
}
return JsonServer::success('删除成功');
}
}
/**
* @notes 设置显示z状态
* @return \think\response\Json
* @author 段誉
* @date 2022/4/28 10:41
*/
public function status()
{
if ($this->request->isAjax()) {
(new CommunityTopicValidate())->goCheck('status');
$post = $this->request->post();
CommunityTopicLogic::setStatus($post);
return JsonServer::success('操作成功');
}
return JsonServer::success('异常');
}
}