This commit is contained in:
wangjinlei
2021-12-20 17:12:23 +08:00
parent c80c9f8da7
commit 49f170a778
12 changed files with 1784 additions and 390 deletions

View File

@@ -29,6 +29,8 @@ class Article extends Controller {
protected $country_obj = '';
protected $subscribe_journal_obj = '';
protected $subscribe_topic_obj = '';
protected $base_topic_obj = '';
protected $subscribe_base_topic_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -47,6 +49,8 @@ class Article extends Controller {
$this->country_obj = Db::name('country');
$this->subscribe_journal_obj = Db::name('subscribe_journal');
$this->subscribe_topic_obj = Db::name('subscribe_topic');
$this->base_topic_obj = Db::name('base_topic');
$this->subscribe_base_topic_obj = Db::name('subscribe_base_topic');
}
/**
@@ -377,9 +381,7 @@ class Article extends Controller {
* @articleInfo sort:权重
* @articleInfo pub_date:发表日期
*
*
* @return files:文件列表#
*
*/
public function getArticleBase() {
$data = $this->request->post();
@@ -650,12 +652,47 @@ class Article extends Controller {
$insert['topic_id'] = $data['topic_id'];
$res = $this->article_to_topic_obj->insert($insert);
$this->msg_subscript_topic($data['topic_id'], $data['article_id']);
$this->msg_subscribe_base_topic($data['topic_id'], $data['article_id']);
if ($res) {
return json(['code' => 0, 'msg' => 'success']);
} else {
return json(['code' => 1, 'msg' => 'system error']);
}
}
private function msg_subscribe_base_topic($topic_id,$article_id){
$article_info = $this->article_obj->where('article_id',$article_id)->find();
$topic_info = $this->journal_topic_obj->where('journal_topic_id',$topic_id)->find();
$base_topic_info = $this->base_topic_obj->where('title',$topic_info['title'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
if($base_topic_info==null){
return ;
}
$list = $this->subscribe_base_topic_obj->where('base_topic_id',$base_topic_info['base_topic_id'])->where('state',0)->select();
$title = 'These new articles included in TMRDE database are available online.';
$tt = 'Dear Researcher,<br>';
$tt .= 'It is our great honor to present you the articles included in TMRDE.The following new articles have just been included.<br>';
$tt .= '<a href="https://www.tmrjournals.com/article.html?J_num='.$article_info['journal_id'].'&a_id='.$article_id.'">'.$article_info['title'].'</a><br>';
foreach ($list as $v){
$tt1='';
$tt1 .= $tt;
$tt1 .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeBaseTopic/snum/' . $v['subscribe_base_topic_id'] . '">Unsubscribe</a><br><br>';
$tt1 .= 'Email:'.$journal_info['email'].'<br>';
$tt1 .= 'Website:'.$journal_info['website'].'<br><br>';
$tt1 .= 'TMR Publishing Group Ltd.<br>';
$tt1 .= '11 Cockle Bay Rd, Cockle Bay, Auckland, New Zealand<br>';
$tt1 .= 'Tel: +64 02108293806.';
$maidata['email'] = $v['email'];
$maidata['title'] = $title;
$maidata['content'] = $tt1;
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
$maidata['tpassword'] = 'pRWU999999';
Queue::push('app\api\job\mail@fire', $maidata, "mail");
}
}
private function msg_subscript_topic($topic_id, $article_id) {
$article_info = $this->article_obj->where('article_id', $article_id)->find();
@@ -704,7 +741,7 @@ class Article extends Controller {
$maidata['title'] = $journal_info['title'];
$maidata['content'] = $cache;
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
$maidata['tpassword'] = '999999Wu';
$maidata['tpassword'] = 'pRWU999999';
Queue::push('app\api\job\mail@fire', $maidata, "mail");
}
}
@@ -740,22 +777,22 @@ class Article extends Controller {
}
}
public function mycc() {
$list = $this->article_author_obj->where('article_author_id', '>', 5126)->select();
foreach ($list as $v) {
$ca = explode(' ', $v['author_name']);
$caf = '';
$cal = '';
if (isset($ca[0])) {
$caf = str_replace('-', '', $ca[0]);
}
if (isset($ca[1])) {
$cal = $ca[1];
}
$this->article_author_obj->where('article_author_id', $v['article_author_id'])->update(['first_name' => $caf, 'last_name' => $cal]);
}
echo 'over';
}
// public function mycc() {
// $list = $this->article_author_obj->where('article_author_id', '>', 5126)->select();
// foreach ($list as $v) {
// $ca = explode(' ', $v['author_name']);
// $caf = '';
// $cal = '';
// if (isset($ca[0])) {
// $caf = str_replace('-', '', $ca[0]);
// }
// if (isset($ca[1])) {
// $cal = $ca[1];
// }
// $this->article_author_obj->where('article_author_id', $v['article_author_id'])->update(['first_name' => $caf, 'last_name' => $cal]);
// }
// echo 'over';
// }
/**
* @title 图片上传
@@ -848,6 +885,29 @@ class Article extends Controller {
}
}
}
/**
* @title imgCome文件上传
* @description imgCome文件上传
* @author wangjinlei
* @url /master/Article/up_imgCome_file
* @method POST
*
* @param name:name type:string require:1 default:imgCome desc:文件域名称
*
* @return upurl:图片地址
*/
public function up_imgCome_file(){
$file = request()->file('imgCome');
if ($file) {
$info = $file->move(ROOT_PATH . 'public' . DS . 'imgCome');
if ($info) {
return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
} else {
return json(['code' => 1, 'msg' => $file->getError()]);
}
}
}
/**
* @title 文章文件上传
@@ -1177,8 +1237,8 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
$xml .= '<body>' . PHP_EOL;
$xml .= '<journal>' . PHP_EOL;
$xml .= '<journal_metadata language="en">' . PHP_EOL;
$xml .= '<full_title>' . $journal_info['title'] . '</full_title>' . PHP_EOL;
$xml .= '<abbrev_title>' . $journal_info['jabbr'] . '</abbrev_title>' . PHP_EOL;
$xml .= '<full_title>' . str_replace("&", "and", $journal_info['title']) . '</full_title>' . PHP_EOL;
$xml .= '<abbrev_title>' . str_replace('&', 'and', $journal_info['jabbr']) . '</abbrev_title>' . PHP_EOL;
$xml .= '<issn media_type="print">' . $journal_info['issn'] . '</issn>' . PHP_EOL;
$xml .= '<coden>' . $journal_info['usx'] . '</coden>' . PHP_EOL;
$xml .= '</journal_metadata>' . PHP_EOL;
@@ -1193,7 +1253,7 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
$xml .= '</journal_issue>' . PHP_EOL;
$xml .= '<journal_article publication_type="full_text">' . PHP_EOL;
$xml .= '<titles>' . PHP_EOL;
$xml .= '<title>' . $article_info['title'] . '</title>' . PHP_EOL;
$xml .= '<title>' . str_replace("&", "and", $article_info['title']) . '</title>' . PHP_EOL;
$xml .= '</titles>' . PHP_EOL;
$xml .= '<contributors>' . PHP_EOL;
$authors = $this->article_author_obj->where('article_id', $data['article_id'])->where('state', 0)->select();
@@ -1347,8 +1407,8 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
*/
public function agentDOI() {
$data = $this->request->post();
$data['doi'] = '10.12032/TMR20210301222';
$data['article_id'] = 1333;
// $data['doi'] = '10.12032/TMR20210301222';
// $data['article_id'] = 1333;
$xml = '';