Compare commits

..

21 Commits

Author SHA1 Message Date
chengxl
6f417f6e9f 判断是否是草稿箱 2026-02-05 13:08:08 +08:00
chengxl
8319777d3e 判断是否是草稿箱 2026-02-04 17:55:28 +08:00
chengxl
71ec3c2ccd 查询终审审稿人的机构调整 2026-02-04 17:27:15 +08:00
chengxl
56dd707f9b 查询终审审稿人的机构调整 2026-02-04 13:37:40 +08:00
chengxl
d2fe34a7a3 排版问题处理 2026-02-04 10:47:40 +08:00
chengxl
2f921a4ea2 查询终审审稿人的机构调整 2026-02-03 17:28:59 +08:00
wangjinlei
e109a84eff Merge remote-tracking branch 'origin/master' 2026-02-03 14:00:03 +08:00
wangjinlei
31da31b252 latex update 2026-02-03 13:59:57 +08:00
chengxl
7c54b4f518 排版图片修改 2026-02-03 13:48:12 +08:00
chengxl
8fe397ff50 排版相关调整 2026-02-03 09:52:07 +08:00
wangjinlei
f9e29ad876 Merge remote-tracking branch 'origin/master' 2026-02-02 11:23:56 +08:00
wangjinlei
875d486ab5 latex update 2026-02-02 11:23:50 +08:00
chengxl
a80897644e 新增方法 2026-01-30 15:58:17 +08:00
chengxl
d518097f18 排版公共方法修改 2026-01-30 15:07:12 +08:00
wangjinlei
63a89b4af7 Merge remote-tracking branch 'origin/master' 2026-01-27 15:44:23 +08:00
wangjinlei
fd6d9de32f latex update 2026-01-27 15:44:19 +08:00
chengxl
0029b96308 处理表格和图片关联 2026-01-27 15:44:05 +08:00
wangjinlei
14e425c057 Merge remote-tracking branch 'origin/master' 2026-01-27 11:22:39 +08:00
wangjinlei
1d0581e46e latex update 2026-01-27 11:22:35 +08:00
chengxl
56e8bb2a17 生成长表格 2026-01-27 10:17:00 +08:00
chengxl
fda672ddc3 排版修改 2026-01-27 10:11:46 +08:00
10 changed files with 1077 additions and 1018 deletions

View File

@@ -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'] . ',<br/><br/>';
$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.<br/><br/>";
$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.<br/><br/>";
$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.<br/><br/>";
$report_tt .= "Thank you for choosing to submit your work to our journal. We look forward to working with you.<br/><br/>";
$report_tt .= "Best regards,<br>" . $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,<br>';
$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']) . ',<br><br>';
$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.<br><br><br>';
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.<br><br>';
$tt1 .= 'You may check on the status of this manuscript in the Submission System. If you encounter any problems, please contact liferes@tmrjournals.com.<br><br>';
$tt1 .= 'Thank you for choosing to submit your manuscript to Life Research.<br><br><br>';
$tt1 .= 'Yours sincerely,<br>Haoran Zhang<br><br>';
$tt1 .= 'Manuscript Administration, Life Research<br>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'] . '.<br><br>';
$tt1 .= 'Thank you for choosing to submit your manuscript to ' . $journal_info['title'] . '.<br><br><br>';
$tt1 .= 'Sincerely,<br>Editorial Office<br>';
$tt1 .= '<a href="https://www.tmrjournals.com/draw_up.html?issn=' . $journal_info['issn'] . '">Subscribe to this journal</a><br>';
$tt1 .= $journal_info['title'] . '<br>';
$tt1 .= 'Email: ' . $journal_info['email'] . '<br>';
$tt1 .= 'Website: ' . $journal_info['website'] . '<br>';
$tt1 .= '<hr/>If you have any questions, please contact us: <br>';
$tt1 .= 'Head of publication ethics<br>Dr. Dan Chen<br>TMR Publishing Group Limited Company, Auckland, New Zealand<br>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'] . ',<br><br>';
$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'] . ',<br/><br/>';
// $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.<br/><br/>";
// $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.<br/><br/>";
// $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.<br/><br/>";
// $report_tt .= "Thank you for choosing to submit your work to our journal. We look forward to working with you.<br/><br/>";
// $report_tt .= "Best regards,<br>" . $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,<br>';
// $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']) . ',<br><br>';
// $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.<br><br><br>';
// 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.<br><br>';
// $tt1 .= 'You may check on the status of this manuscript in the Submission System. If you encounter any problems, please contact liferes@tmrjournals.com.<br><br>';
// $tt1 .= 'Thank you for choosing to submit your manuscript to Life Research.<br><br><br>';
// $tt1 .= 'Yours sincerely,<br>Haoran Zhang<br><br>';
// $tt1 .= 'Manuscript Administration, Life Research<br>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'] . '.<br><br>';
// $tt1 .= 'Thank you for choosing to submit your manuscript to ' . $journal_info['title'] . '.<br><br><br>';
// $tt1 .= 'Sincerely,<br>Editorial Office<br>';
// $tt1 .= '<a href="https://www.tmrjournals.com/draw_up.html?issn=' . $journal_info['issn'] . '">Subscribe to this journal</a><br>';
// $tt1 .= $journal_info['title'] . '<br>';
// $tt1 .= 'Email: ' . $journal_info['email'] . '<br>';
// $tt1 .= 'Website: ' . $journal_info['website'] . '<br>';
// $tt1 .= '<hr/>If you have any questions, please contact us: <br>';
// $tt1 .= 'Head of publication ethics<br>Dr. Dan Chen<br>TMR Publishing Group Limited Company, Auckland, New Zealand<br>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'] . ',<br><br>';
// $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]);
// }
}

View File

@@ -67,7 +67,7 @@ class Base extends Controller
protected $production_article_author_to_organ_obj = '';
protected $production_article_frag_obj = '';
protected $production_article_main_obj = '';
protected $production_article_main_img_obj = '';
// protected $production_article_main_img_obj = '';
protected $apply_reviewer_obj = '';
protected $promotion_obj = '';
protected $promotion_email_obj = '';
@@ -150,7 +150,7 @@ class Base extends Controller
$this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ');
$this->production_article_frag_obj = Db::name('production_article_frag');
$this->production_article_main_obj = Db::name('production_article_main');
$this->production_article_main_img_obj = Db::name("production_article_main_img");
// $this->production_article_main_img_obj = Db::name("production_article_main_img");
$this->apply_reviewer_obj = Db::name("apply_reviewer");
$this->promotion_obj = Db::name("promotion");
$this->promotion_email_obj = Db::name("promotion_email");
@@ -437,7 +437,7 @@ class Base extends Controller
$article_info = $this->article_obj->where('article_id', $article_id)->find();
$check = $this->article_main_obj->where("article_id",$article_id)->whereIn("state",[0,2])->find();
if($check){
if($check){//防止重复添加
return ;
}
@@ -523,7 +523,10 @@ class Base extends Controller
$this->article_main_table_obj->insert($ins);
}
//写入处理内容里table和figure队列-排版 20260121 start
\think\Queue::later(60,'app\api\job\DealMainFigureOrTable@fire', ['article_id' => $article_id], 'DealMainFigureOrTable');
//写入处理内容里table和figure队列-排版 20260121 end
$pics = $this->article_file_obj->where("article_id",$article_id)->where("type_name","picturesAndTables")->where("state",0)->order("file_id desc")->limit(1)->select();
if(!isset($pics[0])){
return ;
@@ -843,95 +846,95 @@ class Base extends Controller
}
public function getProductionMainImgs($p_article_id)
{
$mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
if (count($mains) == 0) {
$this->creatMainData($p_article_id);
$mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
}
$frag = [];
foreach ($mains as $v) {
$frag[] = $v;
$ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
if ($ca) {
$frag[] = $ca;
$pre_id = $ca['p_main_img_id'];
while ($pre_id != 0) {
$cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
if ($cac) {
$frag[] = $cac;
$pre_id = $cac['p_main_img_id'];
} else {
$pre_id = 0;
}
}
}
}
return $frag;
}
// public function getProductionMainImgs($p_article_id)
// {
// $mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
// if (count($mains) == 0) {
// $this->creatMainData($p_article_id);
// $mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
// }
// $frag = [];
// foreach ($mains as $v) {
// $frag[] = $v;
// $ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
// if ($ca) {
// $frag[] = $ca;
// $pre_id = $ca['p_main_img_id'];
// while ($pre_id != 0) {
// $cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
// if ($cac) {
// $frag[] = $cac;
// $pre_id = $cac['p_main_img_id'];
// } else {
// $pre_id = 0;
// }
// }
// }
// }
// return $frag;
// }
private function creatMainData($p_article_id)
{
$p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find();
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
$files = $this->article_file_obj
->where('article_id', $article_info['article_id'])
->where('type_name', 'manuscirpt')
->order('ctime desc')
->limit(1)
->select();
if (count($files) == 0) {
return jsonError('No Manuscript');
}
$url = $this->ts_base_url."api/typeset/webReaddoc";
$program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
$res = object_to_array(json_decode(myPost($url, $program)));
$file_runs = $res['data'];
//整理信息
$frag = [];
$aa = [];
$frag['title'] = $article_info['title'];
$start_refer = false;
foreach ($file_runs as $k => $v) {
if ($start_refer && $v != '') {
if (strlen($v) > 500) {
$start_refer = false;
$frag['main'][] = $v;
continue;
}
$frag['references'][] = $v;
continue;
}
$g_val = trim(preg_replace('/\<.*?\>/', '', $v));
$aa[] = $g_val;
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
$frag['keywords'] = $v;
continue;
}
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
$start_refer = true;
continue;
}
$frag['main'][] = $v;
}
if (!isset($frag['main'])) {
return jsonError("manuscript file error!");
}
//将主体内容写入数据库
foreach ($frag['main'] as $v) {
$ca['p_article_id'] = $p_article_id;
$ca['content'] = $v;
$ca['content_g'] = '';
$ca['ctime'] = time();
$this->production_article_main_obj->insert($ca);
}
}
// private function creatMainData($p_article_id)
// {
// $p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find();
// $article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
// $files = $this->article_file_obj
// ->where('article_id', $article_info['article_id'])
// ->where('type_name', 'manuscirpt')
// ->order('ctime desc')
// ->limit(1)
// ->select();
// if (count($files) == 0) {
// return jsonError('No Manuscript');
// }
// $url = $this->ts_base_url."api/typeset/webReaddoc";
// $program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
// $res = object_to_array(json_decode(myPost($url, $program)));
//
// $file_runs = $res['data'];
//
// //整理信息
// $frag = [];
// $aa = [];
// $frag['title'] = $article_info['title'];
// $start_refer = false;
// foreach ($file_runs as $k => $v) {
// if ($start_refer && $v != '') {
// if (strlen($v) > 500) {
// $start_refer = false;
// $frag['main'][] = $v;
// continue;
// }
// $frag['references'][] = $v;
// continue;
// }
// $g_val = trim(preg_replace('/\<.*?\>/', '', $v));
// $aa[] = $g_val;
//
// if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
// $frag['keywords'] = $v;
// continue;
// }
// if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
// $start_refer = true;
// continue;
// }
// $frag['main'][] = $v;
// }
// if (!isset($frag['main'])) {
// return jsonError("manuscript file error!");
// }
//
//
// //将主体内容写入数据库
// foreach ($frag['main'] as $v) {
// $ca['p_article_id'] = $p_article_id;
// $ca['content'] = $v;
// $ca['content_g'] = '';
// $ca['ctime'] = time();
// $this->production_article_main_obj->insert($ca);
// }
// }
public function refuseReferIndex($p_article_id)
{
@@ -946,83 +949,83 @@ class Base extends Controller
}
public function getProductionMainImgsByNew($p_article_id, $file)
{
$p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find();
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
$url = $this->ts_base_url."api/typeset/webReaddoc";
$program['fileRoute'] = "https://submission.tmrjournals.com/public/completedManuscirpt/" . $file;
// $program['fileRoute'] = "https://submission.tmrjournals.com/public/completedManuscirpt/20230706/87628e769c4ee8a8414219b05c72a028.docx" ;
$res = object_to_array(json_decode(myPost($url, $program)));
$file_runs = $res['data'];
if (count($file_runs) == 0) {
return jsonError("File crawl failed");
}
//清空之前的
$this->production_article_main_obj->where('p_article_id', $p_article_id)->update(['state' => 1]);
//整理信息
$frag = [];
$aa = [];
$frag['title'] = $article_info['title'];
$start_refer = false;
foreach ($file_runs as $k => $v) {
if ($start_refer && $v != '') {
if (strlen($v) > 500) {
$start_refer = false;
$frag['main'][] = $v;
continue;
}
$frag['references'][] = $v;
continue;
}
$g_val = trim(preg_replace('/\<.*?\>/', '', $v));
$aa[] = $g_val;
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
$frag['keywords'] = $v;
continue;
}
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
$start_refer = true;
continue;
}
$frag['main'][] = $v;
}
if (!isset($frag['main'])) {
return jsonError("manuscript file error!");
}
//将主体内容写入数据库
foreach ($frag['main'] as $v) {
$ca['p_article_id'] = $p_article_id;
$ca['content'] = $v;
$ca['content_g'] = '';
$ca['ctime'] = time();
$this->production_article_main_obj->insert($ca);
}
$mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
$f = [];
foreach ($mains as $v) {
$f[] = $v;
$ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
if ($ca) {
$f[] = $ca;
$pre_id = $ca['p_main_img_id'];
while ($pre_id != 0) {
$cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
if ($cac) {
$f[] = $cac;
$pre_id = $cac['p_main_img_id'];
} else {
$pre_id = 0;
}
}
}
}
return $f;
}
// public function getProductionMainImgsByNew($p_article_id, $file)
// {
// $p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find();
// $article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
// $url = $this->ts_base_url."api/typeset/webReaddoc";
// $program['fileRoute'] = "https://submission.tmrjournals.com/public/completedManuscirpt/" . $file;
//// $program['fileRoute'] = "https://submission.tmrjournals.com/public/completedManuscirpt/20230706/87628e769c4ee8a8414219b05c72a028.docx" ;
// $res = object_to_array(json_decode(myPost($url, $program)));
// $file_runs = $res['data'];
// if (count($file_runs) == 0) {
// return jsonError("File crawl failed");
// }
// //清空之前的
// $this->production_article_main_obj->where('p_article_id', $p_article_id)->update(['state' => 1]);
//
// //整理信息
// $frag = [];
// $aa = [];
// $frag['title'] = $article_info['title'];
// $start_refer = false;
// foreach ($file_runs as $k => $v) {
// if ($start_refer && $v != '') {
// if (strlen($v) > 500) {
// $start_refer = false;
// $frag['main'][] = $v;
// continue;
// }
// $frag['references'][] = $v;
// continue;
// }
// $g_val = trim(preg_replace('/\<.*?\>/', '', $v));
// $aa[] = $g_val;
//
// if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
// $frag['keywords'] = $v;
// continue;
// }
// if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
// $start_refer = true;
// continue;
// }
// $frag['main'][] = $v;
// }
// if (!isset($frag['main'])) {
// return jsonError("manuscript file error!");
// }
//
// //将主体内容写入数据库
// foreach ($frag['main'] as $v) {
// $ca['p_article_id'] = $p_article_id;
// $ca['content'] = $v;
// $ca['content_g'] = '';
// $ca['ctime'] = time();
// $this->production_article_main_obj->insert($ca);
// }
//
// $mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
// $f = [];
// foreach ($mains as $v) {
// $f[] = $v;
// $ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
// if ($ca) {
// $f[] = $ca;
// $pre_id = $ca['p_main_img_id'];
// while ($pre_id != 0) {
// $cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
// if ($cac) {
// $f[] = $cac;
// $pre_id = $cac['p_main_img_id'];
// } else {
// $pre_id = 0;
// }
// }
// }
// }
// return $f;
// }
/**创建空production实例应对main和refers

View File

@@ -21,7 +21,7 @@ class Contribute extends Base
}
/**
* 自动投稿
* 自动投稿,提交存储文章相关信息
* @param file_url 文件地址
*/
public function contribute($aParam = []){

View File

@@ -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]);
}

View File

@@ -1,341 +0,0 @@
<?php
namespace app\api\controller;
class Latex extends Base
{
public function __construct(\think\Request $request = null)
{
parent::__construct($request);
}
public function generateLatexPdf()
{
$data = $this->request->post();
$rule = new Validate([
'p_article_id' => 'require|number'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
try {
// 获取文章信息
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
if (!$p_info) {
return jsonError('文章实例不存在');
}
// 获取作者信息
$authors = $this->production_article_author_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
// 获取机构信息
$organs = $this->production_article_organ_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
// 获取正文内容
$main_contents = $this->production_article_main_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->order('p_main_id')->select();
// 获取参考文献
$references = $this->production_article_refer_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->order('index')->select();
// 构建LaTeX内容
$latex_content = $this->buildLatexContent($p_info, $authors, $organs, $main_contents, $references);
// 创建临时目录
$temp_dir = ROOT_PATH . 'public' . DS . 'temp_latex' . DS;
if (!is_dir($temp_dir)) {
mkdir($temp_dir, 0755, true);
}
// 生成唯一的文件名
$filename = 'article_' . $p_info['p_article_id'] . '_' . time();
$tex_file = $temp_dir . $filename . '.tex';
$pdf_file = $temp_dir . $filename . '.pdf';
// 写入LaTeX文件
file_put_contents($tex_file, $latex_content);
// 执行LaTeX编译命令生成PDF
$command = sprintf(
'cd %s && pdflatex -interaction=nonstopmode -output-directory=%s %s',
escapeshellarg($temp_dir),
escapeshellarg($temp_dir),
escapeshellarg($tex_file)
);
// 执行命令
$output = [];
$return_var = 0;
exec($command, $output, $return_var);
// 检查PDF是否生成成功
if (!file_exists($pdf_file) || filesize($pdf_file) == 0) {
return jsonError('PDF生成失败请检查LaTeX内容或系统环境');
}
// 移动PDF到正式目录
$pdf_dir = ROOT_PATH . 'public' . DS . 'latex_pdfs' . DS;
if (!is_dir($pdf_dir)) {
mkdir($pdf_dir, 0755, true);
}
$final_pdf_path = $pdf_dir . $filename . '.pdf';
rename($pdf_file, $final_pdf_path);
// 清理临时文件
if (file_exists($tex_file)) {
unlink($tex_file);
}
// 清理辅助文件(.aux, .log等)
$aux_file = $temp_dir . $filename . '.aux';
$log_file = $temp_dir . $filename . '.log';
if (file_exists($aux_file)) unlink($aux_file);
if (file_exists($log_file)) unlink($log_file);
// 返回PDF路径
$relative_path = 'latex_pdfs/' . $filename . '.pdf';
return jsonSuccess([
'pdf_url' => $relative_path,
'message' => 'PDF生成成功'
]);
} catch (\Exception $e) {
return jsonError('生成过程中发生错误: ' . $e->getMessage());
}
}
/**
* 构建LaTeX文档内容
* @param $p_info
* @param $authors
* @param $organs
* @param $main_contents
* @param $references
* @return string
*/
private function buildLatexContent($p_info, $authors, $organs, $main_contents, $references)
{
// 构建机构映射
$organ_map = [];
foreach ($organs as $index => $organ) {
$organ_map[$organ['p_article_organ_id']] = $index + 1;
}
// LaTeX文档开始
$latex = '\documentclass[twocolumn]{article}' . "\n";
$latex .= '\usepackage[utf8]{inputenc}' . "\n";
$latex .= '\usepackage[T1]{fontenc}' . "\n";
$latex .= '\usepackage{geometry}' . "\n";
$latex .= '\usepackage{graphicx}' . "\n";
$latex .= '\usepackage{amsmath}' . "\n";
$latex .= '\usepackage{amsfonts}' . "\n";
$latex .= '\usepackage{amssymb}' . "\n";
$latex .= '\usepackage{setspace}' . "\n";
$latex .= '\usepackage{titlesec}' . "\n";
$latex .= '\usepackage{hyperref}' . "\n";
$latex .= '\usepackage{caption}' . "\n";
$latex .= '\usepackage{multicol}' . "\n";
$latex .= '\usepackage{abstract}' . "\n";
$latex .= '\geometry{left=1.5cm,right=1.5cm,top=2.5cm,bottom=2.5cm}' . "\n";
$latex .= '\setstretch{1.5}' . "\n";
$latex .= '\title{' . $this->escapeLatexText($p_info['title']) . '}' . "\n";
// 处理作者和机构
if (!empty($authors)) {
$author_text = '';
$affiliations = [];
foreach ($authors as $author) {
if ($author_text !== '') {
$author_text .= ', ';
}
$author_text .= $this->escapeLatexText($author['first_name'] . ' ' . $author['last_name']);
// 获取作者的机构
$author_organs = $this->production_article_author_to_organ_obj
->where('p_article_author_id', $author['p_article_author_id'])
->where('state', 0)
->select();
foreach ($author_organs as $ao) {
if (isset($organ_map[$ao['p_article_organ_id']])) {
$author_text .= '$^{' . $organ_map[$ao['p_article_organ_id']] . '}$';
}
}
if ($author['is_report'] == 1) {
$author_text .= '$^{*}$';
}
}
$latex .= '\author{' . $author_text . "\n";
// 添加机构信息
foreach ($organs as $index => $organ) {
$latex .= '\\\\$' . ($index + 1) . '$ ' . $this->escapeLatexText($organ['organ_name']) . "\n";
}
if (!empty($authors)) {
// 查找通讯作者
$corresponding_authors = array_filter($authors, function($author) {
return $author['is_report'] == 1;
});
if (!empty($corresponding_authors)) {
$corr_author = reset($corresponding_authors);
$latex .= '\\\\$*$ Corresponding author: ' .
$this->escapeLatexText($corr_author['email']) . "\n";
}
}
$latex .= '}' . "\n";
}
$latex .= '\date{}' . "\n";
$latex .= '\begin{document}' . "\n";
$latex .= '\maketitle' . "\n";
// 摘要
if (!empty($p_info['abstract'])) {
$latex .= '\begin{abstract}' . "\n";
$latex .= $this->escapeLatexText($p_info['abstract']) . "\n";
$latex .= '\end{abstract}' . "\n";
}
// 关键词
if (!empty($p_info['keywords'])) {
$latex .= '\textbf{Keywords:} ' . $this->escapeLatexText($p_info['keywords']) . "\n";
$latex .= '\sectionbreak' . "\n";
}
// 正文内容
$in_section = false;
$section_count = 0;
foreach ($main_contents as $content) {
$text = trim($content['content']);
// 跳过空内容
if (empty($text)) {
continue;
}
// 检查是否是标题
$clean_text = strip_tags($text);
$lower_text = strtolower($clean_text);
// 判断是否为章节标题
if (stripos($lower_text, 'introduction') === 0 ||
stripos($lower_text, 'methods') === 0 ||
stripos($lower_text, 'results') === 0 ||
stripos($lower_text, 'discussion') === 0 ||
stripos($lower_text, 'conclusion') === 0 ||
stripos($lower_text, 'references') === 0) {
// 结束前一节
if ($in_section) {
$latex .= "\n" . '\sectionbreak' . "\n";
}
// 开始新节
$section_count++;
$section_title = $this->escapeLatexText($clean_text);
$latex .= '\section{' . $section_title . '}' . "\n";
$in_section = true;
}
// 检查是否是图片或表格占位符
else if (preg_match('/<img[^>]*imageId=[\'"]([^\'"]+)[\'"][^>]*>/i', $text, $img_matches)) {
$image_id = $img_matches[1];
// 这里可以添加图片处理逻辑
$latex .= '% 图片插入位置 (ID: ' . $image_id . ')' . "\n";
$latex .= '\begin{figure}[htbp]' . "\n";
$latex .= '\centering' . "\n";
$latex .= '\includegraphics[width=0.8\textwidth]{image_' . $image_id . '}' . "\n";
$latex .= '\caption{图片说明}' . "\n";
$latex .= '\end{figure}' . "\n";
}
else if (preg_match('/<table[^>]*tableId=[\'"]([^\'"]+)[\'"][^>]*>/i', $text, $table_matches)) {
$table_id = $table_matches[1];
// 这里可以添加表格处理逻辑
$latex .= '% 表格插入位置 (ID: ' . $table_id . ')' . "\n";
$latex .= '\begin{table}[htbp]' . "\n";
$latex .= '\centering' . "\n";
$latex .= '\caption{表格说明}' . "\n";
$latex .= '\begin{tabular}{|c|c|c|}' . "\n";
$latex .= '\hline' . "\n";
$latex .= '列1 & 列2 & 列3 \\\\' . "\n";
$latex .= '\hline' . "\n";
$latex .= '% 表格数据' . "\n";
$latex .= '\hline' . "\n";
$latex .= '\end{tabular}' . "\n";
$latex .= '\end{table}' . "\n";
}
// 普通段落文本
else {
// 移除HTML标签并转义特殊字符
$plain_text = $this->escapeLatexText(strip_tags($text));
$latex .= $plain_text . "\n\n";
}
}
// 参考文献
if (!empty($references)) {
$latex .= '\section*{References}' . "\n";
$latex .= '\begin{thebibliography}{99}' . "\n";
foreach ($references as $index => $ref) {
$ref_text = isset($ref['refer_frag']) ? $ref['refer_frag'] : $ref['refer_content'];
$latex .= '\bibitem{} ' . $this->escapeLatexText($ref_text) . "\n";
}
$latex .= '\end{thebibliography}' . "\n";
}
$latex .= '\end{document}' . "\n";
return $latex;
}
/**
* 转义LaTeX特殊字符
* @param string $text
* @return string
*/
private function escapeLatexText($text)
{
// 移除HTML标签
$text = strip_tags($text);
// 转义LaTeX特殊字符
$escape_chars = [
'\\' => '\\textbackslash{}',
'&' => '\\&',
'%' => '\\%',
'$' => '\\$',
'#' => '\\#',
'_' => '\\_',
'{' => '\\{',
'}' => '\\}',
'~' => '\\textasciitilde{}',
'^' => '\\textasciicircum{}',
'"' => '\\"{}',
'\'' => '\\\'{}',
'<' => '\\textless{}',
'>' => '\\textgreater{}',
];
foreach ($escape_chars as $char => $replacement) {
$text = str_replace($char, $replacement, $text);
}
return $text;
}
}

View File

@@ -45,6 +45,12 @@ class Preaccept extends Base
}else{
$list[$k]['is_repeat'] = 0;
}
if(strpos($v['refer_content'],'retraction')!==false||strpos($v['refer_content'],'retracted')!==false){
$list[$k]['retract'] = 1;
}else{
$list[$k]['retract'] = 0;
}
}
$re["refers"] = $list;
$re['repeat'] = empty($aRepeat) ? [] : $aRepeat;
@@ -321,8 +327,15 @@ class Preaccept extends Base
$insert['ami_id'] = $data['ami_id'];
$insert['sort'] = $am_info['sort']+1;
$insert['ctime'] = time();
$this->article_main_obj->insert($insert);
return jsonSuccess([]);
//$this->article_main_obj->insert($insert);
// return jsonSuccess([]);
//返回更新数据 20260120 start
$iId = $this->article_main_obj->insertGetId($insert);
$insert = empty($insert) ? [] : array_merge($insert,['am_id' => empty($iId) ? 0 : $iId]);
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $insert : $aResult;
return jsonSuccess($aResult);
//返回更新数据 20260120 end
}
public function removeImage(){
@@ -384,8 +397,15 @@ class Preaccept extends Base
$insert["content"] = "<table tableId='".$amt_info['amt_id']."' />";
$insert['sort'] = $am_info['sort']+1;
$insert['ctime'] = time();
$this->article_main_obj->insert($insert);
return jsonSuccess([]);
// $this->article_main_obj->insert($insert);
// return jsonSuccess([]);
//返回更新数据 20260120 start
$iId = $this->article_main_obj->insertGetId($insert);
$insert = empty($insert) ? [] : array_merge($insert,['am_id' => empty($iId) ? 0 : $iId]);
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $insert : $aResult;
return jsonSuccess($aResult);
//返回更新数据 20260120 end
}
@@ -832,7 +852,14 @@ class Preaccept extends Base
$this->addBRow($am_info['article_id'],$data['am_id']);
}
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>1,"is_h2"=>0,"is_h3"=>0]);
return jsonSuccess([]);
// return jsonSuccess([]);
//返回数据 20260119 start
$am_info = empty($am_info) ? [] : array_merge($am_info,["is_h1"=>1,"is_h2"=>0,"is_h3"=>0]);
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $am_info : $aResult;
return jsonSuccess($aResult);
//返回数据 20260119 end
}
public function changeH2(){
@@ -850,7 +877,14 @@ class Preaccept extends Base
$this->addBRow($am_info['article_id'],$p_list[0]['am_id']);
}
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>1,"is_h3"=>0]);
return jsonSuccess([]);
// return jsonSuccess([]);
//返回数据 20260119 start
$am_info = empty($am_info) ? [] : array_merge($am_info,["is_h1"=>0,"is_h2"=>1,"is_h3"=>0]);
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $am_info : $aResult;
return jsonSuccess($aResult);
//返回数据 20260119 end
}
public function changeH3(){
@@ -863,7 +897,14 @@ class Preaccept extends Base
}
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>0,"is_h3"=>1]);
return jsonSuccess([]);
// return jsonSuccess([]);
//返回数据 20260119 start
$am_info = empty($am_info) ? [] : array_merge($am_info,["is_h1"=>0,"is_h2"=>0,"is_h3"=>1]);
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $am_info : $aResult;
return jsonSuccess($aResult);
//返回数据 20260119 end
}
public function changeNormal(){
@@ -875,7 +916,13 @@ class Preaccept extends Base
return jsonError($rule->getError());
}
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>0,"is_h3"=>0]);
return jsonSuccess([]);
// return jsonSuccess([]);
//返回数据 20260119 start
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? [] : $aResult;
return jsonSuccess($aResult);
//返回数据 20260119 end
}
public function addBlankRow(){
@@ -892,14 +939,26 @@ class Preaccept extends Base
}else{
$row = 1;
}
// while ($row>0){
// $this->addBRow($data['article_id'],$data['am_id']);
// $row--;
// }
// return jsonSuccess([]);
//返回添加数据 20260119 start
$aId = [];
while ($row>0){
$this->addBRow($data['article_id'],$data['am_id']);
$iId = $this->addBRow($data['article_id'],$data['am_id']);
$row--;
if(!empty($iId)){
$aId[] = $iId;
}
}
return jsonSuccess([]);
$aResult = $this->_getRowInfo($aId);
$aResult = empty($aResult) ? $aId : $aResult;
return jsonSuccess($aResult);
//返回添加数据 20260119 end
}
/**添加批量主体内容
* @return \think\response\Json
* @throws \think\Exception
@@ -926,15 +985,32 @@ class Preaccept extends Base
$this->article_main_obj->where("article_id",$data['article_id'])->where("sort",">",$r['sort'])->inc("sort",count($data['rows']))->update();
$sort = $r['sort']+1;
}
// foreach ($data['rows'] as $v){
// $insert['article_id'] = $data['article_id'];
// $insert['content'] = $v;
// $insert['sort'] = $sort;
// $insert['ctime'] = time();
// $this->article_main_obj->insert($insert);
// $sort++;
// }
// return jsonSuccess([]);
//返回数组数据 20260119 start
$aInsert = [];
foreach ($data['rows'] as $v){
$insert['article_id'] = $data['article_id'];
$insert['content'] = $v;
$insert['sort'] = $sort;
$insert['ctime'] = time();
$this->article_main_obj->insert($insert);
$iId = $this->article_main_obj->insertGetId($insert);
$sort++;
$aInsert[] = empty($iId) ? $insert : array_merge($insert,['am_id' => $iId]);
}
return jsonSuccess([]);
$aId = empty($aInsert) ? [] : array_column($aInsert, 'am_id');
$aResult = $this->_getRowInfo($aId);
$aResult = empty($aResult) ? $aInsert : $aResult;
return jsonSuccess($aResult);
//返回数组数据 20260119 end
}
@@ -945,7 +1021,10 @@ class Preaccept extends Base
$insert['content'] = "";
$insert['sort'] = 1;
$insert['ctime'] = time();
$this->article_main_obj->insert($insert);
// $this->article_main_obj->insert($insert);
//返回主键ID 0119 start
return $this->article_main_obj->insertGetId($insert);
//返回主键ID 0119 end
}else{
$am_info = $this->article_main_obj->where("am_id",$am_id)->find();
$this->article_main_obj->where("article_id",$article_id)->where("sort",">",$am_info['sort'])->inc("sort",1)->update();
@@ -953,7 +1032,10 @@ class Preaccept extends Base
$insert['content'] = "";
$insert['sort'] = $am_info['sort']+1;
$insert['ctime'] = time();
$this->article_main_obj->insert($insert);
// $this->article_main_obj->insert($insert);
//返回主键ID 0119 start
return $this->article_main_obj->insertGetId($insert);
//返回主键ID 0119 end
}
}
@@ -1063,7 +1145,14 @@ class Preaccept extends Base
$update['content'] = $this->formatMain($data['content']);
$update['state'] = 0;
$this->article_main_obj->where("am_id",$data['am_id'])->update($update);
return jsonSuccess([]);
// return jsonSuccess([]);
//返回更新数据 20260119 start
$update = empty($update) ? [] : array_merge($update,['am_id' => empty($data['am_id']) ? 0 : $data['am_id']]);
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $update : $aResult;
return jsonSuccess($aResult);
//返回更新数据 20260119 end
}
public function getArticleMainsRecycle(){
@@ -1099,11 +1188,18 @@ class Preaccept extends Base
$insert['title'] = $data['title'];
}
$insert['ctime'] = time();
$this->article_main_image_obj->insert($insert);
$re['url'] = $data['url'];
// $this->article_main_image_obj->insert($insert);
// $re['url'] = $data['url'];
return jsonSuccess($re);
// return jsonSuccess($re);
//返回新增数据 20260119 start
$iId = $this->article_main_image_obj->insertGetId($insert);
$insert = empty($iId) ? $insert : array_merge(['ami_id' => $iId],$insert);
$aResult = $this->_getImageInfo($iId);
$aResult = empty($aResult) ? $insert : $aResult;
return jsonSuccess($aResult);
//返回新增数据 20260119 end
}
public function editMainImage(){
@@ -1119,7 +1215,18 @@ class Preaccept extends Base
$update['note'] = isset($data['note'])?$data['note']:"";
$update['title'] = isset($data['title'])?$data['title']:"";
$this->article_main_image_obj->where("ami_id",$data['ami_id'])->update($update);
return jsonSuccess([]);
// return jsonSuccess([]);
//返回修改数据 20260119 start
$update = empty($update) ? [] : array_merge(['ami_id' => empty($data['ami_id']) ? 0 : $data['ami_id']],$update);
$iId = empty($data['ami_id']) ? 0 : $data['ami_id'];
$aResult = $this->_getImageInfo($iId);
$aResult = empty($aResult) ? $update : $aResult;
if(!empty($aResult['main'])){
$aResultInfo = $this->_getMainRow(0,$aResult['main']);
$aResult = empty($aResultInfo) ? $aResult : $aResultInfo;
}
return jsonSuccess($aResult);
//返回新增数据 20260119 end
}
public function addMainTable(){
@@ -1144,9 +1251,15 @@ class Preaccept extends Base
$insert['note'] = $data['note'];
}
$insert['ctime'] = time();
$this->article_main_table_obj->insert($insert);
return jsonSuccess([]);
// $this->article_main_table_obj->insert($insert);
// return jsonSuccess([]);
//返回新增数据 20260119 start
$iId = $this->article_main_table_obj->insertGetId($insert);
$insert = empty($iId) ? $insert : array_merge(['amt_id' => $iId],$insert);
$aResult = $this->_getTableInfo($iId);
$aResult = empty($aResult) ? $insert : $aResult;
return jsonSuccess($aResult);
//返回新增数据 20260119 end
}
@@ -1168,7 +1281,18 @@ class Preaccept extends Base
$update['note'] = $data['note'];
}
$this->article_main_table_obj->where("amt_id",$data['amt_id'])->update($update);
return jsonSuccess([]);
// return jsonSuccess([]);
//返回修改数据 20260119 start
$update = empty($update) ? [] : array_merge(['amt_id' => empty($data['amt_id']) ? 0 : $data['amt_id']],$update);
$iId = empty($data['amt_id']) ? 0 : $data['amt_id'];
$aResult = $this->_getTableInfo($iId);
$aResult = empty($aResult) ? $update : $aResult;
if(!empty($aResult['main'])){
$aResultInfo = $this->_getMainRow(0,$aResult['main']);
$aResult = empty($aResultInfo) ? $aResult : $aResultInfo;
}
return jsonSuccess($aResult);
//返回新增数据 20260119 end
}
@@ -1549,12 +1673,14 @@ return null;
}
foreach ($item as $k => $main) {
if($main['is_h1']==1){
$main['content'] = "<b><i>".$main['content']."</i></b>";
}
if($main['is_h2']==1||$main['is_h3']==1){
$main['content'] = "<b>".$main['content']."</b>";
}
//取消一级/二级/三级 标题样式 20260119 start
// if($main['is_h1']==1){
// $main['content'] = "<b><i>".$main['content']."</i></b>";
// }
// if($main['is_h2']==1||$main['is_h3']==1){
// $main['content'] = "<b>".$main['content']."</b>";
// }
//取消一级/二级/三级 标题样式 20260119 end
$main['checks'] = empty($aMainCheckData[$main['am_id']]) ? [] : $aMainCheckData[$main['am_id']];
if($main['type'] == 1){
$main['image'] = empty($aArticleMainImage[$main['ami_id']]) ? [] : $aArticleMainImage[$main['ami_id']];
@@ -1743,4 +1869,175 @@ return null;
return jsonSuccess([]);
}
//获取多条信息
private function _getRowInfo($aId = []){
if(empty($aId)){
return [];
}
//获取信息
$aWhere = ['am_id' => ['in',$aId],'state' => 0];
$aArticleMain = Db::name("article_main")->where($aWhere)->order("sort asc")->select();
if(empty($aArticleMain)){
return [];
}
//获取主键ID
$aMId = array_column($aArticleMain, 'am_id');
//查询article_main_check
$aWhere = ['am_id' => ['in',$aMId],'state' => 0];
$aMainCheck = Db::name("article_main_check")->where($aWhere)->select();
$aMainCheckData = [];
if(!empty($aMainCheck)){
foreach ($aMainCheck as $value) {
if(empty($value['am_id'])){
continue;
}
$aMainCheckData[$value['am_id']][] = $value;
}
}
//获取图片信息
$aMiId = array_unique(array_column($aArticleMain, 'ami_id'));
$aWhere = ['ami_id' => ['in',$aMiId],'state' => 0];
$aArticleMainImage = Db::name("article_main_image")->where($aWhere)->select();
$aArticleMainImage = empty($aArticleMainImage) ? [] : array_column($aArticleMainImage, null,'ami_id');
//获取表格信息
$aMiId = array_unique(array_column($aArticleMain, 'amt_id'));
$aWhere = ['amt_id' => ['in',$aMiId],'state' => 0];
$aArticleMainTable = Db::name("article_main_table")->where($aWhere)->select();
$aArticleMainTable = empty($aArticleMainTable) ? [] : array_column($aArticleMainTable, null,'amt_id');
//查询校对数量 t_article_proofread
$aWhere = ['am_id' => ['in',$aMId],'state' => ['between',[1,2]],'is_delete' => 2];
$aArticleProofread = Db::name("article_proofread")->field('am_id,count(id) as num,state')->where($aWhere)->group('am_id,state')->select();
$aArticleProofreadData = [];
if(!empty($aArticleProofread)){
foreach ($aArticleProofread as $key => $value) {
$aArticleProofreadData[$value['am_id']][$value['state']] = $value['num'];
}
}
//数据处理
foreach ($aArticleMain as $k => $main) {
$aArticleMain[$k]['checks'] = empty($aMainCheckData[$main['am_id']]) ? [] : $aMainCheckData[$main['am_id']];
if($main['type'] == 1){
$aArticleMain[$k]['image'] = empty($aArticleMainImage[$main['ami_id']]) ? [] : $aArticleMainImage[$main['ami_id']];
}
if($main['type'] == 2){
$aArticleMain[$k]['table'] = empty($aArticleMainTable[$main['amt_id']]) ? [] : $aArticleMainTable[$main['amt_id']];
}
if($main['type'] == 0){
$aDataInfo = empty($aArticleProofreadData[$main['am_id']]) ? [] : $aArticleProofreadData[$main['am_id']];
$main['proof_read_num'] = -1;
if(!empty($aDataInfo)){
$main['proof_read_num'] = empty($aDataInfo[2]) ? 0 : $aDataInfo[2];
}
}
}
return $aArticleMain;
}
//获取图片信息
private function _getImageInfo($iAmiId = 0){
if(empty($iAmiId)){
return [];
}
//获取图片信息
$aWhere = ['ami_id' => $iAmiId,'state' => 0];
$aArticleMainImage = Db::name("article_main_image")->where($aWhere)->find();
if(empty($aArticleMainImage)){
return [];
}
$iArticleId = empty($aArticleMainImage['article_id']) ? 0 : $aArticleMainImage['article_id'];
//获取表信息
$aWhere = ['ami_id' => $iAmiId,'state' => 0,'type' => 1,'article_id' => $iArticleId];
$aArticleMain = Db::name("article_main")->where($aWhere)->find();
//数据处理
$aArticleMainImage['has_selected'] = empty($aArticleMain) ? 0 : 1;
if(!empty($aArticleMain)){
$aArticleMainImage['main'] = $aArticleMain;
}
return $aArticleMainImage;
}
//获取表格信息
private function _getTableInfo($iAmtId = 0){
if(empty($iAmtId)){
return [];
}
//获取图片信息
$aWhere = ['amt_id' => $iAmtId,'state' => 0];
$aArticleMainTable = Db::name("article_main_table")->where($aWhere)->find();
if(empty($aArticleMainTable)){
return [];
}
$iArticleId = empty($aArticleMainTable['article_id']) ? 0 : $aArticleMainTable['article_id'];
//获取表信息
$aWhere = ['amt_id' => $iAmtId,'state' => 0,'type' => 2,'article_id' => $iArticleId];
$aArticleMain = Db::name("article_main")->where($aWhere)->find();
//数据处理
$aArticleMainTable['has_selected'] = empty($aArticleMain) ? 0 : 1;
if(!empty($aArticleMain)){
$aArticleMainTable['main'] = $aArticleMain;
}
return $aArticleMainTable;
}
//获取单独的一条信息
private function _getMainRow($iId = 0,$aArticleMain = []){
if(empty($iId) && empty($aArticleMain)){
return [];
}
//获取基本信息
if(empty($aArticleMain)){
$aWhere = ['am_id' => $iId,'state' => 0];
$aArticleMain = Db::name("article_main")->where($aWhere)->find();
}
if(empty($aArticleMain)){
return [];
}
//获取主键ID
$iId = empty($aArticleMain['am_id']) ? 0 : $aArticleMain['am_id'];
//查询article_main_check
$aWhere = ['am_id' => $iId,'state' => 0];
$aMainCheck = Db::name("article_main_check")->where($aWhere)->select();
//获取主体信息
$iType = isset($aArticleMain['type']) ? $aArticleMain['type'] : -1;
if($iType == 1){//获取图片
$iAmiId = empty($aArticleMain['ami_id']) ? 0 : $aArticleMain['ami_id'];
$aWhere = ['ami_id' => $iAmiId,'state' => 0];
$aArticleMainImage = Db::name("article_main_image")->where($aWhere)->find();
}
//获取表格信息
if($iType == 2){
$iAmtId = empty($aArticleMain['amt_id']) ? 0 : $aArticleMain['amt_id'];
$aWhere = ['amt_id' => $iAmtId,'state' => 0];
$aArticleMainTable = Db::name("article_main_table")->where($aWhere)->find();
}
//查询校对数量 t_article_proofread
$aWhere = ['am_id' => $iId,'state' => ['between',[1,2]],'is_delete' => 2];
$aArticleProofread = Db::name("article_proofread")->field('am_id,count(id) as num,state')->where($aWhere)->group('state')->select();
$aArticleProofreadData = [];
if(!empty($aArticleProofread)){
foreach ($aArticleProofread as $key => $value) {
$aArticleProofreadData[$value['state']] = $value['num'];
}
}
//数据处理
$aArticleMain['checks'] = empty($aMainCheckData) ? [] : $aMainCheckData;
if($iType == 1){
$aArticleMain['image'] = empty($aArticleMainImage) ? [] : $aArticleMainImage;
}
if($iType == 2){
$aArticleMain['table'] = empty($aArticleMainTable) ? [] : $aArticleMainTable;
}
if($iType == 0){
$aDataInfo = empty($aArticleProofreadData) ? [] : $aArticleProofreadData;
$aArticleMain['proof_read_num'] = -1;
if(!empty($aDataInfo)){
$aArticleMain['proof_read_num'] = empty($aDataInfo[2]) ? 0 : $aDataInfo[2];
}
}
return $aArticleMain;
}
}

View File

@@ -50,57 +50,57 @@ class Production extends Base
}
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
$files = $this->article_file_obj
->where('article_id', $article_info['article_id'])
->where('type_name', 'manuscirpt')
->order('ctime desc')
->limit(1)
->select();
if (count($files) == 0) {
return jsonError('No Manuscript');
}
// $files = $this->article_file_obj
// ->where('article_id', $article_info['article_id'])
// ->where('type_name', 'manuscirpt')
// ->order('ctime desc')
// ->limit(1)
// ->select();
// if (count($files) == 0) {
// return jsonError('No Manuscript');
// }
$url = $this->ts_base_url . "api/typeset/webReaddoc";
$program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
$res = object_to_array(json_decode(myPost($url, $program)));
$file_runs = $res['data'];
// $url = $this->ts_base_url . "api/typeset/webReaddoc";
// $program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
// $res = object_to_array(json_decode(myPost($url, $program)));
// $file_runs = $res['data'];
// return jsonSuccess($file_runs);
//整理信息
$frag = [];
$aa = [];
$frag['title'] = $article_info['title'];
$start_refer = false;
foreach ($file_runs as $k => $v) {
if ($start_refer && $v != '') {
if (strlen($v) > 500) {
$start_refer = false;
$frag['main'][] = $v;
continue;
}
$frag['references'][] = $v;
continue;
}
$g_val = trim(preg_replace('/\<.*?\>/', '', $v));
$aa[] = $g_val;
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
$frag['keywords'] = $v;
continue;
}
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
$start_refer = true;
continue;
}
$frag['main'][] = $v;
}
// $frag = [];
// $aa = [];
// $frag['title'] = $article_info['title'];
// $start_refer = false;
// foreach ($file_runs as $k => $v) {
// if ($start_refer && $v != '') {
// if (strlen($v) > 500) {
// $start_refer = false;
// $frag['main'][] = $v;
// continue;
// }
// $frag['references'][] = $v;
// continue;
// }
// $g_val = trim(preg_replace('/\<.*?\>/', '', $v));
// $aa[] = $g_val;
//
// if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
// $frag['keywords'] = $v;
// continue;
// }
// if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
// $start_refer = true;
// continue;
// }
// $frag['main'][] = $v;
// }
if (!isset($frag['main'])) {
return jsonError("manuscript file error!");
}
// if (!isset($frag['main'])) {
// return jsonError("manuscript file error!");
// }
$insert['main'] = isset($frag['main']) ? json_encode($frag['main']) : '';
$insert['main'] = '';//isset($frag['main']) ? json_encode($frag['main']) : '';
$insert['article_id'] = $data['article_id'];
$insert['journal_id'] = $article_info['journal_id'];
$insert['ctime'] = time();
@@ -108,13 +108,13 @@ class Production extends Base
//将主体内容写入数据库
foreach ($frag['main'] as $v) {
$ca['p_article_id'] = $p_article_id;
$ca['content'] = $v;
$ca['content_g'] = '';
$ca['ctime'] = time();
$this->production_article_main_obj->insert($ca);
}
// foreach ($frag['main'] as $v) {
// $ca['p_article_id'] = $p_article_id;
// $ca['content'] = $v;
// $ca['content_g'] = '';
// $ca['ctime'] = time();
// $this->production_article_main_obj->insert($ca);
// }
return jsonSuccess([]);
}
@@ -260,6 +260,7 @@ class Production extends Base
*/
public function getProductionMains()
{
// die("stop service!");
$data = $this->request->post();
$rule = new Validate([
"p_article_id" => "require"
@@ -268,10 +269,12 @@ class Production extends Base
return jsonError($rule->getError());
}
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
$frag = $this->getProductionMainImgs($data['p_article_id']);
if (count($frag) == 0) {
return jsonError("create error");
}
$frag = getArticleMains($p_info['article_id']);
// $frag = $this->getProductionMainImgs($data['p_article_id']);
// if (count($frag) == 0) {
// return jsonError("create error");
// }
$re['mains'] = $frag;
$re['production'] = $p_info;
return jsonSuccess($re);
@@ -282,30 +285,31 @@ class Production extends Base
*/
public function getProductionMainsByDoi()
{
$data = $this->request->post();
$rule = new Validate([
'doi' => 'require'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$a = explode('/', $data['doi']);
$pro_info = $this->production_article_obj->where('doi', $a[1])->where('state', 2)->find();
if (!$pro_info) {
return jsonError("production error");
}
if (isset($data['file']) && $data['file'] != "") {
$frag = $this->getProductionMainImgsByNew($pro_info['p_article_id'], $data['file']);
} else {
$frag = $this->getProductionMainImgs($pro_info['p_article_id']);
}
if (count($frag) == 0) {
return jsonError("create error");
}
$re['mains'] = $frag;
$re['production'] = $pro_info;
return jsonSuccess($re);
die("stop service");
// $data = $this->request->post();
// $rule = new Validate([
// 'doi' => 'require'
// ]);
// if (!$rule->check($data)) {
// return jsonError($rule->getError());
// }
// $a = explode('/', $data['doi']);
// $pro_info = $this->production_article_obj->where('doi', $a[1])->where('state', 2)->find();
// if (!$pro_info) {
// return jsonError("production error");
// }
//
// if (isset($data['file']) && $data['file'] != "") {
// $frag = $this->getProductionMainImgsByNew($pro_info['p_article_id'], $data['file']);
// } else {
// $frag = $this->getProductionMainImgs($pro_info['p_article_id']);
// }
// if (count($frag) == 0) {
// return jsonError("create error");
// }
// $re['mains'] = $frag;
// $re['production'] = $pro_info;
// return jsonSuccess($re);
}
@@ -314,117 +318,117 @@ class Production extends Base
* @return void
*
*/
public function delProductionMain()
{
$data = $this->request->post();
$rule = new Validate([
'p_main_id' => 'require'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update(['state' => 1]);
return jsonSuccess([]);
}
// public function delProductionMain()
// {
// $data = $this->request->post();
// $rule = new Validate([
// 'p_main_id' => 'require'
// ]);
// if (!$rule->check($data)) {
// return jsonError($rule->getError());
// }
// $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update(['state' => 1]);
// return jsonSuccess([]);
// }
/**添加主体文章图片
* @return void
*/
public function addProductionMainImg()
{
$data = $this->request->post();
$rule = new Validate([
'p_article_id' => 'require',
"pre_type" => "require",
"body" => "require",
"content" => "require",
"width" => "require",
"note" => "require"
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$insert['p_article_id'] = $data['p_article_id'];
if ($data['pre_type'] == "main") {
$insert['p_main_id'] = $data['body'];
} else {
$insert['pre_id'] = $data['body'];
}
$insert['content'] = $data['content'];
$insert['width'] = $data['width'];
$insert['title'] = $data['title'];
$insert['note'] = $data['note'];
$this->production_article_main_img_obj->insert($insert);
return jsonSuccess([]);
}
// public function addProductionMainImg()
// {
// $data = $this->request->post();
// $rule = new Validate([
// 'p_article_id' => 'require',
// "pre_type" => "require",
// "body" => "require",
// "content" => "require",
// "width" => "require",
// "note" => "require"
// ]);
// if (!$rule->check($data)) {
// return jsonError($rule->getError());
// }
// $insert['p_article_id'] = $data['p_article_id'];
// if ($data['pre_type'] == "main") {
// $insert['p_main_id'] = $data['body'];
// } else {
// $insert['pre_id'] = $data['body'];
// }
// $insert['content'] = $data['content'];
// $insert['width'] = $data['width'];
// $insert['title'] = $data['title'];
// $insert['note'] = $data['note'];
// $this->production_article_main_img_obj->insert($insert);
// return jsonSuccess([]);
// }
/**删除mainimg
* @return void
*/
public function delProductionMainImg()
{
$data = $this->request->post();
$rule = new Validate([
'p_main_img_id' => 'require'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$p_img_info = $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->find();
$next_info = $this->production_article_main_img_obj->where('pre_id', $p_img_info['p_main_img_id'])->find();
if ($next_info) {
if ($p_img_info['p_main_id'] == 0) {
$this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['pre_id' => $p_img_info['pre_id']]);
} else {
$this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['p_main_id' => $p_img_info['p_main_id']]);
}
}
$this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update(['state' => 1]);
return jsonSuccess([]);
}
// public function delProductionMainImg()
// {
// $data = $this->request->post();
// $rule = new Validate([
// 'p_main_img_id' => 'require'
// ]);
// if (!$rule->check($data)) {
// return jsonError($rule->getError());
// }
// $p_img_info = $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->find();
// $next_info = $this->production_article_main_img_obj->where('pre_id', $p_img_info['p_main_img_id'])->find();
// if ($next_info) {
// if ($p_img_info['p_main_id'] == 0) {
// $this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['pre_id' => $p_img_info['pre_id']]);
// } else {
// $this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['p_main_id' => $p_img_info['p_main_id']]);
// }
// }
// $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update(['state' => 1]);
// return jsonSuccess([]);
// }
/**编辑mainimg
* @return void
*/
public function editProductionMainImg()
{
$data = $this->request->post();
$rule = new Validate([
'p_main_img_id' => 'require',
"width" => "require",
"content" => "require",
"note" => "require"
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$update['width'] = $data['width'];
$update['content'] = $data['content'];
$update['title'] = $data['title'];
$update['note'] = $data['note'];
$this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update($update);
return jsonSuccess([]);
}
// public function editProductionMainImg()
// {
// $data = $this->request->post();
// $rule = new Validate([
// 'p_main_img_id' => 'require',
// "width" => "require",
// "content" => "require",
// "note" => "require"
// ]);
// if (!$rule->check($data)) {
// return jsonError($rule->getError());
// }
// $update['width'] = $data['width'];
// $update['content'] = $data['content'];
// $update['title'] = $data['title'];
// $update['note'] = $data['note'];
// $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update($update);
// return jsonSuccess([]);
// }
/**
* 编辑main内容
* @return \think\response\Json|void
*
*/
public function editProductionMain()
{
$data = $this->request->post();
$rule = new Validate([
'p_main_id' => 'require',
'content' => 'require'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$update['content'] = trim($data['content']);
$this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update($update);
return jsonSuccess([]);
}
// public function editProductionMain()
// {
// $data = $this->request->post();
// $rule = new Validate([
// 'p_main_id' => 'require',
// 'content' => 'require'
// ]);
// if (!$rule->check($data)) {
// return jsonError($rule->getError());
// }
// $update['content'] = trim($data['content']);
// $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update($update);
// return jsonSuccess([]);
// }
public function pushMainToWeb()
@@ -451,24 +455,24 @@ class Production extends Base
* @return void
*
*/
public function mainGptcheck()
{
$data = $this->request->post();
$rule = new Validate([
'p_main_id' => 'require'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$main_info = $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->find();
if (mb_strlen($main_info['content']) < 20) {
return trim($main_info['content']);
}
$res = object_to_array(json_decode(pushGpt('请将以下内容按照医学期刊的标准校对,不要改变原意,主要是对格式和拼写的校对,将<b></b><i></i>这四个标签保留,将校对好的内容返回 ' . trim($main_info['content']))));
$r = $res['choices'][0]['message']['content'];
$re['content'] = $r;
return jsonSuccess($re);
}
// public function mainGptcheck()
// {
// $data = $this->request->post();
// $rule = new Validate([
// 'p_main_id' => 'require'
// ]);
// if (!$rule->check($data)) {
// return jsonError($rule->getError());
// }
// $main_info = $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->find();
// if (mb_strlen($main_info['content']) < 20) {
// return trim($main_info['content']);
// }
// $res = object_to_array(json_decode(pushGpt('请将以下内容按照医学期刊的标准校对,不要改变原意,主要是对格式和拼写的校对,将<b></b><i></i>这四个标签保留,将校对好的内容返回 ' . trim($main_info['content']))));
// $r = $res['choices'][0]['message']['content'];
// $re['content'] = $r;
// return jsonSuccess($re);
// }
public function getPublicMains()
{
@@ -628,6 +632,11 @@ class Production extends Base
} else {
$list[$k]['is_repeat'] = 0;
}
if(strpos($v['refer_content'],'retraction')!==false||strpos($v['refer_content'],'retracted')!==false){
$list[$k]['retract'] = 1;
}else{
$list[$k]['retract'] = 0;
}
}
$re['refers'] = $list;
$re['repeat'] = empty($aRepeat) ? [] : $aRepeat;
@@ -813,6 +822,7 @@ class Production extends Base
$pra['authors'] = json_encode($authors);
$pra['organs'] = json_encode($organs);
$res = object_to_array(json_decode(myPost($url, $pra)));
if ($res['code'] == 0) {
$r_update['state'] = 2;
$r_update['w_article_id'] = isset($res['data']['article_id']) ? $res['data']['article_id'] : 0;
@@ -1835,26 +1845,26 @@ class Production extends Base
/**
* gpt校对main内容
*/
public function freshMain()
{
$data = $this->request->post();
$rule = new Validate([
'p_article_id' => 'require'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$list = $this->production_article_main_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
foreach ($list as $v) {
if ($v['content'] == '' || strlen($v['content']) < 60) {
$this->production_article_main_obj->where('p_main_id', $v['p_main_id'])->update(['content_g' => $v['content']]);
} else {
Queue::push('app\api\job\gpt@fresh', $v, 'gpt');
}
}
return jsonSuccess([]);
}
// public function freshMain()
// {
// $data = $this->request->post();
// $rule = new Validate([
// 'p_article_id' => 'require'
// ]);
// if (!$rule->check($data)) {
// return jsonError($rule->getError());
// }
// $list = $this->production_article_main_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
// foreach ($list as $v) {
// if ($v['content'] == '' || strlen($v['content']) < 60) {
// $this->production_article_main_obj->where('p_main_id', $v['p_main_id'])->update(['content_g' => $v['content']]);
// } else {
// Queue::push('app\api\job\gpt@fresh', $v, 'gpt');
// }
// }
//
// return jsonSuccess([]);
// }
@@ -2238,9 +2248,15 @@ class Production extends Base
return jsonError($rule->getError());
}
$info = $this->article_main_obj->where("am_id",$data['id'])->find();
if(isset($data["code"])){
$content = $data['code'];
}else{
$content = $info['content'];
}
$production_info = $this->production_article_obj->where("article_id",$info['article_id'])->find();
$refers = $this->production_article_refer_obj->where("p_article_id",$production_info['p_article_id'])->where('state',0)->order("index")->select();
$res = $this->convertToLatex($info['content'],$refers);
$res = $this->convertToLatex($content,$refers);
echo $res;
// return jsonSuccess([$res]);
}
@@ -2254,9 +2270,9 @@ class Production extends Base
return '';
}
//单行处理公式内容
$pattern = '/^<wmath\s+data-latex="([^"]*)">.*<\/wmath>$/';
$pattern = '/^<wmath[^>]*?\s+data-latex="([^"]*)"[^>]*?>.*?<\/wmath>$/';
if(preg_match($pattern, $content) === 1){
$pattern1 = '/<wmath\s+data-latex="([^"]*)">/';
$pattern1 = '/<wmath[^>]*?\s+data-latex="([^"]*)">/';
if (preg_match($pattern1, $content, $matches)) {
$latexContent = $matches[1];
// 将 $$ 转换为 $因为equation环境不需要$$
@@ -3651,7 +3667,14 @@ class Production extends Base
// 方法1: 使用pdflatex命令推荐
// $command = "{$sLatexDir}pdflatex -include-directory=" . dirname($texFilePath) .
// " -output-directory=" . $pdfDir . " " . escapeshellarg($texFilePath);
$command = "pdflatex -output-directory=" . $pdfDir . " " . escapeshellarg($texFilePath);
// $command = "pdflatex -output-directory=" . $pdfDir . " " . escapeshellarg($texFilePath);
$sLatexDir = '/usr/bin/';//latex执行目录
$command = sprintf(
'%slualatex -interaction=nonstopmode -output-directory=%s %s 2>&1',
rtrim($sLatexDir, '/') . '/', // /usr/bin/lualatex
escapeshellarg($pdfDir), // 转义输出目录(含空格/特殊字符)
escapeshellarg($texFilePath) // 转义tex文件路径
);
$output = [];
$returnVar = 0;
@@ -4322,10 +4345,8 @@ class Production extends Base
$queue = Queue::push('app\api\job\ArticleCreatePdf@fire', ['p_article_id' => $iPArticleId], 'ArticleCreatePdf');
//生成长表格PDF
$aLongTableId = empty($aResult['long_table_id']) ? [] : $aResult['long_table_id'];
var_dump($aLongTableId);
if(!empty($aLongTableId)){ //调用生成长表格队列
$longtablequeue = Queue::push('app\api\job\ArticleCreateLongTable@fire', ['p_article_id' => $iPArticleId,'long_table_id' => $aLongTableId], 'ArticleCreateLongTable');
var_dump($longtablequeue);
}
return json_encode(array('status' => 1,'msg' => 'tex file generated successfully'));
}
@@ -4436,4 +4457,54 @@ class Production extends Base
Db::commit();
return json_encode(array('status' => 1,'msg' => 'PDF generated successfully'));
}
/**
* 获取排版生成PDF历史版本
* @param p_article_id 文章ID
*/
public function getProductionArticlePdf($aParam = []){
//获取参数
$aParam = empty($aParam) ? $this->request->post() : $aParam;
//必填值验证
$iPArticleId = empty($aParam['p_article_id']) ? '' : $aParam['p_article_id'];
if(empty($iPArticleId)){
return json_encode(array('status' => 2,'msg' => 'Please select an article' ));
}
//查询文章
$aWhere = ['p_article_id' => $iPArticleId,'state' => ['in',[0,2]]];
$aProductionArticle = Db::name('production_article')->field('article_id,pdf_id')->where($aWhere)->find();
if(empty($aProductionArticle)){
return json_encode(array('status' => 3,'msg' => 'No articles found' ));
}
$iArticleId = empty($aProductionArticle['article_id']) ? 0 : $aProductionArticle['article_id'];
if(empty($iArticleId)){
return json_encode(array('status' => 4,'msg' => 'Unbound article' ));
}
//日志查询
$aWhere = ['article_id' => $iArticleId,'p_article_id' => $iPArticleId,'state' => 2];
$aPdf = Db::name('production_article_pdf')->field('pdf_id,url,create_time')->where($aWhere)->select();
return json_encode(array('status' => 1,'msg' => 'success','data' => $aPdf));
}
/**
* 获取生产文章信息
* @param p_article_id 文章ID
*/
public function getProductionArticle($aParam = []){
//获取参数
$aParam = empty($aParam) ? $this->request->post() : $aParam;
//必填值验证
$iPArticleId = empty($aParam['p_article_id']) ? '' : $aParam['p_article_id'];
if(empty($iPArticleId)){
return json_encode(array('status' => 2,'msg' => 'Please select an article' ));
}
//查询文章
$aWhere = ['p_article_id' => $iPArticleId,'state' => ['in',[0,2]]];
$aProductionArticle = Db::name('production_article')->field('pdf_id,file_sub_table')->where($aWhere)->find();
return json_encode(array('status' => 1,'msg' => 'success','data' => $aPdf));
}
}

View File

@@ -199,48 +199,48 @@ class Typeset extends Base
/**
* 推送文章到官网系统
*/
public function pushArticleToSystem(){
die('Service suspension!');
$data = $this->request->post();
$rule = new Validate([
'on_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$on_info = $this->online_obj->where('on_id',$data['on_id'])->find();
$ts_info = $this->ts_obj->where('article_id',$on_info['article_id'])->where('ts_state',0)->find();
$article_info = $this->article_obj->where('article_id',$on_info['article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$authors = $this->article_author_obj->where('article_id',$article_info['article_id'])->where('state',0)->select();
//check信息是否完整
if($on_info['journal_stage_id']==''||$on_info['on_doi']==''||$on_info['abstract']==''||$on_info['npp']==''){
return jsonError('信息不全!');
}
//发送推送请求
// $url = "http://www.journal.com/master/Article/addArticleForSubmission";
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/addArticleForSubmission';
$pra = [];
$pra['title'] = $ts_info['ts_title'];
$pra['journal_stage_id'] = $on_info['journal_stage_id'];
$pra['issn'] = $journal_info['issn'];
$pra['type'] = translateType($article_info['type']);
$pra['doi'] = $on_info['on_doi'];
$pra['abstract'] = $on_info['abstract'];
$pra['pub_date'] = $ts_info['online_date'];
$pra['file_pdf'] = $article_info['pdf_url'];
$pra['keywords'] = $ts_info['keywords'];
$pra['npp'] = $on_info['npp'];
$pra['authors'] = json_encode($authors);
$res = object_to_array(json_decode(myPost($url, $pra)));
if($res['code']==0){
$this->online_obj->where('on_id',$data['on_id'])->update(['has_push'=>1]);
return jsonSuccess([]);
}else{
return jsonError('system error:'.$res['msg']);
}
}
// public function pushArticleToSystem(){
// die('Service suspension!');
// $data = $this->request->post();
// $rule = new Validate([
// 'on_id'=>'require'
// ]);
// if(!$rule->check($data)){
// return jsonError($rule->getError());
// }
// $on_info = $this->online_obj->where('on_id',$data['on_id'])->find();
// $ts_info = $this->ts_obj->where('article_id',$on_info['article_id'])->where('ts_state',0)->find();
// $article_info = $this->article_obj->where('article_id',$on_info['article_id'])->find();
// $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
// $authors = $this->article_author_obj->where('article_id',$article_info['article_id'])->where('state',0)->select();
// //check信息是否完整
// if($on_info['journal_stage_id']==''||$on_info['on_doi']==''||$on_info['abstract']==''||$on_info['npp']==''){
// return jsonError('信息不全!');
// }
// //发送推送请求
// // $url = "http://www.journal.com/master/Article/addArticleForSubmission";
// $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/addArticleForSubmission';
// $pra = [];
// $pra['title'] = $ts_info['ts_title'];
// $pra['journal_stage_id'] = $on_info['journal_stage_id'];
// $pra['issn'] = $journal_info['issn'];
// $pra['type'] = translateType($article_info['type']);
// $pra['doi'] = $on_info['on_doi'];
// $pra['abstract'] = $on_info['abstract'];
// $pra['pub_date'] = $ts_info['online_date'];
// $pra['file_pdf'] = $article_info['pdf_url'];
// $pra['keywords'] = $ts_info['keywords'];
// $pra['npp'] = $on_info['npp'];
// $pra['authors'] = json_encode($authors);
//
// $res = object_to_array(json_decode(myPost($url, $pra)));
// if($res['code']==0){
// $this->online_obj->where('on_id',$data['on_id'])->update(['has_push'=>1]);
// return jsonSuccess([]);
// }else{
// return jsonError('system error:'.$res['msg']);
// }
// }
/**
* 编辑online信息

View File

@@ -53,11 +53,9 @@ class ArticleCreateLongTable
if (!$this->oQueueJob->acquireLock($sRedisKey, $sRedisValue, $job)) {
return; // 未获取到锁,已处理
}
var_dump($aLongTableId);
//生成内容
$oProduction = new \app\api\controller\Production;
$response = $oProduction->longTablePdfCreate($aLongTableId);
var_dump($response);
// 验证API响应
if (empty($response)) {
throw new \RuntimeException("返回空结果");

View File

@@ -105,6 +105,7 @@ page={{stage_page}},%号
}
}
//子刊信息
$aJournalStage = [];
$iJournalStageId = empty($aProductionArticle['journal_stage_id']) ? 0 : $aProductionArticle['journal_stage_id'];
if(!empty($iJournalStageId)){
$aJournalStage = $this->getJournalStage(['journal_stage_id' => $iJournalStageId]);
@@ -195,21 +196,23 @@ page={{stage_page}},%号
//文章图片地址
$sIcon = empty($aProductionArticle['icon']) ? '' : $aProductionArticle['icon'];
if(!empty($sIcon)){
// $sIconUrl = rtrim(ROOT_PATH).$this->sArticleIcon.'/'.$sIcon;
// if(file_exists($sIconUrl)){
// $sIcon = '\KeywordImage{'.$sIconUrl.'}';
// }else{
// $sIcon = '';
// }
//下载图片
$sImagePath = trim($this->sSubmissionUrl,'/').$this->sArticleIcon.'/'.$sIcon;
$aImageInfo = $this->getImage($sImagePath,$aProductionArticle['article_id']);
if(!empty($aImageInfo['data'])){
$aImageInfo['data'] = './image/'.basename($aImageInfo['data']);
$sIcon = '\KeywordImage{'.$aImageInfo['data'].'}';
$sIconUrl = ROOT_PATH.trim($this->sArticleIcon,'/').'/'.$sIcon;
if(file_exists($sIconUrl)){
$sIconUrl = str_replace(ROOT_PATH.'public/', '', $sIconUrl);
$sIconUrl = '../../'.$sIconUrl;
$sIcon = '\KeywordImage{'.$sIconUrl.'}';
}else{
$sIcon = '';
}
// //下载图片
// $sImagePath = trim($this->sSubmissionUrl,'/').$this->sArticleIcon.'/'.$sIcon;
// $aImageInfo = $this->getImage($sImagePath,$aProductionArticle['article_id']);
// if(!empty($aImageInfo['data'])){
// $aImageInfo['data'] = './image/'.basename($aImageInfo['data']);
// $sIcon = '\KeywordImage{'.$aImageInfo['data'].'}';
// }else{
// $sIcon = '';
// }
}
$aSearch['{{article_icon}}'] = $sIcon;
$aSearch['{{keywords}}'] = $sKeywords;
@@ -255,6 +258,7 @@ 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)){
//查询图片
@@ -305,7 +309,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>(.*?)<\/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']];
@@ -313,21 +323,20 @@ page={{stage_page}},%号
continue;
}
// $sIconUrl = rtrim(ROOT_PATH).$this->sArticleIcon.'/'.$sIcon;
// if(file_exists($sIconUrl)){
// $sIcon = '\KeywordImage{'.$sIconUrl.'}';
// }else{
// $sIcon = '';
// }
//下载图片
$sImagePath = trim($this->sSubmissionUrl,'/').$this->sArticleMainImage.'/'.$aImageInfo['url'];
$aResult = $this->getImage($sImagePath,$aProductionArticle['p_article_id']);
if(empty($aResult['data'])){
$sMainImageUrl = ROOT_PATH.trim($this->sArticleMainImage,'/').'/'.$aImageInfo['url'];
if(!file_exists($sMainImageUrl)){
continue;
}
// //下载图片
// $sImagePath = trim($this->sSubmissionUrl,'/').$this->sArticleMainImage.'/'.$aImageInfo['url'];
// $aResult = $this->getImage($sImagePath,$aProductionArticle['article_id']);
// if(empty($aResult['data'])){
// continue;
// }
// $aImageSearch = ['{{img_url}}' => $aResult['data'],'{{img_title}}' => $aImageInfo['note'],'{{img_fig_sim}}' => 'img_fig_sim_'.$value['ami_id']];
// $sImageTempalteInfo = str_replace(array_keys($aImageSearch), array_values($aImageSearch), $sImageTempalte);
$aImageInfo['image_url'] = $aResult['data'];
// $aImageInfo['image_url'] = $aResult['data'];
$aImageInfo['image_url'] = $sMainImageUrl;
$aDealImage = $this->dealImage($aImageInfo);
if(empty($aDealImage['data'])){
continue;
@@ -353,7 +362,6 @@ page={{stage_page}},%号
}
}
}
$aSearch['{{article_main}}'] = empty($sMain) ? '' : $sMain."\n";
//模版内容替换
$sTemplateInfo = str_replace(array_keys($aSearch), array_values($aSearch), $sTemplateInfo);
@@ -641,7 +649,8 @@ page={{stage_page}},%号
$isWideImage = $imageWidth > $wideImageThreshold;
// 生成LaTeX图片代码
$sImageUrl = './image/'.basename($sImageUrl);
$sImageUrl = str_replace(ROOT_PATH.'public/', '', $sImageUrl);
$sImageUrl = '../../'.$sImageUrl;
if ($isWideImage) {
$latexLines[] = "\\begin{figure*}[htbp]"; // 使用figure*环境实现两栏
$latexLines[] = " \\centering";