diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index a037ece..c626c89 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -143,6 +143,7 @@ class Article extends Controller { $p_info = $this->production_article_obj->where('article_id',$val['article_id'])->where('state',0)->find(); if($p_info&&$p_info['proof_state']==1){ $proof_state = 1; + $res[$key]['state']=7; } } $res[$key]['proof'] = $proof_state; @@ -155,17 +156,17 @@ class Article extends Controller { /** * 获取proof的详情 */ - public function getProofDetail(){ - $data = $this->request->post(); - $rule = new Validate([]); - if(!$rule->check($data)){ - return jsonError($rule->getError()); - } + // public function getProofDetail(){ + // $data = $this->request->post(); + // $rule = new Validate([]); + // if(!$rule->check($data)){ + // return jsonError($rule->getError()); + // } - } + // } /** * @title 获取文章列表(编辑) diff --git a/application/api/controller/Board.php b/application/api/controller/Board.php index 66f1e2b..9cb4980 100644 --- a/application/api/controller/Board.php +++ b/application/api/controller/Board.php @@ -220,6 +220,272 @@ class Board extends Controller { $re['boards'] = $list; return jsonSuccess($re); } + + + /** + * 获取编委列表 + */ + public function getBoards(){ + $data = $this->request->post(); + $rule = new Validate([ + 'journal_id'=>'require', + 'board_group_id'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find(); + + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/getBoardListForSubmit'; + $pra = []; + $pra['issn'] = $journal_info['issn']; + // if($data['board_group_id']!=-1){ + $pra['board_group_id'] = $data['board_group_id']; + // }else{ + // $pra['board_group_id'] + // } + $res = object_to_array(json_decode(myPost($url, $pra))); + $boards = $res['data']['boards']; + $frag = []; + foreach($boards as $k => $v){ + $cache_user = $this->user_obj->where('user_id',$v['tuser_id'])->find(); + $h_index = $this->user_index_obj->where('user_id',$cache_user['user_id'])->where('year',date('Y'))->find(); + $h_index_num = 0; + if($h_index){ + $h_index_num = $h_index['h_index']; + } + $boards[$k]['phone'] = $cache_user['phone']; + $boards[$k]['hindex'] = $h_index_num; + } + $re['boards'] = $boards; + return jsonSuccess($re); + } + + /** + * 获取编委信息详情 + */ + public function getBoardMsgDetail(){ + $data = $this->request->post(); + $rule = new Validate([ + 'board_id'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/getBoardDetail'; + $pra = []; + $pra['board_id'] = $data['board_id']; + $res = object_to_array(json_decode(myPost($url, $pra))); + $board = $res['data']['board']; + $user_info = $this->user_obj->where('user_id',$board['tuser_id'])->find(); + // $index_info = $this->user_index_obj->where('user_id',$user_info['user_id'])->where('year',date('Y'))->find(); + // if($index_info){ + // $board['h_index'] = $index_info['h_index']; + // }else{ + // $board['h_index'] = 0; + // } + $re['board'] = $board; + return jsonSuccess($re); + } + + /** + * 删除编委 + */ + public function delBoard(){ + $data = $this->request->post(); + $rule = new Validate([ + 'board_id' => 'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/delBoard'; + $pra = []; + $pra['board_id'] = $data['board_id']; + $res = object_to_array(json_decode(myPost($url, $pra))); + $board = $res['data']['board']; + $journal_info = $this->journal_obj->where('issn',$board['issn'])->find(); + $this->board_to_journal_obj->where('user_id',$board['tuser_id'])->where('journal_id',$journal_info['journal_id'])->update(['state'=>1]); + return jsonSuccess([]); + } + + /** + * 获取编委分组列表 + */ + public function getBoardGroupList(){ + $data = $this->request->post(); + $rule = new Validate([ + 'journal_id'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find(); + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/getBoardGroups'; + $pra = []; + $pra['issn'] = $journal_info['issn']; + $res = object_to_array(json_decode(myPost($url, $pra))); + $groups = $res['data']['groups']; + $re['groups'] = $groups; + return jsonSuccess($re); + } + + /** + * 添加编委分组 + */ + 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()); + } + $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find(); + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/addBoardGroup'; + $pra = []; + $pra['issn'] = $journal_info['issn']; + $pra['group_name'] = trim($data['group_name']); + $res = object_to_array(json_decode(myPost($url, $pra))); + return jsonSuccess([]); + } + + /** + * 删除编委分组 + */ + public function delBoardGroup(){ + $data = $this->request->post(); + $rule = new Validate([ + 'board_group_id'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/delBoardGroup'; + $pra = []; + $pra['board_group_id'] = $data['board_group_id']; + $res = object_to_array(json_decode(myPost($url, $pra))); + if($res['code']==0){ + return jsonSuccess([]); + }else{ + return jsonError($res['msg']); + } + } + + /** + * 添加编委 + */ + public function addBoard(){ + $data = $this->request->post(); + $rule = new Validate([ + 'user_id'=>'require', + 'journal_id'=>'require', + 'name'=>'require', + 'board_group_id'=>'require', + 'website'=>'require', + 'type'=>'require', + 'dr'=>'require', + 'title'=>'require', + 'field'=>'require', + 'address'=>'require', + 'country'=>'require', + 'board_icon'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $user_info = $this->user_obj->where('user_id',$data['user_id'])->find(); + $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find(); + $check = $this->board_to_journal_obj->where('user_id',$data['user_id'])->where('journal_id',$data['journal_id'])->find(); + if($check){ + return jsonError("Add repeatedly"); + } + + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/addBoard'; + $pra = []; + $pra['user_id'] = $data['user_id']; + $pra['journal_issn'] = $journal_info['issn']; + $pra['type'] = $data['type']; + $pra['name'] = $data['name']; + $pra['website'] = $data['website']; + $pra['dr'] = $data['dr']; + $pra['email'] = $user_info['email']; + $pra['title'] = $data['title']; + $pra['field'] = $data['field']; + $pra['address'] = $data['address']; + $pra['country'] = $data['country']; + $pra['board_icon'] = $data['board_icon']; + $pra['board_group_id'] = $data['board_group_id']; + $res = object_to_array(json_decode(myPost($url, $pra))); + if($res['code']==1){ + return jsonError($res['msg']); + } + + //添加对应关系 + $insert['user_id'] = $data['user_id']; + $insert['journal_id'] = $data['journal_id']; + $this->board_to_journal_obj->insert($insert); + return jsonSuccess([]); + } + + /** + * 编辑编委信息 + */ + public function editBoard(){ + $data = $this->request->post(); + $rule = new Validate([ + 'board_id'=>'require', + 'name'=>'require', + 'board_group_id'=>'require', + 'website'=>'require', + 'type'=>'require', + 'dr'=>'require', + 'title'=>'require', + 'field'=>'require', + 'address'=>'require', + 'country'=>'require', + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/editBoard'; + $pra = []; + $pra['board_id'] = $data['board_id']; + $pra['type'] = $data['type']; + $pra['name'] = $data['name']; + $pra['website'] = $data['website']; + $pra['dr'] = $data['dr']; + $pra['title'] = $data['title']; + $pra['field'] = $data['field']; + $pra['address'] = $data['address']; + $pra['country'] = $data['country']; + $pra['board_group_id'] = $data['board_group_id']; + $res = object_to_array(json_decode(myPost($url, $pra))); + return jsonSuccess([]); + } + + /** + * 编辑编委头像信息 + */ + public function editIcon(){ + $data = $this->request->post(); + $rule = new Validate([ + 'board_id'=>'require', + 'board_icon'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/editBoardIcon'; + $pra = []; + $pra['board_id'] = $data['board_id']; + $pra['board_icon'] = $data['board_icon']; + $res = object_to_array(json_decode(myPost($url, $pra))); + + return jsonSuccess([]); + } /** * @title 编委导入--关联用户 @@ -329,5 +595,19 @@ class Board extends Controller { $re['user'] = $user; return jsonSuccess($re); } + + public function up_boardIcon_file(){ + $file = request()->file('boardIcon'); + if ($file) { + $info = $file->move(ROOT_PATH . 'public' . DS . 'boardIcon'); + if ($info) { + return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]); + } else { + return json(['code' => 1, 'msg' => $file->getError()]); + } + } + } + + } diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index 3af55d7..e1a6f67 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -391,6 +391,10 @@ class Production extends Controller } // $data['p_article_id'] = 7; $p_info = $this->production_article_obj->where('p_article_id',$data['p_article_id'])->find(); + if($p_info['proof_state']!=2){ + return jsonError('Warning: It is a violation to publish your article online without completing PROOF. + The ONLINE step will only continue if you have completed the PROOF step.'); + } $article_info = $this->article_obj->where('article_id',$p_info['article_id'])->find(); $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find(); $authors = $this->production_article_author_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select(); @@ -563,6 +567,7 @@ class Production extends Controller return jsonError($rule->getError()); } $p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find(); + proofState($p_info['article_id']); $list = $this->production_article_author_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select(); foreach ($list as $k => $v) { $list[$k]['organs'] = $this->production_article_author_to_organ_obj @@ -576,6 +581,27 @@ class Production extends Controller return jsonSuccess($re); } + /** + * 获取生产实例详情通过文章id + */ + public function getProductionDetailByArticleid() + { + $data = $this->request->post(); + $rule = new Validate([ + 'article_id' => 'require|number' + ]); + if (!$rule->check($data)) { + return jsonError($rule->getError()); + } + $p_info = $this->production_article_obj->where('article_id', $data['article_id'])->where('state',0)->find(); + $article_info = $this->article_obj->where('article_id',$p_info['article_id'])->find(); + $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find(); + $re['production'] = $p_info; + $re['article'] = $article_info; + $re['journal'] = $journal_info; + return jsonSuccess($re); + } + /** * 添加作者机构 @@ -946,13 +972,14 @@ class Production extends Controller //发送邮件 $tt = "Dear Author,

"; $tt .= "Please confirm proof of your manuscript on the submission website within 48 hours. (https://submission.tmrjournals.com)

"; - $tt .= "Click here to confirm the proof.
"; - $tt .= "Click here to make changes based on this version.

"; + $tt .= "Click here to confirm the proof.
"; + $tt .= "Click here to make changes based on this version.

"; $tt .= "If your response is not received, we will regard the author's consent to the version if the time exceeds.

"; $tt .= "If you have any questions, please feel free to contact us.
"; $tt .= "Note: Double-check the authors' information carefully to ensure they are correct."; + // $maidata['email'] = '751475802@qq.com'; $maidata['email'] = $user_info['email']; $maidata['title'] = "PROOF|".$journal_info['title']; $maidata['content'] = $tt; @@ -960,15 +987,14 @@ class Production extends Controller $maidata['tpassword'] = $journal_info['epassword']; $file = ROOT_PATH . 'public' . DS.'proofPDF'.DS.$p_info['article_id'].'.pdf'; sendEmail($maidata['email'],$maidata['title'],$journal_info['title'],$maidata['content'],$maidata['tmail'],$maidata['tpassword'],$file); - // Queue::push('app\api\job\mail@fire', $maidata, "tmail"); //更改数据库 - $update['proof_state'] = 1; + $updata['proof_state'] = 1; $updata['proof_stime'] = time(); $updata['proof_etime'] = strtotime("+2 day"); $this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($updata); - return jsonSuccess([]); + return jsonSuccess(['msg'=>$this->production_article_obj->getLastSql()]); } /** @@ -978,6 +1004,8 @@ class Production extends Controller $this->production_article_obj->where('proof_state',1)->where('proof_etime','<',time())->update(['proof_state'=>2]); } + + /** * 作者反馈proof */ @@ -991,14 +1019,14 @@ class Production extends Controller return jsonError($rule->getError()); } $updata = []; + $updata['proof_rtime'] = time(); if($data['code']==0){//同意 - $update['proof_state'] = 2; + $updata['proof_state'] = 2; }else{//拒绝 - $update['proof_state'] = 2; - $update['proof_content'] = trim($data['content']); + $updata['proof_state'] = 2; + $updata['proof_content'] = trim($data['content']); } - //发送邮件提醒编辑 - + $this->production_article_obj->where('article_id',$data['article_id'])->where('state',0)->update($updata); return jsonSuccess([]); } @@ -1007,7 +1035,7 @@ class Production extends Controller * 同意proof通过邮件链接 */ public function editProofFromEmail($articleId){ - $this->production_article_obj->where('article_id',$articleId)->where('state',0)->update(['proof'=>2]); + $this->production_article_obj->where('article_id',$articleId)->where('state',0)->update(['proof_state'=>2,'proof_rtime'=>time()]); echo 'Commit Succeeded'; } @@ -1019,7 +1047,6 @@ class Production extends Controller vendor('fpdi/fpdi'); $pdf = new \FPDI(); $pageCount = $pdf->setSourceFile(ROOT_PATH . 'public' . DS.$p_info['file_pdf']); - // iterate through all pages for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) { // import a page