1055 lines
38 KiB
PHP
1055 lines
38 KiB
PHP
<?php
|
||
|
||
namespace app\master\controller;
|
||
|
||
use think\Controller;
|
||
use think\Db;
|
||
|
||
/**
|
||
* @title 期刊接口
|
||
* @description 期刊相关操作
|
||
* @group 期刊相关
|
||
*/
|
||
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 $journal_notices_obj = '';
|
||
protected $journal_abs_obj = '';
|
||
protected $article_to_topic_obj = '';
|
||
protected $journal_cfp_obj = '';
|
||
protected $journal_paper_obj = '';
|
||
protected $journal_paper_art_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->journal_notices_obj = Db::name('journal_notices');
|
||
$this->journal_abs_obj = Db::name('journal_abstracting');
|
||
$this->article_to_topic_obj = Db::name('article_to_topic');
|
||
$this->journal_cfp_obj = Db::name('journal_cfp');
|
||
$this->journal_paper_obj = Db::name('journal_paper');
|
||
$this->journal_paper_art_obj = Db::name('journal_paper_art');
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊列表
|
||
* @description 获取期刊列表
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getJournalList
|
||
* @method POST
|
||
*
|
||
* @param name:editor_id type:int require:1 desc:编辑id
|
||
*
|
||
* @return journalList:期刊列表@
|
||
* @journalList title:标题 issn:issn editorinchief:editorinchief acceptance:acceptance finaldecision:finaldecision apc:apc
|
||
*/
|
||
public function getJournalList(){
|
||
$data = $this->request->post();
|
||
$where['j_journal.state'] = 0;
|
||
if($data['editor_id']!=1){
|
||
$where['j_journal.editor_id'] = $data['editor_id'];
|
||
}
|
||
$res = $this->journal_obj
|
||
->field('j_journal.*,j_admin.realname realname')
|
||
->join('j_admin','j_admin.admin_id = j_journal.editor_id','LEFT')
|
||
->where($where)
|
||
->order('j_journal.sort desc')
|
||
->select();
|
||
return json(['code'=>0,'msg'=>'success','data'=>['journalList'=>$res]]);
|
||
}
|
||
|
||
|
||
/**
|
||
* @title 添加期刊
|
||
* @description 添加期刊
|
||
* @author wangjinlei
|
||
* @url /master/Journal/addJournal
|
||
* @method POST
|
||
*
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:issn type:string require:1
|
||
* @param name:editorinchief type:string require:1
|
||
* @param name:acceptance type:string require:1 desc:受理度
|
||
* @param name:finaldecision type:string require:1 desc:最终受理
|
||
* @param name:sort type:int require:1 detault:0 desc:权重值
|
||
* @param name:abstract type:string require:1 desc:简介
|
||
* @param name:sx type:string require:1 desc:缩写(demo:tmr)
|
||
* @param name:jabbr type:int require:0 desc:期刊简称
|
||
* @param name:apc type:string require:1
|
||
* @param name:icon type:string require:1
|
||
* @param name:editor_id type:int require:1 desc:编辑id
|
||
* @param name:system_color type:string require:1
|
||
* @param name:submission_url type:string require:1
|
||
*/
|
||
public function addJournal(){
|
||
$data = $this->request->post();
|
||
$insert_data['title'] = $data['title'];
|
||
$insert_data['issn'] = $data['issn'];
|
||
$insert_data['editorinchief'] = $data['editorinchief'];
|
||
$insert_data['acceptance'] = $data['acceptance'];
|
||
$insert_data['finaldecision'] = $data['finaldecision'];
|
||
$insert_data['sort'] = $data['sort'];
|
||
$insert_data['abstract'] = $data['abstract'];
|
||
$insert_data['sx'] = $data['sx'];
|
||
$insert_data['jabbr'] = $data['jabbr'];
|
||
$insert_data['apc'] = $data['apc'];
|
||
$insert_data['icon'] = $data['icon'];
|
||
$insert_data['editor_id'] = $data['editor_id'];
|
||
$insert_data['system_color'] = $data['system_color'];
|
||
$insert_data['submission_url'] = $data['submission_url'];
|
||
$res = $this->journal_obj->insert($insert_data);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 删除期刊
|
||
* @description 删除期刊
|
||
* @author wangjinlei
|
||
* @url /master/Journal/delJournal
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id require:1 desc:主键
|
||
*/
|
||
public function delJournal(){
|
||
$data = $this->request->post();
|
||
$res = $this->journal_obj->where('journal_id',$data['journal_id'])->update(['state'=>1]);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 修改期刊详情
|
||
* @description 修改期刊详情
|
||
* @author wangjinlei
|
||
* @url /master/Journal/editJournalDetail
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id require:1 desc:主键
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:issn type:string require:1
|
||
* @param name:editorinchief type:string require:1
|
||
* @param name:acceptance type:string require:1 desc:受理度
|
||
* @param name:finaldecision type:string require:1 desc:最终受理
|
||
* @param name:sort type:int require:1 detault:0 desc:权重值
|
||
* @param name:abstract type:string require:1 desc:简介
|
||
* @param name:sx type:string require:1 desc:缩写(demo:tmr)
|
||
* @param name:jabbr type:string require:0 desc:期刊简称
|
||
* @param name:apc type:string require:1
|
||
* @param name:publish_stage_id type:int require:1 desc:推广分期id
|
||
* @param name:icon type:string require:1
|
||
* @param name:editor_id type:int require:1 desc:编辑id
|
||
* @param name:system_color type:string require:1
|
||
* @param name:submission_url type:string require:1
|
||
*/
|
||
public function editJournalDetail(){
|
||
$data = $this->request->post();
|
||
$insert_data['title'] = $data['title'];
|
||
$insert_data['issn'] = $data['issn'];
|
||
$insert_data['editorinchief'] = $data['editorinchief'];
|
||
$insert_data['acceptance'] = $data['acceptance'];
|
||
$insert_data['finaldecision'] = $data['finaldecision'];
|
||
$insert_data['sort'] = $data['sort'];
|
||
$insert_data['abstract'] = $data['abstract'];
|
||
$insert_data['sx'] = $data['sx'];
|
||
$insert_data['jabbr'] = $data['jabbr'];
|
||
$insert_data['publish_stage_id'] = $data['publish_stage_id'];
|
||
$insert_data['apc'] = $data['apc'];
|
||
$insert_data['icon'] = $data['icon'];
|
||
$insert_data['editor_id'] = $data['editor_id'];
|
||
$insert_data['system_color'] = $data['system_color'];
|
||
$insert_data['submission_url'] = $data['submission_url'];
|
||
$res = $this->journal_obj->where('journal_id',$data['journal_id'])->update($insert_data);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'Please confirm you have changed the journal information.']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 获取编辑列表
|
||
* @description 获取编辑列表
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getEditorList
|
||
* @method POST
|
||
*
|
||
* @return editorList:编辑列表@
|
||
* @editorList account:账号 realname:真实姓名 role:角色代号(0admin1editor)
|
||
*/
|
||
public function getEditorList(){
|
||
$editor_list = $this->admin_obj->where('role',1)->select();
|
||
return json(['code'=>0,'msg'=>'success','data'=>['editorList'=>$editor_list]]);
|
||
}
|
||
|
||
/**
|
||
* @title 图片上传
|
||
* @description 图片上传
|
||
* @author wangjinlei
|
||
* @url /master/Journal/up_file
|
||
* @method POST
|
||
*
|
||
* @param name:name type:string require:1 default:journalicon desc:文件域名称
|
||
*
|
||
* @return upurl:图片地址
|
||
*/
|
||
public function up_file() {
|
||
$file = request()->file('journalicon');
|
||
if ($file) {
|
||
$info = $file->move(ROOT_PATH . 'public' . DS . 'journalicon');
|
||
if ($info) {
|
||
return json(['code'=>0 , 'msg'=>'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||
} else {
|
||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 增加话题
|
||
* @description 增加话题
|
||
* @author wangjinlei
|
||
* @url /master/Journal/addTopic
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:parent_id type:int require:1 default:0 desc:父id
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:icon type:string require:1 desc:缩略图
|
||
* @param name:position type:string require:1 desc:摆放位置
|
||
* @param name:is_final type:int require:1 desc:是否终结点(0no1yes)
|
||
* @param name:sort type:int require:1 default:0 desc:权重
|
||
*/
|
||
public function addTopic(){
|
||
$data = $this->request->post();
|
||
$level = 0;
|
||
if($data['parent_id']==0){
|
||
$level = 1;
|
||
}else{
|
||
$parent_info = $this->journal_topic_obj->where('journal_topic_id',$data['parent_id'])->find();
|
||
$level = intval($parent_info['level'])+1;
|
||
}
|
||
$insert['journal_id'] = $data['journal_id'];
|
||
$insert['parent_id'] = $data['parent_id'];
|
||
$insert['title'] = $data['title'];
|
||
$insert['icon'] = $data['icon'];
|
||
if($data['parent_id']==0){
|
||
$insert['position'] = $data['position'];
|
||
}
|
||
$insert['is_final'] = $data['is_final'];
|
||
$insert['sort'] = $data['sort'];
|
||
$insert['level'] = $level;
|
||
$res = $this->journal_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/editTopic
|
||
* @method POST
|
||
*
|
||
* @param name:journal_topic_id type:int require:1 desc:主键
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:icon type:string require:1 desc:缩略图
|
||
* @param name:position type:string require:1 desc:摆放位置
|
||
* @param name:is_final type:int require:1 desc:是否终结点(0no1yes)
|
||
* @param name:sort type:int require:1 default:0 desc:权重
|
||
*/
|
||
public function editTopic(){
|
||
$data = $this->request->post();
|
||
$update['journal_topic_id'] = $data['journal_topic_id'];
|
||
$update['title'] = $data['title'];
|
||
$update['icon'] = $data['icon'];
|
||
$update['position'] = isset($data['position'])?$data['position']:'';
|
||
$update['is_final'] = $data['is_final'];
|
||
$update['sort'] = $data['sort'];
|
||
$res = $this->journal_topic_obj->update($update);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 删除话题
|
||
* @description 删除话题
|
||
* @author wangjinlei
|
||
* @url /master/Journal/delTopic
|
||
* @method POST
|
||
*
|
||
* @param name:journal_topic_id type:int require:1 desc:主键
|
||
*/
|
||
public function delTopic(){
|
||
$data = $this->request->post();
|
||
//排除有子节点的项
|
||
$rep = $this->journal_topic_obj->where('parent_id',$data['journal_topic_id'])->where('state',0)->find();
|
||
if($rep){
|
||
return json(['code'=>1,'msg'=>'删除的话题不能有子节点!']);
|
||
}
|
||
$res = $this->journal_topic_obj->where('journal_topic_id',$data['journal_topic_id'])->update(['state'=>1]);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 获取话题父级列表
|
||
* @description 获取话题父级列表
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getParent
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:
|
||
*
|
||
* @return parentList:array#
|
||
*/
|
||
public function getParent(){
|
||
$data = $this->request->post();
|
||
// $data['journal_id'] = 9;
|
||
$res = $this->journal_topic_obj
|
||
->where('journal_id',$data['journal_id'])
|
||
->where('state',0)
|
||
->where('is_final',0)
|
||
->order('sort desc')
|
||
->select();
|
||
//处理数组
|
||
$frag = [];
|
||
foreach ($res as $v){
|
||
if($v['parent_id'] == 0){
|
||
$frag[] = $v;
|
||
}
|
||
}
|
||
$ff = [];
|
||
foreach ($frag as $kk => $vv){
|
||
$ff[] = $this->getpChieldarr($vv, $res);
|
||
// $frag[$kk] = $this->getChieldarr($vv,$res);
|
||
}
|
||
$fff = [];
|
||
foreach ($ff as $vvv){
|
||
foreach ($vvv as $vvvv){
|
||
$fff[] = $vvvv;
|
||
}
|
||
}
|
||
return json(['code'=>0,'msg'=>'success','data'=>['parentList'=>$fff]]);
|
||
}
|
||
private function getpChieldarr($vv,$res){
|
||
if($vv['is_final']==1){
|
||
return $vv;
|
||
}
|
||
$frag = [];
|
||
$frag[] = $vv;
|
||
foreach ($res as $v){
|
||
if($v['parent_id'] == $vv['journal_topic_id']){
|
||
$frag[] = $this->getChieldarr($v, $res);
|
||
}
|
||
}
|
||
return $frag;
|
||
}
|
||
|
||
/**
|
||
* @title 获取话题列表
|
||
* @description 获取话题列表
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getTopicList
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return journal:array#
|
||
* @return topicList:话题数组@
|
||
* @topicList array:数据
|
||
*/
|
||
public function getTopicList(){
|
||
$data = $this->request->post();
|
||
$res = $this->journal_topic_obj
|
||
->where('journal_id',$data['journal_id'])
|
||
->where('state',0)
|
||
->select();
|
||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
//处理数组
|
||
$frag = [];
|
||
foreach ($res as $v){
|
||
if($v['parent_id'] == 0){
|
||
$frag[] = $v;
|
||
}
|
||
}
|
||
foreach ($frag as $kk => $vv){
|
||
$frag[$kk] = $this->getChieldarr($vv,$res);
|
||
}
|
||
return json(['code'=>0,'msg'=>'success','data'=>['journal'=>$journal_info,'topicList'=>$frag]]);
|
||
}
|
||
private function getChieldarr($vv,$res){
|
||
if($vv['is_final']==1){
|
||
return $vv;
|
||
}
|
||
foreach ($res as $v){
|
||
if($v['parent_id'] == $vv['journal_topic_id']){
|
||
$vv['children'][] = $this->getChieldarr($v, $res);
|
||
}
|
||
}
|
||
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 添加期刊外链
|
||
* @description 添加期刊外链
|
||
* @author wangjinlei
|
||
* @url /master/Journal/addJournalAbs
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:title type:int require:1 desc:标题
|
||
* @param name:url type:string require:1 desc:地址
|
||
* @param name:sort type:int require:1 default:0 desc:权重
|
||
* @param name:is_show type:int require:1 default:1 desc:是否显示(1yes0no)
|
||
*/
|
||
public function addJournalAbs(){
|
||
$data = $this->request->post();
|
||
$add_data['journal_id'] = $data['journal_id'];
|
||
$add_data['title'] = $data['title'];
|
||
$add_data['url'] = $data['url'];
|
||
$add_data['sort'] = $data['sort'];
|
||
$add_data['is_show'] = $data['is_show'];
|
||
$res = $this->journal_abs_obj->insert($add_data);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error!']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 删除期刊外链
|
||
* @description 删除期刊外链
|
||
* @author wangjinlei
|
||
* @url /master/Journal/delJournalAbs
|
||
* @method POST
|
||
*
|
||
* @param name:journal_abstracting_id type:int require:1 desc:期刊外链id
|
||
*/
|
||
public function delJournalAbs(){
|
||
$data = $this->request->post();
|
||
$this->journal_abs_obj->where('journal_abstracting_id',$data['journal_abstracting_id'])->update(['state'=>1]);
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}
|
||
|
||
/**
|
||
* @title 编辑期刊外链
|
||
* @description 编辑期刊外链
|
||
* @author wangjinlei
|
||
* @url /master/Journal/editJournalAbs
|
||
* @method POST
|
||
*
|
||
* @param name:journal_abstracting_id type:int require:1 desc:期刊外链id
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:title type:int require:1 desc:标题
|
||
* @param name:url type:string require:1 desc:地址
|
||
* @param name:sort type:int require:1 default:0 desc:权重
|
||
* @param name:is_show type:int require:1 default:1 desc:是否显示(1yes0no)
|
||
*/
|
||
public function editJournalAbs(){
|
||
$data = $this->request->post();
|
||
$this->journal_abs_obj->update($data);
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊外链
|
||
* @description 获取期刊外链
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getJournalAbs
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*/
|
||
public function getJournalAbs(){
|
||
$data = $this->request->post();
|
||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
$list = $this->journal_abs_obj->where('journal_id',$data['journal_id'])->where('state',0)->order('sort desc')->select();
|
||
return json(['code'=>0,'msg'=>'success','data'=>['journal'=>$journal_info,'absList'=>$list]]);
|
||
}
|
||
|
||
/**
|
||
* @title topic图片上传
|
||
* @description topic图片上传
|
||
* @author wangjinlei
|
||
* @url /master/Journal/up_topic_file
|
||
* @method POST
|
||
*
|
||
* @param name:name type:string require:1 default:journaltopic desc:文件域名称
|
||
*
|
||
* @return upurl:图片地址
|
||
*/
|
||
public function up_topic_file() {
|
||
$file = request()->file('journaltopic');
|
||
if ($file) {
|
||
$info = $file->move(ROOT_PATH . 'public' . DS . 'journaltopic');
|
||
if ($info) {
|
||
return json(['code'=>0 , 'msg'=>'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||
} else {
|
||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 添加期刊分期
|
||
* @description 添加期刊分期
|
||
* @author wangjinlei
|
||
* @url /master/Journal/addStage
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:stage_year type:string require:1 desc:分期年份
|
||
* @param name:stage_vol type:int require:1 desc:分期卷数
|
||
* @param name:stage_no type:int require:1 desc:分期号码
|
||
* @param name:stage_pagename type:string require:1 desc:page名称
|
||
* @param name:is_publish type:int require:1 default:1 desc:是否出刊
|
||
* @param name:stage_page type:string require:1 desc:分期页码
|
||
* @param name:issue_date type:string require:1 desc:发布时间
|
||
*/
|
||
public function addStage(){
|
||
$data = $this->request->post();
|
||
$insert_data['journal_id'] = $data['journal_id'];
|
||
$insert_data['stage_year'] = $data['stage_year'];
|
||
$insert_data['stage_vol'] = $data['stage_vol'];
|
||
$insert_data['stage_no'] = $data['stage_no'];
|
||
$insert_data['stage_pagename'] = $data['stage_pagename'];
|
||
$insert_data['stage_page'] = $data['stage_page'];
|
||
$insert_data['issue_date'] = $data['issue_date'];
|
||
$res = $this->journal_stage_obj->insert($insert_data);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊分期
|
||
* @description 获取期刊分期
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getStageList
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return journal:array#
|
||
* @return stage_list:array#
|
||
*/
|
||
public function getStageList(){
|
||
$data = $this->request->post();
|
||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
$stage_list = $this->journal_stage_obj->where('journal_id',$data['journal_id'])->where('state',0)->order('journal_stage_id desc')->select();
|
||
return json(['code'=>0,'msg'=>'success','data'=>['journal'=>$journal_info,'stage_list'=>$stage_list]]);
|
||
}
|
||
|
||
/**
|
||
* @title 删除期刊分期
|
||
* @description 删除期刊分期
|
||
* @author wangjinlei
|
||
* @url /master/Journal/delStage
|
||
* @method POST
|
||
*
|
||
* @param name:journal_stage_id type:int require:1 desc:期刊分期id
|
||
*/
|
||
public function delStage(){
|
||
$data = $this->request->post();
|
||
$res = $this->journal_stage_obj->where('journal_stage_id',$data['journal_stage_id'])->update(['state'=>1]);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 更改期刊分期
|
||
* @description 更改期刊分期
|
||
* @author wangjinlei
|
||
* @url /master/Journal/editStage
|
||
* @method POST
|
||
*
|
||
* @param name:journal_stage_id type:int require:1 desc:期刊分期id
|
||
* @param name:stage_year type:string require:1 desc:分期年份
|
||
* @param name:stage_vol type:int require:1 desc:分期卷数
|
||
* @param name:stage_no type:int require:1 desc:分期号码
|
||
* @param name:is_publish type:int require:1 default:1 desc:是否出刊
|
||
* @param name:stage_pagename type:string require:1 desc:分期页码name
|
||
* @param name:stage_page type:string require:1 desc:分期页码
|
||
* @param name:issue_date type:string require:1 desc:发布时间
|
||
*/
|
||
public function editStage(){
|
||
$data = $this->request->post();
|
||
$res = $this->journal_stage_obj->update($data);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 增加期刊消息
|
||
* @description 增加期刊消息
|
||
* @author wangjinlei
|
||
* @url /master/Journal/addNotices
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:title type:string require:1 desc:消息标题
|
||
* @param name:content type:string require:1 desc:内容
|
||
* @param name:ctime type:string require:1 desc:时间
|
||
*
|
||
*/
|
||
public function addNotices(){
|
||
$data = $this->request->post();
|
||
$insert['journal_id'] = $data['journal_id'];
|
||
$insert['title'] = $data['title'];
|
||
$insert['content'] = $data['content'];
|
||
$insert['ctime'] = $data['ctime']==''?time():strtotime($data['ctime']);
|
||
$res = $this->journal_notices_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/delNotices
|
||
* @method POST
|
||
*
|
||
* @param name:journal_notices_id type:int require:1 desc:期刊id
|
||
*
|
||
*/
|
||
public function delNotices(){
|
||
$data = $this->request->post();
|
||
$this->journal_notices_obj->where('journal_notices_id',$data['journal_notices_id'])->update(['state'=>1]);
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}
|
||
|
||
/**
|
||
* @title 更改期刊消息
|
||
* @description 更改期刊消息
|
||
* @author wangjinlei
|
||
* @url /master/Journal/changeNotices
|
||
* @method POST
|
||
*
|
||
* @param name:journal_notices_id type:int require:1 desc:期刊消息id
|
||
* @param name:title type:string require:1 desc:消息标题
|
||
* @param name:content type:string require:1 desc:内容
|
||
* @param name:ctime type:string require:1 desc:时间
|
||
*
|
||
*/
|
||
public function changeNotices(){
|
||
$data = $this->request->post();
|
||
$update['title'] = $data['title'];
|
||
$update['content'] = $data['content'];
|
||
$update['ctime'] = strtotime($data['ctime']);
|
||
$this->journal_notices_obj->where('journal_notices_id',$data['journal_notices_id'])->update($update);
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊消息
|
||
* @description 获取期刊消息
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getNotices
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return notices:消息list
|
||
* @return journal_info:期刊消息
|
||
*/
|
||
public function getNotices(){
|
||
$data = $this->request->post();
|
||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
$list = $this->journal_notices_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
|
||
return jsonSuccess(['journal_info'=>$journal_info,'notices'=>$list]);
|
||
}
|
||
|
||
/**
|
||
* @title 增加期刊收刊文章
|
||
* @description 增加期刊收刊文章
|
||
* @author wangjinlei
|
||
* @url /master/Journal/addJournalCfp
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:icon type:string require:1 desc:图标
|
||
* @param name:content type:string require:1 desc:内容
|
||
*
|
||
* @return notices:消息list
|
||
* @return journal_info:期刊消息
|
||
*/
|
||
public function addJournalCfp(){
|
||
$data = $this->request->post();
|
||
$insert['journal_id'] = $data['journal_id'];
|
||
$insert['title'] = $data['title'];
|
||
$insert['icon'] = $data['icon'];
|
||
$insert['content'] = $data['content'];
|
||
$insert['ctime'] = time();
|
||
$this->journal_cfp_obj->insert($insert);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 删除期刊收刊文章
|
||
* @description 删除期刊收刊文章
|
||
* @author wangjinlei
|
||
* @url /master/Journal/delJournalCfp
|
||
* @method POST
|
||
*
|
||
* @param name:journal_cfp_id type:int require:1 desc:期刊收刊id
|
||
*
|
||
*/
|
||
public function delJournalCfp(){
|
||
$data = $this->request->post();
|
||
$this->journal_cfp_obj->where('journal_cfp_id',$data['journal_cfp_id'])->update(['state'=>1]);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 编辑期刊收刊信息
|
||
* @description 删除期刊收刊文章
|
||
* @author wangjinlei
|
||
* @url /master/Journal/editJournalCfp
|
||
* @method POST
|
||
*
|
||
* @param name:journal_cfp_id type:int require:1 desc:期刊收刊id
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:icon type:string require:1 desc:图标
|
||
* @param name:content type:string require:1 desc:内容
|
||
*/
|
||
public function editJournalCfp(){
|
||
$data = $this->request->post();
|
||
$update['title'] = $data['title'];
|
||
$update['icon'] = $data['icon'];
|
||
$update['content'] = $data['content'];
|
||
$this->journal_cfp_obj->where('journal_cfp_id',$data['journal_cfp_id'])->update($update);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊收刊列表
|
||
* @description 获取期刊收刊列表
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getJournalCfps
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return journal:期刊信息#
|
||
* @return cfps:收刊列表#
|
||
*/
|
||
public function getJournalCfps(){
|
||
$data = $this->request->post();
|
||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
$list = $this->journal_cfp_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
|
||
|
||
$re['cfps'] = $list;
|
||
$re['journal'] = $journal_info;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title cfp图片上传
|
||
* @description cfp图片上传
|
||
* @author wangjinlei
|
||
* @url /master/Journal/up_cfp_file
|
||
* @method POST
|
||
*
|
||
* @param name:name type:string require:1 default:journalCfp desc:文件域名称
|
||
*
|
||
* @return upurl:图片地址
|
||
*/
|
||
public function up_cfp_file() {
|
||
$file = request()->file('journalCfp');
|
||
if ($file) {
|
||
$info = $file->move(ROOT_PATH . 'public' . DS . 'journalCfp');
|
||
if ($info) {
|
||
return json(['code'=>0 , 'msg'=>'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||
} else {
|
||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 添加期刊paper
|
||
* @description 添加期刊paper
|
||
* @author wangjinlei
|
||
* @url /master/Journal/addJournalPaper
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:title type:string require:1 desc:标题
|
||
*
|
||
*/
|
||
public function addJournalPaper(){
|
||
$data = $this->request->post();
|
||
$insert['journal_id'] = $data['journal_id'];
|
||
$insert['title'] = $data['title'];
|
||
$this->journal_paper_obj->insert($insert);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 删除期刊paper
|
||
* @description 删除期刊paper
|
||
* @author wangjinlei
|
||
* @url /master/Journal/delJournalPaper
|
||
* @method POST
|
||
*
|
||
* @param name:journal_paper_id type:int require:1 desc:期刊paperid
|
||
*
|
||
*/
|
||
public function delJournalPaper(){
|
||
$data = $this->request->post();
|
||
$this->journal_paper_obj->where('journal_paper_id',$data['journal_paper_id'])->update(['state'=>1]);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 编辑期刊paper
|
||
* @description 编辑期刊paper
|
||
* @author wangjinlei
|
||
* @url /master/Journal/editJournalPaper
|
||
* @method POST
|
||
*
|
||
* @param name:journal_paper_id type:int require:1 desc:期刊paperid
|
||
* @param name:title type:string require:1 desc:标题
|
||
*
|
||
*/
|
||
public function editJournalPaper(){
|
||
$data = $this->request->post();
|
||
$this->journal_paper_obj->where('journal_paper_id',$data['journal_paper_id'])->update(['title'=>$data['title']]);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 增加期刊paper文章
|
||
* @description 增加期刊paper文章
|
||
* @author wangjinlei
|
||
* @url /master/Journal/addJournalPaperArt
|
||
* @method POST
|
||
*
|
||
* @param name:journal_paper_id type:int require:1 desc:期刊paperid
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:content type:string require:1 desc:内容
|
||
*
|
||
*/
|
||
public function addJournalPaperArt(){
|
||
$data = $this->request->post();
|
||
$insert['journal_paper_id'] = $data['journal_paper_id'];
|
||
$insert['journal_id'] = $data['journal_id'];
|
||
$insert['title'] = $data['title'];
|
||
$insert['content'] = $data['content'];
|
||
$insert['ctime'] = time();
|
||
$this->journal_paper_art_obj->insert($insert);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 删除期刊paper文章
|
||
* @description 删除期刊paper文章
|
||
* @author wangjinlei
|
||
* @url /master/Journal/delJournalPaperArt
|
||
* @method POST
|
||
*
|
||
* @param name:journal_paper_art_id type:int require:1 desc:期刊paperid
|
||
*
|
||
*/
|
||
public function delJournalPaperArt(){
|
||
$data = $this->request->post();
|
||
$this->journal_paper_art_obj->where('journal_paper_art_id',$data['journal_paper_art_id'])->update(['state'=>1]);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 编辑期刊paper文章
|
||
* @description 编辑期刊paper文章
|
||
* @author wangjinlei
|
||
* @url /master/Journal/editJournalPaperArt
|
||
* @method POST
|
||
*
|
||
* @param name:journal_paper_art_id type:int require:1 desc:期刊paper文章id
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:content type:string require:1 desc:内容
|
||
*
|
||
*/
|
||
public function editJournalPaperArt(){
|
||
$data = $this->request->post();
|
||
$update['title'] = $data['title'];
|
||
$update['content'] = $data['content'];
|
||
$this->journal_paper_art_obj->where('journal_paper_art_id',$data['journal_paper_art_id'])->update($update);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊paper
|
||
* @description 获取期刊paper
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getJournalPapers
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊paperid
|
||
*
|
||
* @return paperLists:paperlist#
|
||
*
|
||
*/
|
||
public function getJournalPapers(){
|
||
$data = $this->request->post();
|
||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
$journalPapers = $this->journal_paper_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
|
||
|
||
$re['journalInfo'] = $journal_info;
|
||
$re['paperLists'] = $journalPapers;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊paper文章列表
|
||
* @description 获取期刊paper文章列表
|
||
* @author wangjinlei
|
||
* @url /master/Journal/getJournalPaperArt
|
||
* @method POST
|
||
*
|
||
* @param name:journal_paper_id type:int require:1 desc:期刊paperid
|
||
*
|
||
* @return paperinfo:array#
|
||
* @return articleLists:paperlist#
|
||
*
|
||
*/
|
||
public function getJournalPaperArt(){
|
||
$data = $this->request->post();
|
||
$paper_info = $this->journal_paper_obj->where('journal_paper_id',$data['journal_paper_id'])->find();
|
||
$list = $this->journal_paper_art_obj->where('journal_paper_id',$data['journal_paper_id'])->where('state',0)->select();
|
||
|
||
$re['paperinfo'] = $paper_info;
|
||
$re['articleLists'] = $list;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
}
|