diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index 6206c67..28a7be9 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -2808,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]); + } }