This commit is contained in:
wangjinlei
2021-06-15 10:34:52 +08:00
parent b79316e8d9
commit 7d216a169d
7 changed files with 663 additions and 42 deletions

View File

@@ -17,6 +17,8 @@ class Mysystem extends Controller {
protected $sys_scient_obj = '';
protected $sys_book_obj = '';
protected $sys_not_obj = '';
protected $de_topic_obj = '';
protected $de_topic_to_article = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -26,6 +28,8 @@ class Mysystem extends Controller {
$this->sys_scient_obj = Db::name('system_scient');
$this->sys_book_obj = Db::name('system_books');
$this->sys_not_obj = Db::name('system_notices');
$this->de_topic_obj = Db::name('de_topic');
$this->de_topic_to_article = Db::name('de_topic_to_article');
}
/**
@@ -452,6 +456,187 @@ class Mysystem extends Controller {
return jsonSuccess($re);
}
/**
* @title 增加总话题
* @description 增加总话题
* @author wangjinlei
* @url /master/Mysystem/addTopic
* @method POST
*
* @param name:title type:string require:1 desc:标题
* @param name:intro type:string require:0 desc:简介
* @param name:icon type:string require:1 desc:图片地址
*
*/
public function addTopic(){
$data = $this->request->post();
$insert['title'] = trim($data['title']);
$insert['intro'] = isset($data['intro'])?trim($data['intro']):'';
$insert['icon'] = $data['icon'];
$this->de_topic_obj->insert($insert);
return jsonSuccess([]);
}
/**
* @title 删除总话题
* @description 删除总话题
* @author wangjinlei
* @url /master/Mysystem/delTopic
* @method POST
*
* @param name:de_topic_id type:int require:1 desc:主键id
*
*/
public function delTopic(){
$data = $this->request->post();
$this->de_topic_obj->where('de_topic_id',$data['de_topic_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**
* @title 编辑总话题
* @description 编辑总话题
* @author wangjinlei
* @url /master/Mysystem/editTopic
* @method POST
*
* @param name:de_topic_id type:int require:1 desc:主键id
* @param name:title type:string require:1 desc:标题
* @param name:intro type:string require:0 desc:简介
* @param name:icon type:string require:1 desc:图片地址
*
*/
public function editTopic(){
$data = $this->request->post();
$update['title'] = trim($data['title']);
$update['intro'] = isset($data['intro'])?trim($data['intro']):'';
$update['icon'] = $data['icon'];
$this->de_topic_obj->where('de_topic_id',$data['de_topic_id'])->update($update);
return jsonSuccess([]);
}
/**
* @title 获取总话题列表
* @description 获取总话题列表
* @author wangjinlei
* @url /master/Mysystem/getTopicList
* @method POST
*
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
*
* @return topics:topic@
* @return count:总数
* @topics title:标题 intro:简介 icon:图片路径
*/
public function getTopicList(){
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = $this->de_topic_obj->where('state',0)->limit($limit_start,$data['pageSize'])->select();
$count = $this->de_topic_obj->where('state',0)->count();
$re['topics'] = $list;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* @title 添加话题文章对应关系
* @description 添加话题文章对应关系
* @author wangjinlei
* @url /master/Mysystem/addTopicToArticle
* @method POST
*
* @param name:de_topic_id type:int require:1 desc:话题id
* @param name:article_id type:int require:1 desc:文章id
*/
public function addTopicToArticle(){
$data = $this->request->post();
$insert['de_article_id'] = $data['de_article_id'];
$insert['article_id'] = $data['article_id'];
$this->de_topic_to_article->insert($insert);
return jsonSuccess([]);
}
/**
* @title 删除话题文章对应关系
* @description 删除话题文章对应关系
* @author wangjinlei
* @url /master/Mysystem/delTopicToArticle
* @method POST
*
* @param name:de_topic_to_article_id type:int require:1 desc:对应关系id
*/
public function delTopicToArticle(){
$data = $this->request->post();
$this->de_topic_to_article->where('de_topic_to_article_id',$data['de_topic_to_article_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**
* @title 获取话题通过文章
* @description 获取话题通过文章
* @author wangjinlei
* @url /master/Mysystem/getTopicByArticle
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
*
* @return topics:topic@
* @return count:总数
* @topics title:标题 intro:简介 icon:图片路径
*/
public function getTopicByArticle(){
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = $this->de_topic_to_article
->field('j_de_topic.*')
->join('j_de_topic','j_de_topic_to_article.de_topic_id = j_de_topic.de_topic_id','LEFT')
->where('j_de_topic_to_article.article_id',$data['article_id'])
->where('j_de_topic_to_article.state',0)
->limit($limit_start,$data['pageSize'])
->select();
$count = $this->de_topic_to_article->where('state',0)->where('article_id',$data['article_id'])->count();
$re['topics'] = $list;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* @title 获取文章通过话题
* @description 获取文章通过话题
* @author wangjinlei
* @url /master/Mysystem/getArticleByTopic
* @method POST
*
* @param name:de_topic_id type:int require:1 desc:话题id
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
*
* @return articles:article@
* @return count:总数
* @articles title:标题 type:类型 icon:图片路径 doi:doi号
*/
public function getArticleByTopic(){
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = $this->de_topic_to_article
->field('j_article.*')
->join('j_article','j_de_topic_to_article.article_id = j_article.article_id','LEFT')
->where('j_de_topic_to_article.de_topic_id',$data['de_topic_id'])
->where('j_de_topic_to_article.state',0)
->limit($limit_start,$data['pageSize'])
->select();
$count = $this->de_topic_to_article->where('state',0)->where('de_topic_id',$data['de_topic_id'])->count();
$re['articles'] = $list;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* @title pdf上传
* @description pdf上传