This commit is contained in:
wangjinlei
2020-11-24 10:19:18 +08:00
parent f0b8830eed
commit c9186d3f87
2 changed files with 102 additions and 6 deletions

View File

@@ -365,7 +365,7 @@ class Article extends Controller {
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
* @param name:filetype type:string require:1 desc:文件类型(PDF/HTML/SUB)
* @param name:filetype type:string require:1 desc:文件类型(PDF/HTML/SUB/SUB2)
* @param name:fileURL type:string require:1 desc:文件地址
*
*/
@@ -375,8 +375,10 @@ class Article extends Controller {
$updata['file_pdf'] = $data['fileURL'];
}elseif($data['filetype']=='HTML'){
$updata['file_html'] = $data['fileURL'];
}else{
}elseif($data['filetype']=='SUB'){
$updata['file_sub'] = $data['fileURL'];
}else{
$updata['file_sub2'] = $data['fileURL'];
}
$this->article_obj->where('article_id',$data['article_id'])->update($updata);
return json(['code'=>0,'msg'=>'success']);
@@ -450,14 +452,14 @@ class Article extends Controller {
}
/**
* @title 文章图片上传
* @description 文章图片上传
* @title 文章文件上传
* @description 文章文件上传
* @author wangjinlei
* @url /master/Article/article_file
* @method GET
*
* @param name:name type:string require:1 desc:文件域名称(articlePDF/articleHTML/articleSUB)
* @param name:type type:string require:1 desc:pathinfo(articlePDF/articleHTML/articleSUB)
* @param name:name type:string require:1 desc:文件域名称(articlePDF/articleHTML/articleSUB/articleSUB2)
* @param name:type type:string require:1 desc:pathinfo(articlePDF/articleHTML/articleSUB/articleSUB2)
*
* @return upurl:图片地址
*/

View File

@@ -14,15 +14,19 @@ class Journal extends Controller {
//put your code here
protected $admin_obj = '';
protected $journal_obj = '';
protected $article_obj = '';
protected $journal_topic_obj = '';
protected $journal_stage_obj = '';
protected $article_to_topic_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->admin_obj = Db::name('admin');
$this->journal_obj = Db::name('journal');
$this->article_obj = Db::name('article');
$this->journal_topic_obj = Db::name('journal_topic');
$this->journal_stage_obj = Db::name('journal_stage');
$this->article_to_topic_obj = Db::name('article_to_topic');
}
/**
@@ -381,6 +385,96 @@ class Journal extends Controller {
return $vv;
}
/**
* @title 添加话题的文章
* @description 添加话题的文章
* @author wangjinlei
* @url /master/Journal/addTopicArticle
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
* @param name:topic_id type:int require:1 desc:话题id
*/
public function addTopicArticle(){
$data = $this->request->post();
$insert['article_id'] = $data['article_id'];
$insert['topic_id'] = $data['topic_id'];
$res = $this->article_to_topic_obj->insert($insert);
if($res){
return json(['code'=>0,'msg'=>'success']);
}else{
return json(['code'=>1,'msg'=>'system error']);
}
}
/**
* @title 获取当前话题的文章
* @description 获取当前话题的文章
* @author wangjinlei
* @url /master/Journal/getTopicArticles
* @method POST
*
* @param name:topic_id type:int require:1 desc:话题id
*
* @return dataList:array#
* @return topic:array#
*/
public function getTopicArticles(){
$data = $this->request->post();
$list = $this->article_to_topic_obj
->field('j_article_to_topic.*,j_article.*')
->join('j_article','j_article.article_id = j_article_to_topic.article_id','LEFT')
->where('j_article_to_topic.topic_id',$data['topic_id'])
->where('j_article_to_topic.state',0)
->select();
$info = $this->journal_topic_obj->where('journal_topic_id',$data['topic_id'])->find();
return json(['code'=>0,'msg'=>'success','data'=>['topic'=>$info,'dataList'=>$list]]);
}
/**
* @title 获取当前期刊的文章
* @description 获取当前期刊的文章
* @author wangjinlei
* @url /master/Journal/getArticleByJournal
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
* @param name: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 dataList:array#
*/
public function getArticleByJournal(){
$data = $this->request->post();
//排除stage
$ids = $this->article_to_topic_obj->where('topic_id',$data['topic_id'])->where('state',0)->column('article_id');
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = $this->article_obj->where('journal_id',$data['journal_id'])->where('state',0)->where('article_id','not in',$ids)->limit($limit_start,$data['pageSize'])->select();
$count = $this->article_obj->where('journal_id',$data['journal_id'])->where('state',0)->where('article_id','not in',$ids)->count();
return json(['code'=>0,'msg'=>'success','data'=>['count'=>$count,'dataList'=>$list]]);
}
/**
* @title 删除文章话题关系
* @description 删除文章话题关系
* @author wangjinlei
* @url /master/Journal/delArticleToTopic
* @method POST
*
* @param name:article_to_topic_id type:int require:1 desc:id
*
*/
public function delArticleToTopic(){
$data = $this->request->post();
$res = $this->article_to_topic_obj->where('article_to_topic_id',$data['article_to_topic_id'])->update(['state'=>1]);
if($res){
return json(['code'=>0,'msg'=>'success']);
}else{
return json(['code'=>1,'msg'=>'system error']);
}
}
/**
* @title topic图片上传
* @description topic图片上传