智慧教务系统 PHP-NiuCloud框架开发
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.
 
 
 
 
 
 

102 lines
2.8 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace addon\zhjw\app\adminapi\controller\articles;
use core\base\BaseAdminController;
use addon\zhjw\app\service\admin\articles\ArticlesService;
/**
* 文章管理控制器
* Class Articles
* @package addon\zhjw\app\adminapi\controller\articles
*/
class Articles extends BaseAdminController
{
/**
* 获取文章管理列表
* @return \think\Response
*/
public function lists(){
$data = $this->request->params([
["title",""],
["category",""],
["publisher_id",""],
["status",""],
["create_time",["",""]],
["update_time",["",""]]
]);
return success((new ArticlesService())->getPage($data));
}
/**
* 文章管理详情
* @param int $id
* @return \think\Response
*/
public function info(int $id){
return success((new ArticlesService())->getInfo($id));
}
/**
* 添加文章管理
* @return \think\Response
*/
public function add(){
$data = $this->request->params([
["title",""],
["content",""],
["category",""],
["publisher_id",0],
["status",""],
]);
$this->validate($data, 'addon\zhjw\app\validate\articles\Articles.add');
$id = (new ArticlesService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
* 文章管理编辑
* @param $id 文章管理id
* @return \think\Response
*/
public function edit(int $id){
$data = $this->request->params([
["title",""],
["content",""],
["category",""],
["publisher_id",0],
["status",""],
]);
$this->validate($data, 'addon\zhjw\app\validate\articles\Articles.edit');
(new ArticlesService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 文章管理删除
* @param $id 文章管理id
* @return \think\Response
*/
public function del(int $id){
(new ArticlesService())->del($id);
return success('DELETE_SUCCESS');
}
public function getSysUserAll(){
return success(( new ArticlesService())->getSysUserAll());
}
}