diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index 52ecc16..c62420b 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -1451,6 +1451,7 @@ class Article extends Base ->join("t_journal", "t_journal.issn = t_major_to_journal.journal_issn", "left") ->where("t_major_to_journal.major_id", $data['major_id']) ->where('t_major_to_journal.mtj_state', 0) + ->where("t_journal.state",0) ->select(); $re['journals'] = $list; diff --git a/application/api/controller/Auto.php b/application/api/controller/Auto.php index 2710a6f..8374b5f 100644 --- a/application/api/controller/Auto.php +++ b/application/api/controller/Auto.php @@ -157,6 +157,8 @@ class Auto extends Base $ca_rev_info = $this->article_reviewer_obj->where('art_rev_id',$v['art_rev_id'])->find(); if($ca_rev_info['state']==2){ $com = 2; + }elseif($ca_rev_info['state']==1){//大修的复审不需要做处理 + continue; }else{ $com = 1; } diff --git a/application/api/controller/Base.php b/application/api/controller/Base.php index d6c6502..67a183b 100644 --- a/application/api/controller/Base.php +++ b/application/api/controller/Base.php @@ -70,6 +70,7 @@ class Base extends Controller protected $promotion_obj = ''; protected $promotion_email_obj = ''; protected $article_reviewer_repeat_obj = ''; + protected $board_group_obj = ""; public function __construct(\think\Request $request = null) @@ -137,6 +138,7 @@ class Base extends Controller $this->promotion_obj = Db::name("promotion"); $this->promotion_email_obj = Db::name("promotion_email"); $this->article_reviewer_repeat_obj = Db::name("article_reviewer_repeat"); + $this->board_group_obj = Db::name("board_group"); } @@ -360,6 +362,32 @@ class Base extends Controller return jsonSuccess([]); } + public function getBoardsForJournal($journal_id){ + $ca_board = []; + $boards = $this->board_to_journal_obj + ->field("t_board_to_journal.*,t_board_group.group_name,t_user.account,t_user.email,t_user.realname,t_user.icon,t_user.google_index,t_user.google_time,t_user_reviewer_info.*") + ->join("t_board_group","t_board_group.board_group_id = t_board_to_journal.board_group_id","left") + ->join("t_user","t_user.user_id = t_board_to_journal.user_id","left") + ->join("t_user_reviewer_info","t_user_reviewer_info.reviewer_id=t_board_to_journal.user_id","left") + ->where('t_board_to_journal.journal_id',$journal_id) + ->where('t_board_to_journal.state',0) + ->select(); + foreach ($boards as $val){ + if($val['type']==0){//主编 + $ca_board['main'][] = $val; + }elseif ($val['type']==1){//副主编 + $ca_board['remain'][] = $val; + }else{//编委会成员 + if($val['board_group_id']==0){ + $ca_board['member']['nogroup'][] = $val; + }else{ + $ca_board['member'][$val['group_name']][] = $val; + } + } + } + return $ca_board; + } + public function getCvs($user_id) { diff --git a/application/api/controller/Board.php b/application/api/controller/Board.php index 9cd008e..25a8825 100644 --- a/application/api/controller/Board.php +++ b/application/api/controller/Board.php @@ -2,7 +2,7 @@ namespace app\api\controller; -use think\Controller; +use app\api\controller\Base; use think\Db; use think\Queue; use think\Validate; @@ -11,54 +11,23 @@ use think\Validate; * @title 编委相关接口 * @description 编委相关接口 */ -class Board extends Controller { +class Board extends Base { - protected $article_obj = ''; - protected $user_obj = ''; - protected $user_act_obj = ''; - protected $journal_obj = ''; - protected $user_log_obj = ''; - protected $reviewer_major_obj = ''; - protected $reviewer_to_journal_obj = ''; - protected $article_msg_obj = ''; - protected $article_file_obj = ''; - protected $article_reviewer_obj = ''; - protected $article_author_obj = ''; - protected $article_transfer_obj = ''; protected $staff_obj = ''; protected $staff_level_obj = ''; protected $staff_log_obj = ''; protected $staff_to_journal_obj = ''; - protected $chief_to_journal_obj = ''; - protected $board_to_journal_obj = ''; protected $chief_msg_obj = ''; protected $article_to_board_obj = ''; - protected $login_auto_obj = ''; public function __construct(\think\Request $request = null) { parent::__construct($request); - $this->user_obj = Db::name('user'); - $this->user_act_obj = Db::name('user_act'); - $this->article_obj = Db::name('article'); - $this->journal_obj = Db::name('journal'); - $this->user_log_obj = Db::name('user_log'); - $this->reviewer_major_obj = Db::name('reviewer_major'); - $this->reviewer_to_journal_obj = Db::name('reviewer_to_journal'); - $this->article_msg_obj = Db::name('article_msg'); - $this->article_file_obj = Db::name('article_file'); - $this->article_reviewer_obj = Db::name('article_reviewer'); - $this->article_author_obj = Db::name('article_author'); - $this->article_transfer_obj = Db::name('article_transfer'); $this->staff_obj = Db::name('staff'); $this->staff_level_obj = Db::name('staff_level'); $this->staff_log_obj = Db::name('staff_log'); $this->staff_to_journal_obj = Db::name('staff_to_journal'); - $this->chief_to_journal_obj = Db::name('chief_to_journal'); - $this->board_to_journal_obj = Db::name('board_to_journal'); $this->chief_msg_obj = Db::name('chief_msg'); $this->article_to_board_obj = Db::name('article_to_board'); - $this->chief_to_journal_obj = Db::name('chief_to_journal'); - $this->login_auto_obj = Db::name('login_auto'); } /** @@ -290,10 +259,23 @@ class Board extends Controller { } + public function getBoards(){ + $data = $this->request->post(); + $rule = new Validate([ + "journal_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $re['boards'] = $this->getBoardsForJournal($data['journal_id']); + return jsonSuccess($re); + } + + /** * 获取编委列表 */ - public function getBoards(){ + public function getBoards1(){ $data = $this->request->post(); $rule = new Validate([ 'journal_id'=>'require', @@ -372,10 +354,22 @@ class Board extends Controller { return jsonSuccess($re); } + public function delBoard(){ + $data = $this->request->post(); + $rule = new Validate([ + "btj_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $this->board_to_journal_obj->where('btj_id',$data['btj_id'])->update(['state'=>1]); + return jsonSuccess([]); + } + /** * 删除编委 */ - public function delBoard(){ + public function delBoard1(){ $data = $this->request->post(); $rule = new Validate([ 'board_id' => 'require' @@ -393,10 +387,24 @@ class Board extends Controller { return jsonSuccess([]); } - /** - * 获取编委分组列表 - */ public function getBoardGroupList(){ + $data = $this->request->post(); + $rule = new Validate([ + "journal_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $groups = $this->board_group_obj->where('journal_id',$data['journal_id'])->where("state",0)->select(); + $re['groups'] = $groups; + + return jsonSuccess($re); + } + + /** + * 获取编委分组列表(原版) + */ + public function getBoardGroupList1(){ $data = $this->request->post(); $rule = new Validate([ 'journal_id'=>'require' @@ -417,7 +425,7 @@ class Board extends Controller { /** * 添加编委分组 */ - public function addBoardGroup(){ + public function addBoardGroup1(){ $data = $this->request->post(); $rule = new Validate([ 'journal_id'=>'require|number', @@ -435,10 +443,25 @@ class Board extends Controller { return jsonSuccess([]); } + public function addBoardGroup(){ + $data = $this->request->post(); + $rule = new Validate([ + 'journal_id'=>'require|number', + 'group_name'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $insert['journal_id'] = $data['journal_id']; + $insert['group_name'] = trim($data['group_name']); + $this->board_group_obj->insert($insert); + return jsonSuccess([]); + } + /** * 删除编委分组 */ - public function delBoardGroup(){ + public function delBoardGroup1(){ $data = $this->request->post(); $rule = new Validate([ 'board_group_id'=>'require' @@ -457,10 +480,53 @@ class Board extends Controller { } } + public function delBoardGroup(){ + $data = $this->request->post(); + $rule = new Validate([ + 'board_group_id'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $check = $this->board_to_journal_obj->where('board_group_id',$data['board_group_id'])->where('state',0)->find(); + if($check){ + return jsonError("Please note that there are editorial committee members in the group, and you cannot delete this group."); + } + $this->board_group_obj->where('board_group_id',$data['board_group_id'])->update(['state'=>1]); + return jsonSuccess([]); + } + + public function addBoard(){ + $data = $this->request->post(); + $rule = new Validate([ + "user_id"=>"require", + "journal_id"=>"require", + "type"=>"require", + "board_group_id"=>"require", + "research_areas"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $check = $this->board_to_journal_obj->where('user_id',$data['user_id'])->where('state',0)->find(); + if($check){ + return jsonError("According to TMR Publishing Group Policy, scientists are not allowed to serve on the editorial board of more than one journal at the same time."); + } + + //添加对应关系 + $insert['user_id'] = $data['user_id']; + $insert['journal_id'] = $data['journal_id']; + $insert['type'] = $data['type']; + $insert['board_group_id'] = $data['board_group_id']; + $insert['research_areas'] = trim($data['research_areas']); + $this->board_to_journal_obj->insert($insert); + return jsonSuccess([]); + } + /** * 添加编委 */ - public function addBoard(){ + public function addBoard1(){ $data = $this->request->post(); $rule = new Validate([ 'user_id'=>'require', @@ -515,10 +581,28 @@ class Board extends Controller { return jsonSuccess([]); } + public function editBoard(){ + $data = $this->request->post(); + $rule = new Validate([ + "btj_id"=>"require", + "type"=>'require', + "board_group_id"=>"require", + "research_areas"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $update['type'] = $data['type']; + $update['board_group_id'] = $data['type']==2?$data['board_group_id']:0; + $update['research_areas'] = trim($data['research_areas']); + $this->board_to_journal_obj->where('btj_id',$data['btj_id'])->update($update); + return jsonSuccess([]); + } + /** * 编辑编委信息 */ - public function editBoard(){ + public function editBoard1(){ $data = $this->request->post(); $rule = new Validate([ 'board_id'=>'require', diff --git a/application/api/controller/Monitor.php b/application/api/controller/Monitor.php new file mode 100644 index 0000000..77d7373 --- /dev/null +++ b/application/api/controller/Monitor.php @@ -0,0 +1,49 @@ +journal_obj->where('state',0)->select(); + foreach ($journals as $k => $v){ + $ca_board = $this->getBoardsForJournal($v['journal_id']); + $journals[$k]["boards"] = $ca_board; + $journals[$k]['boards_count'] = $this->board_to_journal_obj->where("journal_id",$v['journal_id'])->where('state',0)->count(); + } + $re['journals'] = $journals; + + return jsonSuccess($re); + } + + /**获取编委 + * @return void + */ + public function getboards(){ + $data = $this->request->post(); + $rule = new Validate([ + "journal_id" => "require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $ca_board = $this->getBoardsForJournal($data['journal_id']); + $re['boards'] = $ca_board; + + return jsonSuccess($re); + } + +} \ No newline at end of file diff --git a/application/api/controller/Reviewer.php b/application/api/controller/Reviewer.php index 1906f3e..8804e4a 100644 --- a/application/api/controller/Reviewer.php +++ b/application/api/controller/Reviewer.php @@ -931,6 +931,14 @@ class Reviewer extends Base // sendEmail("1586428462@qq.com", "title", "ttttt", "content", 'tmr@tmrjournals.com', "Wu9999999999", $reviewer_ZS); // } + /**提交复审 + * @return \think\response\Json + * @throws \think\Exception + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ public function questionRepeat(){ $data = $this->request->post(); $rule = new Validate([ @@ -941,6 +949,9 @@ class Reviewer extends Base return jsonError($rule->getError()); } $repeat_info = $this->article_reviewer_repeat_obj->where('art_rev_rep_id',$data['art_rev_rep_id'])->find(); + $art_info = $this->article_reviewer_obj->where('art_rev_id',$repeat_info['art_rev_id'])->find(); + $article_info = $this->article_obj->where('article_id',$art_info['article_id'])->find(); + $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find(); $update['recommend'] = $data['recommend']; $update['stime'] = time(); if($data['recommend']==3){ @@ -957,6 +968,10 @@ class Reviewer extends Base //复审后发送邮件 + //增加usermsg + add_usermsg($journal_info['editor_id'], 'New re_reviewer', '/articleReviewerDetail?id=' . $art_info['art_rev_id']); + + return jsonSuccess([]); } diff --git a/application/api/controller/Ucenter.php b/application/api/controller/Ucenter.php index 7bbd948..5dc2fc3 100644 --- a/application/api/controller/Ucenter.php +++ b/application/api/controller/Ucenter.php @@ -358,6 +358,7 @@ class Ucenter extends Base{ 'major'=>$data['major'], 'field'=>$data['field'], 'introduction'=>isset($data['introduction'])?$data['introduction']:'', + "website"=>isset($data['website'])?$data["website"]:"", 'company'=>$data['company'] ]; $this->user_reviewer_info_obj->where(['reviewer_id'=>$data['user_id']])->update($updata1); diff --git a/application/api/controller/Web.php b/application/api/controller/Web.php index 45ed06f..ba2cc8f 100644 --- a/application/api/controller/Web.php +++ b/application/api/controller/Web.php @@ -121,8 +121,8 @@ class Web extends Base //添加复审问卷 $reviewers[$k]['re_question']=$this->article_reviewer_repeat_obj->where('art_rev_id',$v['art_rev_id'])->select(); }else { - $reviewers[$k]['question'] = []; - $reviewers[$k]['re_question'] = []; + $reviewers[$k]['question'] = null; + $reviewers[$k]['re_question'] = null; } } $begin['type'] = 0; @@ -143,12 +143,14 @@ class Web extends Base if($v['state_to']==4&&!$reciv&&$reviewer_has&&(($article_info['journal_id']==1&&$p_info['journal_stage_id']>=453)||$article_info['journal_id']==23)){ $r_files = $this->article_response_to_reviewer_obj->where('article_id',$article_info['article_id'])->select(); $reciv=true; - $frag[] = [ - "type"=>$v['state_to'], - "response" => $r_files, - "time"=>$v['ctime'] - ]; - continue; + if($r_files){ + $frag[] = [ + "type"=>$v['state_to'], + "response" => $r_files, + "time"=>$v['ctime'] + ]; + continue; + } } $frag[] = [ "type"=>$v['state_to'],