diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index 01145ea..28a7be9 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -129,6 +129,12 @@ class Article extends Base } } $res[$key]['proof'] = $proof_state; + //新增是否是草稿删除 20260204 start + $res[$key]['is_draft'] = 2; + if(!empty($val['accept_sn']) && substr($val['accept_sn'], 0, 5) === 'Draft'){ + $res[$key]['is_draft'] = 1; + } + //新增是否是草稿删除 20260204 end } //返回数据 @@ -585,6 +591,14 @@ class Article extends Base } } //查询终审意见 chengxiaoling 20250828 end + //新增是否是草稿删除 20260204 start + if(!empty($article_res)){ + $article_res['is_draft'] = 2; + if(!empty($article_res['accept_sn']) && substr($article_res['accept_sn'], 0, 5) === 'Draft'){ + $article_res['is_draft'] = 1; + } + } + //新增是否是草稿删除 20260204 end return json(['article' => $article_res, 'msg' => $article_msg, 'authors' => $author_res, 'suggest' => $suggest, 'transfer' => $transfer_res, 'transinfo' => $transfer_info, "major" => $major,'suggest_final' => $aFinal]); } @@ -2794,196 +2808,196 @@ class Article extends Base die("Please update your browser cache and resubmit your submission (shortcut key: Ctrl+F5)"); //接受参数,查询信息 -// $data = $this->request->post(); -// -// $user_res = $this->user_obj->where('account', $data['username'])->find(); -// -// //确定用户是否属于黑名单 -// $black_check = $this->user_black_obj->where('user_id', $user_res['user_id'])->where('black_state', 0)->find(); -// if ($black_check) { -// return jsonError("Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com."); -// } -// -// // if($user_res['account']=='fariba'||$user_res['account']=='zc'||$user_res['account']=='Mohammad Hossein'||$user_res['account']=='xiaoyueyue'||$user_res['account']=='sethlee000'||$user_res['account']=='yuanying9908'){ -// // return json(['code'=>1,'msg'=>'Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.']); -// // } -// -// $journal_info = $this->journal_obj->where('journal_id', $data['journal'])->find(); -// //首先查重是否重复投稿 -// $checkArticle = $this->article_obj->where("title", trim($data['title']))->select(); -// foreach ($checkArticle as $v) { -// if ($v['state'] != 3) { -// return json(['code' => 1, 'msg' => 'Warning: you are re-submitting the article!']); -// } -// } -// Db::startTrans(); -// -// //添加文章基础信息 -// $inset_data['user_id'] = $user_res['user_id']; -// $inset_data['journal_id'] = $data['journal']; -// $inset_data['editor_id'] = $journal_info['editor_id']; -// $inset_data['title'] = trim($data['title']); -// $inset_data['keywords'] = $data['keyWords']; -// $inset_data['fund'] = trim($data['fund']); -// $inset_data['accept_sn'] = getArticleSN($journal_info['abbr'], $data['type']); -// $inset_data['type'] = $data['type']; -// $inset_data['major_id'] = $data['major']; -// // $inset_data['cmajor_id'] = $data['cmajor']; -// $inset_data['approval'] = $data['approval'] == 'true' ? 1 : 0; -// $inset_data['abstrart'] = $data['abstrart']; -// $inset_data['author_act'] = 1; -// $inset_data['ctime'] = time(); -// $res = $this->article_obj->insertGetId($inset_data); -// -// //上传文章作者信息 -// $author_email = []; -// $authors = []; -// $res_add_user = true; -// foreach ($data['authorList'] as $v) { -// if ($v['firstname'] == '') { -// continue; -// } -// $i['article_id'] = $res; -// $i['firstname'] = trim($v['firstname']); -// $i['lastname'] = trim($v['lastname']); -// $i['orcid'] = trim($v['orcid']); -// $i['company'] = trim($v['company']); -// $i['department'] = trim($v['department']); -// $i['author_title'] = $v['title']; -// $i['country'] = $v['country']; -// $i['email'] = trim($v['email']); -// $i['address'] = trim($v['address']); -// $i['is_super'] = $v['isSuper'] == 'true' ? 1 : 0; -// $i['is_report'] = $v['isReport'] == 'true' ? 1 : 0; -// $authors[] = $i; -// $cache['email'] = trim($v['email']); -// $cache['name'] = trim($v['firstname']) . ' ' . trim($v['lastname']); -// $author_email[] = $cache; -// -// //通讯作者用户添加 -// if ($v['isReport'] == "true") { -// $re_user_check = $this->user_obj->where('account|email', trim($v['email']))->find(); -// if (!$re_user_check) { -// $password = getRandPassword(); -// $inser_data['account'] = trim($v['email']); -// $inser_data['password'] = md5($password); -// $inser_data['email'] = trim($v['email']); -// $inser_data['realname'] = trim($v['firstname']) . ' ' . trim($v['lastname']); -// $inser_data['ctime'] = time(); -// $c_res_add_user = $this->user_obj->insertGetId($inser_data); -// if ($res_add_user) { -// $res_add_user = $c_res_add_user; -// } -// -// //发送提示邮件给通讯作者 -// $report_tt = "Dear " . $inser_data['realname'] . ',

'; -// $report_tt .= "We are delighted to welcome you as a new author for our journal, " . $journal_info['title'] . ". We have received your submission and are excited to review it for potential publication.

"; -// $report_tt .= "As a next step, we have created an account for you on our journal's website. Your account is [Username: " . trim($v['email']) . " password:$password]"; -// $report_tt .= "and you can access your account by visiting " . $journal_info['website'] . " and logging in.

"; -// $report_tt .= "If you have any questions or need assistance with accessing your account, please don't hesitate to contact us. We are here to support you throughout the submission and review process.

"; -// $report_tt .= "Thank you for choosing to submit your work to our journal. We look forward to working with you.

"; -// $report_tt .= "Best regards,
" . $journal_info['title']; -// $maidata['email'] = trim($v['email']); -// $maidata['title'] = $journal_info['title']; -// $maidata['content'] = $report_tt; -// $maidata['tmail'] = $journal_info['email']; -// $maidata['tpassword'] = $journal_info['epassword']; -// Queue::push('app\api\job\mail@fire', $maidata, "tmail"); -// } -// } -// } -// $res_author = $this->article_author_obj->insertAll($authors); -// -// //增加转投信息 -// $transr = true; -// if ($data['istransfer'] == 'true') { -// foreach ($data['checkedjours'] as $val) { -// $trans_insert['article_id'] = $res; -// $trans_insert['journal_id'] = $val; -// $trans_insert['ctime'] = time(); -// $transr = $transr ? $this->article_transfer_obj->insert($trans_insert) : false; -// } -// } -// -// -// //增加articlefile表的信息 -// $res_file1 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['coverLetter'], 'coverLetter'); -// $res_file2 = true; -// if (isset($data['picturesAndTables'])) { -// foreach ($data['picturesAndTables'] as $v) { -// $res_file2 = $res_file2 ? self::save_article_file($res, $user_res['user_id'], $user_res['account'], $v, 'picturesAndTables') : false; -// } -// } -// $res_file4 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['totalpage'], 'totalpage'); -// $res_file3 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['manuscirpt'], 'manuscirpt'); -// -// //发送邮件到编辑,提醒有待审文章 -// $editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find(); -// $tt = 'Dear editor,
'; -// $tt .= 'Please check the new manuscript in the submission system.'; -// sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']); -// $user_rev_info = $this->user_reviewer_info_obj->where("reviewer_id", $user_res['user_id'])->find(); -// //发送邮件给作者,表示感谢 -// $tt_t = 'Dear Dr. ' . ($user_res['realname'] == '' ? $user_res['account'] : $user_res['realname']) . ',

'; -// $tt1 = 'Thank you for submitting your manuscript entitled "' . $data['title'] . '". Your submission has been assigned the following tracking number:' . $inset_data['accept_sn'] . '. We will be in touch again as soon as we have reached a decision. Please quote the tracking number in any communication. This e-mail simply acknowledges receipt of your submission. If the editors decide for editorial reasons that the paper is unsuitable for publication in ' . $journal_info['title'] . ', you will be informed as soon as possible.


'; -// if ($journal_info['journal_id'] == 9) { //life research 期刊发送收到文章邮件 -// $tt1 .= 'Life Research applies the CC BY-NC 4.0 license. Full details of the policy can be found at https://www.tmrjournals.com/notice.html?J_num=14&footer_id=123. Authors should read Guide to Authors carefully before submitting.

'; -// $tt1 .= 'You may check on the status of this manuscript in the Submission System. If you encounter any problems, please contact liferes@tmrjournals.com.

'; -// $tt1 .= 'Thank you for choosing to submit your manuscript to Life Research.


'; -// $tt1 .= 'Yours sincerely,
Haoran Zhang

'; -// $tt1 .= 'Manuscript Administration, Life Research
https://www.tmrjournals.com/lr/'; -// } else { //其他期刊发送邮件 -// $tt1 .= 'You may check on the status of this manuscript in the Submission System. If you encounter any problems, please contact ' . $journal_info['email'] . '.

'; -// $tt1 .= 'Thank you for choosing to submit your manuscript to ' . $journal_info['title'] . '.


'; -// $tt1 .= 'Sincerely,
Editorial Office
'; -// $tt1 .= 'Subscribe to this journal
'; -// $tt1 .= $journal_info['title'] . '
'; -// $tt1 .= 'Email: ' . $journal_info['email'] . '
'; -// $tt1 .= 'Website: ' . $journal_info['website'] . '
'; -// $tt1 .= '
If you have any questions, please contact us:
'; -// $tt1 .= 'Head of publication ethics
Dr. Dan Chen
TMR Publishing Group Limited Company, Auckland, New Zealand
Email: publication.ethics@tmrjournals.com'; -// } -// -// sendEmail($user_res['email'], $journal_info['title'], $journal_info['title'], $tt_t . $tt1, $journal_info['email'], $journal_info['epassword']); -// -// foreach ($author_email as $v) { -// $cache_str = 'Dear Dr. ' . $v['name'] . ',

'; -// $maidata['email'] = $v['email']; -// $maidata['title'] = $journal_info['title']; -// $maidata['content'] = $cache_str . $tt1; -// $maidata['tmail'] = $journal_info['email']; -// $maidata['tpassword'] = $journal_info['epassword']; -// Queue::push('app\api\job\mail@fire', $maidata, "tmail"); -// } -// -// //增加用户操作log -// $log_data['user_id'] = $user_res['user_id']; -// $log_data['type'] = 0; -// $log_data['content'] = $user_res['account'] . "(" . $user_res['realname'] . "),上传了一篇文章:" . $data['title'] . ",上传时间是:" . date('Y-m-d H:i:s', time()); -// $log_data['ctime'] = time(); -// $res_log = $this->user_log_obj->insert($log_data); -// -// //增加usermsg -// $res_msg = add_usermsg($journal_info['editor_id'], 'New manuscript', '/articleDetailEditor?id=' . $res); -// -// //通讯作者转为审稿人 -// $this->addReviewerFromArticle($res, $journal_info['journal_id']); -// -// //推荐审稿人 -// $recommend_res = true; -// $reviewers = isset($data['reviewers']) ? $data['reviewers'] : []; -// foreach ($reviewers as $v) { -// $recommend_res = $this->addRecommentReviewer($v, $journal_info['journal_id'], $user_res['user_id'], $res); -// } -// -// if ($res && $res_author && $transr && $res_add_user && $res_file1 && $res_file2 && $res_file3 && $res_file4 && $res_log && $res_msg && $recommend_res) { -// Db::commit(); -// $this->ai_scor($res); -// return json(['code' => 0]); -// } else { -// Db::rollback(); -// return json(['code' => 1]); -// } + $data = $this->request->post(); + + $user_res = $this->user_obj->where('account', $data['username'])->find(); + + //确定用户是否属于黑名单 + $black_check = $this->user_black_obj->where('user_id', $user_res['user_id'])->where('black_state', 0)->find(); + if ($black_check) { + return jsonError("Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com."); + } + + // if($user_res['account']=='fariba'||$user_res['account']=='zc'||$user_res['account']=='Mohammad Hossein'||$user_res['account']=='xiaoyueyue'||$user_res['account']=='sethlee000'||$user_res['account']=='yuanying9908'){ + // return json(['code'=>1,'msg'=>'Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.']); + // } + + $journal_info = $this->journal_obj->where('journal_id', $data['journal'])->find(); + //首先查重是否重复投稿 + $checkArticle = $this->article_obj->where("title", trim($data['title']))->select(); + foreach ($checkArticle as $v) { + if ($v['state'] != 3) { + return json(['code' => 1, 'msg' => 'Warning: you are re-submitting the article!']); + } + } + Db::startTrans(); + + //添加文章基础信息 + $inset_data['user_id'] = $user_res['user_id']; + $inset_data['journal_id'] = $data['journal']; + $inset_data['editor_id'] = $journal_info['editor_id']; + $inset_data['title'] = trim($data['title']); + $inset_data['keywords'] = $data['keyWords']; + $inset_data['fund'] = trim($data['fund']); + $inset_data['accept_sn'] = getArticleSN($journal_info['abbr'], $data['type']); + $inset_data['type'] = $data['type']; + $inset_data['major_id'] = $data['major']; + // $inset_data['cmajor_id'] = $data['cmajor']; + $inset_data['approval'] = $data['approval'] == 'true' ? 1 : 0; + $inset_data['abstrart'] = $data['abstrart']; + $inset_data['author_act'] = 1; + $inset_data['ctime'] = time(); + $res = $this->article_obj->insertGetId($inset_data); + + //上传文章作者信息 + $author_email = []; + $authors = []; + $res_add_user = true; + foreach ($data['authorList'] as $v) { + if ($v['firstname'] == '') { + continue; + } + $i['article_id'] = $res; + $i['firstname'] = trim($v['firstname']); + $i['lastname'] = trim($v['lastname']); + $i['orcid'] = trim($v['orcid']); + $i['company'] = trim($v['company']); + $i['department'] = trim($v['department']); + $i['author_title'] = $v['title']; + $i['country'] = $v['country']; + $i['email'] = trim($v['email']); + $i['address'] = trim($v['address']); + $i['is_super'] = $v['isSuper'] == 'true' ? 1 : 0; + $i['is_report'] = $v['isReport'] == 'true' ? 1 : 0; + $authors[] = $i; + $cache['email'] = trim($v['email']); + $cache['name'] = trim($v['firstname']) . ' ' . trim($v['lastname']); + $author_email[] = $cache; + + //通讯作者用户添加 + if ($v['isReport'] == "true") { + $re_user_check = $this->user_obj->where('account|email', trim($v['email']))->find(); + if (!$re_user_check) { + $password = getRandPassword(); + $inser_data['account'] = trim($v['email']); + $inser_data['password'] = md5($password); + $inser_data['email'] = trim($v['email']); + $inser_data['realname'] = trim($v['firstname']) . ' ' . trim($v['lastname']); + $inser_data['ctime'] = time(); + $c_res_add_user = $this->user_obj->insertGetId($inser_data); + if ($res_add_user) { + $res_add_user = $c_res_add_user; + } + + //发送提示邮件给通讯作者 + $report_tt = "Dear " . $inser_data['realname'] . ',

'; + $report_tt .= "We are delighted to welcome you as a new author for our journal, " . $journal_info['title'] . ". We have received your submission and are excited to review it for potential publication.

"; + $report_tt .= "As a next step, we have created an account for you on our journal's website. Your account is [Username: " . trim($v['email']) . " password:$password]"; + $report_tt .= "and you can access your account by visiting " . $journal_info['website'] . " and logging in.

"; + $report_tt .= "If you have any questions or need assistance with accessing your account, please don't hesitate to contact us. We are here to support you throughout the submission and review process.

"; + $report_tt .= "Thank you for choosing to submit your work to our journal. We look forward to working with you.

"; + $report_tt .= "Best regards,
" . $journal_info['title']; + $maidata['email'] = trim($v['email']); + $maidata['title'] = $journal_info['title']; + $maidata['content'] = $report_tt; + $maidata['tmail'] = $journal_info['email']; + $maidata['tpassword'] = $journal_info['epassword']; + Queue::push('app\api\job\mail@fire', $maidata, "tmail"); + } + } + } + $res_author = $this->article_author_obj->insertAll($authors); + + //增加转投信息 + $transr = true; + if ($data['istransfer'] == 'true') { + foreach ($data['checkedjours'] as $val) { + $trans_insert['article_id'] = $res; + $trans_insert['journal_id'] = $val; + $trans_insert['ctime'] = time(); + $transr = $transr ? $this->article_transfer_obj->insert($trans_insert) : false; + } + } + + + //增加articlefile表的信息 + $res_file1 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['coverLetter'], 'coverLetter'); + $res_file2 = true; + if (isset($data['picturesAndTables'])) { + foreach ($data['picturesAndTables'] as $v) { + $res_file2 = $res_file2 ? self::save_article_file($res, $user_res['user_id'], $user_res['account'], $v, 'picturesAndTables') : false; + } + } + $res_file4 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['totalpage'], 'totalpage'); + $res_file3 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['manuscirpt'], 'manuscirpt'); + + //发送邮件到编辑,提醒有待审文章 + $editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find(); + $tt = 'Dear editor,
'; + $tt .= 'Please check the new manuscript in the submission system.'; + sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']); + $user_rev_info = $this->user_reviewer_info_obj->where("reviewer_id", $user_res['user_id'])->find(); + //发送邮件给作者,表示感谢 + $tt_t = 'Dear Dr. ' . ($user_res['realname'] == '' ? $user_res['account'] : $user_res['realname']) . ',

'; + $tt1 = 'Thank you for submitting your manuscript entitled "' . $data['title'] . '". Your submission has been assigned the following tracking number:' . $inset_data['accept_sn'] . '. We will be in touch again as soon as we have reached a decision. Please quote the tracking number in any communication. This e-mail simply acknowledges receipt of your submission. If the editors decide for editorial reasons that the paper is unsuitable for publication in ' . $journal_info['title'] . ', you will be informed as soon as possible.


'; + if ($journal_info['journal_id'] == 9) { //life research 期刊发送收到文章邮件 + $tt1 .= 'Life Research applies the CC BY-NC 4.0 license. Full details of the policy can be found at https://www.tmrjournals.com/notice.html?J_num=14&footer_id=123. Authors should read Guide to Authors carefully before submitting.

'; + $tt1 .= 'You may check on the status of this manuscript in the Submission System. If you encounter any problems, please contact liferes@tmrjournals.com.

'; + $tt1 .= 'Thank you for choosing to submit your manuscript to Life Research.


'; + $tt1 .= 'Yours sincerely,
Haoran Zhang

'; + $tt1 .= 'Manuscript Administration, Life Research
https://www.tmrjournals.com/lr/'; + } else { //其他期刊发送邮件 + $tt1 .= 'You may check on the status of this manuscript in the Submission System. If you encounter any problems, please contact ' . $journal_info['email'] . '.

'; + $tt1 .= 'Thank you for choosing to submit your manuscript to ' . $journal_info['title'] . '.


'; + $tt1 .= 'Sincerely,
Editorial Office
'; + $tt1 .= 'Subscribe to this journal
'; + $tt1 .= $journal_info['title'] . '
'; + $tt1 .= 'Email: ' . $journal_info['email'] . '
'; + $tt1 .= 'Website: ' . $journal_info['website'] . '
'; + $tt1 .= '
If you have any questions, please contact us:
'; + $tt1 .= 'Head of publication ethics
Dr. Dan Chen
TMR Publishing Group Limited Company, Auckland, New Zealand
Email: publication.ethics@tmrjournals.com'; + } + + sendEmail($user_res['email'], $journal_info['title'], $journal_info['title'], $tt_t . $tt1, $journal_info['email'], $journal_info['epassword']); + + foreach ($author_email as $v) { + $cache_str = 'Dear Dr. ' . $v['name'] . ',

'; + $maidata['email'] = $v['email']; + $maidata['title'] = $journal_info['title']; + $maidata['content'] = $cache_str . $tt1; + $maidata['tmail'] = $journal_info['email']; + $maidata['tpassword'] = $journal_info['epassword']; + Queue::push('app\api\job\mail@fire', $maidata, "tmail"); + } + + //增加用户操作log + $log_data['user_id'] = $user_res['user_id']; + $log_data['type'] = 0; + $log_data['content'] = $user_res['account'] . "(" . $user_res['realname'] . "),上传了一篇文章:" . $data['title'] . ",上传时间是:" . date('Y-m-d H:i:s', time()); + $log_data['ctime'] = time(); + $res_log = $this->user_log_obj->insert($log_data); + + //增加usermsg + $res_msg = add_usermsg($journal_info['editor_id'], 'New manuscript', '/articleDetailEditor?id=' . $res); + + //通讯作者转为审稿人 + $this->addReviewerFromArticle($res, $journal_info['journal_id']); + + //推荐审稿人 + $recommend_res = true; + $reviewers = isset($data['reviewers']) ? $data['reviewers'] : []; + foreach ($reviewers as $v) { + $recommend_res = $this->addRecommentReviewer($v, $journal_info['journal_id'], $user_res['user_id'], $res); + } + + if ($res && $res_author && $transr && $res_add_user && $res_file1 && $res_file2 && $res_file3 && $res_file4 && $res_log && $res_msg && $recommend_res) { + Db::commit(); + $this->ai_scor($res); + return json(['code' => 0]); + } else { + Db::rollback(); + return json(['code' => 1]); + } } diff --git a/application/api/controller/Finalreview.php b/application/api/controller/Finalreview.php index bbb57a8..7839240 100644 --- a/application/api/controller/Finalreview.php +++ b/application/api/controller/Finalreview.php @@ -1167,9 +1167,17 @@ class Finalreview extends Base if(empty($aReviewerFinal)){ return json_encode(['status' => 3,'msg' => 'Review record does not exist or review has been completed']); } + //查询审稿人基本信息 $aWhere = ['user_id' => $iReviewerId]; - $aUser = Db::name('user')->field('realname')->where($aWhere)->find(); + $aUser = Db::name('user')->field('realname,email')->where($aWhere)->find(); $aReviewerFinal['realname'] = empty($aUser['realname']) ? '' : $aUser['realname']; + $aReviewerFinal['email'] = empty($aUser['email']) ? '' : $aUser['email']; + //查询审稿人机构 + if(!empty($aUser)){ + $aWhere = ['reviewer_id' => $iReviewerId,'state' => 0]; + $aReviewerInfo = Db::name('user_reviewer_info')->field('company')->where($aWhere)->find(); + $aReviewerFinal['company'] = empty($aReviewerInfo['company']) ? '' : $aReviewerInfo['company']; + } return json_encode(['status' => 1,'msg' => 'success','data' => $aReviewerFinal]); } diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index 874d191..fe91f2b 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -18,7 +18,7 @@ use think\log; class Production extends Base { - private $supportedTags = ['sup', 'sub', 'blue', 'b', 'i', 't', 'r', 'wmath','myfigure','mytable']; + private $supportedTags = ['sup', 'sub', 'blue', 'b', 'i', 't', 'r', 'wmath','myfigure','mytable',"myh3"]; // 颜色映射(自定义标签颜色对应LaTeX的HTML十六进制颜色) private $colorMap = [ 'blue' => '0082AA', @@ -2033,7 +2033,6 @@ class Production extends Base } public function creatLatex(){ - die("stop service"); $data = $this->request->post(); $rule = new Validate([ "article_id"=>"require" @@ -2249,8 +2248,8 @@ class Production extends Base return jsonError($rule->getError()); } $info = $this->article_main_obj->where("am_id",$data['id'])->find(); - if(isset($data["content"])){ - $content = $data['content']; + if(isset($data["code"])){ + $content = $data['code']; }else{ $content = $info['content']; } @@ -2271,21 +2270,9 @@ class Production extends Base return ''; } //单行处理公式内容 -/* $pattern = '/^]*?\s+data-latex="([^"]*)"[^>]*?>.*?<\/wmath>$/';*/ -// if(preg_match($pattern, $content) === 1){ -// $pattern1 = '/]*?\s+data-latex="([^"]*)">/'; -// if (preg_match($pattern1, $content, $matches)) { -// $latexContent = $matches[1]; -// // 将 $$ 转换为 $,因为equation环境不需要$$ -// $latexContent = str_replace('$$', '', $latexContent); -// -// return "\\begin{equation}\n\t{$latexContent}\n\\end{equation}"; -// } -// return $content; -// } - $pattern = '/^]*?\s+data-latex="([^"]*)"[^>]*?\s+data-wrap="block"[^>]*?>.*?<\/wmath>$/'; + $pattern = '/^]*?\s+data-latex="([^"]*)"[^>]*?>.*?<\/wmath>$/'; if(preg_match($pattern, $content) === 1){ - $pattern1 = '/]*?\s+data-latex="([^"]*)"[^>]*?\s+data-wrap="block"[^>]*?>/'; + $pattern1 = '/]*?\s+data-latex="([^"]*)">/'; if (preg_match($pattern1, $content, $matches)) { $latexContent = $matches[1]; // 将 $$ 转换为 $,因为equation环境不需要$$ @@ -2343,9 +2330,10 @@ class Production extends Base $latex .= $this->escapeLatexSpecialChars($content); $content = ''; }else { - $tagOpen = "<{$nextTag}"; + $tagOpen = "<{$nextTag}>"; $tagClose = ""; $beginTag = strpos($content, $tagOpen); + // 标签前的文本 if ($beginTag > 0) { $latex .= $this->escapeLatexSpecialChars(substr($content, 0, $beginTag)); @@ -2353,7 +2341,6 @@ class Production extends Base // 找到标签的最后闭合位置(处理嵌套) $endTag = $this->getLastTabIndex($content, $nextTag); - if ($endTag === false) { // 无闭合标签,保留原内容(异常情况处理) $latex .= $this->escapeLatexSpecialChars(substr($content, $beginTag)); @@ -2368,6 +2355,7 @@ class Production extends Base $endTag - $beginTag + strlen($tagClose) ); + //这里处理引用 if ($check_refer&&preg_match('/(?:)?\[(\d+(?:[-,]\d+)*)\](?:<\/blue>)?/', $tagWrappedContent, $matches)) { // 去除匹配中的 @@ -2431,7 +2419,7 @@ class Production extends Base * @return int|false 闭合标签的起始位置 */ private function getLastTabIndex($content, $tag) { - $tagOpen = "<{$tag}"; + $tagOpen = "<{$tag}>"; $tagClose = ""; $beginTag = strpos($content, $tagOpen); @@ -2447,7 +2435,7 @@ class Production extends Base // 统计当前标签内的开放标签数量 $caNowStr = substr($content, $beginTag, $endTagCa - $beginTag + strlen($tagClose)); - $caCount = preg_match_all("/<{$tag}/", $caNowStr, $matches); + $caCount = preg_match_all("/<{$tag}>/", $caNowStr, $matches); if ($caCount === 1) { return $endTagCa; @@ -2460,7 +2448,7 @@ class Production extends Base break; } $substring = substr($content, $beginTag, $numIndex - $beginTag + strlen($tagClose)); - $ccaCount = preg_match_all("/<{$tag}/", $substring, $matches); + $ccaCount = preg_match_all("/<{$tag}>/", $substring, $matches); if ($ccaCount !== $caCount) { $caCount = $ccaCount; } else { @@ -2613,7 +2601,7 @@ class Production extends Base * @return string 标签名或'no' */ private function determineNextTag($content) { - $tagPattern = '/<(' . implode('|', $this->supportedTags) . ')\b[^>]*>/i'; + $tagPattern = '/<(' . implode('|', $this->supportedTags) . ')>/i'; if (preg_match($tagPattern, $content, $matches)) { return $matches[1]; } diff --git a/application/api/controller/Reviewer.php b/application/api/controller/Reviewer.php index 5056475..fc2cbcc 100644 --- a/application/api/controller/Reviewer.php +++ b/application/api/controller/Reviewer.php @@ -2242,7 +2242,7 @@ class Reviewer extends Base $aReviewerCompany = []; if(!empty($aUserId)){ //作者同机构的审稿人 - $aReviewerCompany = Db::name('user_reviewer_info')->where(['reviewer_id' => ['in',$aUserId],'state' => 0])->column('reviewer_id,company'); + $aReviewerCompany = Db::name('user_reviewer_info')->where(['reviewer_id' => ['in',$aUserId],'state' => 0,'company' => ['<>','']])->column('reviewer_id,company'); } //文章作者机构信息 @@ -2277,7 +2277,12 @@ class Reviewer extends Base //过滤审稿人机构 if(!empty($aAuthorCompany)){ - $where['t_user_reviewer_info.company'] = ['not in', $aAuthorCompany]; + $aAuthorCompany = array_filter($aAuthorCompany, function($v) { + return trim((string)$v) !== ''; + }); + if(!empty($aAuthorCompany)){ + $where['t_user_reviewer_info.company'] = ['not in', $aAuthorCompany]; + } } // 计算10天之后的时间戳(10天 = 10 * 24 * 60 * 60秒) $iTeenDaysLater = strtotime('-10 days'); @@ -2292,6 +2297,7 @@ class Reviewer extends Base ->whereOr('t_user_reviewer_info.last_invite_time', '=', 0); }) ->count(); + if(empty($count)){ return jsonSuccess(['reviewers' => [],'count' => 0]); } diff --git a/application/api/controller/Supplementary.php b/application/api/controller/Supplementary.php index 068fe0e..ab09c56 100644 --- a/application/api/controller/Supplementary.php +++ b/application/api/controller/Supplementary.php @@ -23,7 +23,7 @@ class Supplementary extends Base public function getJournalBoard(){ - //获取参数 + //获取参数 $aParam = $this->request->post(); //参数验证 @@ -38,17 +38,17 @@ class Supplementary extends Base $aWhere = ['state' => 0,'issn' => ['in',$sIssn]]; $aJournal = Db::name('journal')->where($aWhere)->column('journal_id,issn'); if(empty($aJournal)){ - return json_encode(['status' => 3,'msg' => 'No journal information found']); + return json_encode(['status' => 3,'msg' => 'No journal information found']); } //查询期刊编辑信息 $aWhere = ['state' => 0,'journal_id' => ['in',array_keys($aJournal)]]; if(isset($aParam['type'])){//编辑类型 - $aWhere['type'] = $aParam['type']; + $aWhere['type'] = $aParam['type']; } $aJournalBoard = Db::name('board_to_journal')->field('journal_id,user_id')->where($aWhere)->select(); if(empty($aJournalBoard)){ - return json_encode(['status' => 4,'msg' => 'No editorial information was found for the journal']); + return json_encode(['status' => 4,'msg' => 'No editorial information was found for the journal']); } //查询编辑详情 @@ -62,10 +62,73 @@ class Supplementary extends Base continue; } $sRealName = empty($aUser[$value['user_id']]) ? '' : $aUser[$value['user_id']]; + if(!empty($sRealName) && strlen($sRealName) >= 3 && substr($sRealName, 0, 3) === "\xEF\xBB\xBF") { + $sRealName = substr($sRealName, 3); + } $aUserData[$sIssn][] = $sRealName; } - return json_encode(['status' => 1,'msg' => 'success','data' => $aUserData]); - } + return json_encode(['status' => 1,'msg' => 'success','data' => $aUserData]); + } + /** + * @title 获取文章底部信息 + * @description 获取期刊编辑接口 + */ + public function getProductiArticleFooter(){ + $aParam = $this->request->post(); + + //官网文章ID + $iWarticleId = empty($aParam['w_article_id']) ? 0 : $aParam['w_article_id']; + if(empty($iWarticleId)){ + return json_encode(['status' => 2,'msg' => 'Please select an article']); + } + + //获取子刊信息 + $aJournalStage = empty($aParam['journal_stage']) ? [] : $aParam['journal_stage']; + + //查询文章生产信息 + $aWhere = ['w_article_id' => $iWarticleId,'state' => ['in',[0,2]]]; + $aProductionArticle = Db::name('production_article')->field('p_article_id,article_id,journal_stage_id,journal_id,title,type,acknowledgment,abbreviation,author_contribution,abbr,npp,doi,executive_editor')->where($aWhere)->find(); + if(empty($aProductionArticle)){ + return json_encode(['status' => 3,'msg' => 'No production article information found']); + } + + //查询期刊信息 + $iJournalId = empty($aProductionArticle['journal_id']) ? 0 : $aProductionArticle['journal_id']; + $aJournal = []; + if(!empty($iJournalId)){ + $aWhere = ['journal_id' => $iJournalId,'state' => 0]; + $aJournal = Db::name('journal')->field('jabbr,title')->where($aWhere)->find(); + } + //获取文章时间/编委信息 + $iArticleId = empty($aProductionArticle['article_id']) ? 0 : $aProductionArticle['article_id']; + if(empty($iArticleId)){ + return json_encode(['status' => 3,'msg' => 'No article information found']); + } + $oLatexContent = new \app\common\LatexContent; + $aTime = $oLatexContent->getArticleTime(['article_id' => $iArticleId]); + $aProductionArticle = empty($aTime['data']) ? $aProductionArticle : array_merge($aTime['data'],$aProductionArticle); + + //获取期刊引用信息 + $sCite = $this->_cite($aProductionArticle,$aJournal,$aJournalStage); + $aProductionArticle['article_cite'] = empty($sCite) ? '' : $sCite; + $aProductionArticle['journal_title'] = empty($aJournal['title']) ? '' : $aJournal['title']; + return json_encode(['status' => 1,'data' => $aProductionArticle]); + } + //处理期刊引用信息 + private function _cite($aArticle = [],$aJournal = [],$aJournalStage = []){ + $no = empty($aJournalStage['stage_no']) ? ':' : '(' . $aJournalStage['stage_no'] . '):'; + $jabbr = empty($aJournal['jabbr']) ? '' : $aJournal['jabbr']; + $stage_year = empty($aJournalStage['stage_year']) ? '' : $aJournalStage['stage_year']; + $stage_vol = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol']; + + $sCite = ''; + if ($aArticle['journal_id'] == 22) { + $sCite = $aArticle['abbr'] . '. ' . $aArticle['title'] . '[J]. ' . choiseJabbr($aArticle['article_id'],$jabbr) . ',' . $stage_year . ',' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; + } else { + $sCite = $aArticle['abbr'] . '. ' . $aArticle['title'] . '. ' . choiseJabbr($aArticle['article_id'], $jabbr) . '. ' . $stage_year . ';' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; + } + return $sCite; + } } ?> \ No newline at end of file diff --git a/application/api/controller/Workbench.php b/application/api/controller/Workbench.php index 5ccd66c..e8d2844 100644 --- a/application/api/controller/Workbench.php +++ b/application/api/controller/Workbench.php @@ -36,7 +36,7 @@ class Workbench extends Base //获取状态 $iState = isset($aParam['state']) ? $aParam['state'] : -2; //空的查询条件 - $aWhere = []; + $aWhere = ['accept_sn' => ['not like','Draft%']]; //SN $sAcceptSn = empty($aParam['accept_sn']) ? '': $aParam['accept_sn']; if(!empty($sAcceptSn)){ @@ -181,6 +181,10 @@ class Workbench extends Base $aArticle[$key]['report'] = $aAuthorInfo; $aArticle[$key]['country'] = empty($aAuthorInfo) ? [] : array_unique(array_column($aAuthorInfo, 'country')); $aArticle[$key]['type_name'] = translateType($value['type']); + $aArticle[$key]['is_draft'] = 2; + if(!empty($value['accept_sn']) && substr($value['accept_sn'], 0, 5) === 'Draft'){ + $aArticle[$key]['is_draft'] = 1; + } // //付款信息 // $iPsId = empty($aOrder[$value['article_id']]) ? 0 : $aOrder[$value['article_id']]; @@ -452,6 +456,12 @@ class Workbench extends Base $aArticleReviewer['realname'] = empty($aUser['realname']) ? '' : $aUser['realname']; $aArticleReviewer['email'] = empty($aUser['email']) ? '' : $aUser['email']; } + //查询审稿人机构 + if(!empty($aUser)){ + $aWhere = ['reviewer_id' => $iUserId,'state' => 0]; + $aReviewerInfo = Db::name('user_reviewer_info')->field('company')->where($aWhere)->find(); + $aArticleReviewer['company'] = empty($aReviewerInfo['company']) ? '' : $aReviewerInfo['company']; + } //组装信息 $aData = ['article' => $aArticle,'article_reviewer' => $aArticleReviewer]; @@ -641,13 +651,31 @@ class Workbench extends Base //查询审稿记录 $aWhere = ['art_rev_id' => $iArtRevId]; - $aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,reviewer_id,article_id,state')->where($aWhere)->find(); + $aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,reviewer_id,article_id,state,agree_review_time,ctime')->where($aWhere)->find(); if(empty($aArticleReviewer)){ return json_encode(['status' => 4,'msg' => 'Review record does not exist']); } - if($aArticleReviewer['state'] != 4){ + if($aArticleReviewer['state'] != 4 && $aArticleReviewer['state'] != 0){ return json_encode(['status' => 5,'msg' => 'The review link has not expired and no application is required']); } + if($aArticleReviewer['state'] == 0){ + $iCtime = empty($aArticleReviewer['ctime']) ? 0 : $aArticleReviewer['ctime']; + $iTime = empty($aArticleReviewer['agree_review_time']) ? 0 : $aArticleReviewer['agree_review_time']; + $iTime = empty($iTime) ? intval($iCtime) : intval($iTime); + if (!is_numeric($iTime) || (int)$iTime <= 0) { + return json_encode(['status' => 12,'msg' => 'Invalid record time, the review period has expired']); + } + //判断是否超过14天 + // 14天 = 14*24*3600 秒 = 1209600 秒 + $iNowTime = strtotime(date('Y-m-d', time())); + $iFourteenDays = 14 * 24 * 3600; + $iTime = date('Y-m-d', $iTime); + $iTime = strtotime($iTime);//同意审稿时间戳 + $timeDiff = $iTime+$iFourteenDays; + if($timeDiff >= $iNowTime){ + return json_encode(['status' => 13,'msg' => 'The review link has not expired and no application is required']); + } + } //获取文章信息 $aWhere = ['article_id' => $aArticleReviewer['article_id']]; @@ -685,7 +713,7 @@ class Workbench extends Base $aUser = array_column($aUser, null,'user_id'); //更新审稿人重新申请状态为 - $aWhere = ['art_rev_id' => $iArtRevId,'state' => 4]; + $aWhere = ['art_rev_id' => $iArtRevId]; $result = Db::name('article_reviewer')->where($aWhere)->limit(1)->update(['is_reapply' => 1,'reapply_time' => time(),'reviewer_act' => 1]); if($result === false){ return json_encode(array('status' => 11,'msg' => 'Application to reopen link failed' )); @@ -773,14 +801,34 @@ class Workbench extends Base //查询审稿记录 $aWhere = ['art_rev_id' => $iArtRevId]; - $aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,reviewer_id,article_id,state')->where($aWhere)->find(); + $aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,reviewer_id,article_id,state,ctime,agree_review_time')->where($aWhere)->find(); if(empty($aArticleReviewer)){ return json_encode(['status' => 4,'msg' => 'Review record does not exist']); } - if($aArticleReviewer['state'] != 4){ + // if($aArticleReviewer['state'] != 4){ + // return json_encode(['status' => 5,'msg' => 'The review link has not expired and no application is required']); + // } + if($aArticleReviewer['state'] != 4 && $aArticleReviewer['state'] != 0){ return json_encode(['status' => 5,'msg' => 'The review link has not expired and no application is required']); } - + if($aArticleReviewer['state'] == 0){ + $iCtime = empty($aArticleReviewer['ctime']) ? 0 : $aArticleReviewer['ctime']; + $iTime = empty($aArticleReviewer['agree_review_time']) ? 0 : $aArticleReviewer['agree_review_time']; + $iTime = empty($iTime) ? intval($iCtime) : intval($iTime); + if (!is_numeric($iTime) || (int)$iTime <= 0) { + return json_encode(['status' => 12,'msg' => 'Invalid record time, the review period has expired']); + } + //判断是否超过14天 + $iNowTime = strtotime(date('Y-m-d', time())); + // 14天 = 14*24*3600 秒 = 1209600 秒 + $iFourteenDays = 14 * 24 * 3600; + $iTime = date('Y-m-d', $iTime); + $iTime = strtotime($iTime);//同意审稿时间戳 + $timeDiff = $iTime+$iFourteenDays; + if($timeDiff >= $iNowTime){ + return json_encode(['status' => 13,'msg' => 'The review link has not expired and no application is required']); + } + } //获取文章信息 $aWhere = ['article_id' => $aArticleReviewer['article_id']]; $aArticle = Db::name('article')->field('article_id,abstrart,title,type,accept_sn,journal_id,state')->where($aWhere)->find(); @@ -808,12 +856,24 @@ class Workbench extends Base // } //更新文章状态为邀请 - $aWhere = ['art_rev_id' => $iArtRevId,'state' => 4]; - $result = Db::name('article_reviewer')->where($aWhere)->limit(1)->update(['state' => 5,'ctime' => time(),'editor_act' => 1,'is_reapply' => 2,'update_time' => time(),'reviewer_act' => 0]); + $aWhere = ['art_rev_id' => $iArtRevId]; + $aUpdate = []; + if($aArticleReviewer['state'] == 4){ + $aUpdate['state'] = 5; + $aUpdate['ctime'] = time(); + } + if($aArticleReviewer['state'] == 0){ + $aUpdate['agree_review_time'] = time(); + } + if(empty($aUpdate)){ + return json_encode(array('status' => 15,'msg' => 'Update data to empty' )); + } + $aUpdate += ['editor_act' => 1,'is_reapply' => 2,'update_time' => time(),'reviewer_act' => 0]; + $result = Db::name('article_reviewer')->where($aWhere)->limit(1)->update($aUpdate); if($result === false){ return json_encode(array('status' => 11,'msg' => 'Status update failed' )); } - + //查询审稿人的邮箱 $aWhere = ['user_id' => $aArticleReviewer['reviewer_id'],'state' => 0,'email' => ['<>','']]; $aUser = Db::name('user')->field('user_id,email,realname,account')->where($aWhere)->find(); diff --git a/application/common/LatexContent.php b/application/common/LatexContent.php index b2abfbc..e241dde 100644 --- a/application/common/LatexContent.php +++ b/application/common/LatexContent.php @@ -35,6 +35,7 @@ journalname={{{{journal_title}}}}, layout=largetwo, year={{stage_year}},%年 volume={{stage_vol}},%卷 +articletype={{{{article_type}}}}, no={{stage_no}},%期 page={{stage_page}},%号 ]{../tmr-tex} @@ -43,6 +44,7 @@ page={{stage_page}},%号 \journalweb{{{website}}} \usepackage{amsmath} +\usepackage{balance} \usepackage[nopatch]{microtype} \usepackage{booktabs} \usepackage[backend=biber]{biblatex} @@ -50,27 +52,29 @@ page={{stage_page}},%号 \usepackage{tabularray} \addbibresource{references_{{article_id}}.bib} \definecolor{evenRowColor}{RGB}{250,231,232} - +\SetLeftRatio{{{left_ratio}}} +\setlength{\parindent}{1em} \title{{{article_title}}} {{author_info}} -{{correspondence_info}} +\Correspondence{{{correspondence_info}}} \keywords{keyword entry 1, keyword entry 2, keyword entry 3} %% First letter not capped -{{author_contribution}} +\authorcontributions{{{author_contribution}}} \competinginterests{The authors declare no conflicts of interest.} -{{article_acknowledgment}} -\Peerreviewinformation{{{journal_title}} thanks all anonymous reviewers for their contribution to the peer review of this paper} -{{article_abbreviation}} -{{article_cite}} +\Acknowledgments{{{article_acknowledgment}}} +\Peerreviewinformation{\textit{{{journal_title}}} thanks all anonymous reviewers for their contribution to the peer review of this paper} +\Abbreviations{{{article_abbreviation}}} +\Citation{{{article_cite}}} \received{{{received_date}}} \revised{{{revision_date}}} \accepted{{{accepted_date}}} \Availableonline{{{pub_date}}} -{{executive_editor}} +\EditorialAdvisoryBoard{{{editorial_advisory_board}}} +\Executiveeditor{{{executive_editor}}} {{abstract}} {{keywords}} @@ -83,6 +87,7 @@ page={{stage_page}},%号 {{article_main}} \nocite{*} \printbibliography[title={References}] + \balance \end{document}'; /** * 生成初稿-基本内容 @@ -119,9 +124,9 @@ page={{stage_page}},%号 //年 $iYear = empty($aJournalStage['stage_year']) ? date('Y') : $aJournalStage['stage_year']; //卷 - $iVolume = empty($aJournalStage['stage_vol']) ? 0 : $aJournalStage['stage_vol']; + $iVolume = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol']; //期 - $iPeriod = empty($aJournalStage['stage_no']) ? 0 : $aJournalStage['stage_no']; + $iPeriod = empty($aJournalStage['stage_no']) ? '' : $aJournalStage['stage_no']; //页 $sPage = empty($aProductionArticle['npp']) ? '' : $aProductionArticle['npp']; @@ -139,7 +144,7 @@ page={{stage_page}},%号 $aAuthoInfo = $this->dealAuthor(['p_article_id' => $aProductionArticle['p_article_id']]); $aSearch['{{author_info}}'] = empty($aAuthoInfo['author']) ? '' : $aAuthoInfo['author']; //通讯作者信息 - $aSearch['{{correspondence_info}}'] = empty($aAuthoInfo['correspondence']) ? '' : '\Correspondence{'.$aAuthoInfo['correspondence'].'}'; + $aSearch['{{correspondence_info}}'] = empty($aAuthoInfo['correspondence']) ? '' : $aAuthoInfo['correspondence']; //文章基本信息处理 //标题 @@ -157,34 +162,41 @@ page={{stage_page}},%号 } $aSearch['{{article_title}}'] = $sTitle; //author_contribution - $aSearch['{{author_contribution}}'] = empty($aProductionArticle['author_contribution']) ? '' : '\authorcontributions{'.$this->dealContent($aProductionArticle['author_contribution']).'}'; + $aSearch['{{author_contribution}}'] = empty($aProductionArticle['author_contribution']) ? '' : $this->dealContent($aProductionArticle['author_contribution']); //acknowledgment - $aSearch['{{article_acknowledgment}}'] = empty($aProductionArticle['acknowledgment']) ? '' : '\Acknowledgments{'.$this->dealContent($aProductionArticle['acknowledgment']).'}'; + $aSearch['{{article_acknowledgment}}'] = empty($aProductionArticle['acknowledgment']) ? '' : $this->dealContent($aProductionArticle['acknowledgment']); //abbreviation - $aSearch['{{article_abbreviation}}'] = empty($aProductionArticle['abbreviation']) ? '' : '\Abbreviations{'.$this->dealContent($aProductionArticle['abbreviation']).'}'; + $aSearch['{{article_abbreviation}}'] = empty($aProductionArticle['abbreviation']) ? '' : $this->dealContent($aProductionArticle['abbreviation']); //文章引用信息 $sCite = $this->getArticleCite($aProductionArticle,$aJournal,$aJournalStage); - $aSearch['{{article_cite}}'] = empty($sCite) ? '' : '\Citation{'.$sCite.'}'; + $aSearch['{{article_cite}}'] = empty($sCite) ? '' : $sCite; + //文章类型 + $aSearch['{{article_type}}'] = empty($aProductionArticle['type']) ? 'ARTICLE' : strtoupper($aProductionArticle['type']); //获取文章时间 $aTime = $this->getArticleTime(['article_id' => $aProductionArticle['article_id']]); $aTime = empty($aTime['data']) ? [] : $aTime['data']; $aSearch['{{received_date}}'] = empty($aTime['received_date']) ? '' : $aTime['received_date']; - $aSearch['{{revision_date}}'] = empty($aTime['revision_date']) ? '' : $aTime['revision_date']; + $aSearch['{{revision_date}}'] = ''; + if(in_array( $aSearch['{{article_type}}'], ['ARTICLE','REVIEW','MINI REVIEW'])){ + $aSearch['{{revision_date}}'] = empty($aTime['revision_date']) ? '' : $aTime['revision_date']; + } + $aSearch['{{accepted_date}}'] = empty($aTime['accepted_date']) ? '' : $aTime['accepted_date']; $aSearch['{{pub_date}}'] = empty($aProductionArticle['pub_date']) ? '' : $aProductionArticle['pub_date']; - + //终审编委名字 + $aSearch['{{editorial_advisory_board}}'] = empty($aTime['editorial_advisory_board']) ? '' : $aTime['editorial_advisory_board']; //获取编辑信息 - $executive_editor = empty($aProductionArticle['executive_editor']) ? '' : '\Executiveeditor{'.$this->dealContent($aProductionArticle['executive_editor']).'}'; - $executive_editor_realname = empty($aUser['realname']) ? '' : '\Executiveeditor{'.$this->dealContent($aUser['realname']).'}'; + $executive_editor = empty($aProductionArticle['executive_editor']) ? '' : $this->dealContent($aProductionArticle['executive_editor']); + $executive_editor_realname = empty($aUser['realname']) ? '' : $this->dealContent($aUser['realname']); $executive_editor = empty($executive_editor) ? $executive_editor_realname : $executive_editor; $aSearch['{{executive_editor}}'] = $executive_editor; //摘要替换 $sAbstract = empty($aProductionArticle['abstract']) ? '' : $this->dealContent($aProductionArticle['abstract']); if(!empty($sAbstract)){ - $aRelace = ['Background:' => '\textcolor[HTML]{0070C0}{\textbf{Background:}}','Methods:' => '\textcolor[HTML]{0070C0}{\textbf{Methods:}}','Results:' => '\textcolor[HTML]{0070C0}{\textbf{Results:}}','Conclusion:' => '\textcolor[HTML]{0070C0}{\textbf{Conclusion:}}']; + $aRelace = ['Background:' => '\textcolor[HTML]{0070C0}{\textbf{Background:}}','Methods:' => '\\ \textcolor[HTML]{0070C0}{\textbf{Methods:}}','Results:' => '\\ \textcolor[HTML]{0070C0}{\textbf{Results:}}','Conclusion:' => '\\ \textcolor[HTML]{0070C0}{\textbf{Conclusion:}}']; $sAbstract = str_replace(array_keys($aRelace), array_values($aRelace), $sAbstract); $sAbstract = '\tmrabstract{'.$sAbstract.'}'; } @@ -195,12 +207,13 @@ page={{stage_page}},%号 //文章图片地址 $sIcon = empty($aProductionArticle['icon']) ? '' : $aProductionArticle['icon']; + $is_graphical_abstract = empty($aProductionArticle['is_graphical_abstract']) ? 3 : $aProductionArticle['is_graphical_abstract'];//是否显示图文摘要1是2否3未选择 if(!empty($sIcon)){ $sIconUrl = ROOT_PATH.trim($this->sArticleIcon,'/').'/'.$sIcon; - if(file_exists($sIconUrl)){ + if(file_exists($sIconUrl) && $is_graphical_abstract == 1){ $sIconUrl = str_replace(ROOT_PATH.'public/', '', $sIconUrl); $sIconUrl = '../../'.$sIconUrl; - $sIcon = '\KeywordImage{'.$sIconUrl.'}'; + $sIcon = $sIconUrl; }else{ $sIcon = ''; } @@ -214,10 +227,14 @@ page={{stage_page}},%号 // $sIcon = ''; // } } - $aSearch['{{article_icon}}'] = $sIcon; + $aSearch['{{article_icon}}'] = '\KeywordImage{'.$sIcon.'}'; $aSearch['{{keywords}}'] = $sKeywords; // $aSearch['{{CLSFILEURL}}'] = ROOT_PATH.'public/latex/cls'; $aSearch['{{article_id}}'] = $aProductionArticle['article_id']; + $aSearch['is_have_icon'] = empty($sIcon) ? 2 : 1; + //计算左侧内容长度 + $aRatio = $this->generateLatexDynamicColumns($aSearch); + $aSearch['{{left_ratio}}'] = empty($aRatio['left_ratio']) ? '' : $aRatio['left_ratio']; //模版内容替换 $sTemplateInfo = str_replace(array_keys($aSearch), array_values($aSearch), $sTemplateInfo); //返回内容 @@ -258,12 +275,13 @@ page={{stage_page}},%号 //查询正文信息 $aWhere = ['article_id' => $aProductionArticle['article_id'],'state' => 0]; $aArticleMain = Db::name('article_main')->field('am_id,article_id,type,content,ami_id,amt_id,is_h1,is_h2,is_h3,sort')->where($aWhere)->order('sort')->select(); + if(!empty($aArticleMain)){ //查询图片 $aAmiId = array_unique(array_column($aArticleMain, 'ami_id')); $aWhere = ['ami_id' => ['in',$aAmiId],'state' => 0]; - $aArticleMainImage = Db::name('article_main_image')->field('ami_id,url,note')->where($aWhere)->select(); + $aArticleMainImage = Db::name('article_main_image')->field('ami_id,url,title,note')->where($aWhere)->select(); $aArticleMainImage = empty($aArticleMainImage) ? [] : array_column($aArticleMainImage, null,'ami_id'); //查询表格 $aAmtId = array_unique(array_column($aArticleMain, 'amt_id')); @@ -308,7 +326,13 @@ page={{stage_page}},%号 } if($value['is_h1'] == 0 && $value['is_h2'] == 0 && $value['is_h3'] == 0){ if($value['type'] == 0 ){ - $sMain .= $this->dealContent($value['content'],$aReferences)."\\par\n"; + //处理内容 + $sMainContent = $this->dealContent($value['content'],$aReferences); + // //替换myh3标签 + // $contentpattern = '/(.*?)<\/myh3>/is'; + // $contentreplacement = '\\subsubsection{$1}'; + // $sMainContent = preg_replace($contentpattern, $contentreplacement, $sMainContent); + $sMain .= $sMainContent."\\par\n"; } if($value['type'] == 1 ){//图片 $aImageInfo = empty($aArticleMainImage[$value['ami_id']]) ? [] : $aArticleMainImage[$value['ami_id']]; @@ -355,7 +379,6 @@ page={{stage_page}},%号 } } } - $aSearch['{{article_main}}'] = empty($sMain) ? '' : $sMain."\n"; //模版内容替换 $sTemplateInfo = str_replace(array_keys($aSearch), array_values($aSearch), $sTemplateInfo); @@ -384,7 +407,7 @@ page={{stage_page}},%号 } //查询作者机构 $aWhere['p_article_author_id'] = ['in',array_column($aAuthor, 'p_article_author_id')]; - $aAuthorOrgan = Db::name('production_article_author_to_organ')->field('p_article_author_id,p_article_organ_id')->where($aWhere)->select(); + $aAuthorOrgan = Db::name('production_article_author_to_organ')->field('p_article_author_id,p_article_organ_id')->where($aWhere)->order('p_article_author_id asc,p_article_organ_id asc')->select(); //查询机构信息 $aAuthorOrganList = []; if(!empty($aAuthorOrgan)){ @@ -403,9 +426,10 @@ page={{stage_page}},%号 } //处理作者 $sAuthor = $sCorrespondence = ''; + $iFirstNum = 0; foreach ($aAuthor as $key => $value) { //作者姓名 - $sName = empty($value['fifirst_name']) ? '' : $value['fifirst_name']; + $sName = empty($value['first_name']) ? '' : $value['first_name']; $sName = empty($sName) ? '' : $sName . ' ' .$value['last_name']; if(empty($sName)){ $sName = empty($value['author_name']) ? '' : $value['author_name']; @@ -436,21 +460,32 @@ page={{stage_page}},%号 } if($value['is_first'] == 1){ $sAuthor .= '\firstauthor'."\n"; + $iFirstNum++; } if(!empty($value['orcid'])){ $sAuthor .= '\orcid{'.$this->dealContent($value['orcid']).'}'."\n"; } if($value['is_report'] == 1){ - $sCorrespondence .= $sName; - if(!empty($aOrganList[0])){ - $sCorrespondence .= ','.trim($this->dealContent($aOrganList[0]),'.'); + $sCorrespondenceInfo = $sName; + // if(!empty($aOrganList[0])){ + // $sCorrespondence .= ','.trim($this->dealContent($aOrganList[0]),'.'); + // } + if(!empty($value['mailing_address'])){//通讯地址 + $value['mailing_address'] = trim($value['mailing_address']); + $sCorrespondenceInfo .= ','.trim($this->dealContent($value['mailing_address']),'.'); } if(!empty($value['email'])){ - $sCorrespondence .= '.E-mail: '.trim($this->dealContent($value['email']),'.').'.'; + $sCorrespondenceInfo .= '. E-mail:'.trim($this->dealContent($value['email']),'.').'.'; + }else{ + $sCorrespondenceInfo .= trim($sCorrespondenceInfo,'.').'.'; } + $sCorrespondence .= $sCorrespondenceInfo .' '; } } - return ['author' => $sAuthor,'correspondence' => $sCorrespondence]; + if($iFirstNum == 1 && !empty($sAuthor)){ + $sAuthor = str_replace('\firstauthor'."\n", '', $sAuthor); + } + return ['author' => $sAuthor,'correspondence' => trim($sCorrespondence)]; } /** @@ -478,28 +513,29 @@ page={{stage_page}},%号 $jabbr = empty($aJournal['jabbr']) ? '' : $aJournal['jabbr']; $stage_year = empty($aJournalStage['stage_year']) ? '' : $aJournalStage['stage_year']; $stage_vol = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol']; - - $aAbbr = empty($aArticle['abbr']) ? '' : explode(',', trim($aArticle['abbr'])); - if(!empty($aAbbr)){ - $sEnd = end($aAbbr); - if($sEnd != 'et al'){ - $aArticle['abbr'] = implode(',', array_slice($aAbbr, 0,3)); - if(!empty($aArticle['abbr'])){ - $aArticle['abbr'] .= ', et al'; - } - } - } + $sAbbr = empty($aArticle['abbr']) ? '' : trim(trim($aArticle['abbr'],'.')); + // $aAbbr = empty( $sAbbr ) ? [] : explode(',', trim( $sAbbr )); + // if(!empty($aAbbr)){ + // $sEnd = end($aAbbr); + // if($sEnd != 'et al'){ + // $aThree = array_slice($aAbbr, 0,3); + // $sAbbr = implode(',', $aThree); + // if(!empty( $sAbbr ) && count($aThree) > 3){ + // $sAbbr .= ', et al'; + // } + // } + // } $sCite = ''; if ($aArticle['journal_id'] == 22) { - $sCite = $aArticle['abbr'] . '. ' . $aArticle['title'] . '[J]. ' . choiseJabbr($aArticle['article_id'],$jabbr) . ',' . $stage_year . ',' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; + $sCite = $sAbbr . '. ' . $aArticle['title'] . '[J]. ' . choiseJabbr($aArticle['article_id'],$jabbr) . ',' . $stage_year . ',' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; $sCite = $this->dealContent($sCite); } else { - $sCite = $this->dealContent($aArticle['abbr']) . '. ' . $this->dealContent($aArticle['title']) . '. \textit{' . $this->dealContent(choiseJabbr($aArticle['article_id'], $jabbr)) . '}. ' . $stage_year . ';' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; + $sCite = $this->dealContent($sAbbr) . '. ' . $this->dealContent($aArticle['title']) . '. \textit{' . $this->dealContent(choiseJabbr($aArticle['article_id'], $jabbr)) . '}. ' . $stage_year . ';' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; } return $sCite; } - private function getArticleTime($aParam = []){ + public function getArticleTime($aParam = []){ //必填值验证 $iArticleId = empty($aParam['article_id']) ? '' : $aParam['article_id']; if(empty($iArticleId)){ @@ -511,6 +547,15 @@ page={{stage_page}},%号 if(empty($aArticle)){ return array('status' => 2,'msg' => 'The article does not exist' ); } + //查询终审-审稿记录 + $aWhere = ['article_id' => $iArticleId,'state' => ['in',[1,2,3]]]; + $aFinalReviewerId = Db::name('article_reviewer_final')->order('review_time desc')->where($aWhere)->column('reviewer_id'); + //查询审稿人姓名 + $aUserName = []; + if(!empty($aFinalReviewerId)){ + $aWhere = ['user_id' => ['in',array_unique($aFinalReviewerId)],'state' => 0,'realname' => ['<>','']]; + $aUserName = Db::name('user')->where($aWhere)->column('realname'); + } //获取文章记录 $aWhere = ['article_id' => $iArticleId,'state' => 0,'state_to' => ['in',[0,1,5]]]; $aArticleMsg = Db::name('article_msg')->field('state_from,state_to,ctime')->where($aWhere)->order('ctime deac')->select(); @@ -534,6 +579,7 @@ page={{stage_page}},%号 $aTime['received_date'] = empty($iReceivedTime) ? '' : $this->timestampToEnglishDate($iReceivedTime); $aTime['revision_date'] = empty($iRevisionTime) ? '' : $this->timestampToEnglishDate($iRevisionTime); $aTime['accepted_date'] = empty($iAcceptedTime) ? '' : $this->timestampToEnglishDate($iAcceptedTime); + $aTime['editorial_advisory_board'] = empty($aUserName) ? '' : implode(',', $aUserName); return ['status' => 1,'msg' => 'success','data' => $aTime]; } /** @@ -671,6 +717,97 @@ page={{stage_page}},%号 return ['status' => 1,'msg' => 'success','data' => implode("\n", $latexLines)]; } - + + /** + * 动态LaTeX 比例分栏[两栏] + */ + private function generateLatexDynamicColumns($aSearch = []) { + + //数据处理 + //右侧列 + $sRightLen = ''; + if(!empty($aSearch['{{abstract}}'])){ + $sRightLen .= $aSearch['{{abstract}}']; + } + if(!empty($aSearch['{{keywords}}'])){ + $sRightLen .= $aSearch['{{keywords}}']; + } + $iRightLen = mb_strlen($sRightLen, 'UTF-8'); + + if(!empty($aSearch['is_have_icon']) && $aSearch['is_have_icon'] == 1){ + $iRightImgRatio = 0.6; // 图片宽度=0.6\textwidth + $iRightImgChar = $this->imgRatioToCharCount($iRightImgRatio); + $iRightLen = $iRightLen + $iRightImgChar; + } + //左侧列 + $sLefttLen = ''; + if(!empty($aSearch['{{author_contribution}}'])){ + $sLefttLen .= 'Author contributions'."\n".$aSearch['{{author_contribution}}']; + } + $sLefttLen .= 'Competing interests'."\n".'The authors declare no conflicts of interest.'; + if(!empty($aSearch['{{article_acknowledgment}}'])){ + $sLefttLen .= 'Acknowledgments'."\n".$aSearch['{{article_acknowledgment}}']; + } + if(!empty($aSearch['{{article_abbreviation}}'])){ + $sLefttLen .= 'Abbreviations'."\n".$aSearch['{{article_abbreviation}}']; + } + if(!empty($aSearch['{{article_cite}}'])){ + $sLefttLen .= 'Citation'."\n".$aSearch['{{article_cite}}']; + } + if(!empty($aSearch['{{journal_title}}'])){ + $sLefttLen .= 'Peer review information'."\n".$aSearch['{{journal_title}}'].' thanks all anonymous reviewers for their contribution to the peer review of this paper'; + } + if(!empty($aSearch['{{editorial_advisory_board}}'])){ + $sLefttLen .= 'Editorial Advisory Board: '.$aSearch['{{editorial_advisory_board}}']; + } + if(!empty($aSearch['{{executive_editor}}'])){ + $sLefttLen .= 'Executive editor: '.$aSearch['{{executive_editor}}']; + } + if(!empty($aSearch['{{received_date}}'])){ + $sLefttLen .= 'Received: '.$aSearch['{{received_date}}'].'; '; + } + if(!empty($aSearch['{{revision_date}}'])){ + $sLefttLen .= 'Revised: '.$aSearch['{{revision_date}}'].'; '; + } + if(!empty($aSearch['{{accepted_date}}'])){ + $sLefttLen .= 'Accepted:'.$aSearch['{{accepted_date}}'].'; '; + } + if(!empty($aSearch['{{pub_date}}'])){ + $sLefttLen .= 'Available online: '.$aSearch['{{pub_date}}']; + } + $sLefttLen .= date('Y').' By Author(s). Published by TMR Publishing Group Limited. This is an open access article under the CC-BY license. (https://creativecommons.org/licenses/by/4.0/)'; + $iLeftLen = mb_strlen($sLefttLen, 'UTF-8'); + + //统计总字数 + $iTotalLen = $iLeftLen + $iRightLen; + + $iLeftRatio = $iRightRatio = 0.5; + if($iTotalLen > 0) { + $iLeftRatio = round($iLeftLen / $iTotalLen,2); + } + if(intval($iLeftRatio*100) > 50){ + $iLeftRatio = 0.5; + } + if(intval($iLeftRatio*100) < 36){ + $iLeftRatio = 0.36; + } + return ['left_ratio' => $iLeftRatio]; + } + /** + * 图片宽度比例 → 等效英文字符数 + * @param float $fImgRatio 图片宽度占\textwidth的比例(如0.5=0.5\textwidth) + * @param float $fTextWidthEm 页面\textwidth的em宽度(英文期刊默认36em) + * @return int 英文字符数 + */ + function imgRatioToCharCount($fImgRatio = 0.6, $fTextWidthEm = 36) { + if ($fImgRatio <= 0 || !is_numeric($fImgRatio)) { + return 0; + } + //计算图片宽度(em) + $fImgWidthEm = $fImgRatio * $fTextWidthEm; + //折算为英文字符数(1em=2个英文字符) + $iImgCharCount = round($fImgWidthEm * 2); + return max($iImgCharCount, 0); + } } ?> \ No newline at end of file diff --git a/application/common/Reviewer.php b/application/common/Reviewer.php index e33923a..ec695c9 100644 --- a/application/common/Reviewer.php +++ b/application/common/Reviewer.php @@ -210,11 +210,19 @@ class Reviewer $sMajorQuery = Db::name('major_to_user')->field('user_id')->where($aWhere)->buildSql(); // 查询符合公司条件的审稿人ID,确保去重 - $aWhere = ['state' => 0, 'company' => ['<>', $sCompany]]; + $aWhere = ['state' => 0]; + if(!empty($sCompany)){ + $aWhere['company'] = ['<>',$sCompany]; + } if(!empty($aAuthorCompany)){ array_push($aAuthorCompany, $sCompany); $aAuthorCompany = array_unique($aAuthorCompany); - $aWhere['company'] = ['not in', $aAuthorCompany]; + $aAuthorCompany = array_filter($aAuthorCompany, function($v) { + return trim((string)$v) !== ''; + }); + if(!empty($aAuthorCompany)){ + $aWhere['company'] = ['not in', $aAuthorCompany]; + } } if(!empty($aBlack) && !empty($aParam['not_choose_id'])){ $aBlack = array_unique(array_merge($aBlack, $aParam['not_choose_id']));