20201112
This commit is contained in:
@@ -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'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user