20201112
This commit is contained in:
@@ -483,6 +483,84 @@ class Article extends Controller {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 修回文章
|
||||
* @description 修回文章
|
||||
* @author wangjinlei
|
||||
* @url /api/Article/RepairBack
|
||||
* @method POST
|
||||
*
|
||||
* @param name:username type:string require:1 desc:作者账号名
|
||||
* @param name:articleId type:int require:1 desc:文章id
|
||||
* @param name:picturesAndTables type:string require:1 desc:Figures
|
||||
* @param name: $name Description
|
||||
*
|
||||
*/
|
||||
public function RepairBack(){
|
||||
$data = $this->request->post();
|
||||
|
||||
$username = $data['username'];
|
||||
$user_res = $this->user_obj->where(['account' => $username])->find();
|
||||
$article_old_info = $this->article_obj->where('article_id',$data['articleId'])->find();
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
$inset_data['author_act'] = 1;
|
||||
$inset_data['state'] = 1;
|
||||
$where['article_id'] = $data['articleId'];
|
||||
$up_res = $this->article_obj->where($where)->update($inset_data);
|
||||
$article_info = $this->article_obj->where($where)->find();
|
||||
$journal_info = $this->journal_obj->where("journal_id",$article_info["journal_id"])->find();
|
||||
|
||||
//增加article_msg
|
||||
$insmsg_data['article_id'] = $data['articleId'];
|
||||
$insmsg_data['content'] = '';
|
||||
$insmsg_data['state_from'] = $article_old_info['state'];
|
||||
$insmsg_data['state_to'] = 1;
|
||||
$insmsg_data['ctime'] = time();
|
||||
$msg_res = $this->article_msg_obj->insert($insmsg_data);
|
||||
|
||||
//发送邮件
|
||||
$editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
|
||||
$tt = 'Dear editor,<br>';
|
||||
$tt .= 'The author changed the manuscript’s status, please check.<br><br>';
|
||||
$tt .= 'TMR Publishing Group';
|
||||
|
||||
$sendUser=[
|
||||
'title'=> $journal_info['title'], // 邮件标题
|
||||
'content'=>$tt,//邮件内容
|
||||
'user_id'=>$user_res['user_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',$sendUser,'domail');
|
||||
|
||||
|
||||
$res2 = self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $data['picturesAndTables'], 'picturesAndTables');
|
||||
$res3 = self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $data['manuscirpt'], 'manuscirpt');
|
||||
|
||||
//增加用户操作log
|
||||
$log_data['user_id'] = $article_info['user_id'];
|
||||
$log_data['type'] = 1;
|
||||
$log_data['content'] = $data['username'] . "(" . $user_res['realname'] . "),修改了一篇文章:" . $article_info['title'] . ",时间是:" . date('Y-m-d H:i:s', time());
|
||||
$log_data['ctime'] = time();
|
||||
$log_res=$this->user_log_obj->insert($log_data);
|
||||
|
||||
//增加usermsg
|
||||
$umsg_res=add_usermsg($journal_info['editor_id'], 'The manuscript has new process: ' . $article_info['title'], '/articleDetailEditor?id=' . $article_info['article_id']);
|
||||
|
||||
if($up_res&&$msg_res&&$res2&&$res3&&$log_res&&$umsg_res){
|
||||
Db::commit();
|
||||
return json(['code' => 0]);
|
||||
}else{
|
||||
Db::rollback();
|
||||
return json(['code' => 1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 发送留言板消息
|
||||
* @description 发送留言板消息
|
||||
@@ -1452,7 +1530,7 @@ class Article extends Controller {
|
||||
$user_insert['email'] = $author_info['email'];
|
||||
$user_insert['realname'] = $author_info['firstname']." ".$author_info['lastname'];
|
||||
$user_insert['ctime'] = time();
|
||||
$this->user_obj->insert($user_insert);
|
||||
$add_user_id = $this->user_obj->insertGetId($user_insert);
|
||||
|
||||
//发送邮件
|
||||
$tt = 'Dear Dr. '.$user_insert['realname'].'<br><br>';
|
||||
@@ -1471,7 +1549,7 @@ class Article extends Controller {
|
||||
$sendUser=[
|
||||
'title'=>$journal_info['title'], // 邮件标题
|
||||
'content'=>$tt,//邮件内容
|
||||
'user_id'=>$author_info['user_id'], //收件人ID
|
||||
'user_id'=>$add_user_id, //收件人ID
|
||||
'email'=>$author_info['email'],// 收件人邮箱
|
||||
'journal_id'=>$journal_info['journal_id'], // 期刊ID
|
||||
'sendEmail'=>$journal_info['email'], // 期刊邮箱
|
||||
|
||||
Reference in New Issue
Block a user