This commit is contained in:
wangjinlei
2021-06-25 15:25:42 +08:00
parent 7d216a169d
commit a34439b183
5 changed files with 445 additions and 214 deletions

View File

@@ -160,6 +160,9 @@ class Article extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
@@ -227,6 +230,9 @@ class Article extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
@@ -258,6 +264,7 @@ class Article extends Controller {
*/
public function addArticleNum(){
$data = $this->request->post();
$this->article_obj->where('article_id',$data['article_id'])->setInc($data['type'].'_num');
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
@@ -330,6 +337,9 @@ class Article extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}

View File

@@ -233,6 +233,9 @@ class Journal extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
@@ -287,8 +290,9 @@ class Journal extends Controller {
} else {
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
}
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
// $cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
@@ -355,6 +359,9 @@ class Journal extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
@@ -392,6 +399,9 @@ class Journal extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
@@ -448,6 +458,9 @@ class Journal extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
@@ -531,6 +544,9 @@ class Journal extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
@@ -703,7 +719,7 @@ class Journal extends Controller {
*/
public function getTopicForSubscribe() {
$data = $this->request->post();
$list = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('state', 0)->where('level', 2)->select();
$list = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('state', 0)->where('is_final', 1)->select();
$re['topics'] = $list;
return jsonSuccess($re);
@@ -751,6 +767,57 @@ class Journal extends Controller {
return jsonSuccess([]);
}
/**
* @title 添加期刊话题订阅(批量)
* @description 添加期刊话题订阅(批量)
* @author wangjinlei
* @url /api/Journal/addSubscribeTopics
* @method POST
*
* @param name:topic_ids type:string require:1 desc:期刊话题id(1,2,3,4)
* @param name:email type:string require:1 desc:邮箱地址
*/
public function addSubscribeTopics() {
$data = $this->request->post();
// $topics = explode(',', $data['topic_ids']);
$topics = $data['topic_ids'];
$str = '';
foreach ($topics as $k => $v) {
//去重
$repeat = $this->subscribe_topic_obj
->where('topic_id', $v)
->where('email', $data['email'])
->where('state', 0)
->find();
if ($repeat) {
continue;
}
$insert['topic_id'] = $v;
$insert['email'] = $data['email'];
$id = $this->subscribe_topic_obj->insertGetId($insert);
$cache_info = $this->journal_topic_obj->where('journal_topic_id',$v)->find();
$str .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeTopic/snum/' . $id . '">Unsubscribe topic->'.$cache_info['title'].'</a><br>';
}
if($str==''){
return jsonError('repeat subscribe!');
}
//发送邮件感谢
$tt = 'Dear Researcher,<br><br>';
$tt .= 'Welcome you to the email alert for the latest research and more. Thank you for your interest in our publications and topics.<br>';
$tt .= $str;
$tt .= 'This service is provided by TMR Publishing Group | New Zealand<br>';
$tt .= 'Telephone: +64 02108293806';
$tt .= 'Email: publisher@tmrjournals.com';
$tt .= 'www.tmrjournals.com';
$maidata['email'] = $data['email'];
$maidata['title'] = 'Thank you for subscribing.';
$maidata['content'] = $tt;
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
$maidata['tpassword'] = 'pRWU999999';
Queue::push('app\api\job\mail@fire', $maidata, "mail");
return jsonSuccess([]);
}
/**
* @title 添加期刊话题订阅
* @description 添加期刊话题订阅
@@ -863,6 +930,9 @@ class Journal extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
@@ -922,6 +992,9 @@ class Journal extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
//斜体变红
@@ -978,7 +1051,7 @@ class Journal extends Controller {
}
//组装作者
$arts = [];
if(isset($data['author']) && $data['author'] != ''){
if (isset($data['author']) && $data['author'] != '') {
$arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['author']) . '%')->column('article_id');
if (count($arts) == 0) {
$re['articles'] = [];
@@ -1063,54 +1136,54 @@ class Journal extends Controller {
* @return articles:文章信息#
* @return count:总数
*/
public function searchArticleMenu(){
public function searchArticleMenu() {
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
//组合where语句
$where_str = '';
if($data['key1'] == 'author'){
if ($data['key1'] == 'author') {
$arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['val1']) . '%')->column('article_id');
$a_str = '(' . implode(',', $arts) . ')';
$where_str = '(article_id in '. $a_str;
}else{
$where_str = '('.$data['key1'].' like "%'.$data['val1'].'%"';
$where_str = '(article_id in ' . $a_str;
} else {
$where_str = '(' . $data['key1'] . ' like "%' . $data['val1'] . '%"';
}
if(isset($data['key2'])&&$data['key2']!=''){
if($data['oper'] == 'and'){
if (isset($data['key2']) && $data['key2'] != '') {
if ($data['oper'] == 'and') {
$where_str = $where_str . ' and ';
}else{
} else {
$where_str = $where_str . ' or ';
}
if($data['key2'] == 'author'){
if ($data['key2'] == 'author') {
$arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['val2']) . '%')->column('article_id');
$a_str = '(' . implode(',', $arts) . ')';
$where_str = $where_str.' article_id in '. $a_str;
}else{
$where_str = $where_str.' '.$data['key2'].' like "%'.$data['val2'].'%"';
$where_str = $where_str . ' article_id in ' . $a_str;
} else {
$where_str = $where_str . ' ' . $data['key2'] . ' like "%' . $data['val2'] . '%"';
}
}
//处理journal_id
$where_str = $where_str . ') and journal_id in ('.trim($data['journal_id']).') and state = 0 ';
$where_str = $where_str . ') and journal_id in (' . trim($data['journal_id']) . ') and state = 0 ';
//处理order
$order_str = '';
if($data['key1']=='title'&&(isset($data['key2'])&&$data['key2']=='title')){
if ($data['key1'] == 'title' && (isset($data['key2']) && $data['key2'] == 'title')) {
$order_str = "((CASE WHEN title LIKE '%" . trim($data['val1']) . "%' THEN 1 ELSE 0 END) + (CASE WHEN title LIKE '%" . trim($data['val2']) . "%' THEN 1 ELSE 0 END)) desc";
}elseif($data['key1']=='title'||(isset($data['key2'])&&$data['key2']=='title')){
if($data['key1']=='title'){
} elseif ($data['key1'] == 'title' || (isset($data['key2']) && $data['key2'] == 'title')) {
if ($data['key1'] == 'title') {
$order_str = "(CASE WHEN title LIKE '%" . trim($data['val1']) . "%' THEN 1 ELSE 0 END) desc";
}else{
} else {
$order_str = "(CASE WHEN title LIKE '%" . trim($data['val2']) . "%' THEN 1 ELSE 0 END) desc";
}
}else{
} else {
$order_str = "article_id desc";
}
$list = $this->article_obj
->where($where_str)
->orderRaw($order_str)
->limit($limit_start,$data['pageSize'])
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->article_obj
->where($where_str)
@@ -1124,6 +1197,9 @@ class Journal extends Controller {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$cache_topic = $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',$v['article_id'])->where('j_article_to_topic.state',0)->select();
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
//斜体变红
@@ -1132,10 +1208,10 @@ class Journal extends Controller {
foreach ($caches as $val) {
$cache_title = str_replace($val, '<i>' . $val . '</i>', $cache_title);
}
if ($data['key1']=='title') {
if ($data['key1'] == 'title') {
$cache_title = str_replace(trim($data['val1']), '<b style="color:#c00">' . $data['val1'] . '</b>', $cache_title);
}
if (isset($data['key2'])&&$data['key2']=='title') {
if (isset($data['key2']) && $data['key2'] == 'title') {
$cache_title = str_replace(trim($data['val2']), '<b style="color:#c00">' . $data['val2'] . '</b>', $cache_title);
}
$list[$k]['title'] = $cache_title;
@@ -1144,7 +1220,6 @@ class Journal extends Controller {
$re['articles'] = $list;
$re['count'] = $count;
return jsonSuccess($re);
}
}

View File

@@ -579,4 +579,5 @@ class Main extends Controller {
// die;
// }
}

View File

@@ -175,3 +175,39 @@ function myPost($url, $param=array()){
}
function ORCIDPost($url, $param=array()){
if(!is_array($param)){
throw new Exception("参数必须为array");
}
$headerArray = ['Content-Type: application/x-www-form-urlencoded'];
$httph =curl_init($url);
curl_setopt($httph, CURLOPT_SSL_VERIFYPEER, false);
// curl_setopt($httph, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($httph,CURLOPT_RETURNTRANSFER,1);
curl_setopt($httph, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
curl_setopt($httph, CURLOPT_POST, 1);//设置为POST方式
curl_setopt($httph, CURLOPT_POSTFIELDS, $param);
curl_setopt($httph, CURLOPT_HTTPHEADER,$headerArray);
// curl_setopt($httph, CURLOPT_RETURNTRANSFER,0);
// curl_setopt($httph, CURLOPT_HEADER,1);
$rst=curl_exec($httph);
curl_close($httph);
return $rst;
}

View File

@@ -434,9 +434,6 @@ class Article extends Controller {
* @param name:doi type:string require:1 desc:doi
* @param name:abstract type:string require:1 desc:简介
* @param name:keywords type:string require:1 desc:关键字
* @param name:abs_num type:int require:1 desc:简介数量
* @param name:pdf_num type:int require:1 desc:pdf数量
* @param name:html_num type:int require:1 desc:html数量
* @param name:ltai type:string require:0 desc:标题斜体(demo1,demo2)
* @param name:npp type:strng require:1 desc:文章页码
* @param name:type type:string require:1 desc:类型
@@ -462,9 +459,9 @@ class Article extends Controller {
$updata['doi'] = $data['doi'];
$updata['abstract'] = $data['abstract'];
$updata['keywords'] = $data['keywords'];
$updata['abs_num'] = $data['abs_num'];
$updata['pdf_num'] = $data['pdf_num'];
$updata['html_num'] = $data['html_num'];
// $updata['abs_num'] = $data['abs_num'];
// $updata['pdf_num'] = $data['pdf_num'];
// $updata['html_num'] = $data['html_num'];
$updata['npp'] = $data['npp'];
$updata['type'] = $data['type'];
$updata['cited'] = $data['cited'];
@@ -1018,4 +1015,116 @@ class Article extends Controller {
$re['cites'] = $list;
return jsonSuccess($re);
}
/**
* @title 注册doi
* @description 注册doi
* @author wangjinlei
* @url /master/Article/agentDOI
* @method POST
*
* @param name:doi type:string require:1 desc:doi号
* @param name:article_id type:int require:1 desc:文章id
*/
public function agentDOI(){
$data = $this->request->post();
$data['doi'] = '10.12032/TMR20210301222';
$data['article_id'] = 1333;
$xml = '';
//create xml 头
$xml .= '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
$xml .= '<doi_batch version="1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\jboss-4.0.3SP1\wanfang\jboss-4.0.3SP1\server\default\deploy\WanFang.war\check.xsd">'.PHP_EOL.PHP_EOL;
$xml .= '<head>'.PHP_EOL;
$xml .= '<doi_batch_id>'.date('Ymd').'</doi_batch_id>'.PHP_EOL;
$xml .= '<timestamp>'.date('YmdHis').'</timestamp>'.PHP_EOL;
$xml .= '<depositor>'.PHP_EOL;
$xml .= '<name>TMR2015@163.com</name>'.PHP_EOL;
$xml .= '<email_address>TMR2015@163.com</email_address>'.PHP_EOL;
$xml .= '</depositor>'.PHP_EOL;
$xml .= '<registrant>传统医学研究(英文版)</registrant>'.PHP_EOL;
$xml .= '</head>'.PHP_EOL;
//组装主体信息部分
$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();
$stage_info = $this->journal_stage_obj->where('journal_stage_id',$article_info['journal_stage_id'])->find();
$xml .= '<body>'.PHP_EOL;
$xml .= '<journal>'.PHP_EOL;
$xml .= '<journal_metadata>'.PHP_EOL;
$xml .= '<journal_id>'.$journal_info['usx'].'</journal_id>'.PHP_EOL;
$xml .= '<full_title>'.$journal_info['title'].'</full_title>'.PHP_EOL;
$xml .= '<issn media_type="print">'.$journal_info['issn'].'</issn>'.PHP_EOL;
$xml .= '<cn media_type="print"></cn>'.PHP_EOL;
$xml .= '</journal_metadata>'.PHP_EOL;
$xml .= '<journal_issue>'.PHP_EOL;
$xml .= '<publication_date media_type="print">'.PHP_EOL;
$xml .= '<year>'.$stage_info['stage_year'].'</year>'.PHP_EOL;
$xml .= '<month/>'.PHP_EOL;
$xml .= '<day/>'.PHP_EOL;
$xml .= '</publication_date>'.PHP_EOL;
$xml .= '<journal_volume>'.PHP_EOL;
$xml .= '<volume>'.$stage_info['stage_vol'].'</volume>'.PHP_EOL;
$xml .= '</journal_volume>'.PHP_EOL;
$xml .= '<issue>'.$stage_info['stage_no'].'</issue>'.PHP_EOL;
$xml .= '</journal_issue>'.PHP_EOL;
$xml .= '<journal_article>'.PHP_EOL;
$xml .= '<titles>'.PHP_EOL;
$xml .= '<title>'.$article_info['title'].'</title>'.PHP_EOL;
$xml .= '<subtitle></subtitle>'.PHP_EOL;
$xml .= '</titles>'.PHP_EOL;
$xml .= '<contributors>'.PHP_EOL;
$xml .= '<contributors>'.PHP_EOL;
$authors = $this->article_author_obj->where('article_id',$data['article_id'])->where('state',0)->select();
$address = '';
$author = '';
foreach ($authors as $v){
if($v['is_first']==1){
$ca = $this->author_to_organ_obj->where('article_author_id',$v['article_author_id'])->where('article_id',$data['article_id'])->find();
$ca_organ = $this->article_organ_obj->where('article_organ_id',$ca['article_organ_id'])->find();
$address = $ca_organ['organ_name'];
}
$author .= $v['author_name'].',';
}
$xml .= '<person_name sequence="first" contributor_role="author">'.substr($author,-1).'</person_name>'.PHP_EOL;
$xml .= '<organization sequence="first" contributor_role="author">'.$address.'</organization>'.PHP_EOL;
$xml .= '</contributors>'.PHP_EOL;
$xml .= '<keywords></keywords>'.PHP_EOL;
$xml .= '<keywords>'. str_replace(',', ' ', $article_info['keywords']).'</keywords>'.PHP_EOL;
$xml .= '<abstract></abstract>'.PHP_EOL;
$xml .= '<abstract>'.str_replace('Abstract','',strip_tags(str_replace("&nbsp;","",htmlspecialchars_decode($article_info['abstract'])))).'</abstract>'.PHP_EOL;
$xml .= '<doi_data>'.PHP_EOL;
$xml .= '<doi>'.$article_info['doi'].'</doi>'.PHP_EOL;
$xml .= '<resource><![CDATA[https://www.tmrjournals.com/article.html?J_num='.$journal_info['journal_id'].'&a_id='.$article_info['article_id'].']]></resource>'.PHP_EOL;
$xml .= '</doi_data>'.PHP_EOL;
$xml .= '<pages>'.PHP_EOL;
$start = '';
$end = '';
if(stripos($article_info['npp'],'-')>0){
$ca_list = explode('-', $article_info['npp']);
$start = $ca_list[0];
$end = $ca_list[1];
}else{
$start = $article_info['npp'];
}
$xml .= '<first_page>'.$start.'</first_page>'.PHP_EOL;
$xml .= '<last_page>'.$end.'</last_page>'.PHP_EOL;
$xml .= '</pages>'.PHP_EOL;
$xml .= '</journal_article>'.PHP_EOL;
$txt = ROOT_PATH . 'public' . DS . 'xml'.DS.$article_info['article_id'].'.xml';
file_put_contents($txt, $xml);
}
public function upXML(){
vendor("chinadoi.UPXML2");
$up_obj = new \UpXml;
$xmlfile = ROOT_PATH . 'public' . DS . 'xml'.DS.'1333.xml';
$result = $up_obj->upload($xmlfile);
echo '<pre>';
var_dump($result);
echo '</pre>';
die;
}
}