From 6c759de0fbf4a5fcf0ec99e38ffd2d7a7fb9d09b Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Sun, 21 Aug 2022 15:47:28 +0800 Subject: [PATCH] 1 --- .env | 246 +++++++++++------------- application/api/controller/Article.php | 58 +++++- application/api/controller/Email.php | 140 ++++++++++++++ application/api/controller/Reviewer.php | 2 +- application/api/controller/User.php | 5 + application/common.php | 8 +- 6 files changed, 322 insertions(+), 137 deletions(-) create mode 100644 application/api/controller/Email.php diff --git a/.env b/.env index 73ab5ff..5d75257 100644 --- a/.env +++ b/.env @@ -24,146 +24,124 @@ pre = ' TMR - -
-
- - -

TMR Publishing Group

-
-
- TMR - / - Scientist Community - / - Database - / - Submission System -
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + -
- -
' +
+
+ + +

TMR + Publishing Group

+
+
+ Home Page + | + Scientist Community + | + Database + | + Submission System +
+
+ + + + + - net = ' -
-

- Copyright © TMR Publishing Group Limited.
- E-mail: publisher@tmrjournals.com | https://www.tmrjournals.com
- Telephone: +64 02108293806 -

-
- -
-
- + +
+
+
+ + + + + + + + + +
+ +

' + +net = '

+
+
+
+ + + + + + + +
+
+
+ + + + + + + + + +
+

Copyright © TMR Publishing Group Limited.
+ E-Mail: publisher@tmrjournals.com | https://www.tmrjournals.com
+ Telephone: +64 02108293806

+
+ +
+
+ ' \ No newline at end of file diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index c482b60..a9d6d0a 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -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') diff --git a/application/api/controller/Email.php b/application/api/controller/Email.php new file mode 100644 index 0000000..f25ca2b --- /dev/null +++ b/application/api/controller/Email.php @@ -0,0 +1,140 @@ +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); + } + + +} \ No newline at end of file diff --git a/application/api/controller/Reviewer.php b/application/api/controller/Reviewer.php index 10f689f..1cae02e 100644 --- a/application/api/controller/Reviewer.php +++ b/application/api/controller/Reviewer.php @@ -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; diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 60069dc..ef79545 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -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 申请期刊审稿人对于审稿人 diff --git a/application/common.php b/application/common.php index efbf92e..2eccc7f 100644 --- a/application/common.php +++ b/application/common.php @@ -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)) {