其余文件
This commit is contained in:
109
app/admin/controller/content/Article.php
Normal file
109
app/admin/controller/content/Article.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller\content;
|
||||
|
||||
|
||||
use app\admin\logic\content\ArticleCategoryLogic;
|
||||
use app\admin\logic\content\ArticleLogic;
|
||||
use app\admin\validate\content\ArticleValidate;
|
||||
use app\common\basics\AdminBase;
|
||||
use app\common\server\JsonServer;
|
||||
|
||||
class Article extends AdminBase
|
||||
{
|
||||
public function lists()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
$lists = ArticleLogic::lists($get);
|
||||
return JsonServer::success("获取成功", $lists);
|
||||
}
|
||||
|
||||
return view('', [
|
||||
'category' => ArticleCategoryLogic::getCategory()
|
||||
]);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new ArticleValidate())->goCheck('add');
|
||||
$post = $this->request->post();
|
||||
$res = ArticleLogic::add($post);
|
||||
if ($res === false) {
|
||||
$error = ArticleLogic::getError() ?: '新增失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('新增成功');
|
||||
}
|
||||
|
||||
return view('', [
|
||||
'category' => ArticleCategoryLogic::getCategory()
|
||||
]);
|
||||
}
|
||||
|
||||
/***
|
||||
* @Notes: 编辑文章
|
||||
* @Author: 张无忌
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new ArticleValidate())->goCheck('edit');
|
||||
$post = $this->request->post();
|
||||
$res = ArticleLogic::edit($post);
|
||||
if ($res === false) {
|
||||
$error = ArticleLogic::getError() ?: '编辑失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('编辑成功');
|
||||
}
|
||||
|
||||
$id = $this->request->get('id');
|
||||
return view('', [
|
||||
'detail' => ArticleLogic::detail($id),
|
||||
'category' => ArticleCategoryLogic::getCategory()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Notes: 删除文章
|
||||
* @Author: 张无忌
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new ArticleValidate())->goCheck('id');
|
||||
$id = $this->request->post('id');
|
||||
$res = ArticleLogic::del($id);
|
||||
if ($res === false) {
|
||||
$error = ArticleLogic::getError() ?: '删除失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('删除成功');
|
||||
}
|
||||
|
||||
return JsonServer::success('异常');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Notes: 隐藏文章
|
||||
* @Author: 张无忌
|
||||
*/
|
||||
public function hide()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new ArticleValidate())->goCheck('id');
|
||||
$id = $this->request->post('id');
|
||||
$res = ArticleLogic::hide($id);
|
||||
if ($res === false) {
|
||||
$error = ArticleLogic::getError() ?: '操作失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('操作成功');
|
||||
}
|
||||
|
||||
return JsonServer::success('异常');
|
||||
}
|
||||
}
|
||||
112
app/admin/controller/content/ArticleCategory.php
Normal file
112
app/admin/controller/content/ArticleCategory.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller\content;
|
||||
|
||||
|
||||
use app\admin\logic\content\ArticleCategoryLogic;
|
||||
use app\admin\validate\content\ArticleCategoryValidate;
|
||||
use app\common\basics\AdminBase;
|
||||
use app\common\server\JsonServer;
|
||||
|
||||
class ArticleCategory extends AdminBase
|
||||
{
|
||||
/**
|
||||
* @NOTES: 文章分类列表
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
$lists = ArticleCategoryLogic::lists($get);
|
||||
return JsonServer::success("获取成功", $lists);
|
||||
}
|
||||
|
||||
return view();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NOTES: 添加文章分类
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new ArticleCategoryValidate())->goCheck('add');
|
||||
$post = $this->request->post();
|
||||
$res = ArticleCategoryLogic::add($post);
|
||||
if ($res === false) {
|
||||
$error = ArticleCategoryLogic::getError() ?: '新增失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('新增成功');
|
||||
}
|
||||
|
||||
|
||||
return view();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NOTES: 编辑文章分类
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new ArticleCategoryValidate())->goCheck('edit');
|
||||
$post = $this->request->post();
|
||||
$res = ArticleCategoryLogic::edit($post);
|
||||
if ($res === false) {
|
||||
$error = ArticleCategoryLogic::getError() ?: '编辑失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('编辑成功');
|
||||
}
|
||||
|
||||
$id = $this->request->get('id');
|
||||
return view('', [
|
||||
'detail' => ArticleCategoryLogic::detail($id)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NOTES: 删除文章分类
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new ArticleCategoryValidate())->goCheck('id');
|
||||
$id = $this->request->post('id');
|
||||
$res = ArticleCategoryLogic::del($id);
|
||||
if ($res === false) {
|
||||
$error = ArticleCategoryLogic::getError() ?: '删除失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('删除成功');
|
||||
}
|
||||
|
||||
return JsonServer::error('异常');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Notes: 隐藏分类
|
||||
* @Author: 张无忌
|
||||
*/
|
||||
public function hide()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new ArticleCategoryValidate())->goCheck('id');
|
||||
$id = $this->request->post('id');
|
||||
$res = ArticleCategoryLogic::hide($id);
|
||||
if ($res === false) {
|
||||
$error = ArticleCategoryLogic::getError() ?: '操作失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('操作成功');
|
||||
}
|
||||
|
||||
return JsonServer::success('异常');
|
||||
}
|
||||
}
|
||||
118
app/admin/controller/content/Help.php
Normal file
118
app/admin/controller/content/Help.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller\content;
|
||||
|
||||
|
||||
use app\admin\logic\content\HelpCategoryLogic;
|
||||
use app\admin\logic\content\HelpLogic;
|
||||
use app\admin\validate\content\HelpValidate;
|
||||
use app\common\basics\AdminBase;
|
||||
use app\common\server\JsonServer;
|
||||
|
||||
class Help extends AdminBase
|
||||
{
|
||||
/**
|
||||
* @NOTES: 帮助分类列表
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
$lists = HelpLogic::lists($get);
|
||||
return JsonServer::success("获取成功", $lists);
|
||||
}
|
||||
|
||||
return view('', [
|
||||
'category' => HelpCategoryLogic::getCategory()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NOTES: 添加帮助类
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new HelpValidate())->goCheck('add');
|
||||
$post = $this->request->post();
|
||||
$res = HelpLogic::add($post);
|
||||
if ($res === false) {
|
||||
$error = HelpLogic::getError() ?: '新增失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('新增成功');
|
||||
}
|
||||
|
||||
|
||||
return view('', [
|
||||
'category' => HelpCategoryLogic::getCategory()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NOTES: 编辑帮助分类
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new HelpValidate())->goCheck('edit');
|
||||
$post = $this->request->post();
|
||||
$res = HelpLogic::edit($post);
|
||||
if ($res === false) {
|
||||
$error = HelpLogic::getError() ?: '编辑失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('编辑成功');
|
||||
}
|
||||
|
||||
$id = $this->request->get('id');
|
||||
return view('', [
|
||||
'detail' => HelpLogic::detail($id),
|
||||
'category' => HelpCategoryLogic::getCategory()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NOTES: 删除帮助分类
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new HelpValidate())->goCheck('id');
|
||||
$id = $this->request->post('id');
|
||||
$res = HelpLogic::del($id);
|
||||
if ($res === false) {
|
||||
$error = HelpLogic::getError() ?: '删除失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('删除成功');
|
||||
}
|
||||
|
||||
return JsonServer::error('异常');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Notes: 隐藏帮助分类
|
||||
* @Author: 张无忌
|
||||
*/
|
||||
public function hide()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new HelpValidate())->goCheck('id');
|
||||
$id = $this->request->post('id');
|
||||
$res = HelpLogic::hide($id);
|
||||
if ($res === false) {
|
||||
$error = HelpLogic::getError() ?: '操作失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('操作成功');
|
||||
}
|
||||
|
||||
return JsonServer::success('异常');
|
||||
}
|
||||
}
|
||||
112
app/admin/controller/content/HelpCategory.php
Normal file
112
app/admin/controller/content/HelpCategory.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller\content;
|
||||
|
||||
|
||||
use app\admin\logic\content\HelpCategoryLogic;
|
||||
use app\admin\validate\content\HelpCategoryValidate;
|
||||
use app\common\basics\AdminBase;
|
||||
use app\common\server\JsonServer;
|
||||
|
||||
class HelpCategory extends AdminBase
|
||||
{
|
||||
/**
|
||||
* @NOTES: 帮助分类列表
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
$lists = HelpCategoryLogic::lists($get);
|
||||
return JsonServer::success("获取成功", $lists);
|
||||
}
|
||||
|
||||
return view();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NOTES: 添加帮助分类
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new HelpCategoryValidate())->goCheck('add');
|
||||
$post = $this->request->post();
|
||||
$res = HelpCategoryLogic::add($post);
|
||||
if ($res === false) {
|
||||
$error = HelpCategoryLogic::getError() ?: '新增失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('新增成功');
|
||||
}
|
||||
|
||||
|
||||
return view();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NOTES: 编辑帮助分类
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new HelpCategoryValidate())->goCheck('edit');
|
||||
$post = $this->request->post();
|
||||
$res = HelpCategoryLogic::edit($post);
|
||||
if ($res === false) {
|
||||
$error = HelpCategoryLogic::getError() ?: '编辑失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('编辑成功');
|
||||
}
|
||||
|
||||
$id = $this->request->get('id');
|
||||
return view('', [
|
||||
'detail' => HelpCategoryLogic::detail($id)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NOTES: 删除帮组分类
|
||||
* @author: 张无忌
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new HelpCategoryValidate())->goCheck('id');
|
||||
$id = $this->request->post('id');
|
||||
$res = HelpCategoryLogic::del($id);
|
||||
if ($res === false) {
|
||||
$error = HelpCategoryLogic::getError() ?: '删除失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('删除成功');
|
||||
}
|
||||
|
||||
return JsonServer::error('异常');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Notes: 隐藏帮助分类
|
||||
* @Author: 张无忌
|
||||
*/
|
||||
public function hide()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
(new HelpCategoryValidate())->goCheck('id');
|
||||
$id = $this->request->post('id');
|
||||
$res = HelpCategoryLogic::hide($id);
|
||||
if ($res === false) {
|
||||
$error = HelpCategoryLogic::getError() ?: '操作失败';
|
||||
return JsonServer::error($error);
|
||||
}
|
||||
return JsonServer::success('操作成功');
|
||||
}
|
||||
|
||||
return JsonServer::success('异常');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user