admin_obj = Db::name('admin'); $this->journal_obj = Db::name('journal'); $this->article_obj = Db::name('article'); $this->article_author_obj = Db::name('article_author'); $this->article_organ_obj = Db::name('article_organ'); $this->article_ltai_obj = Db::name('article_ltai'); $this->article_cite_obj = Db::name('article_cite'); $this->author_to_organ_obj = Db::name('article_author_to_organ'); $this->article_to_topic_obj = Db::name('article_to_topic'); $this->journal_topic_obj = Db::name('journal_topic'); $this->journal_stage_obj = Db::name('journal_stage'); $this->journal_special_obj = Db::name('journal_special'); $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'); } /** * @title 获取期刊和分期 * @description 获取期刊和分期 * @author wangjinleichang * @url /master/Article/getJournalAndStage * @method POST * * @param name:editor_id type:int require:1 desc:编辑id * * @return joutaglist:array# * */ public function getJournalAndStage() { $data = $this->request->post(); $journal_list = $this->journal_obj->where('editor_id', $data['editor_id'])->where('state', 0)->select(); $frag = []; foreach ($journal_list as $v) { $v['journal_stage_id'] = $v['journal_id']; $cache_list = $this->journal_stage_obj->where('journal_id', $v['journal_id'])->where('state', 0)->select(); foreach ($cache_list as $k => $vv) { $cache_list[$k]['title'] = $vv['stage_year'] . ' Vol.' . $vv['stage_vol'] . ' issue.' . $vv['stage_no'] . $vv['stage_pagename'] . $vv['stage_page']; } if (count($cache_list) > 0) { $v['children'] = $cache_list; } else { $v['children'] = []; } $frag[] = $v; } return json(['code' => 0, 'msg' => 'success', 'data' => ['joutaglist' => $frag]]); } /** * @title 添加文章基本信息 * @description 添加文章基本信息 * @author wangjinleichang * @url /master/Article/addArticleBase * @method POST * * @param name:journal_id type:int require:1 desc:期刊id * @param name:journal_stage_id type:int require:1 desc:分期id * @param name:sort type:int require:1 default:0 desc:权重 * @param name:title type:string require:1 desc:标题 */ public function addArticleBase() { $data = $this->request->post(); $insert_data['journal_id'] = $data['journal_id']; $insert_data['journal_stage_id'] = $data['journal_stage_id']; $insert_data['title'] = $data['title']; $insert_data['sort'] = $data['sort']; $insert_data['ctime'] = time(); $res = $this->article_obj->insert($insert_data); if ($res) { return json(['code' => 0, 'msg' => 'success']); } else { return json(['code' => 1, 'msg' => 'system error']); } } /** * @title 删除文章 * @description 删除文章 * @author wangjinleichang * @url /master/Article/delArticle * @method POST * * @param name:article_id type:int require:1 desc:文章id */ public function delArticle() { $data = $this->request->post(); $res = $this->article_obj->where('article_id', $data['article_id'])->update(['state' => 1]); return json(['code' => 0, 'msg' => 'success']); } /** * @title 添加文章作者 * @description 添加文章作者 * @author wangjinleichang * @url /master/Article/addArticleAuthor * @method POST * * @param name:article_id type:int require:1 desc:article_id * @param name:author_name type:string require:1 desc:作者名字 * @param name:author_country type:string require:1 desc:国家 * @param name:orcid type:string require:0 desc:orcid * @param name:is_first type:boolean require:1 default:0 desc:是否第一作者(1yes0no) * @param name:is_report type:boolean require:1 default:0 desc:是否通讯作者(1yes0no) * @param name:email type:string require:0 desc:邮箱 * @param name:organs type:string require:1 desc:array * */ public function addArticleAuthor() { $data = $this->request->post(); $insert_author['article_id'] = $data['article_id']; $insert_author['author_name'] = trim($data['author_name']); //处理名字 $ca = explode(' ', $insert_author['author_name']); $caf = ''; $cal = ''; if (isset($ca[0])) { $caf = str_replace('-', '', $ca[0]); } if (isset($ca[1])) { $cal = $ca[1]; } $insert_author['first_name'] = $caf; $insert_author['last_name'] = $cal; $insert_author['orcid'] = isset($data['orcid']) ? $data['orcid'] : ''; $insert_author['author_country'] = $data['author_country']; $insert_author['is_first'] = $data['is_first']; $insert_author['is_report'] = $data['is_report']; $insert_author['email'] = intval($data['is_report']) == 1 ? $data['email'] : ''; Db::startTrans(); $insert_id = $this->article_author_obj->insertGetId($insert_author); $or_res = true; if (isset($data['organs']) && is_array($data['organs'])) { foreach ($data['organs'] as $k => $v) { $cache_ins['article_id'] = $data['article_id']; $cache_ins['article_author_id'] = $insert_id; $cache_ins['article_organ_id'] = $v; $or_res = $this->author_to_organ_obj->insert($cache_ins) ? true : false; } } if ($insert_id && $or_res) { Db::commit(); return json(['code' => 0, 'msg' => 'success']); } else { Db::rollback(); return json(['code' => 1, 'msg' => 'system error']); } } /** * @title 编辑文章作者 * @description 编辑文章作者 * @author wangjinleichang * @url /master/Article/editArticleAuthor * @method POST * * @param name:article_author_id type:int require:1 desc:article_id * @param name:author_name type:string require:1 desc:作者名字 * @param name:orcid type:string require:0 desc:orcid * @param name:author_country type:string require:1 desc:国家 * @param name:is_first type:boolean require:1 default:0 desc:是否第一作者(1yes0no) * @param name:is_report type:boolean require:1 default:0 desc:是否通讯作者(1yes0no) * @param name:email type:string require:0 desc:邮箱 * @param name:organs type:string require:1 desc:array * */ public function editArticleAuthor() { $data = $this->request->post(); // $data['article_author_id'] = 21; // $data['article_id'] = 38; // $data['author_name'] = '作者3'; // $data['author_country'] = 'Netherlands'; // $data['is_first'] = 1; // $data['is_report'] = 1; // $data['email'] = 'xl37@163.com'; // $data['organs'] = ['1','2','3']; $old_article_author_info = $this->article_author_obj->where('article_author_id', $data['article_author_id'])->find(); $update_author['author_name'] = trim($data['author_name']); //处理名字 $ca = explode(' ', $update_author['author_name']); $caf = ''; $cal = ''; if (isset($ca[0])) { $caf = str_replace('-', '', $ca[0]); } if (isset($ca[1])) { $cal = $ca[1]; } $update_author['first_name'] = $caf; $update_author['last_name'] = $cal; $update_author['orcid'] = isset($data['orcid']) ? $data['orcid'] : ''; $update_author['author_country'] = $data['author_country']; $update_author['is_first'] = $data['is_first']; $update_author['is_report'] = $data['is_report']; $update_author['email'] = intval($data['is_report']) == 1 ? $data['email'] : ''; $this->article_author_obj->where('article_author_id', $data['article_author_id'])->update($update_author); if (is_array($data['organs'])) { $has_ids = []; foreach ($data['organs'] as $v) { $cache_one = $this->author_to_organ_obj->where('article_author_id', $data['article_author_id'])->where('article_organ_id', $v)->where('state', 0)->find(); if ($cache_one == null) { $insert['article_id'] = $old_article_author_info['article_id']; $insert['article_author_id'] = $data['article_author_id']; $insert['article_organ_id'] = $v; $this->author_to_organ_obj->insert($insert); } $has_ids[] = intval($v); } $this->author_to_organ_obj->where('article_author_id', $data['article_author_id'])->where('state', 0)->where('article_organ_id', 'not in', $has_ids)->update(['state' => 1]); } else { $this->author_to_organ_obj->where('article_author_id', $data['article_author_id'])->where('state', 0)->update(['state' => 1]); } return json(['code' => 0, 'msg' => 'success']); } /** * @title 删除文章作者 * @description 删除文章作者 * @author wangjinleichang * @url /master/Article/delArticleAuthor * @method POST * * @param name:article_author_id type:int require:1 desc:article_id * */ public function delArticleAuthor() { $data = $this->request->post(); //删除作者和机构的关系 $this->author_to_organ_obj->where('article_author_id', $data['article_author_id'])->update(['state' => 1]); $this->article_author_obj->where('article_author_id', $data['article_author_id'])->update(['state' => 1]); return json(['code' => 0, 'msg' => 'success']); } /** * @title 获取文章作者和机构 * @description 获取文章作者和机构 * @author wangjinleichang * @url /master/Article/getArticleAuthor * @method POST * * @param name:article_id type:int require:1 desc:article_id * * @return authorList:array# * @return organList:array# */ public function getArticleAuthor() { $data = $this->request->post(); $author_list = $this->article_author_obj->where('article_id', $data['article_id'])->where('state', 0)->select(); foreach ($author_list as $k => $v) { $cache_to = $this->author_to_organ_obj ->field('j_article_author_to_organ.*,j_article_organ.organ_name') ->join('j_article_organ', 'j_article_organ.article_organ_id = j_article_author_to_organ.article_organ_id') ->where('j_article_author_to_organ.article_author_id', $v['article_author_id']) ->where('j_article_author_to_organ.state', 0) ->select(); $cache_frag = []; foreach ($cache_to as $vv) { $cache_frag[] = $vv; } $author_list[$k]['organs'] = $cache_frag; } $organ_list = $this->article_organ_obj->where('article_id', $data['article_id'])->where('state', 0)->select(); return json(['code' => 0, 'msg' => 'success', 'data' => ['authorList' => $author_list, 'organList' => $organ_list]]); } /** * @title 添加文章作者机构 * @description 添加文章作者机构 * @author wangjinleichang * @url /master/Article/addArticleOrgan * @method POST * * @param name:article_id type:int require:1 desc:article_id * @param name:organ_name type:string require:1 desc:机构名字 */ public function addArticleOrgan() { $data = $this->request->post(); $insert_data['article_id'] = $data['article_id']; $insert_data['organ_name'] = $data['organ_name']; $res = $this->article_organ_obj->insert($insert_data); if ($res) { return json(['code' => 0, 'msg' => 'success']); } else { return json(['code' => 1, 'msg' => 'system error']); } } /** * @title 编辑文章作者机构 * @description 编辑文章作者机构 * @author wangjinleichang * @url /master/Article/editArticleOrgan * @method POST * * @param name:article_organ_id type:int require:1 desc:article_organ_id * @param name:organ_name type:string require:1 desc:机构名字 */ public function editArticleOrgan() { $data = $this->request->post(); $this->article_organ_obj->where('article_organ_id', $data['article_organ_id'])->update(['organ_name' => $data['organ_name']]); return json(['code' => 0, 'msg' => 'success']); } /** * @title 删除文章作者机构 * @description 删除文章作者机构 * @author wangjinleichang * @url /master/Article/delArticleOrgan * @method POST * * @param name:article_organ_id type:int require:1 desc:article_organ_id */ public function delArticleOrgan() { $data = $this->request->post(); //删除作者和机构的关系 $this->author_to_organ_obj->where('article_organ_id', $data['article_organ_id'])->update(['state' => 1]); $this->article_organ_obj->where('article_organ_id', $data['article_organ_id'])->update(['state' => 1]); return json(['code' => 0, 'msg' => 'success']); } /** * @title 获取文章基本信息 * @description 获取文章基本信息 * @author wangjinleichang * @url /master/Article/getArticleBase * @method POST * * @param name:article_id type:int require:1 desc:文章id * * @return journal:期刊信息# * @return articleInfo:文章详情@ * @articleInfo icon:图片 * @articleInfo tradition_tag:封皮标签 * @articleInfo tradition:封皮简介 * @articleInfo doi:doi * @articleInfo abstract:简介 * @articleInfo keywords:关键字 * @articleInfo fund:fund * @articleInfo file_html:html文件 * @articleInfo sort:权重 * @articleInfo pub_date:发表日期 * * @return files:文件列表# */ public function getArticleBase() { $data = $this->request->post(); $article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); $ltais = $this->article_ltai_obj->where('article_id', $article_info['article_id'])->where('state', 0)->column('content'); $article_info['ltai'] = implode(',', $ltais); $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find(); $list = scandir(ROOT_PATH . 'public/articleHTML/' . trim($journal_info['sx'])); $frag = []; foreach ($list as $k => $v) { if ($k > 1) { $frag[] = ['val' => $v]; } } $re['journal'] = $journal_info; $re['articleInfo'] = $article_info; $re['files'] = $frag; return jsonSuccess($re); // return json(['code'=>0,'msg'=>'success','data'=>$article_info]); } public function getHtmlFiles() { $data = $this->request->post(); $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(); $list = scandir(ROOT_PATH . 'public/articleHTML/' . $journal_info['sx']); $frag = []; foreach ($list as $k => $v) { if ($k > 1) { $frag[] = $v; } } return jsonSuccess($data); // $list = scandir(ROOT_PATH.'public/articleHTML/TMR'); // echo '
';
//        var_dump($list);
//        echo '
'; // die; } /** * @title 编辑文章基本信息 * @description 编辑文章基本信息 * @author wangjinleichang * @url /master/Article/editArticleBase * @method POST * * @param name:article_id type:int require:1 desc:文章id * @param name:title type:string require:1 desc:标题 * @param name:subtitle type:string require:0 desc:副标题 * @param name:rotation type:string require:0 desc:轮播图 * @param name:icon type:string require:1 desc:图片 * @param name:tradition_tag type:string require:1 desc:封皮标签 * @param name:tradition type:string require:1 desc:封皮简介 * @param name:journal_stage_id type:int require:1 desc:期刊分期id * @param name:journal_special_id type:int require:1 desc:客座期刊id * @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:ltai type:string require:0 desc:标题斜体(demo1,demo2) * @param name:npp type:strng require:1 desc:文章页码 * @param name:type type:string require:1 desc:类型 * @param name:cited type:int require:1 desc:引用数 * @param name:abbr type:string require:0 desc:作者简称 * @param name:sort type:int require:1 desc:权重 * @param name:file_html type:string require:0 desc:html文件 * @param name:fund type:string require:1 desc:fund * @param name:pub_date type:string require:1 desc:发表日期 * */ public function editArticleBase() { $data = $this->request->post(); if (isset($data['ltai'])) { $this->editArticleLtai($data['ltai'], $data['article_id']); } $updata['icon'] = $data['icon']; $updata['title'] = trim($data['title']); $updata['subtitle'] = isset($data['subtitle'])?trim($data['subtitle']):''; $updata['rotation'] = isset($data['rotation'])?$data['rotation']:''; $updata['journal_stage_id'] = $data['journal_stage_id']; $updata['journal_special_id'] = $data['journal_special_id']; $updata['tradition_tag'] = $data['tradition_tag']; $updata['tradition'] = $data['tradition']; $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['npp'] = $data['npp']; $updata['type'] = $data['type']; $updata['cited'] = $data['cited']; $updata['abbr'] = $data['abbr']; $updata['fund'] = $data['fund']; $updata['file_html'] = $data['file_html']; $updata['sort'] = $data['sort']; $updata['pub_date'] = $data['pub_date']; $res = $this->article_obj->where('article_id', $data['article_id'])->update($updata); // if($res){ return json(['code' => 0, 'msg' => 'success']); // }else{ // return json(['code'=>1,'msg'=>'system error']); // } } private function editArticleLtai($ltai, $article_id) { $list = explode(',', $ltai); $has = $this->article_ltai_obj->where('article_id', $article_id)->where('state', 0)->select(); foreach ($has as $val) { if (in_array($val['content'], $list)) { foreach ($list as $k => $v) { if ($val['content'] == $v) { unset($list[$k]); } } } else { //删除 $this->article_ltai_obj->where('article_ltai_id', $val['article_ltai_id'])->update(['state' => 1]); } } //增加 foreach ($list as $value) { $cache['article_id'] = $article_id; $cache['content'] = $value; $this->article_ltai_obj->insert($cache); } } /** * @title 编辑文章文件信息 * @description 编辑文章文件信息 * @author wangjinleichang * @url /master/Article/editArticleFile * @method POST * * @param name:article_id type:int require:1 desc:文章id * @param name:filetype type:string require:1 desc:文件类型(PDF/HTML/SUB/SUB2/endNote/bibTex/CDF) * @param name:fileURL type:string require:1 desc:文件地址 * */ public function editArticleFile() { $data = $this->request->post(); if ($data['filetype'] == 'PDF') { $updata['file_pdf'] = $data['fileURL']; } elseif ($data['filetype'] == 'HTML') { $updata['file_html'] = $data['fileURL']; } elseif ($data['filetype'] == 'SUB') { $updata['file_sub'] = $data['fileURL']; } elseif ($data['filetype'] == 'SUB2') { $updata['file_sub2'] = $data['fileURL']; } elseif ($data['filetype'] == 'endNote') { $updata['endnote'] = $data['fileURL']; } elseif ($data['filetype'] == 'bibTex') { $updata['bibtex'] = $data['fileURL']; }elseif($data['filetype'] == 'CDF'){ $updata['file_cdf'] = $data['fileURL']; } $this->article_obj->where('article_id', $data['article_id'])->update($updata); return json(['code' => 0, 'msg' => 'success']); } /** * @title 获取文章列表 * @description 获取文章列表 * @author wangjinleichang * @url /master/Article/getArticleList * @method POST * * @param name:journal_id type:int default:0 require:1 desc:主键 * @param name:journal_stage_id type:int default:0 require:1 desc:主键 * @param name:editor_id type:int require:1 desc:编辑id * @param name:seach type:string require:0 desc:关键词 * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 * * @return count:总数据数 * @return articleList:array# */ public function getArticleList() { $data = $this->request->post(); $where['j_article.state'] = 0; if (intval($data['journal_id']) !== 0) { $where['j_article.journal_id'] = $data['journal_id']; } else { $journals = $this->journal_obj->where('editor_id', $data['editor_id'])->column('journal_id'); $where['j_article.journal_id'] = ['in', $journals]; } if (intval($data['journal_stage_id']) !== 0) { $where['j_article.journal_stage_id'] = $data['journal_stage_id']; } if (isset($data['seach']) && $data['seach'] != '') { $where['j_article.title'] = ['like', '%' . $data['seach'] . '%']; } $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; $article_list = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'], ['j_journal', 'j_journal.journal_id=j_article.journal_id', 'LEFT']))->where($where)->order(['j_article.sort desc', 'j_article.article_id'])->limit($limit_start, $data['pageSize'])->select(); foreach ($article_list as $k => $v) { $caches = $this->article_ltai_obj->where('article_id', $v['article_id'])->where('state', 0)->column('content'); $cache_title = $v['title']; foreach ($caches as $val) { $cache_title = str_replace($val, '' . $val . '', $cache_title); } $article_list[$k]['title'] = $cache_title; } $count = $this->article_obj->where($where)->count(); return json(['code' => 0, 'msg' => 'success', 'data' => ['count' => $count, 'articleList' => $article_list]]); } /** * @title 获取文章对应期刊话题 * @description 获取文章对应期刊话题 * @author wangjinlei * @url /master/Article/getTopicByArticle * @method POST * * @param name:article_id type:int require:1 desc:期刊id * * @return topics:array# * @return nowtopic:array# */ public function getTopicByArticle() { $data = $this->request->post(); $article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); $topic_res = $this->journal_topic_obj->where('journal_id', $article_info['journal_id'])->where('state', 0)->select(); $frag = []; foreach ($topic_res as $v) { if ($v['is_final'] == 1) { $frag[] = $v; } } foreach ($frag as $k => $val) { $frag[$k]['tname'] = $this->getTname($val, $topic_res); } //获取初始话题 $now_list = $this->article_to_topic_obj->where('article_id', $data['article_id'])->where('state', 0)->select(); return json(['code' => 0, 'msg' => 'success', 'data' => ['nowtopic' => $now_list, 'topics' => $frag]]); } private function getTname($now, $arr) { if ($now['parent_id'] == 0) { return $now['title']; } else { $frag = '>' . $now['title']; foreach ($arr as $v) { if ($v['journal_topic_id'] == $now['parent_id']) { $frag = $this->getTname($v, $arr) . $frag; } } return $frag; } } /** * @title 增加文章话题 * @description 增加文章话题 * @author wangjinlei * @url /master/Article/addTopicByArticle * @method POST * * @param name:article_id type:int require:1 desc:期刊id * @param name:topic_id type:int require:1 desc:话题id * */ public function addTopicByArticle() { $data = $this->request->post(); $insert['article_id'] = $data['article_id']; $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,
'; $tt .= 'It is our great honor to present you the articles included in TMRDE.The following new articles have just been included.
'; $tt .= ''.$article_info['title'].'
'; foreach ($list as $v){ $tt1=''; $tt1 .= $tt; $tt1 .= 'Unsubscribe

'; $tt1 .= 'Email:'.$journal_info['email'].'
'; $tt1 .= 'Website:'.$journal_info['website'].'

'; $tt1 .= 'TMR Publishing Group Ltd.
'; $tt1 .= '11 Cockle Bay Rd, Cockle Bay, Auckland, New Zealand
'; $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(); $stage_info = $this->journal_stage_obj->where('journal_stage_id', $article_info['journal_stage_id'])->find(); $topic_info = $this->journal_topic_obj->where('journal_topic_id', $topic_id)->find(); $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find(); $list = []; if ($topic_info['level'] == 2) { $list = $this->subscribe_topic_obj->where('topic_id', $topic_id)->where('state', 0)->select(); } else { $list = $this->subscribe_topic_obj->where('topic_id', $topic_info['parent_id'])->where('state', 0)->select(); } //组成文章信息 $tt1 = '


'; $tt1 .= $journal_info['title'] . '

'; $tt1 .= 'The following new articles have just been published in Topic "' . $topic_info['title'] . '" of ' . $journal_info['title'] . '

'; $tt1 .= $article_info['type'] . '
'; $tt1 .= '' . $article_info['title'] . '
'; $tt1 .= $this->getAuthor($article_info) . '
'; $tt1 .= $journal_info['title'] . ' ' . $stage_info['stage_year'] . ' ' . $stage_info['stage_vol'] . "(" . $stage_info['stage_no'] . "). https://doi.org/" . $article_info['doi'] . '
'; $tt1 .= 'Download pdf


'; $tt2 = 'Email: ' . $journal_info['email'] . '
'; $tt2 .= 'Website: https://www.tmrjournals.com/' . $journal_info['usx'] . '
'; $tt2 .= 'TMR Publishing Group Ltd.
'; $tt2 .= '11 Cockle Bay Rd, Cockle Bay, Auckland, New Zealand
'; $tt2 .= 'Tel: +64 02108293806.'; $tt2 .= '
'; foreach ($list as $v) { $cache = $tt1 . 'Unsubscribe

' . $tt2; $maidata['email'] = $v['email']; $maidata['title'] = $journal_info['title']; $maidata['content'] = $cache; $maidata['tmail'] = 'publicrelations@tmrjournals.com'; $maidata['tpassword'] = 'pRWU999999'; Queue::push('app\api\job\mail@fire', $maidata, "mail"); } } 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; } /** * @title 删除文章话题 * @description 删除文章话题 * @author wangjinlei * @url /master/Article/delTopic * @method POST * * @param name:article_to_topic_id type:int require:1 desc:主键id * */ public function delTopic() { $data = $this->request->post(); $res = $this->article_to_topic_obj->where('article_to_topic_id', $data['article_to_topic_id'])->update(['state' => 1]); if ($res) { return json(['code' => 0, 'msg' => 'success']); } else { return json(['code' => 1, 'msg' => 'system error']); } } // 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 图片上传 * @description 图片上传 * @author wangjinlei * @url /master/Article/up_article_file * @method POST * * @param name:name type:string require:1 default:articleicon desc:文件域名称 * * @return upurl:图片地址 */ public function up_article_file() { $file = request()->file('articleicon'); if ($file) { $info = $file->move(ROOT_PATH . 'public' . DS . 'articleicon'); if ($info) { return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]); } else { return json(['code' => 1, 'msg' => $file->getError()]); } } } /** * @title 轮播图上传 * @description 轮播图上传 * @author wangjinlei * @url /master/Article/up_rotation_file * @method POST * * @param name:name type:string require:1 default:rotation desc:文件域名称 * * @return upurl:图片地址 */ public function up_rotation_file(){ $file = request()->file('rotation'); if ($file) { $info = $file->move(ROOT_PATH . 'public' . DS . 'rotation'); if ($info) { return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]); } else { return json(['code' => 1, 'msg' => $file->getError()]); } } } /** * @title cite图片上传 * @description cite图片上传 * @author wangjinlei * @url /master/Article/up_cite_file * @method POST * * @param name:name type:string require:1 default:articleCite desc:文件域名称 * * @return upurl:图片地址 */ public function up_cite_file() { $file = request()->file('articleCite'); if ($file) { $info = $file->move(ROOT_PATH . 'public' . DS . 'articleCite'); if ($info) { return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]); } else { return json(['code' => 1, 'msg' => $file->getError()]); } } } /** * @title CDF文件上传 * @description CDF文件上传 * @author wangjinlei * @url /master/Article/up_cdf_file * @method POST * * @param name:name type:string require:1 default:articleCDF desc:文件域名称 * * @return upurl:图片地址 */ public function up_cdf_file(){ $file = request()->file('articleCDF'); if ($file) { $info = $file->move(ROOT_PATH . 'public' . DS . 'articleCDF'); if ($info) { return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]); } else { return json(['code' => 1, 'msg' => $file->getError()]); } } } /** * @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 文章文件上传 * @description 文章文件上传 * @author wangjinlei * @url /master/Article/article_file * @method GET * * @param name:name type:string require:1 desc:文件域名称(articlePDF/articleHTML/articleSUB/articleSUB2/bibTex/endNote/articleCDF) * @param name:type type:string require:1 desc:pathinfo(articlePDF/articleHTML/articleSUB/articleSUB2/bibTex/endNote/articleCDF) * * @return upurl:图片地址 */ public function article_file($type) { $file = request()->file($type); if ($file) { $info = $file->move(ROOT_PATH . 'public' . DS . $type); if ($info) { return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]); } else { return json(['code' => 1, 'msg' => $file->getError()]); } } } /** * @title 获取城市列表 * @description 获取城市列表 * @author wangjinlei * @url /master/Article/getCountrys * @method POST * * @return countrys:array# */ public function getCountrys() { $res = $this->country_obj->order('en_name')->select(); return json(['code' => 0, 'msg' => 'success', 'data' => ['countrys' => $res]]); } /** * @title 获取客座话题 * @description 获取客座话题 * @author wangjinlei * @url /master/Article/getJournalSpecials * @method POST * * @param name:journal_id type:int require:1 desc:期刊id * * @return specials:客座期刊array# */ public function getJournalSpecials() { $data = $this->request->post(); $list = $this->journal_special_obj->where('journal_id', $data['journal_id'])->where('state', 2)->select(); $re['specials'] = $list; return jsonSuccess($re); } /** * @title 添加文章引用申请 * @description 添加文章引用申请 * @author wangjinlei * @url /master/Article/addArticleCite * @method POST * * @param name:article_id type:int require:1 desc:文章id * @param name:journal_id type:int require:1 desc:期刊id * @param name:img type:string require:1 desc:地址 * @param name:journal_name type:string require:1 desc:期刊名 * @param name:article_name type:string require:1 desc:文章名 * @param name:factor type:string require:1 desc:影响因子 * @param name:adate type:string require:1 desc:引用时间 * * @return specials:客座期刊array# */ public function addArticleCite() { $data = $this->request->post(); $insert['article_id'] = $data['article_id']; $insert['journal_id'] = $data['journal_id']; $insert['img'] = $data['img']; $insert['journal_name'] = $data['journal_name']; $insert['article_name'] = $data['article_name']; $insert['factor'] = $data['factor']; $insert['date'] = $data['adate']; $insert['ctime'] = time(); $this->article_cite_obj->insert($insert); return jsonSuccess([]); } /** * @title 获取文章引用申请列表(编辑) * @description 获取文章引用申请列表 * @author wangjinlei * @url /master/Article/getArticleCites * @method POST * * @param name:admin_id type:int require:1 desc:管理员id * * @return cites:信息array# */ public function getArticleCites() { $data = $this->request->post(); $journals = $this->journal_obj->where('editor_id', $data['admin_id'])->where('state', 0)->column('journal_id'); $list = $this->article_cite_obj ->field('j_article_cite.*,j_journal.title journal_title') ->join('j_journal', 'j_journal.journal_id = j_article_cite.journal_id', 'left') ->where('j_article_cite.journal_id', 'in', $journals) ->order('j_article_cite.state asc,j_article_cite.article_cite_id asc') ->select(); $re['cites'] = $list; return jsonSuccess($re); } /** * @title 获取文章引用列表(编辑) * @description 获取文章引用列表 * @author wangjinlei * @url /master/Article/getCitesByArticle * @method POST * * @param name:article_id type:int require:1 desc:文章id * * @return cites:信息array# * @return article:文章信息# */ public function getCitesByArticle() { $data = $this->request->post(); $article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); $list = $this->article_cite_obj->where('article_id', $data['article_id'])->order('state asc,article_cite_id asc')->select(); $re['article'] = $article_info; $re['cites'] = $list; return jsonSuccess($re); } /** * @title 获取文章引用申请列表(管理员) * @description 获取文章引用申请列表(管理员) * @author wangjinlei * @url /master/Article/getAllArticleCites * @method POST * * @param name:state type:int require:1 desc:状态-1,0,1,2 * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 * * @return count:总数 * @return cites:信息array# */ public function getAllArticleCites() { $data = $this->request->post(); $where = []; if ($data['state'] >= 0) { $where['j_article_cite.state'] = $data['state']; } $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; $list = $this->article_cite_obj ->field('j_article_cite.*,j_journal.title journal_title') ->join('j_journal', 'j_journal.journal_id = j_article_cite.journal_id', 'left') ->where($where) ->order('j_article_cite.state asc,j_article_cite.article_cite_id asc') ->limit($limit_start, $data['pageSize']) ->select(); $count = $this->article_cite_obj->where($where)->count(); $re['count'] = $count; $re['cites'] = $list; return jsonSuccess($re); } /** * @title 获取文章引用详情 * @description 获取文章引用详情 * @author wangjinlei * @url /master/Article/getCiteDetail * @method POST * * @param name:article_cite_id type:int require:1 desc:主键 * * @return cite:信息# */ public function getCiteDetail() { $data = $this->request->post(); $cite_info = $this->article_cite_obj->where('article_cite_id', $data['article_cite_id'])->find(); $re['cite'] = $cite_info; return jsonSuccess($re); } /** * @title 审核文章引用 * @description 审核文章引用 * @author wangjinlei * @url /master/Article/changeCiteState * @method POST * * @param name:article_cite_id type:int require:1 desc:主键 * @param name:state type:int require:1 desc:状态1通过2驳回 */ public function changeCiteState() { $data = $this->request->post(); $this->article_cite_obj->where('article_cite_id', $data['article_cite_id'])->update(['state' => $data['state'], 'atime' => time()]); if ($data['state'] == 1) { $info = $this->article_cite_obj->where('article_cite_id', $data['article_cite_id'])->find(); $this->article_obj->where('article_id', $info['article_id'])->setInc('cited'); } return jsonSuccess([]); } /** * @title 获取期刊引用 * @description 获取期刊引用 * @author wangjinlei * @url /master/Article/getJournalCites * @method POST * * @param name:issn type:string require:1 desc:issn号 */ public function getJournalCites() { $data = $this->request->post(); $journal_info = $this->journal_obj->where('issn', $data['issn'])->find(); $c_time = strtotime("-1 month", strtotime(date('Y-m') . '-26 00:00:00')); $c_time1 = strtotime(date('Y-m' . '-25 23:59:59')); $where['journal_id'] = $journal_info['journal_id']; $where['atime'] = array(['>', $c_time], ['<=', $c_time1]); $where['state'] = 1; $list = $this->article_cite_obj->where($where)->select(); $re['cites'] = $list; return jsonSuccess($re); } /** * @title 推送crossref * @description 推送crossref * @author wangjinlei * @url /master/Article/pushCrossref * @method POST * * @param name:doi_num type:string require:1 desc:doi号 * @param name:article_id type:int require:1 desc:文章id */ public function pushCrossref() { $data = $this->request->post(); $has = $this->article_obj->where('doi', '10.53388/' . $data['doi_num'])->find(); if ($has) { return jsonError('doi号重复'); } if (strstr($data['doi_num'], '/') !== false) { return jsonError('格式错误'); } $author = $this->article_author_obj->where('article_id', $data['article_id'])->where('state', 0)->find(); if ($author == null) { return jsonError('请先上传作者'); } $article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); if ($article_info['npp'] == '') { return jsonError('请先上传页码'); } $url = 'https://doi.crossref.org/servlet/deposit'; $file = ROOT_PATH . 'public' . DS . 'xml' . DS . $data['article_id'] . '.xml'; $this->crossRef($data); //存储 $this->article_obj->where('article_id', $data['article_id'])->update(['doi' => '10.53388/' . $data['doi_num']]); //发送请求 $par['login_id'] = 'books@tmrjournals.com/tmrp'; $par['login_passwd'] = '849192806pnX'; $par['fname'] = new \CURLFile($file); $this->myPost($url, $par); return jsonSuccess([]); } private function myPost($url, $param = array()) { if (!is_array($param)) { throw new Exception("参数必须为array"); } $httph = curl_init($url); 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_exec($httph); curl_close($httph); // echo '
';
//        var_dump($rst);
//        echo '
'; // echo '
';
//        var_dump($err);
//        echo '
'; // die; // die; } public function met() { $s = '11'; $arr = explode('-', $s); echo $arr[0]; } public function crossRef($data) { $xml = ''; //create xml 头 $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . date('Ymd') . '' . PHP_EOL; $xml .= '' . date('YmdHis') . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= 'tmr@tmrjournals.com' . PHP_EOL; $xml .= 'tmr@tmrjournals.com' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= 'TMR' . PHP_EOL; $xml .= '' . 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 .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . str_replace("&", "and", $journal_info['title']) . '' . PHP_EOL; $xml .= '' . str_replace('&', 'and', $journal_info['jabbr']) . '' . PHP_EOL; $xml .= '' . $journal_info['issn'] . '' . PHP_EOL; $xml .= '' . $journal_info['usx'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage_info['stage_year'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage_info['stage_vol'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage_info['stage_no'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . str_replace("&", "and", $article_info['title']) . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $authors = $this->article_author_obj->where('article_id', $data['article_id'])->where('state', 0)->select(); foreach ($authors as $v) { if ($v['is_first'] == 1) { $xml .= '' . PHP_EOL; } else { $xml .= '' . PHP_EOL; } $xml .= '' . $v['first_name'] . '' . PHP_EOL; $xml .= '' . ($v['last_name']==''?$v['first_name']:$v['last_name']) . '' . PHP_EOL; $xml .= '' . PHP_EOL; } $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage_info['stage_year'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $ca = explode('-', $article_info['npp']); $xml .= '' . $ca[0] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . trim($data['doi_num']) . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '10.53388/' . trim($data['doi_num']) . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $txt = ROOT_PATH . 'public' . DS . 'xml' . DS . $article_info['article_id'] . '.xml'; file_put_contents($txt, $xml); } private function changDOI() { $list = $this->article_obj->where('journal_id', 14)->where('state', 0)->select(); foreach ($list as $art) { $ca_doi = explode('/', $art['doi']); if (!isset($ca_doi[1])) { continue; } $doi = '10.53388/' . $ca_doi[1]; $this->article_obj->where('article_id',$art['article_id'])->update(['doi'=>$doi]); } } /** * 生成xml文件 */ private function makeXML() { $xml = ''; //create xml 头 $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . date('Ymd') . '' . PHP_EOL; $xml .= '' . date('YmdHis') . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= 'tmr@tmrjournals.com' . PHP_EOL; $xml .= 'tmr@tmrjournals.com' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= 'TMR' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; //组装主体信息部分 $journal_info = $this->journal_obj->where('journal_id', 14)->find(); // $article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); $stage_list = $this->journal_stage_obj->where('journal_id', 14)->where('state', 0)->select(); foreach ($stage_list as $stage) { $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $journal_info['title'] . '' . PHP_EOL; $xml .= '' . $journal_info['jabbr'] . '' . PHP_EOL; $xml .= '' . $journal_info['issn'] . '' . PHP_EOL; $xml .= '' . $journal_info['usx'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage['stage_year'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage['stage_vol'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage['stage_no'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $art_list = $this->article_obj->where('journal_stage_id', $stage['journal_stage_id'])->where('state', 0)->select(); foreach ($art_list as $art) { $ca_doi = explode('/', $art['doi']); if (!isset($ca_doi[1])) { continue; } $doi = '10.53388/' . $ca_doi[1]; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $art['title'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $authors = $this->article_author_obj->where('article_id', $art['article_id'])->where('state', 0)->select(); foreach ($authors as $v) { if ($v['is_first'] == 1) { $xml .= '' . PHP_EOL; } else { $xml .= '' . PHP_EOL; } $xml .= '' . $v['first_name'] . '' . PHP_EOL; $xml .= '' . ($v['last_name']==''?$v['first_name']:$v['last_name']) . '' . PHP_EOL; $xml .= '' . PHP_EOL; } $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage['stage_year'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $ca = explode('-', $art['npp']); $xml .= '' . $ca[0] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $doi . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $doi . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; } $xml .= '' . PHP_EOL; } $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $txt = ROOT_PATH . 'public' . DS . 'xml' . DS . 'all_1.xml'; file_put_contents($txt, $xml); } /** * @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 .= '' . PHP_EOL; $xml .= '' . PHP_EOL . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . date('Ymd') . '' . PHP_EOL; $xml .= '' . date('YmdHis') . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= 'TMR2015@163.com' . PHP_EOL; $xml .= 'TMR2015@163.com' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '传统医学研究(英文版)' . PHP_EOL; $xml .= '' . 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 .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $journal_info['usx'] . '' . PHP_EOL; $xml .= '' . $journal_info['title'] . '' . PHP_EOL; $xml .= '' . $journal_info['issn'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage_info['stage_year'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage_info['stage_vol'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $stage_info['stage_no'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $article_info['title'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . 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 .= '' . substr($author, -1) . '' . PHP_EOL; $xml .= '' . $address . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . str_replace(',', ' ', $article_info['keywords']) . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . str_replace('Abstract', '', strip_tags(str_replace(" ", "", htmlspecialchars_decode($article_info['abstract'])))) . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . $article_info['doi'] . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . 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 .= '' . $start . '' . PHP_EOL; $xml .= '' . $end . '' . PHP_EOL; $xml .= '' . PHP_EOL; $xml .= '' . 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 '
';
//        var_dump($result);
//        echo '
'; // die; // } }