696 lines
25 KiB
PHP
696 lines
25 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_abs_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->journal_abs_obj = Db::name('journal_abstracting');
|
||
$this->article_to_topic_obj = Db::name('article_to_topic');
|
||
}
|
||
|
||
/**
|
||
* @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: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['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/getJournalDetail
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id require:1 desc:主键
|
||
*
|
||
* @return
|
||
*/
|
||
public function getJournalDetail(){
|
||
// $data = $this->request->post();
|
||
// $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
|
||
|
||
}
|
||
|
||
|
||
/**
|
||
* @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: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 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['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: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'];
|
||
$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: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['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: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: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']);
|
||
}
|
||
}
|
||
|
||
|
||
}
|