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); } /** * 增加模板调用计数 */ public function addEmailTemplateNum() { $data = $this->request->post(); $rule = new Validate([ 'eid' => 'require' ]); if (!$rule->check($data)) { return jsonError($rule->getError()); } $this->email_template_obj->where('eid', $data['eid'])->setInc('num'); return jsonSuccess([]); } /** * 发送模板邮件 */ public function pushEmailOnTemplate() { $data = $this->request->post(); $rule = new Validate([ 'email' => 'require', 'content' => 'require', 'article_id' => '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(); $maidata['email'] = $data['email']; $maidata['title'] = $journal_info['title']; $maidata['content'] = $data['content']; $maidata['tmail'] = $journal_info['email']; $maidata['tpassword'] = $journal_info['epassword']; $maidata['article_id'] = $data['article_id']; $maidata['attachmentFile'] = (isset($data['attachment']) && $data['attachment'] != '') ? ROOT_PATH . 'public' . DS . $data['attachment'] : ''; Queue::push('app\api\job\mail@tgpu', $maidata, "tmail"); return jsonSuccess([]); } public function lsPushEmail() { // $journal_info = $this->journal_obj->where("journal_id", 4)->find(); // $list[] = "751475802@qq.com"; // $list[] = "15122276210@163.com"; $list = Db::name("reviewer_to_journal t") ->join("t_user u", "u.user_id = t.reviewer_id", "left") ->field("t.*,u.email,u.realname") ->where("t.journal_id", 4) ->where("t.state", 0) ->where("not exists(select * from t_reviewer_to_journal where journal_id=22 and state = 0 and reviewer_id = t.reviewer_id)") ->select(); foreach ($list as $v) { $tt = "Dear " . $v['realname'] == "" ? $v['account'] : $v['realname'] . ",

"; $tt .= " I hope this message finds you well.

I am writing to inform you about a significant change in our journal structure. Due to substantial overlap in scope, our publisher has decided to merge Toxicology Advances (TA) into Pharmacology Discovery (PD).

As part of this transition, the editorial board has decided to transfer all reviewers from TA to PD. We highly value your contributions and hope that you will continue to lend your expertise to PD.

If you agree to serve as a reviewer for PD, please click on the following link. The system will automatically add you to the PD reviewer system:
[Insert link here]

However, if you prefer not to continue as a reviewer for PD, please disregard this email.

Thank you for your understanding and continued support.

Best regards,
Editorial Office
Toxicology Advances"; // $maidata['email'] = $v['email']; $maidata['email'] = $v['email']; $maidata['title'] = "Toxicology Advances: Reviewer Transition"; $maidata['content'] = $tt; $maidata['has_hb'] = 1; // $maidata['tmail'] = $journal_info['email']; // $maidata['tpassword'] = $journal_info['epassword']; // aliemail($maidata['email'],$maidata['title'],$maidata['content'],$maidata['has_hb']); Queue::push('app\api\job\mail@promotion', $maidata, "tmail"); } echo "ok"; } /** * 获取邮件发送记录通过文章 */ public function getEmailsByArticle() { $data = $this->request->post(); $rule = new Validate([ 'article_id' => 'require' ]); if (!$rule->check($data)) { return jsonError($rule->getError()); } $list = $this->email_log_obj->where('article_id', $data['article_id'])->where('is_success', 1)->select(); $re['emails'] = $list; return jsonSuccess($re); } /** * 上传文章的文件 */ public function up_enclosure_file() { $file = request()->file("enclosure"); if ($file) { $info = $file->move(ROOT_PATH . 'public' . DS . 'enclosure'); if ($info) { return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]); } else { return json(['code' => 1, 'msg' => $file->getError()]); } } } }