You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.2 KiB
57 lines
1.2 KiB
<?php
|
|
|
|
namespace app\fire\controller\admin;
|
|
|
|
|
|
|
|
use app\fire\model\FireKnowledgeCategory;
|
|
use think\facade\Db;
|
|
use think\facade\View;
|
|
|
|
class Fire extends Base
|
|
{
|
|
/**
|
|
* 知识分类
|
|
*/
|
|
public function category()
|
|
{
|
|
$where = [
|
|
'uid' => UID,
|
|
];
|
|
$category_model = new FireKnowledgeCategory();
|
|
$dataList = $category_model->getAllData($where, '*', 'sort desc');
|
|
View::assign('dataList', $dataList);
|
|
|
|
return View::fetch();
|
|
}
|
|
|
|
/**
|
|
* 添加分类
|
|
*/
|
|
public function categoryAdd()
|
|
{
|
|
$category_model = new FireKnowledgeCategory();
|
|
if (request()->isPost()) {
|
|
$data = input('post.');
|
|
$data['uid'] = UID;
|
|
$res = $category_model->dataUpdate($data);
|
|
if (!$res) {
|
|
return sendErrorMessage();
|
|
}
|
|
return sendSuccessMessage();
|
|
} else {
|
|
$id = input('param.id', 0);
|
|
$data = $category_model->getOneData(['id' => $id]);
|
|
View::assign('data', $data);
|
|
return View::fetch('categoryadd');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 修改分类
|
|
*/
|
|
public function categoryUpdate()
|
|
{
|
|
return $this->categoryadd();
|
|
}
|
|
} |