20201112
This commit is contained in:
@@ -109,6 +109,28 @@ class Article extends Controller {
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取文章话题
|
||||
* @description 获取文章话题
|
||||
* @author wangjinlei
|
||||
* @url /api/Article/getTopicsForArticle
|
||||
* @method POST
|
||||
*
|
||||
* @param name:article_id type:int require:1 desc:文章id
|
||||
*
|
||||
* @return topics:话题列表#
|
||||
*/
|
||||
public function getTopicsForArticle(){
|
||||
$data = $this->request->post();
|
||||
$list = $this->article_to_topic_obj
|
||||
->field("j_journal_topic.*")
|
||||
->join("j_journal_topic","j_journal_topic.journal_topic_id = j_article_to_topic.topic_id","left")
|
||||
->where("j_article_to_topic.article_id",$data['article_id'])
|
||||
->where('j_article_to_topic.state',0)
|
||||
->select();
|
||||
$re['topics'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
public function mytest(){
|
||||
$article_info = $this->article_obj->where('article_id',1689)->find();
|
||||
@@ -194,8 +216,10 @@ class Article extends Controller {
|
||||
->limit($limit_start,$data['pageSize'])
|
||||
->select();
|
||||
$count = $this->article_to_topic_obj
|
||||
->join(array(['j_article', 'j_article_to_topic.article_id = j_article.article_id', 'LEFT'], ['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT']))
|
||||
->where('j_article_to_topic.topic_id', $data['topic_id'])
|
||||
->where('j_article_to_topic.state', 0)
|
||||
->where('j_journal_stage.stage_year','>',intval(date('Y'))-3)
|
||||
->count();
|
||||
//获取作者
|
||||
foreach ($list as $k => $v) {
|
||||
|
||||
@@ -390,7 +390,7 @@ class Journal extends Controller {
|
||||
$data = $this->request->post();
|
||||
$list = [];
|
||||
if($data['journal_topic_id'] == 0){
|
||||
$journals = $this->journal_obj->where('state',0)->select();
|
||||
$journals = $this->journal_obj->where('state',0)->order("sort desc")->select();
|
||||
foreach ($journals as $k => $v){
|
||||
$topic_info = $this->journal_topic_obj->where('journal_id',$v['journal_id'])->where('title','Topics')->where('state',0)->find();
|
||||
$cache = $this->journal_topic_obj->where('parent_id',$topic_info['journal_topic_id'])->where('state',0)->limit(5)->select();
|
||||
@@ -406,6 +406,7 @@ class Journal extends Controller {
|
||||
->where('j_journal_topic.parent_id','in',$tpids)
|
||||
->where('j_journal_topic.title',$topic_info['title'])
|
||||
->where('j_journal_topic.state',0)
|
||||
->order("j_journal.sort desc")
|
||||
->select();
|
||||
$list = $journals;
|
||||
}
|
||||
@@ -443,7 +444,7 @@ class Journal extends Controller {
|
||||
}
|
||||
$ids = $this->article_to_topic_obj->where('topic_id','in',$topicids)->where('state',0)->column('article_id');
|
||||
$list = $this->article_obj
|
||||
->field('j_article.*,j_journal_stage.*,j_journal.title journal_title')
|
||||
->field('j_article.*,j_journal_stage.*,j_journal.jabbr,j_journal.usx,j_journal.title journal_title')
|
||||
->join('j_journal','j_article.journal_id = j_journal.journal_id','left')
|
||||
->join('j_journal_stage','j_article.journal_stage_id = j_journal_stage.journal_stage_id','left')
|
||||
->where('j_article.article_id','in',$ids)
|
||||
|
||||
@@ -26,6 +26,12 @@ class mail {
|
||||
// }
|
||||
}
|
||||
|
||||
public function puchAndFJ(Job $job, $data){
|
||||
$res = $this->sendFJ($data);
|
||||
$job->delete();
|
||||
}
|
||||
|
||||
|
||||
public function propa(Job $job, $data){
|
||||
$res = $this->push($data);
|
||||
$job->delete();
|
||||
@@ -55,4 +61,9 @@ class mail {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function sendFJ($data){
|
||||
sendEmail_data($data['email'],$data['title'],$data['fromname'],$data['content'],$data['temail'],$data['tpassword'],$data["fj"]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -130,6 +130,67 @@ function sendEmail($email = '', $title = '', $from_name = '', $content = '', $me
|
||||
return ['status' => $status, 'data' => $data]; //返回值(可选)
|
||||
}
|
||||
|
||||
function sendEmail_data($email = '', $title = '', $from_name = '', $content = '', $memail = '', $mpassword = '', $attachmentFile = '') {
|
||||
ini_set('memory_limit','3200M');
|
||||
date_default_timezone_set('PRC');
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
//Tell PHPMailer to use SMTP
|
||||
$mail->isSMTP();
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = client and server messages
|
||||
$mail->SMTPDebug = 0;
|
||||
//Ask for HTML-friendly debug output
|
||||
$mail->Debugoutput = 'html';
|
||||
//charset
|
||||
$mail->CharSet = 'UTF-8';
|
||||
//Set the hostname of the mail server
|
||||
$mail->Host = "smtp.qiye.aliyun.com"; //请填写你的邮箱服务器
|
||||
//Set the SMTP port number - likely to be 25, 465 or 587
|
||||
$mail->Port = 25; //端口号
|
||||
//Whether to use SMTP authentication
|
||||
$mail->SMTPAuth = true;
|
||||
//Username to use for SMTP authentication
|
||||
$mail->Username = $memail == '' ? "tmrweb@tmrjournals.com" : $memail; //发件邮箱用户名
|
||||
//Password to use for SMTP authentication
|
||||
$mail->Password = $mpassword == '' ? "Wu999999tmrwe" : $mpassword; //发件邮箱密码
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
|
||||
//Set an alternative reply-to address(用户直接回复邮件的地址)
|
||||
$mail->addReplyTo($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress($email);
|
||||
//Set the subject line
|
||||
$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);
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = '';
|
||||
// if (is_array($attachmentFile)) {
|
||||
// for ($i = 0; $i < count($attachmentFile); $i++) {
|
||||
// $mail->addAttachment($attachmentFile[$i], 'thanks.pdf' . $i); //这里可以是多维数组,然后循环附件的文件和名称
|
||||
// }
|
||||
// } else {
|
||||
if ($attachmentFile != '') {
|
||||
//Attach an image file
|
||||
$mail->addAttachment($attachmentFile, 'journal.zip');
|
||||
}
|
||||
// }
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
$status = 0;
|
||||
$data = "邮件发送失败" . $mail->ErrorInfo;
|
||||
;
|
||||
} else {
|
||||
$status = 1;
|
||||
$data = "邮件发送成功";
|
||||
}
|
||||
return ['status' => $status, 'data' => $data]; //返回值(可选)
|
||||
}
|
||||
|
||||
function sendEmail1($email = '', $title = '', $from_name = '', $content = '', $memail = '', $mpassword = '', $attachmentFile = '') {
|
||||
date_default_timezone_set('PRC');
|
||||
//Create a new PHPMailer instance
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
namespace app\master\controller;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
|
||||
use think\Queue;
|
||||
/**
|
||||
* @title 数据库接口
|
||||
* @description 数据库接口
|
||||
@@ -14,6 +14,7 @@ class Datebase extends Controller{
|
||||
protected $journal_obj = '';
|
||||
protected $article_obj = '';
|
||||
protected $journal_topic_obj = '';
|
||||
protected $article_author_obj = '';
|
||||
protected $journal_stage_obj = '';
|
||||
protected $journal_line_obj = '';
|
||||
protected $journal_notices_obj = '';
|
||||
@@ -32,6 +33,7 @@ class Datebase extends Controller{
|
||||
$this->journal_obj = Db::name('journal');
|
||||
$this->article_obj = Db::name('article');
|
||||
$this->journal_topic_obj = Db::name('journal_topic');
|
||||
$this->article_author_obj = Db::name('article_author');
|
||||
$this->journal_stage_obj = Db::name('journal_stage');
|
||||
$this->journal_line_obj = Db::name('journal_line');
|
||||
$this->journal_notices_obj = Db::name('journal_notices');
|
||||
@@ -205,4 +207,121 @@ class Datebase extends Controller{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 提交数据库
|
||||
* @description 提交数据库
|
||||
* @author wangjinlei
|
||||
* @url /master/Datebase/dataPush
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_stage_id type:int require:1 desc:分期id
|
||||
*
|
||||
*/
|
||||
public function dataPush(){
|
||||
$data = $this->request->post();
|
||||
// $data["journal_stage_id"] = 297;
|
||||
$stage_info = $this->journal_stage_obj->where("journal_stage_id",$data["journal_stage_id"])->find();
|
||||
$this->createEmailFile($data["journal_stage_id"]);
|
||||
$journal_info = $this->journal_obj->where("journal_id",$stage_info["journal_id"])->find();
|
||||
$zipfile = ROOT_PATH."public/dataFile/".$data["journal_stage_id"].'/'.$data["journal_stage_id"].'.zip';
|
||||
$tt = "Dear Database,<br><br>";
|
||||
$tt .= "Please find the PDF files in attachment of published issue (Vol. ".$stage_info['stage_vol'].", No.".$stage_info['stage_no'].") of ".$journal_info['title'].".<br><br>";
|
||||
$tt .= "Yours Sincerely<br>";
|
||||
$tt .= "Dan Chen<br>";
|
||||
$tt .= "Manager<br>";
|
||||
$tt .= "TMR Publishing Group | Editorial Office | New Zealand<br>";
|
||||
$tt .= "Telephone: +64 02108293806<br>";
|
||||
$tt .= "Email: publisher@tmrjournals.com<br>";
|
||||
$tt .= "Website:www.tmrjournals.com";
|
||||
|
||||
$elist = [];
|
||||
$elist[] = "jgatelicensing@informaticsglobal.com";
|
||||
$elist[] = "3601240974@qq.com";
|
||||
if($journal_info["journal_id"]==1){
|
||||
$elist[] = "958518573@qq.com";
|
||||
$elist[] = "swyy2@wanfangdata.com.cn";
|
||||
}
|
||||
$elist[] = "3097953993@qq.com";
|
||||
$elist[] = "849192806@qq.com";//皮皮
|
||||
$elist[] = "751475802@qq.com";//我
|
||||
foreach ($elist as $v){
|
||||
$cdata['email'] = $v;
|
||||
$cdata['title'] = "Data submitted-TMR Publishing Group";
|
||||
$cdata["fromname"] = "Data submitted-TMR Publishing Group";
|
||||
$cdata["content"] = $tt;
|
||||
$cdata["temail"] = $journal_info['email'];
|
||||
$cdata["tpassword"] = $journal_info['epassword'];
|
||||
$cdata["fj"] = $zipfile;
|
||||
Queue::push('app\api\job\mail@puchAndFJ', $cdata, "mail");
|
||||
// sendEmail_data($v, "Data submitted-TMR Publishing Group", "Data submitted-TMR Publishing Group", $tt, $journal_info['email'], $journal_info['epassword'],$zipfile);
|
||||
}
|
||||
|
||||
return jsonSuccess([]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function createEmailFile($journal_stage_id){
|
||||
$url = "http://ts.tmrjournals.com/api/dataApi/createTemplate";
|
||||
//查找分期信息
|
||||
$stage_info = $this->journal_stage_obj->where("journal_stage_id",$journal_stage_id)->find();
|
||||
$journal_info = $this->journal_obj->where("journal_id",$stage_info["journal_id"])->find();
|
||||
$re['issue'] = $stage_info['issue_date'].", Volume ".$stage_info['stage_vol']." Issue ".$stage_info["stage_no"];
|
||||
$adate = [];
|
||||
$alist = $this->article_obj->where("journal_stage_id",$journal_stage_id)->where("state",0)->order("npp")->select();
|
||||
foreach ($alist as $k => $v){
|
||||
$cache["type"] = $v["type"];
|
||||
$cache["npp"] = $v["npp"];
|
||||
$cache["title"] = $v["title"];
|
||||
$cache["author"] = $this->getAuthor($v);
|
||||
$adate[] = $cache;
|
||||
}
|
||||
$re["date_list"] = json_encode($adate);
|
||||
$res = myPost($url, $re);
|
||||
$r = object_to_array(json_decode($res));
|
||||
$file = $r['data']["file"];
|
||||
//创建目录加压缩操作
|
||||
$base_dir = ROOT_PATH."public/dataFile/".$stage_info["journal_stage_id"];
|
||||
if(!is_dir($base_dir)){
|
||||
@mkdir($base_dir);
|
||||
}
|
||||
$zip = new \ZipArchive;
|
||||
$zip->open($base_dir.'/'.$stage_info["journal_stage_id"].'.zip', \ZipArchive::CREATE);
|
||||
copy('http://ts.tmrjournals.com/upload/'.$file,$base_dir.'/'.$stage_info["journal_stage_id"].".docx");
|
||||
$zip->addFile($base_dir.'/'.$stage_info["journal_stage_id"].".docx","Contents.docx");
|
||||
foreach ($alist as $k=>$v){
|
||||
copy("https://www.tmrjournals.com/public/articlePDF/".$v['file_pdf'],$base_dir.'/'.$v["npp"].".pdf");
|
||||
$zip->addFile($base_dir.'/'.$v["npp"].".pdf",$v["npp"].".pdf");
|
||||
}
|
||||
//添加封面图片
|
||||
copy("https://www.tmrjournals.com/public/journalicon/".$journal_info["icon"],$base_dir."/journal.jpg");
|
||||
$zip->addFile($base_dir."/journal.jpg","journal.jpg");
|
||||
$zip->close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private function getAuthor($article) {
|
||||
$where['article_id'] = $article['article_id'];
|
||||
$where['state'] = 0;
|
||||
$list = $this->article_author_obj->where($where)->select();
|
||||
$frag = '';
|
||||
foreach ($list as $k => $v) {
|
||||
$frag = $frag == '' ? '' . $v['author_name'] : $frag . ', ' . $v['author_name'];
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1079,9 +1079,10 @@ class Journal extends Controller {
|
||||
}
|
||||
|
||||
public function myttt(){
|
||||
$this->msg_subscript_journal(5, 1);
|
||||
// $this->msg_subscript_journal(320, 1);
|
||||
}
|
||||
|
||||
|
||||
private function msg_subscript_journal($journal_stage_id,$journal_id){
|
||||
$articles = $this->article_obj->where('journal_stage_id',$journal_stage_id)->where('state',0)->select();
|
||||
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $journal_stage_id)->find();
|
||||
@@ -1124,7 +1125,8 @@ class Journal extends Controller {
|
||||
$maidata['title'] = $journal_info['title'];
|
||||
$maidata['content'] = $cache;
|
||||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||||
$maidata['tpassword'] = '999999Wu';
|
||||
$maidata['tpassword'] = 'pRWU999999';
|
||||
// sendEmail($maidata['email'],$maidata['title'],$maidata['title'],$maidata['content'],$maidata['tmail'],$maidata['tpassword']);
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
echo $v['email'];
|
||||
}
|
||||
|
||||
@@ -243,6 +243,7 @@ class Publish extends Controller {
|
||||
* @dates SUBJOURNAL:订阅期刊数
|
||||
* @dates SUBTOPIC:订阅话题数
|
||||
* @dates LYL:录用率
|
||||
* @dates JST:接收时间
|
||||
* @dates CC:查重
|
||||
* @dates WS:外审
|
||||
* @dates SJ:时间
|
||||
|
||||
Reference in New Issue
Block a user