This commit is contained in:
wangjinlei
2022-08-21 15:47:28 +08:00
parent ff65394c85
commit 6c759de0fb
6 changed files with 322 additions and 137 deletions

View File

@@ -34,6 +34,7 @@ class Article extends Controller {
protected $reviewer_from_author_obj = '';
protected $article_dialog_obj = '';
protected $article_proposal_obj = '';
protected $article_response_to_reviewer_obj = '';
protected $user_black_obj = '';
protected $user_reviewer_recommend_obj = '';
@@ -60,6 +61,7 @@ class Article extends Controller {
$this->reviewer_from_author_obj = Db::name("reviewer_from_author");
$this->article_dialog_obj = Db::name('article_dialog');
$this->article_proposal_obj = Db::name('article_proposal');
$this->article_response_to_reviewer_obj = Db::name('article_response_to_reviewer');
$this->user_black_obj = Db::name('user_black');
$this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend');
}
@@ -506,6 +508,23 @@ class Article extends Controller {
}
}
/**
* 获取全部作者反馈审稿人文件列表
*/
public function getArticleResponseFiles(){
$data = $this->request->post();
$rule = new Validate([
'article_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$list = $this->article_response_to_reviewer_obj->where('article_id',$data['article_id'])->where('artr_state',0)->select();
$re['files'] = $list;
return jsonSuccess($re);
}
/**
* @title 修回文章
@@ -518,6 +537,7 @@ class Article extends Controller {
* @param name:articleId type:int require:1 desc:文章id
* @param name:picturesAndTables type:string require:1 desc:Figures
* @param name:manuscirpt type:string require:1 desc:文章文件
* @param name:responseFile type:string require:0 desc:作者反馈审稿人文件
*
*/
public function RepairBack(){
@@ -567,6 +587,16 @@ class Article extends Controller {
$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');
//作者反馈审稿人信息文件
$res_response = true;
if(isset($data['responseFile'])&&$data['responseFile']!=''){
$insert_response['article_id'] = $data['articleId'];
$insert_response['file_url'] = $data['responseFile'];
$insert_response['artr_ctime'] = time();
$res_response = $this->article_response_to_reviewer_obj->insert($insert_response);
}
//增加用户操作log
$log_data['user_id'] = $article_info['user_id'];
$log_data['type'] = 1;
@@ -577,7 +607,7 @@ class Article extends Controller {
//增加usermsg
$umsg_res=add_usermsg($journal_info['editor_id'], 'The manuscript has new process: ' . $article_info['title'], '/articleDetailEditor?id=' . $article_info['article_id']);
if($msg_res&&$res2&&$res3&&$log_res&&$umsg_res){
if($msg_res&&$res2&&$res3&&$log_res&&$umsg_res&&$res_response){
Db::commit();
return json(['code' => 0]);
}else{
@@ -754,6 +784,8 @@ class Article extends Controller {
* @param name:state type:int require:1 desc:状态代码
* @param name:editormsg type:String require:1 desc:携带的消息(以后会废除)
* @param name:trsjournal type:int require:0 desc:转投期刊id(拒稿时候是必传不推荐转投的为0)
* @param name:proposal_content type:string require:0 desc:退修编辑意见文件
*
*
*/
public function editArticleEditor() {
@@ -879,6 +911,13 @@ class Article extends Controller {
//更新文章状态
if($data['state']==4){
$update_data['ttime'] = time();
//退休状态,添加退修时编辑的意见
if(isset($data['proposal_content'])&&$data['proposal_content']!=''){//存在这个修回的文件
$insert_proposal['article_id'] = $data['articleId'];
$insert_proposal['proposal_content'] = trim($data['proposal_content']);
$insert_proposal['ap_ctime'] = time();
$this->article_proposal_obj->insert($insert_proposal);
}
}
if($data['state']==3){
$update_data['rstime'] = time();
@@ -1795,6 +1834,21 @@ class Article extends Controller {
}
}
/**
* 上传作者反馈审稿人文件
*/
public function up_response_file(){
$file = request()->file('articleResponse');
if ($file) {
$info = $file->move(ROOT_PATH . 'public' . DS . 'articleResponse');
if ($info) {
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
} else {
return json(['code' => 1, 'msg' => $file->getError()]);
}
}
}
/**
* 获取文章审稿实例列表
*/
@@ -1851,6 +1905,8 @@ class Article extends Controller {
// $revids = $this->reviewer_to_journal_obj->where('journal_id', $article_info['journal_id'])->where('state',0)->column('reviewer_id');
$noids = $this->article_reviewer_obj->where('article_id', $data['articleId'])->column('reviewer_id');
$noids[] = $article_info['user_id'];
$res = $this->reviewer_to_journal_obj
->field('t_user.user_id,t_user.account')

View File

@@ -0,0 +1,140 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
use think\Validate;
class Email extends Controller{
protected $article_obj = '';
protected $user_obj = '';
protected $user_act_obj = '';
protected $journal_obj = '';
protected $user_log_obj = '';
protected $user_reviewer_info_obj = '';
protected $reviewer_major_obj = '';
protected $reviewer_to_journal_obj = '';
protected $article_reviewer_question_obj = '';
protected $article_msg_obj = '';
protected $article_file_obj = '';
protected $article_reviewer_obj = '';
protected $article_author_obj = '';
protected $article_transfer_obj = '';
protected $chief_to_journal_obj = '';
protected $login_auto_obj = '';
protected $major_obj = "";
protected $major_to_journal_obj = '';
protected $reviewer_from_author_obj = '';
protected $article_dialog_obj = '';
protected $article_proposal_obj = '';
protected $article_response_to_reviewer_obj = '';
protected $user_black_obj = '';
protected $user_reviewer_recommend_obj = '';
protected $email_log_obj = '';
protected $email_template_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->user_act_obj = Db::name('user_act');
$this->article_obj = Db::name('article');
$this->journal_obj = Db::name('journal');
$this->user_log_obj = Db::name('user_log');
$this->user_reviewer_info_obj = Db::name("user_reviewer_info");
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->article_reviewer_question_obj = Db::name('article_reviewer_question');
$this->article_msg_obj = Db::name('article_msg');
$this->article_file_obj = Db::name('article_file');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->article_author_obj = Db::name('article_author');
$this->article_transfer_obj = Db::name('article_transfer');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->login_auto_obj = Db::name('login_auto');
$this->major_obj = Db::name("major");
$this->major_to_journal_obj = Db::name('major_to_journal');
$this->reviewer_from_author_obj = Db::name("reviewer_from_author");
$this->article_dialog_obj = Db::name('article_dialog');
$this->article_proposal_obj = Db::name('article_proposal');
$this->article_response_to_reviewer_obj = Db::name('article_response_to_reviewer');
$this->user_black_obj = Db::name('user_black');
$this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend');
$this->email_log_obj = Db::name('email_log');
$this->email_template_obj = Db::name('email_template');
}
/**
* 添加邮件模板
*/
public function addEmailTemplate(){
$data = $this->request->post();
$rule = new Validate([
'etitle'=>'require',
'epid'=>'require',
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$insert['etitle'] = $data['etitle'];
$insert['epid'] = $data['epid'];
$insert['econtent'] = isset($data['econtent'])?$data['econtent']:'';
$this->email_template_obj->insert($insert);
return jsonSuccess([]);
}
/**
* 删除邮件模板
*/
public function delEmailTemplate(){
$data = $this->request->post();
$rule = new Validate([
'eid'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$info = $this->email_template_obj->where('eid',$data['eid'])->find();
if($info['epid']==0){
$check = $this->email_template_obj->where('epid',$info['eid'])->where('estate',0)->find();
if($check){
return jsonError('Please delete all subitems first!');
}
}
$this->email_template_obj->where('eid',$data['eid'])->update(['estate'=>1]);
return jsonSuccess([]);
}
/**
* 获取全部邮件模板
*/
public function getAllEmailTemplate(){
$list = $this->email_template_obj->where('epid',0)->where('estate',0)->select();
foreach($list as $k => $v){
$cache = $this->email_template_obj->where('epid',$v['eid'])->where('estate',0)->select();
$list[$k]['children'] = $cache;
}
$re['templates'] = $list;
return jsonSuccess($re);
}
/**
* 获取邮件模板
*/
public function getEmailTemplate(){
$data = $this->request->post();
$rule = new Validate([
'eid'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$info = $this->email_template_obj->where('eid',$data['eid'])->where('estate',0)->find();
$re['template'] = $info;
return jsonSuccess($re);
}
}

View File

@@ -1358,7 +1358,7 @@ class Reviewer extends Controller
$info_insert['company'] = isset($data['company']) ? trim($data['company']) : '';
$info_insert['major'] = $data['major'];
$info_insert['cmajor'] = $data['cmajor'];
$info_insert['qualifications'] = trim($data['cv']);
$info_insert['qualifications'] = isset($data['cv'])?trim($data['cv']):'';
$info_insert['field'] = trim($data['field']);
$res1 = $this->user_reviewer_info_obj->insertGetId($info_insert);
$to_insert['reviewer_id'] = $uid;

View File

@@ -319,6 +319,11 @@ class User extends Controller
echo 'Unsubscribe successfully!';
}
public function mytestemail(){
sendEmail('751475802@qq.com', "test", "test", "hello", "tmr@tmrjournals.com", "849192806Pnx");
}
/**
* @title 申请期刊审稿人对于审稿人
* @description 申请期刊审稿人对于审稿人

View File

@@ -2,6 +2,7 @@
use PHPMailer\PHPMailer\PHPMailer;
use think\Db;
use think\Env;
//use TCPDF;
// +----------------------------------------------------------------------
@@ -67,7 +68,12 @@ function sendEmail($email = '', $title = '', $from_name = '', $content = '', $me
$mail->Subject = $title;
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($content);
//组合邮件模板的头尾
$pre = Env::get('emailtemplete.pre');
$net = Env::get('emailtemplete.net');
$mail->msgHTML($pre.$content.$net);
//Replace the plain text body with one created manually
$mail->AltBody = '';
if (is_array($attachmentFile)) {