This commit is contained in:
wangjinlei
2022-04-16 18:03:58 +08:00
parent 1ee952836d
commit 1e5ce5b3b2
2 changed files with 378 additions and 126 deletions

View File

@@ -7,8 +7,10 @@ use think\Db;
use think\Env;
use think\Queue;
use think\Validate;
use app\api\controller\Article as articlecontroller;
class Special extends Controller {
class Special extends Controller
{
protected $user_obj = '';
protected $captcha_obj = '';
@@ -24,11 +26,15 @@ class Special extends Controller {
protected $user_reviewer_info_obj = '';
protected $user_msg_obj = '';
protected $article_file_obj = '';
protected $article_msg_obj = '';
protected $user_log_obj = '';
protected $user_black_obj = '';
protected $user_to_special_obj = '';
protected $chief_to_journal_obj = '';
protected $article_reviewer_obj = '';
public function __construct(\think\Request $request = null) {
public function __construct(\think\Request $request = null)
{
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->captcha_obj = Db::name('captcha');
@@ -44,15 +50,19 @@ class Special extends Controller {
$this->country_obj = Db::name('country');
$this->article_author_obj = Db::name('article_author');
$this->article_file_obj = Db::name('article_file');
$this->article_msg_obj = Db::name('article_msg');
$this->user_log_obj = Db::name('user_log');
$this->user_black_obj = Db::name('user_black');
$this->user_to_special_obj = Db::name('user_to_special');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->article_reviewer_obj = Db::name('article_reviewer');
}
/**
* 注册功能
*/
public function register() {
public function register()
{
$data = $this->request->post();
//检测是否用户名和密码已经占用
@@ -63,9 +73,9 @@ class Special extends Controller {
return json('existence');
}
//验证验证码
// if (!$this->my_checkcaptcha($data['code'], $data['random_num'])) {
// return json('errcaptcha');
// }
// if (!$this->my_checkcaptcha($data['code'], $data['random_num'])) {
// return json('errcaptcha');
// }
//存入数据
$inser_data['account'] = trim($account);
$inser_data['password'] = md5($data['password']);
@@ -78,15 +88,15 @@ class Special extends Controller {
$tt = "Dear author,You have successfully registered<br><br>";
$content = $tt . '<p>Username:' . $account . '<br>Password:' . $data['password'] . '</p>';
$sendUser=[
'title'=>'Dear ' . $data['realname'], // 邮件标题
'content'=>$content,//邮件内容
'user_id'=>$id, //收件人ID
'email'=>$email,// 收件人邮箱
'journal_id'=>0, // 期刊ID
'sendEmail'=>Env::get('email.send_email'), // 期刊邮箱
'sendPassword'=>Env::get('email.send_email_password'), // 期刊密码
'from_name'=>'TMR'
$sendUser = [
'title' => 'Dear ' . $data['realname'], // 邮件标题
'content' => $content, //邮件内容
'user_id' => $id, //收件人ID
'email' => $email, // 收件人邮箱
'journal_id' => 0, // 期刊ID
'sendEmail' => Env::get('email.send_email'), // 期刊邮箱
'sendPassword' => Env::get('email.send_email_password'), // 期刊密码
'from_name' => 'TMR'
];
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
sendEmail($email, 'Dear ' . $data['realname'], 'TMR', $content);
@@ -97,7 +107,8 @@ class Special extends Controller {
* 登录功能
* @return type
*/
public function checkLogin() {
public function checkLogin()
{
$data = $this->request->post();
//判断是否管理员登录
if ($data['username'] == 'superadmin' || $data['username'] == 'wuxiongzhi2') {
@@ -112,16 +123,16 @@ class Special extends Controller {
$this->admin_obj->where('admin_id = ' . $admin_info['admin_id'])->update($up_admin);
return json(['code' => 0, 'userinfo' => $admin_info]);
}
} else {//用户登录
// $where['account'] = $data['username'];
// $where['password'] = md5($data['password']);
} else { //用户登录
// $where['account'] = $data['username'];
// $where['password'] = md5($data['password']);
$user_info = $this->user_obj->where('account|email', trim($data['username']))->where('password', md5($data['password']))->find();
if ($user_info == null) {//登陆失败
if ($user_info == null) { //登陆失败
return json(['code' => 1]);
}
//黑名单验证
$blackCheck = $this->user_black_obj->where('user_id',$user_info['user_id'])->where('black_state',0)->find();
if($blackCheck){
$blackCheck = $this->user_black_obj->where('user_id', $user_info['user_id'])->where('black_state', 0)->find();
if ($blackCheck) {
return jsonError("Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.");
}
$up_data['last_login_time'] = time();
@@ -134,12 +145,13 @@ class Special extends Controller {
/**
* 获取文章
*/
public function getArticles() {
public function getArticles()
{
$data = $this->request->post();
$list = $this->article_obj
->where('special_num', $data['special_id'])
->where('user_id', $data['user_id'])
->where('state', 0)->select();
->where('special_num', $data['special_id'])
->where('user_id', $data['user_id'])
->where('state', 0)->select();
$re['articles'] = $list;
return json(['code' => 0, 'data' => ['articles' => $re]]);
@@ -148,18 +160,19 @@ class Special extends Controller {
/**
* 获取期刊的专刊列表
*/
public function getSpecialByIssn(){
public function getSpecialByIssn()
{
$data = $this->request->post();
$rule = new Validate([
'journal_issn' => 'require'
]);
if(!$rule->check($data)){
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$base_url = Env::get('journal.base_url');
$res = object_to_array(json_decode(myPost($base_url."/master/Special/getSpecialByIssn",['journal_issn'=>$data['journal_issn']])));
$res = object_to_array(json_decode(myPost($base_url . "/master/Special/getSpecialByIssn", ['journal_issn' => $data['journal_issn']])));
$specials = $res['data']['specials'];
foreach($specials as $k => $v){
foreach ($specials as $k => $v) {
unset($specials[$k]['journal_id']);
}
$re['specials'] = $specials;
@@ -169,57 +182,58 @@ class Special extends Controller {
/**
* 获取客座审稿人文章列表
*/
public function getSpecialArticles(){
public function getSpecialArticles()
{
$data = $this->request->post();
$rule = new Validate([
'user_id' => 'require',
'pageIndex' => 'require',
'pageSize' =>'require',
'pageSize' => 'require',
'special_id' => 'require',
'state'=>'require'
'state' => 'require'
]);
if(!$rule->check($data)){
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
//构造查询条件
$specialIds = $this->user_to_special_obj->where('user_id',$data['user_id'])->where('uts_state',0)->column('special_id');
$where['t_article.special_num'] = ['in',$specialIds];
if($data['special_id']!=0){
$specialIds = $this->user_to_special_obj->where('user_id', $data['user_id'])->where('uts_state', 0)->column('special_id');
$where['t_article.special_num'] = ['in', $specialIds];
if ($data['special_id'] != 0) {
$where['special_num'] = $data['special_id'];
}
if($data['state']>-1){
if ($data['state'] > -1) {
$where['t_article.state'] = $data['state'];
}
if(isset($data['titleKey'])&&$data['titleKey']!=''){
$where['t_article.title'] = ['like','%'.trim($data['titleKey']).'%'];
if (isset($data['titleKey']) && $data['titleKey'] != '') {
$where['t_article.title'] = ['like', '%' . trim($data['titleKey']) . '%'];
}
if(isset($data['sn'])&&$data['sn']!=''){
$where['t_article.accept_sn']=$data['sn'];
if (isset($data['sn']) && $data['sn'] != '') {
$where['t_article.accept_sn'] = $data['sn'];
}
//分页查询数据
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$res = $this->article_obj
->field('t_article.*,t_journal.title journalname,t_user.email,t_user.realname,t_user.phone')
->join('t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT')
->join('t_user',"t_user.user_id = t_article.user_id",'left')
->where($where)
->order('article_id desc')
->limit($limit_start, $data['pageSize'])->select();
->field('t_article.*,t_journal.title journalname,t_user.email,t_user.realname,t_user.phone')
->join('t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT')
->join('t_user', "t_user.user_id = t_article.user_id", 'left')
->where($where)
->order('article_id desc')
->limit($limit_start, $data['pageSize'])->select();
//添加国家信息
foreach($res as $k => $v){
$cache_author_list = $this->article_author_obj->where('article_id',$v['article_id'])->select();
foreach ($res as $k => $v) {
$cache_author_list = $this->article_author_obj->where('article_id', $v['article_id'])->select();
$cache_country = [];
foreach($cache_author_list as $key => $val){
if($val['country']!=''&&!in_array($val['country'],$cache_country)){
foreach ($cache_author_list as $key => $val) {
if ($val['country'] != '' && !in_array($val['country'], $cache_country)) {
$cache_country[] = $val['country'];
}
}
$res[$k]['countrys'] = $cache_country;
}
$count = $this->article_obj->where($where)->count();
$re['articles'] = $res;
@@ -227,54 +241,179 @@ class Special extends Controller {
return jsonSuccess($re);
}
/**
* 更改文章状态客座编辑
*/
public function editArticle()
{
$data = $this->request->post();
$rule = new Validate([
'editname' => 'require',
'articleId' => 'require',
'state' => 'require'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$editor_info = $this->user_obj->where('account', $data['editname'])->find();
$article_info = $this->article_obj->where('article_id', $data['articleId'])->find();
$journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
$user_info = $this->user_obj->where(['user_id' => $article_info['user_id']])->find();
//添加文章状态信息(如果状态未更新可做通话用,并结束操作)
$insert_data['article_id'] = $data['articleId'];
$insert_data['content'] = '';
$insert_data['state_from'] = $article_info['state'];
$insert_data['state_to'] = $data['state'];
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
$update_data['state'] = $data['state'];
$update_data['editor_act'] = 1;
//更新文章状态
if ($data['state'] == 4) {
$update_data['ttime'] = time();
}
if ($data['state'] == 3) {
$update_data['rstime'] = time();
}
$this->article_obj->where('article_id', $data['articleId'])->update($update_data);
//拒稿或者录用 - 发送审稿意见
$articlecontroller = new articlecontroller();
if ($article_info['journal_id'] == 1 && ($data['state'] == 3 || $data['state'] == 5)) {
$articlecontroller->sendEmailToReviewer($data['articleId'], $data['state']);
}
//发送文章状态更改邮件
if ($data['state'] == 3) { //拒稿
$tt = '"' . $article_info['title'] . '"<br>';
$tt .= $article_info['accept_sn'] . '<br>';
$tt .= 'journal:' . $journal_info['title'] . '<br>';
$tt .= 'Dear Dr. ' . ($user_info['realname'] == '' ? $user_info['account'] : $user_info['realname']) . ',<br>';
$tt .= 'Thank you for submitting your paper to ' . $journal_info['title'] . '. Your manuscript has undergone review.<br>';
$tt .= 'Unfortunately the editors feel that ' . $journal_info['title'] . ' is not the appropriate venue for your manuscript,'
. ' and we are returning your manuscript to you so that you can submit it to another journal without delay. '
. '<br><br>Yours sincerely,<br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
} else if ($data['state'] == 5) { //录用
//录用后更新录用时间
$this->article_obj->where('article_id', $article_info['article_id'])->update(['rtime' => time()]);
$tt = 'Manuscript ID: ' . $article_info['accept_sn'] . '<br>';
$tt .= 'Manuscript Title: ' . $article_info['title'] . '<br>';
$tt .= 'Authors Name: ' . $articlecontroller->getArticleAuthors($article_info['article_id']) . '<br><br>';
$tt .= 'Dear Dr. ' . ($user_info['realname'] == '' ? $user_info['account'] : $user_info['realname']) . ',<br>It is a distinct pleasure to inform you that your manuscript has been accepted for publication in ' . $journal_info['title'] . ' (ISSN ' . $journal_info['issn'] . ').<br> The editor will contact you further by email soon.<br><br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
} else if ($data['state'] == 4) { //退修
$tt = $article_info['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'] . '">AuthorCenter</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>';
} else if ($data['state'] == 6) { //终审
$tt = 'Dear Dr. ' . ($user_info['realname'] == '' ? $user_info['account'] : $user_info['realname']) . '<br>';
$tt .= 'Manuscript status: Your manuscript "' . $article_info['title'] . '" is under reviewing by editorial member team of ' . $journal_info['title'] . '.';
} else {
$tt = '"' . $article_info['title'] . '"<br>';
$tt .= $article_info['accept_sn'] . '<br>';
$tt .= 'journal:' . $journal_info['title'] . '<br><br>';
$tt .= 'Dear Dr. ' . ($user_info['realname'] == '' ? $user_info['account'] : $user_info['realname']) . ',<br>Please check the new status of your manuscript online.<br><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'];
if ($data['state'] != 5 || $journal_info['journal_id'] != 9) {
$sendUser['content'] = $tt;
// sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
}
if ($data['state'] == 6) { //进入终审,通知主编邮件
$chiefs = $this->chief_to_journal_obj->join('t_user', 't_user.user_id = t_chief_to_journal.user_id', 'left')->where('t_chief_to_journal.journal_id', $journal_info['journal_id'])->where('t_chief_to_journal.state', 0)->select();
foreach ($chiefs as $v) {
$tts = 'Dear Dr. ' . ($v['realname'] == '' ? $v['account'] : $v['realname']) . ',<br><br>';
$tts .= 'The manuscript entitled “' . $article_info['title'] . '” has been peer-reviewed, revised and about to be published in ' . $journal_info['title'] . '.<br><br>';
$tts .= 'If you want to review this article, you could use it Submission System (<a href="https://submission.tmrjournals.com">Plese click here</a>).<br>';
$tts .= 'Your username: ' . $v['account'] . '<br>';
$tts .= 'Password: 123456qwe (Original password)<br><br>';
$tts .= 'If you are unable to review it now, you may provide your comments at a later time at your convenience. Then ,there is no need to reply to this email.<br><br>';
$tts .= 'Any comments you make will be valued by the editorial board. Please bring into our knowledge if there is any potential Conflict of Interest.<br><br><br><br>';
$tts .= 'Sincerely,<br>Editorial Office<br>' . $journal_info['title'] . '<br>';
$tts .= 'Email: ' . $journal_info['email'] . '<br>';
$tts .= 'Website:<a href="' . $journal_info['website'] . '">' . $journal_info['website'] . '</a>';
$sendUser['user_id'] = $v['user_id'];
$sendUser['email'] = $v['email'];
$sendUser['content'] = $tts;
// sendEmail($v['email'], $journal_info['title'], $journal_info['title'], $tts, $journal_info['email'], $journal_info['epassword']);
}
}
//增加用户操作log
$log_data['user_id'] = $editor_info['user_id'];
$log_data['type'] = 1;
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),更改了一篇文章:(" . $article_info['title'] . ")的状态,更改时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//增加usermsg
add_usermsg($article_info['user_id'], 'Your manuscript has new process: ' . $article_info['title'], '/articleDetail?id=' . $article_info['article_id']);
return json(['code' => 0]);
}
/**
* 添加专刊文章(作者)
*/
public function addArticle() {
public function addArticle()
{
//接受参数,查询信息
$data = $this->request->post();
// $data['authorList'] = [
// [
// 'address'=>'111',
// 'company'=>'111',
// 'country'=>'china',
// 'department'=>'',
// 'email'=>'6541654@qq.com',
// 'firstname'=>'2222222',
// 'isReport'=>'true',
// 'isSuper'=>'false',
// 'lastname'=>'2222222',
// 'title'=>'Ph.D.'
// ],
// [
// 'address'=>'',
// 'company'=>'112221',
// 'country'=>'china',
// 'department'=>'',
// 'email'=>'2254@qq.com',
// 'firstname'=>'22212222',
// 'isReport'=>'false',
// 'isSuper'=>'true',
// 'lastname'=>'2222222',
// 'title'=>'Ph.D.'
// ]
// ];
// $data['abstrart'] = '1111';
// $data['coverLetter'] = '';
// $data['fund'] = '';
// $data['journal_issn'] = '2538-015X';
// $data['keyWords'] = '111,1111,1111';
// $data['title'] = "111";
// $data['major'] = '1';
// $data['cmajor'] = '26';
// $data['type'] = 'A';
// $data['approval'] = 'true';
// $data['username'] = "user1";
// $data['coverLetter'] = '';
// $data['picturesAndTables'] = '';
// $data['totalpage'] = '';
// $data['manuscirpt'] = '20210122/e08e82edcabe5dc9d9409d1947fccc82.png';
// $data['authorList'] = [
// [
// 'address'=>'111',
// 'company'=>'111',
// 'country'=>'china',
// 'department'=>'',
// 'email'=>'6541654@qq.com',
// 'firstname'=>'2222222',
// 'isReport'=>'true',
// 'isSuper'=>'false',
// 'lastname'=>'2222222',
// 'title'=>'Ph.D.'
// ],
// [
// 'address'=>'',
// 'company'=>'112221',
// 'country'=>'china',
// 'department'=>'',
// 'email'=>'2254@qq.com',
// 'firstname'=>'22212222',
// 'isReport'=>'false',
// 'isSuper'=>'true',
// 'lastname'=>'2222222',
// 'title'=>'Ph.D.'
// ]
// ];
// $data['abstrart'] = '1111';
// $data['coverLetter'] = '';
// $data['fund'] = '';
// $data['journal_issn'] = '2538-015X';
// $data['keyWords'] = '111,1111,1111';
// $data['title'] = "111";
// $data['major'] = '1';
// $data['cmajor'] = '26';
// $data['type'] = 'A';
// $data['approval'] = 'true';
// $data['username'] = "user1";
// $data['coverLetter'] = '';
// $data['picturesAndTables'] = '';
// $data['totalpage'] = '';
// $data['manuscirpt'] = '20210122/e08e82edcabe5dc9d9409d1947fccc82.png';
$user_res = $this->user_obj->where('account', $data['username'])->find();
@@ -324,14 +463,14 @@ class Special extends Controller {
//增加转投信息
$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;
// }
// }
// 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 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['picturesAndTables'], 'picturesAndTables');
@@ -342,17 +481,28 @@ class Special extends Controller {
$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']);
$sendEditor=[
'title'=>$journal_info['title'], // 邮件标题
'content'=>$tt,//邮件内容
'user_id'=>$journal_info['editor_id'], //收件人ID
'email'=>$editor_info['email'],// 收件人邮箱
'journal_id'=>$journal_info['journal_id'], // 期刊ID
'sendEmail'=>$journal_info['email'], // 期刊邮箱
'sendPassword'=>$journal_info['epassword'], // 期刊密码
'from_name'=>$journal_info['title']
];
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//获取客座编辑
$guests = $this->user_to_special_obj
->field("t_user.email")
->join("t_user", 't_user.user_id = t_user_to_special.user_id', 'left')
->where('t_user_to_special.special_id', $data['special_id'])
->where('t_user_to_special.uts_state', 0)
->select();
foreach($guests as $k => $v){
sendEmail($v['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
}
// $sendEditor = [
// 'title' => $journal_info['title'], // 邮件标题
// 'content' => $tt, //邮件内容
// 'user_id' => $journal_info['editor_id'], //收件人ID
// 'email' => $editor_info['email'], // 收件人邮箱
// 'journal_id' => $journal_info['journal_id'], // 期刊ID
// 'sendEmail' => $journal_info['email'], // 期刊邮箱
// 'sendPassword' => $journal_info['epassword'], // 期刊密码
// 'from_name' => $journal_info['title']
// ];
// Queue::push('app\api\job\domail@fire',$sendEditor,'domail');
//增加用户操作log
@@ -374,10 +524,108 @@ class Special extends Controller {
}
}
/**
* 客座编辑添加审稿人
*/
public function addReviewerToArticleForSpecial()
{
$data = $this->request->post();
$rule = new Validate([
'email' => 'require|email',
'realname' => 'require',
'article_id' => 'require',
'major' => 'require',
'cmajor' => 'require'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
Db::startTrans();
//判断此用户是否存在
$reviewer_info = $this->user_obj->where('email', $data['email'])->where('state', 0)->find();
if ($reviewer_info == null) { //添加用户
$insert_user['account'] = $data['email'];
$insert_user['password'] = md5('123456qwe');
$insert_user['email'] = $data['email'];
$insert_user['realname'] = $data['realname'];
$insert_user['ctime'] = time();
$i_id = $this->user_obj->insertGetId($insert_user);
$reviewer_info = $this->user_obj->where('user_id', $i_id)->find();
}
//检验审稿实例是否存在
$check_repi = $this->article_reviewer_obj->where('article_id', $data['article_id'])->where('reviewer_id', $reviewer_info['user_id'])->find();
if ($check_repi != null) {
return jsonError('Cannot be added repeatedly');
}
//判断是否是此期刊审稿人
$rtj = $this->reviewer_to_journal_obj->where('journal_id', $article_info['journal_id'])->where('reviewer_id', $reviewer_info['user_id'])->where('state', 0)->find();
$res2 = true;
$res3 = true;
if ($rtj == null) {
//判断是否具有审稿人身份,并具有审稿人资料
$uri = $this->user_reviewer_info_obj->where('reviewer_id', $reviewer_info['user_id'])->where('state', 0)->find();
if ($uri == null) { //添加审稿人信息
$insert_reviewer_info['reviewer_id'] = $reviewer_info['user_id'];
$insert_reviewer_info['major'] = $data['major'];
$insert_reviewer_info['cmajor'] = $data['cmajor'];
$res2 = $this->user_reviewer_info_obj->insert($insert_reviewer_info);
}
$insert_rtj['reviewer_id'] = $reviewer_info['user_id'];
$insert_rtj['journal_id'] = $journal_info['journal_id'];
$insert_rtj['account'] = $reviewer_info['account'];
$insert_rtj['journal_title'] = $journal_info['title'];
$insert_rtj['ctime'] = time();
$res3 = $this->reviewer_to_journal_obj->insert($insert_rtj);
}
//创建审稿实例
$insert_article_reviewer['reviewer_id'] = $reviewer_info['user_id'];
$insert_article_reviewer['article_id'] = $data['article_id'];
$insert_article_reviewer['editor_act'] = 1;
$insert_article_reviewer['ctime'] = time();
$arid = $this->article_reviewer_obj->insertGetId($insert_article_reviewer);
if ($res2 && $res3 && $arid) {
Db::commit();
$articlecontroller = new articlecontroller();
//发送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="' . $articlecontroller->creatLoginUrlForreviewer($reviewer_info, $arid) . '">Click here to review the article</a><br>';
$tt .= '<a href="' . $articlecontroller->creatRejectUrlForReviewer($reviewer_info, $arid) . '">Click on the link to reject the review of this manuscript</a><br>';
$tt .= 'Your username:' . $reviewer_info['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>';
$tt .= '<a href="https://www.tmrjournals.com/draw_up.html?issn=' . $journal_info['issn'] . '">Subscribe to this journal</a><br>';
$tt .= $journal_info['title'] . '<br>';
$tt .= 'Email:' . $journal_info['email'] . '<br>';
$tt .= 'Website:' . $journal_info['website'];
sendEmail($reviewer_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
return jsonSuccess([]);
} else {
Db::rollback();
return jsonError("system error");
}
}
/**
* 上传文章的文件
*/
public function up_file($type) {
public function up_file($type)
{
$file = request()->file($type);
if ($file) {
$info = $file->move(ROOT_PATH . 'public' . DS . $type);
@@ -392,7 +640,8 @@ class Special extends Controller {
/**
* 获取领域分类
*/
public function getMajor() {
public function getMajor()
{
$majors = $this->reviewer_major_obj->where('pid', 0)->select();
return json(['code' => 0, 'data' => $majors]);
}
@@ -400,7 +649,8 @@ class Special extends Controller {
/**
* 获取major子项目
*/
public function majorChild() {
public function majorChild()
{
$majorid = $this->request->post('majorid');
$ds = $this->reviewer_major_obj->where('pid', $majorid)->select();
return json(['code' => 0, 'data' => $ds]);
@@ -409,19 +659,22 @@ class Special extends Controller {
/**
* 获取城市
*/
public function getCountrys() {
public function getCountrys()
{
$res = $this->country_obj->order('en_name')->select();
return json($res);
}
public function test() {
public function test()
{
echo strtotime('2021-1-1');
}
/**
* 存储article文件历史信息
*/
private function save_article_file($article_id, $user_id, $username, $url, $type_name) {
private function save_article_file($article_id, $user_id, $username, $url, $type_name)
{
//首先确定数据库里面是否存在此数据
$res = $this->article_file_obj->where(['file_url' => $url])->find();
if ($res) {
@@ -441,5 +694,4 @@ class Special extends Controller {
$insert_data['ctime'] = time();
return $this->article_file_obj->insert($insert_data);
}
}