2023-01-26 17:09:29 +08:00

86 lines
1.9 KiB
PHP

<?php
namespace app\admin\controller\nk;
use app\admin\BaseController;
use think\exception\ValidateException;
use think\facade\Db;
use app\admin\controller\nk\Article;
use think\facade\View;
/**
* 文章
*
* @icon fa fa-circle-o
*/
class Mediation extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=147;
$this->url=[
'/admin/nk.mediation/index?category_id='.$this->category_id,
'/admin/nk.mediation/add',
'/admin/nk.mediation/edit',
'/admin/nk.mediation/del',
'/admin/nk.mediation/read',
];
}
/**
* 查看
*/
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$params['category_id']=$this->category_id;
(new Article())->index($params);
}
return view('nk/article/index',['url'=>$this->url]);
}
/**
* 添加
*/
public function add()
{
if (request()->isAjax()) {
$params= get_params();
$params['category_id']=$this->category_id;
(new Article())->add($params);
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view('nk/article/add');
}
}
/**
* 修改
*/
public function edit()
{
$params= get_params();
(new Article())->edit($params);
return view('nk/article/edit',['url'=>$this->url]);
}
/**
* 查看信息
*/
public function read()
{
$params = get_params();
(new Article())->read($params);
return view('nk/article/read',['url'=>$this->url]);
}
/**
* 修改
*/
public function del()
{
$params= get_params();
(new Article())->del($params);
}
}