185 lines
6.5 KiB
PHP
185 lines
6.5 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use think\Controller;
|
|
use think\Db;
|
|
use think\Validate;
|
|
use app\api\controller\User as usercontroller;
|
|
use think\Queue;
|
|
|
|
/**
|
|
* @title 期刊相关
|
|
* @description 期刊相关
|
|
*/
|
|
class Journal extends Controller {
|
|
|
|
protected $user_obj = '';
|
|
protected $captcha_obj = '';
|
|
protected $journal_obj = '';
|
|
protected $user_act_obj = '';
|
|
protected $reviewer_major_obj = '';
|
|
protected $article_obj = '';
|
|
protected $article_msg_obj = '';
|
|
protected $article_author_obj = '';
|
|
protected $admin_obj = '';
|
|
protected $country_obj = '';
|
|
protected $reviewer_to_journal_obj = '';
|
|
protected $user_reviewer_info_obj = '';
|
|
protected $user_reviewer_obj = '';
|
|
protected $user_msg_obj = '';
|
|
protected $user_to_special_obj = '';
|
|
|
|
public function __construct(\think\Request $request = null) {
|
|
parent::__construct($request);
|
|
$this->user_obj = Db::name('user');
|
|
$this->captcha_obj = Db::name('captcha');
|
|
$this->user_act_obj = Db::name('user_act');
|
|
$this->admin_obj = Db::name('admin');
|
|
$this->reviewer_major_obj = Db::name('reviewer_major');
|
|
$this->journal_obj = Db::name('journal');
|
|
$this->user_reviewer_obj = Db::name('user_reviewer_apply');
|
|
$this->user_reviewer_info_obj = Db::name('user_reviewer_info');
|
|
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
|
|
$this->article_obj = Db::name('article');
|
|
$this->user_msg_obj = Db::name('user_msg');
|
|
$this->article_msg_obj = Db::name('article_msg');
|
|
$this->article_author_obj = Db::name('article_author');
|
|
$this->country_obj = Db::name('country');
|
|
$this->user_to_special_obj = Db::name('user_to_special');
|
|
}
|
|
|
|
/**
|
|
* @title 获取期刊列表除去审稿人已存在审稿关系
|
|
* @description 获取期刊列表除去审稿人已存在审稿关系
|
|
* @author wangjinlei
|
|
* @url /api/Journal/getJournalOutReviewer
|
|
* @method POST
|
|
*
|
|
* @param name:username type:string require:1 desc:用户名
|
|
*
|
|
* @return journals:期刊列表#
|
|
*/
|
|
public function getJournalOutReviewer(){
|
|
$data = $this->request->post();
|
|
$user_info = $this->user_obj->where("account",$data['username'])->find();
|
|
$journalIds = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('state',0)->column('journal_id');
|
|
$list = $this->journal_obj->where('journal_id',"not in",$journalIds)->where('state',0)->select();
|
|
|
|
$re['journals'] = $list;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* @title 获取审稿人所属期刊列表
|
|
* @description 获取审稿人所属期刊列表
|
|
* @author wangjinlei
|
|
* @url /api/Journal/getJournalInReviewer
|
|
* @method POST
|
|
*
|
|
* @param name:username type:string require:1 desc:用户名
|
|
*
|
|
* @return journals:期刊列表#
|
|
*/
|
|
public function getJournalInReviewer(){
|
|
$data = $this->request->post();
|
|
$user_info = $this->user_obj->where('account',$data['username'])->where('state',0)->find();
|
|
$list = $this->reviewer_to_journal_obj
|
|
->field("t_journal.*")
|
|
->join('t_journal',"t_journal.journal_id = t_reviewer_to_journal.journal_id","left")
|
|
->where('t_reviewer_to_journal.reviewer_id',$user_info['user_id'])
|
|
->where('t_reviewer_to_journal.state',0)
|
|
->select();
|
|
|
|
$re['journals'] = $list;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取可申请审稿人的期刊
|
|
*/
|
|
public function getJournalsForReviewerInEditor(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'editor_id' => 'require',
|
|
'reviewer_id' => 'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
|
|
$editor_info = $this->user_obj->where('user_id',$data['editor_id'])->find();
|
|
$journalIds = [];
|
|
if($editor_info['type']==2){//责任编辑
|
|
$journalIds = $this->journal_obj->where('editor_id',$editor_info['user_id'])->column('journal_id');
|
|
}else{//客座编辑
|
|
$guests = $this->user_to_special_obj->where('user_id',$data['reviewer_id'])->where('uts_state',0)->select();
|
|
$usercontroller = new usercontroller();
|
|
foreach($guests as $v){
|
|
$c_res = $usercontroller->getSpecialDetailById($v['special_id']);
|
|
$journalIds[] = $this->journal_obj->where('issn',$c_res['journal_issn'])->value('journal_id');
|
|
}
|
|
}
|
|
$njournalIds = $this->reviewer_to_journal_obj->where('reviewer_id',$data['reviewer_id'])->where('state',0)->column('journal_id');
|
|
$list = $this->journal_obj->where('journal_id',"not in",$njournalIds)->where('journal_id',"in",$journalIds)->where('state',0)->select();
|
|
|
|
$re['journals'] = $list;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
public function editJournal(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'journal_id'=>'require',
|
|
'level'=>'require',
|
|
'email'=>'require',
|
|
'epassword'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$update['level'] = $data['level'];
|
|
$update['email'] = $data['email'];
|
|
$update['epassword'] = $data['epassword'];
|
|
$this->journal_obj->where('journal_id',$data['journal_id'])->update($update);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 获取期刊详情
|
|
*/
|
|
public function getJournalDetail(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'journal_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
$re['journal'] = $info;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 获取期刊详情通过文章id
|
|
*/
|
|
public function getJournalDetailByArticleId(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
|
$info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
|
|
$re['journal'] = $info;
|
|
return jsonSuccess($re);
|
|
|
|
}
|
|
|
|
|
|
}
|