505 lines
28 KiB
PHP
505 lines
28 KiB
PHP
<?php
|
||
|
||
namespace app\api\controller;
|
||
|
||
use think\Controller;
|
||
use think\Db;
|
||
use think\Queue;
|
||
|
||
/**
|
||
* Description of Auto
|
||
*
|
||
* @author jgll2
|
||
*/
|
||
class Auto extends Controller {
|
||
|
||
//put your code here
|
||
protected $article_obj = '';
|
||
protected $article_reviewer_obj = '';
|
||
protected $user_obj = '';
|
||
protected $rev_to_jour_obj = '';
|
||
protected $reviewer_obj = '';
|
||
protected $journal_obj = '';
|
||
protected $login_auto_obj = '';
|
||
protected $article_msg_obj = '';
|
||
protected $user_log_obj = '';
|
||
protected $reviewer_info_obj = '';
|
||
|
||
public function __construct(\think\Request $request = null) {
|
||
parent::__construct($request);
|
||
$this->article_obj = Db::name('article');
|
||
$this->article_reviewer_obj = Db::name('article_reviewer');
|
||
$this->user_obj = Db::name('user');
|
||
$this->login_auto_obj = Db::name('login_auto');
|
||
$this->rev_to_jour_obj = Db::name('reviewer_to_journal');
|
||
$this->journal_obj = Db::name('journal');
|
||
$this->reviewer_obj = Db::name('article_reviewer');
|
||
$this->article_msg_obj = Db::name('article_msg');
|
||
$this->user_log_obj = Db::name('user_log');
|
||
$this->reviewer_info_obj = Db::name('user_reviewer_info');
|
||
}
|
||
|
||
public function testEmail() {
|
||
$journal_info = $this->journal_obj->where('journal_id', 4)->find();
|
||
$maidata['email'] = "751475802@qq.com";
|
||
$maidata['title'] = "test email";
|
||
$maidata['content'] = "test content";
|
||
$maidata['tmail'] = $journal_info['email'];
|
||
$maidata['tpassword'] = $journal_info['epassword'];
|
||
// Queue::push('app\api\job\mail@fire', $maidata, "tmail");
|
||
sendEmail($maidata['email'], $journal_info['title'], $journal_info['title'], $maidata['title'], $journal_info['email'], $journal_info['epassword']);
|
||
}
|
||
|
||
public function resetReviewerPassword() {
|
||
$list = $this->user_obj
|
||
->field("t_user.*")
|
||
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", "left")
|
||
->where("t_user_reviewer_info.reviewer_info_id", ">", 0)
|
||
->where("t_user.password", "e9f5c5240c0bb39488e6dbfbdb1517e0")
|
||
->where("t_user.state", 0)
|
||
->select();
|
||
echo '<pre>';
|
||
var_dump($list);
|
||
echo '</pre>';
|
||
die;
|
||
}
|
||
|
||
/**
|
||
* 推送邮件给审稿人提醒审稿人
|
||
*/
|
||
public function pushEmailForReviewer() {
|
||
//筛选数据
|
||
$list = $this->article_reviewer_obj->where("state", "in", [0, 5])->select();
|
||
foreach ($list as $v) {
|
||
$cache_article = $this->article_obj->where("article_id", $v['article_id'])->find();
|
||
if ($cache_article["state"] != 2) {
|
||
continue;
|
||
}
|
||
$cache_t = intval((time() - $v["ctime"]) / 86400);
|
||
if ($cache_t == 14 || $cache_t == 21 || $cache_t == 28) {
|
||
$cache_journal = $this->journal_obj->where("journal_id", $cache_article['journal_id'])->find();
|
||
//查找审稿人信息
|
||
$cache_reviewer = $this->user_obj
|
||
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", "left")
|
||
->where("t_user.user_id", $v['reviewer_id'])->find();
|
||
|
||
$tt = "Manuscript ID: " . $cache_article['accept_sn'] . "<br>";
|
||
$tt .= "Title:" . $cache_article['title'] . "<br>";
|
||
$tt .= "Dear Dr. " . ($cache_reviewer["realname"] == "" ? $cache_reviewer["account"] : $cache_reviewer["realname"]) . "<br><br>";
|
||
$tt .= "On " . date("d D Y", $v["ctime"]) . " we sent you a request to review a paper title " . $cache_article['title'] . ".<br><br>";
|
||
$tt .= "We have not yet received a response from you, possibly because the original invitation went astray. We would be grateful if you could let us know if you can carry out this review.<br><br>";
|
||
$tt .= '<a href="' . $this->creatLoginUrlForreviewer($cache_reviewer, $v['art_rev_id']) . '">Click here to review the article</a><br>';
|
||
$tt .= '<a href="' . $this->creatRejectUrlForReviewer($cache_reviewer, $v['art_rev_id']) . '">Click on the link to reject the review of this manuscript</a><br>';
|
||
$tt .= 'Your username:'.$cache_reviewer['account'].'<br><br>';
|
||
$tt .= 'Your original password:123456qwe, if you have reset the password, please login with the new one or click the "<a href="https://submission.tmrjournals.com/retrieve">forgot password</a>".<br>';
|
||
|
||
$tt .= 'Sincerely,<br>Editorial Office<br>' . $cache_journal['title'] . '<br>';
|
||
$tt .= 'Email: ' . $cache_journal['email'] . '<br>';
|
||
$tt .= 'Website:<a href="' . $cache_journal['website'] . '">' . $cache_journal['website'] . '</a>';
|
||
|
||
$maidata['email'] = $cache_reviewer['email'];
|
||
$maidata['title'] = "Invitation to review manuscript for " . $cache_journal['title'] . " - Reminder";
|
||
$maidata['content'] = $tt;
|
||
$maidata['tmail'] = $cache_journal['email'];
|
||
$maidata['tpassword'] = $cache_journal['epassword'];
|
||
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
|
||
|
||
// $sendUser=[
|
||
// 'title'=>"Invitation to review manuscript for " . $cache_journal['title'] . " - Reminder", // 邮件标题
|
||
// 'content'=>$tt,//邮件内容
|
||
// 'user_id'=>$v['reviewer_id'], //收件人ID
|
||
// 'email'=>$cache_reviewer['email'],// 收件人邮箱
|
||
// 'journal_id'=>$cache_journal['journal_id'], // 期刊ID
|
||
// 'sendEmail'=>$cache_journal['email'], // 期刊邮箱
|
||
// 'sendPassword'=>$cache_journal['epassword'], // 期刊密码
|
||
// 'from_name'=>"Invitation to review manuscript for " . $cache_journal['title'] . " - Reminder"
|
||
// ];
|
||
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
|
||
}
|
||
}
|
||
}
|
||
|
||
public function pushTestEmail() {
|
||
$cache_reviewer = $this->user_obj->where('user_id', 54)->find();
|
||
$cache_journal = $this->journal_obj->where('journal_id', 1)->find();
|
||
$cache_article = $this->article_obj->where("article_id", 1700)->find();
|
||
$tt = "Manuscript ID: " . $cache_article['accept_sn'] . "<br>";
|
||
$tt .= "Title:" . $cache_article['title'] . "<br>";
|
||
$tt .= "Dear Dr. " . ($cache_reviewer["realname"] == "" ? $cache_reviewer["account"] : $cache_reviewer["realname"]) . "<br><br>";
|
||
$tt .= "We have not yet received a response from you, possibly because the original invitation went astray. We would be grateful if you could let us know if you can carry out this review.<br><br>";
|
||
$tt .= '<a href="' . $this->creatLoginUrlForreviewer($cache_reviewer, $cache_article['art_rev_id']) . '">Click here to review the article</a><br>';
|
||
$tt .= '<a href="' . $this->creatRejectUrlForReviewer($cache_reviewer, $cache_article['art_rev_id']) . '">Click on the link to reject the review of this manuscript</a><br>';
|
||
$tt .= 'Sincerely,<br>Editorial Office<br>' . $cache_journal['title'] . '<br>';
|
||
$tt .= 'Email: ' . $cache_journal['email'] . '<br>';
|
||
$tt .= 'Website:<a href="' . $cache_journal['website'] . '">' . $cache_journal['website'] . '</a>';
|
||
|
||
$maidata['email'] = $cache_reviewer['email'];
|
||
$maidata['title'] = "Invitation to review manuscript for " . $cache_journal['title'] . " - Reminder";
|
||
$maidata['content'] = $tt;
|
||
$maidata['tmail'] = $cache_journal['email'];
|
||
$maidata['tpassword'] = $cache_journal['epassword'];
|
||
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
|
||
}
|
||
|
||
private function creatLoginUrlForreviewer($user, $article_id) {
|
||
$code = md5(time() . rand(1000, 9999) . 'thinkphp');
|
||
$insert['user_id'] = $user['user_id'];
|
||
$insert['code'] = $code;
|
||
$insert['ctime'] = time();
|
||
$this->login_auto_obj->insert($insert);
|
||
$url = 'https://submission.tmrjournals.com/per_text?Art_id=' . $article_id . '&act=' . $code;
|
||
return $url;
|
||
}
|
||
|
||
private function creatRejectUrlForReviewer($user, $article_id) {
|
||
$code = md5(time() . rand(1000, 9999) . 'thinkphp');
|
||
$insert['user_id'] = $user['user_id'];
|
||
$insert['code'] = $code;
|
||
$insert['ctime'] = time();
|
||
$this->login_auto_obj->insert($insert);
|
||
$url = 'https://submission.tmrjournals.com/per_text_fail?Art_id=' . $article_id . '&act=' . $code;
|
||
return $url;
|
||
}
|
||
|
||
/**
|
||
* 推送邮件提醒作者修回稿件
|
||
*/
|
||
public function pushEmailForAuthor() {
|
||
//筛选数据
|
||
$list = $this->article_obj->where("state", 4)->select();
|
||
foreach ($list as $v) {
|
||
$cache_t = intval((time() - $v["ttime"]) / 86400);
|
||
if ($v['type'] == 'A') {
|
||
if ($cache_t == 28 || $cache_t == 42 || $cache_t == 56) {
|
||
//查找文章内容
|
||
$cache_journal = $this->journal_obj->where("journal_id", $v['journal_id'])->find();
|
||
//查找作者信息
|
||
$cache_author = $this->user_obj->where("user_id", $v['user_id'])->find();
|
||
|
||
$tt = "Dear Dr. " . ($cache_author["realname"] == "" ? $cache_author["account"] : $cache_author["realname"]) . ",<br>";
|
||
$tt .= "We have send you the email about revision of your manuscript. According to our records you are almost reaching the deadline now. We look forward to receiving your revised article.<br><br>";
|
||
$tt .= "When preparing your revised manuscript, you are asked to carefully consider the reviewers' comments which are attached, and submit a revised versionand a list of responses to the comments before deadline. The revised parts in the manuscript should be highlighted with blue color.<br><br>";
|
||
$tt .= "If you feel that you will require more time to complete your revision, please let me know and I will update our records accordingly. If I can provide any further advice or assistance, please do not hesitate to contact me.<br><br><br>";
|
||
$tt .= 'Sincerely,<br>Editorial Office<br>' . $cache_journal['title'] . '<br>';
|
||
$tt .= 'Email: ' . $cache_journal['email'] . '<br>';
|
||
$tt .= 'Website:<a href="' . $cache_journal['website'] . '">' . $cache_journal['website'] . '</a>';
|
||
|
||
$maidata['email'] = $cache_author['email'];
|
||
$maidata['title'] = "Revision Due Date-" . $cache_journal['title'];
|
||
$maidata['content'] = $tt;
|
||
$maidata['tmail'] = $cache_journal['email'];
|
||
$maidata['tpassword'] = $cache_journal['epassword'];
|
||
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
|
||
|
||
// $sendUser=[
|
||
// 'title'=>"Revision Due Date-" . $cache_journal['title'], // 邮件标题
|
||
// 'content'=>$tt,//邮件内容
|
||
// 'user_id'=>$cache_author['user_id'], //收件人ID
|
||
// 'email'=>$cache_author['email'],// 收件人邮箱
|
||
// 'journal_id'=>$cache_journal['journal_id'], // 期刊ID
|
||
// 'sendEmail'=>$cache_journal['email'], // 期刊邮箱
|
||
// 'sendPassword'=>$cache_journal['epassword'], // 期刊密码
|
||
// 'from_name'=>"Revision Due Date-" . $cache_journal['title']
|
||
// ];
|
||
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
|
||
|
||
|
||
}
|
||
} else {
|
||
if ($cache_t == 14 || $cache_t == 21 || $cache_t == 28) {
|
||
//查找文章内容
|
||
$cache_journal = $this->journal_obj->where("journal_id", $v['journal_id'])->find();
|
||
//查找作者信息
|
||
$cache_author = $this->user_obj->where("user_id", $v['user_id'])->find();
|
||
|
||
$tt = "Dear Dr. " . ($cache_author["realname"] == "" ? $cache_author["account"] : $cache_author["realname"]) . ",<br>";
|
||
$tt .= "We have send you the email about revision of your manuscript. According to our records you are almost reaching the deadline now. We look forward to receiving your revised article.<br><br>";
|
||
$tt .= "When preparing your revised manuscript, you are asked to carefully consider the reviewers' comments which are attached, and submit a revised versionand a list of responses to the comments before deadline. The revised parts in the manuscript should be highlighted with blue color.<br><br>";
|
||
$tt .= "If you feel that you will require more time to complete your revision, please let me know and I will update our records accordingly. If I can provide any further advice or assistance, please do not hesitate to contact me.<br><br><br>";
|
||
$tt .= 'Sincerely,<br>Editorial Office<br>' . $cache_journal['title'] . '<br>';
|
||
$tt .= 'Email: ' . $cache_journal['email'] . '<br>';
|
||
$tt .= 'Website:<a href="' . $cache_journal['website'] . '">' . $cache_journal['website'] . '</a>';
|
||
|
||
$maidata['email'] = $cache_author['email'];
|
||
$maidata['title'] = "Revision Due Date-" . $cache_journal['title'];
|
||
$maidata['content'] = $tt;
|
||
$maidata['tmail'] = $cache_journal['email'];
|
||
$maidata['tpassword'] = $cache_journal['epassword'];
|
||
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
|
||
|
||
// $sendUser=[
|
||
// 'title'=>"Revision Due Date-" . $cache_journal['title'], // 邮件标题
|
||
// 'content'=>$tt,//邮件内容
|
||
// 'user_id'=>$cache_author['user_id'], //收件人ID
|
||
// 'email'=>$cache_author['email'],// 收件人邮箱
|
||
// 'journal_id'=>$cache_journal['journal_id'], // 期刊ID
|
||
// 'sendEmail'=>$cache_journal['email'], // 期刊邮箱
|
||
// 'sendPassword'=>$cache_journal['epassword'], // 期刊密码
|
||
// 'from_name'=>"Revision Due Date-" . $cache_journal['title']
|
||
// ];
|
||
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 自动审稿主方法
|
||
*/
|
||
public function initAutoReview() {
|
||
//查找对应状态的article列表
|
||
$alist = $this->article_obj->where('state', 2)->select();
|
||
foreach ($alist as $v) {
|
||
Queue::push('app\api\job\review@fire', $v, "emailtest");
|
||
}
|
||
}
|
||
|
||
public function testrev() {
|
||
$a = $this->article_obj->where('article_id', 261)->find();
|
||
// $this->checkrev($a);
|
||
}
|
||
|
||
/**
|
||
* 处理过期审稿
|
||
*/
|
||
public function overdue_reviewer() {
|
||
die('Temporarily Out of Service');
|
||
$where['state'] = 0;
|
||
$where['ctime'] = ['lt', time() - 3600 * 24 * 14];
|
||
$revs = $this->article_reviewer_obj->where($where)->select();
|
||
foreach ($revs as $v) {
|
||
//审稿人失败次数+1
|
||
$this->user_obj->where('user_id', $v['reviewer_id'])->setInc('rd_num');
|
||
//此审稿案例超时
|
||
$this->article_reviewer_obj->where('art_rev_id', $v['art_rev_id'])->update(['state' => 4]);
|
||
}
|
||
}
|
||
|
||
public function testmail() {
|
||
$maidata['email'] = '751475802@qq.com';
|
||
$maidata['title'] = 'testdsdsasaddsasdaadsasd' . date('Ymd His', time());
|
||
$maidata['content'] = 'dsadsaas';
|
||
$maidata['tmail'] = 'tmrcancer@tmrjournals.com';
|
||
$maidata['tpassword'] = 'Wu999999tmrcance';
|
||
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
|
||
}
|
||
|
||
public function mytest() {
|
||
echo 'okokokook!!!!';
|
||
}
|
||
|
||
/**
|
||
* 审查文章审稿人状态,返回结果
|
||
*/
|
||
public function checkrev($data) {
|
||
die;
|
||
//查找审稿案例状态
|
||
$rev_list = $this->reviewer_obj->where('article_id', $data['article_id'])->where('state', '<>', 4)->select();
|
||
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
|
||
$user_info = $this->user_obj->where('user_id', $data['user_id'])->find();
|
||
$editor_info = $this->user_obj->where('user_id', $data['editor_id'])->find();
|
||
//分析审稿人状况
|
||
$all = count($rev_list);
|
||
$s_num = 0; //初始数量
|
||
$p_num = 0; //通过数量
|
||
$np_num = 0; //不通过数量
|
||
foreach ($rev_list as $v) {
|
||
if ($v['state'] == 0) {
|
||
$s_num++;
|
||
} else if ($v['state'] == 1 || $v['state'] == 3) {
|
||
$p_num++;
|
||
} else {
|
||
$np_num++;
|
||
}
|
||
}
|
||
//分情况执行
|
||
if ($all == 0) {
|
||
//分配两次审稿人
|
||
$this->add_reviewer($data);
|
||
$this->add_reviewer($data);
|
||
return true;
|
||
} elseif ($all == 1) {
|
||
//分配一次审稿人
|
||
$this->add_reviewer($data);
|
||
return true;
|
||
} elseif ($all == 2) {
|
||
if ($s_num > 0) {//不做任何处理
|
||
return true;
|
||
}
|
||
if ($p_num == 2) {//通过
|
||
//更新文章状态
|
||
$this->article_obj->where('article_id', $data['article_id'])->update(['state' => 4, 'editor_act' => 1]);
|
||
//添加文章msg信息
|
||
$insert_data['article_id'] = $data['article_id'];
|
||
$insert_data['content'] = 'Review completed';
|
||
$insert_data['state_from'] = $data['state'];
|
||
$insert_data['state_to'] = 4;
|
||
$insert_data['ctime'] = time();
|
||
$this->article_msg_obj->insert($insert_data);
|
||
//添加通知信息
|
||
add_usermsg($data['user_id'], 'Your manuscript has new process', '/articleDetail?id=' . $data['article_id']);
|
||
//发送邮件通知编辑
|
||
$tt = $data['accept_sn'] . '<br>';
|
||
$tt .= 'Dear Dr. ' . ($user_info['realname'] == '' ? $user_info['account'] : $user_info['realname']) . ',<br>';
|
||
$tt .= 'Thank you for submitting the manuscript to ' . $journal_info['title'] . '. <br>';
|
||
$tt .= 'Please find the new comments in the "<a href="http://submission.tmrjournals.com/submission?journal=' . $journal_info['alias'] . '">Author Center</a>", Please submit your revised manuscript within two weeks.<br><br>';
|
||
$tt .= 'If you need more time to revise, you can send E-mial to tell us.<br>';
|
||
$tt .= 'Sincerely,<br>Editorial Office<br>';
|
||
$tt .= $journal_info['title'] . '<br>';
|
||
$tt .= '<a href="https://www.tmrjournals.com/draw_up.html?issn=' . $journal_info['issn'] . '">Subscribe to this journal</a><br>';
|
||
$tt .= 'Email: ' . $journal_info['email'] . '<br>';
|
||
$tt .= 'Website: ' . $journal_info['website'];
|
||
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||
} elseif ($np_num == 2) {//不通过
|
||
//发送邮件通知编辑
|
||
$tt = 'Reviewers final opinions on the manuscript ID' . $data['accept_sn'] . ' are rejection. Please login and deal with the next step of this manuscript manually.';
|
||
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||
} else {//一样一个增加一个审稿案例
|
||
$this->add_reviewer($data);
|
||
return true;
|
||
}
|
||
} elseif ($all == 3) {
|
||
if ($s_num > 0) {//不做任何处理
|
||
return true;
|
||
}
|
||
if ($p_num == 2) {//通过
|
||
//更新文章状态
|
||
$this->article_obj->where('article_id', $data['article_id'])->update(['state' => 4, 'editor_act' => 1]);
|
||
//添加文章msg信息
|
||
$insert_data['article_id'] = $data['article_id'];
|
||
$insert_data['content'] = 'Review completed';
|
||
$insert_data['state_from'] = $data['state'];
|
||
$insert_data['state_to'] = 4;
|
||
$insert_data['ctime'] = time();
|
||
$this->article_msg_obj->insert($insert_data);
|
||
//添加通知信息
|
||
add_usermsg($data['user_id'], 'Your manuscript has new process', '/articleDetail?id=' . $data['article_id']);
|
||
//发送邮件通知编辑
|
||
$tt = $data['accept_sn'] . '<br>';
|
||
$tt .= 'Dear Dr. ' . ($user_info['realname'] == '' ? $user_info['account'] : $user_info['realname']) . ',<br>';
|
||
$tt .= 'Thank you for submitting the manuscript to ' . $journal_info['title'] . '. <br>';
|
||
$tt .= 'Please find the new comments in the "<a href="http://submission.tmrjournals.com/submission?journal=' . $journal_info['alias'] . '">Author Center</a>", Please submit your revised manuscript within two weeks.<br><br>';
|
||
$tt .= 'If you need more time to revise, you can send E-mial to tell us.<br>';
|
||
$tt .= 'Sincerely,<br>Editorial Office<br>';
|
||
$tt .= $journal_info['title'] . '<br>';
|
||
$tt .= '<a href="https://www.tmrjournals.com/draw_up.html?issn=' . $journal_info['issn'] . '">Subscribe to this journal</a><br>';
|
||
$tt .= 'Email: ' . $journal_info['email'] . '<br>';
|
||
$tt .= 'Website: ' . $journal_info['website'];
|
||
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||
} else {//不通过
|
||
//发送邮件通知编辑
|
||
$tt = 'Reviewers final opinions on the manuscript ID' . $data['accept_sn'] . ' are rejection. Please login and deal with the next step of this manuscript manually.';
|
||
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 增加一个审稿人
|
||
*/
|
||
public function add_reviewer($article) {
|
||
$journal_info = $this->journal_obj->where('journal_id', $article['journal_id'])->find();
|
||
$editor_info = $this->user_obj->where('user_id', $article['editor_id'])->find();
|
||
//根据文章筛选候选人
|
||
$reviewer = $this->chose_reviewer($article);
|
||
|
||
$sendUser=[
|
||
'title'=> $journal_info['title'], // 邮件标题
|
||
'journal_id'=>$article['journal_id'], // 期刊ID
|
||
'sendEmail'=>$journal_info['email'], // 期刊邮箱
|
||
'sendPassword'=>$journal_info['epassword'], // 期刊密码
|
||
'from_name'=>$journal_info['title']
|
||
];
|
||
|
||
if ($reviewer == null) {//没有查询到审稿人,执行提醒操作
|
||
//发送邮件到编辑,提醒需要手动添加审稿案例
|
||
$tt = 'Dear editor,<br>';
|
||
$tt .= 'There are no enough research area related reviewers in the reviewer list for manuscript ID ' . $article['accept_sn'] . ', please add reviewers for your journal or manual deal with this problem.<br><br>';
|
||
$tt .= 'TMR Publishing Group';
|
||
|
||
$sendUser['user_id'] = $editor_info['editor_id'];
|
||
$sendUser['email'] = $editor_info['email'];
|
||
$sendUser['content'] = $tt;
|
||
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
|
||
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||
} else {//查询到审稿人,执行添加操作
|
||
//将审稿时间定义至现在
|
||
$this->user_obj->where('user_id', $reviewer['user_id'])->update(['rtime' => time()]);
|
||
|
||
$article_info = $article;
|
||
$reviewer_info = $reviewer;
|
||
|
||
//增加信息到文章审稿表
|
||
$insert_data['reviewer_id'] = $reviewer['user_id'];
|
||
$insert_data['article_id'] = $article_info['article_id'];
|
||
$insert_data['editor_act'] = 1;
|
||
$insert_data['ctime'] = time();
|
||
$res = $this->article_reviewer_obj->insertGetId($insert_data);
|
||
|
||
//修改文章状态->审稿中
|
||
$this->article_obj->where('article_id', $article_info['article_id'])->update(['state' => 2]);
|
||
|
||
//添加article_msg信息
|
||
$insmsg_data['article_id'] = $article_info['article_id'];
|
||
$insmsg_data['content'] = '';
|
||
$insmsg_data['state_from'] = $article_info['state'];
|
||
$insmsg_data['state_to'] = 2;
|
||
$insmsg_data['ctime'] = time();
|
||
$this->article_msg_obj->insert($insmsg_data);
|
||
|
||
//发送email提醒审稿员
|
||
$tt = $article_info['accept_sn'] . '<br>';
|
||
$tt .= 'Dear Dr. ' . ($reviewer_info['realname'] == '' ? $reviewer_info['account'] : $reviewer_info['realname']) . '<br><br>';
|
||
$tt .= 'The manuscript entitled “' . $article_info['title'] . '” has'
|
||
. ' been submitted to the journal ' . $journal_info['title'] . '. The Editor-in-Chief would'
|
||
. ' be most grateful if you could offer an opinion regarding its suitability for publication'
|
||
. ' in the journal ' . $journal_info['title'] . '. <br>';
|
||
$tt .= 'Please bring into our knowledge if there is any potential Conflict of Interest. If you agree to review this manuscript, we ask you to complete your review and submit it by submission system within 10 days of receipt of the manuscript.<br><br>';
|
||
$tt .= 'Thank you for your consideration.<br> Look forward for your reply.<br>';
|
||
$tt .= '<a href="http://submission.tmrjournals.com/submission?journal=' . $journal_info['alias'] . '">Reviewer Center</a><br>';
|
||
$tt .= 'Your username:' . $reviewer_info['account'] . '<br><br>';
|
||
$tt .= 'Sincerely,<br>Editorial Office<br>';
|
||
$tt .= $journal_info['title'] . '<br>';
|
||
$tt .= 'Email:' . $journal_info['email'] . '<br>';
|
||
$tt .= 'Website:' . $journal_info['website'];
|
||
|
||
$sendUser['user_id'] = $reviewer_info['editor_id'];
|
||
$sendUser['email'] = $reviewer_info['email'];
|
||
$sendUser['content'] = $tt;
|
||
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
|
||
|
||
sendEmail($reviewer_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||
|
||
//记录userlog
|
||
$log_data['user_id'] = $article_info['editor_id'];
|
||
$log_data['type'] = 2;
|
||
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),添加了一个文章审稿实例:(" . $article_info['title'] . "-----" . $reviewer_info['account'] . "),添加时间是:" . date('Y-m-d H:i:s', time());
|
||
$log_data['ctime'] = time();
|
||
$this->user_log_obj->insert($log_data);
|
||
|
||
//添加usermsg
|
||
add_usermsg($reviewer['user_id'], 'You have new manuscript to be approved', '/reviewerArticleDetail?id=' . $res);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 筛选一个审稿人
|
||
*/
|
||
public function chose_reviewer($article) {
|
||
//筛选符合期刊
|
||
$rev_list = $this->rev_to_jour_obj->where('journal_id', $article['journal_id'])->column('reviewer_id');
|
||
$fie_list = $this->reviewer_info_obj->where('major', $article['major_id'])->column('reviewer_id');
|
||
$u_list = $this->user_obj
|
||
->where('user_id', ['in', $rev_list], ['in', $fie_list])//审核人属于某期刊,并且属于某个领域
|
||
->where('rtime', '<', time() - 3600 * 24 * 15)//审核人间隔时间
|
||
->order('rs_num desc')->select();
|
||
if ($u_list) {
|
||
return $u_list[0];
|
||
} else {
|
||
return null;
|
||
}
|
||
}
|
||
|
||
}
|