From 7016414402d57c2c5e649ef47f98bedb86d68a41 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Wed, 15 Jun 2022 11:01:34 +0800 Subject: [PATCH] 1 --- application/api/controller/Reviewer.php | 7 +++ application/api/controller/Typeset.php | 70 ++++++++++++++++++++++++- application/common.php | 45 +++++++++++----- 3 files changed, 107 insertions(+), 15 deletions(-) diff --git a/application/api/controller/Reviewer.php b/application/api/controller/Reviewer.php index 75a5202..6294cdc 100644 --- a/application/api/controller/Reviewer.php +++ b/application/api/controller/Reviewer.php @@ -666,6 +666,13 @@ class Reviewer extends Controller $article_info = $this->article_obj->where('article_id', $art_rev_info['article_id'])->find(); $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find(); $editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find(); + + //不可重复提交答案的验证 + $check_question = $this->article_reviewer_question_obj->where('art_rev_id',$data['art_rev_id'])->find(); + if($check_question){ + return jsonError("Non repeatable review"); + } + //组合insert数据,存储 $insert_data['art_rev_id'] = $data['art_rev_id']; $insert_data['qu1'] = $data['qu1']; diff --git a/application/api/controller/Typeset.php b/application/api/controller/Typeset.php index a412f1f..0efd293 100644 --- a/application/api/controller/Typeset.php +++ b/application/api/controller/Typeset.php @@ -130,11 +130,79 @@ class Typeset extends Controller { } $frag['main'][] = $v; } - var_dump($frag); + // var_dump($frag); //组合,存储获取到的信息 $insert_ts = []; + $insert_ts['article_id'] = $article_info['article_id']; + $insert_ts['ts_title'] = $article_info['title']; + $insert_ts['ts_type'] = translateType($article_info['type']); + //组合author信息 + $au_res = $this->authorFormate($data['article_id']); + $insert_ts['author'] = $au_res['author']; + $insert_ts['author_address'] = $au_res['address']; + //获取通讯作者信息 + $report_author = $this->article_author_obj->where('article_id',$article_info['article_id'])->where('is_report',1)->where('state',0)->find(); + $insert_ts['corresponding_author'] = $report_author['firstname'].' '.$report_author['lastname']; + $insert_ts['corresponding_author_email'] = $report_author['email']; + $insert_ts['accepted_date'] = date("d F Y",$article_info['rtime']); + $insert_ts['received_date'] = date("d F Y",$article_info['ctime']); + $insert_ts['keywords'] = 'Keywords:'.$article_info['keywords']; + $insert_ts['ts_abstract'] = isset($frag['abstract'])?$frag['abstract']:''; + $insert_ts['ts_main'] = json_encode($frag['main']); + $insert_ts['ts_ctime'] = time(); + var_dump($insert_ts); + Db::startTrans();//开启事务 + $ts_id = $this->ts_obj->insertGetId($insert_ts); + + + + } + + + private function authorFormate($article_id){ + $authors = $this->article_author_obj->where('article_id',$article_id)->where('state',0)->select(); + //组装地址数组 + $address = []; + foreach($authors as $v){ + $adds = explode(';',$v['company']); + foreach($adds as $key => $val){ + $cache = is_numeric(substr(trim($val),0,1))?trim(substr(trim($val),1)):trim($val); + if(!in_array($cache,$address)){ + $address[] = $cache; + } + } + } + //构建数组字符串 + $author = ''; + foreach($authors as $v){ + $cache_str = $v['firstname'].' '.$v['lastname'].''; + $adds = explode(';',$v['company']); + foreach($adds as $key => $val){ + $cache = is_numeric(substr(trim($val),0,1))?trim(substr(trim($val),1)):trim($val); + $cache_str .= (intval(search_array_val($address,$cache))+1)." "; + } + if($v['is_super']==1){ + $cache_str .= '*'; + } + if($v['is_report']==1){ + $cache_str .= '#'; + } + $cache_str = trim($cache_str); + $cache_str .= ''; + $author .= $cache_str; + } + //组装address + $address_str = ''; + foreach($address as $k => $v){ + $address_str .= ($k+1).' '.$v.';'; + } + $frag['author'] = $author; + $frag['address'] = $address_str; + return $frag; + } + } diff --git a/application/common.php b/application/common.php index 4377a2a..5055aea 100644 --- a/application/common.php +++ b/application/common.php @@ -131,25 +131,22 @@ function translateType($type) { $frag = ''; switch ($type) { case "A": - $frag = 'Article'; + $frag = 'ARTICLE'; break; - case "B": - $frag = 'Review'; + case 'B': + $frag = 'REVIEW'; break; - case "C": - $frag = 'Case report'; + case 'C': + $frag = 'CASE REPORT'; break; - case "M": - $frag = 'Meta-analysis'; + case 'P': + $frag = 'RESEARCH PROPOSAL'; break; - case "P": - $frag = 'Research proposal'; + case 'N': + $frag = 'NEWS'; break; - case "N": - $frag = 'News'; - break; - case "T": - $frag = 'Comment'; + case 'T': + $frag = 'COMMENT'; break; case 'CT': $frag = 'CORRECTION'; @@ -166,6 +163,9 @@ function translateType($type) { case 'RP': $frag = 'REPORT'; break; + case 'LR': + $frag = 'LETTER'; + break; case 'EF': $frag = 'EMPIRICAL FORMULA'; break; @@ -184,12 +184,29 @@ function translateType($type) { case 'PT': $frag = 'PROTOCOL'; break; + case 'CS': + $frag = 'CASE SERIES'; + break; + case 'RT': + $frag = 'RETRACTION'; + break; + case 'MR': + $frag = 'MINI REVIEW'; + break; default: $frag = 'OTHERS'; } return $frag; } +function search_array_val($arr,$val){ + foreach($arr as $k => $v){ + if($v == $val){ + return $k; + } + } +} + /** * 增加usermsg */