This commit is contained in:
wangjinlei
2021-08-30 11:43:22 +08:00
parent 68de3a8fd6
commit 375b62ab9d
7 changed files with 453 additions and 17 deletions

View File

@@ -538,6 +538,24 @@ class Article extends Controller {
return jsonSuccess($re);
}
/**
* 获取liferesearch的文章详情
*/
public function getLifeResearch(){
echo "<h2>Life Research</h2>";
$list = $this->article_obj->where('journal_id',14)->where('state',0)->select();
echo "<span>Total number of articles:". count($list)."</span><br><br><br>";
foreach ($list as $k => $v) {
echo '<strong>'.($k+1).'. '.$v['title'].'</strong>('.$v['type'].')<br>';
$au = $this->article_author_obj->where('article_id',$v['article_id'])->where('state',0)->select();
foreach ($au as $val){
echo '&nbsp;&nbsp;&nbsp;&nbsp;';
echo $val['author_name'].'('.$val['author_country'].')<br>';
}
echo '<br>';
}
}
/**
* @title 获取文章text文件
* @description 获取文章text文件

View File

@@ -744,6 +744,35 @@ class Journal extends Controller {
$re['topics'] = $list;
return jsonSuccess($re);
}
public function tttt(){
$host="localhost";//mysql服务器地址
$user='root';
$pass='root';
$dbName='journal';//数据可名称
$charSet='utf8';
$port='3306';
$conn=mysql_connect($host,$user,$padd);
if(!$conn){
echo 'unable to connect to DB '.mysql_error();
exit();
}
query('use '.$db);
$sql = "select * from j_user limit 1";//这里是sql语句
$res = getAll($sql);
echo '<pre>';
var_dump($res);
echo '</pre>';
}
/**
* @title 添加期刊订阅

View File

@@ -29,6 +29,7 @@ class Main extends Controller {
protected $sys_book_obj = '';
protected $sys_not_obj = '';
protected $article_ltai_obj = '';
protected $board_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -45,6 +46,7 @@ class Main extends Controller {
$this->sys_book_obj = Db::name('system_books');
$this->sys_not_obj = Db::name('system_notices');
$this->article_ltai_obj = Db::name('article_ltai');
$this->board_obj = Db::name('board');
}
public function ttest(){
@@ -355,7 +357,7 @@ class Main extends Controller {
// $push_url = 'http://www.journal.com/api/Main/getImgFile';
//定义需要查询同化的数组
$list = ['articleCite','articlePDF','articleicon','articleSUB','articleSUB2','journalCfp','journalfooter','journalicon','journalline','journaltopic','system'];
$list = ['articleCite','articlePDF','articleicon','articleSUB','articleSUB2','journalCfp','journalfooter','journalicon','journalline','rotation','journaltopic','system','articleCDF'];
foreach ($list as $v){
$dir = $root_url."public/".$v."/".date('Ymd');
@@ -570,7 +572,25 @@ class Main extends Controller {
return jsonSuccess($re);
}
/**
* 获取编委
*/
public function getBoards(){
$data = $this->request->post();
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
$boards = $this->board_obj->where('journal_id',$journal_info['journal_id'])->where('state',0)->select();
return json($boards);
}
/**
* 绑定投稿系统用户
*/
public function bindBoard(){
$data = $this->request->post();
$up['tuser_id'] = $data['user_id'];
$this->board_obj->where('board_id',$data['board_id'])->update($up);
return json('success');
}
}

View File

@@ -28,6 +28,7 @@ class Special extends Controller {
protected $sys_scient_obj = '';
protected $sys_book_obj = '';
protected $journal_special_alert_obj = '';
protected $article_cite_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -46,6 +47,7 @@ class Special extends Controller {
$this->sys_scient_obj = Db::name('system_scient');
$this->sys_book_obj = Db::name('system_books');
$this->journal_special_alert_obj = Db::name('journal_special_alert');
$this->article_cite_obj = Db::name('article_cite');
}
/**
@@ -317,5 +319,91 @@ class Special extends Controller {
return jsonSuccess($re);
}
/**
* 读取引用文件
*/
public function readCiteExcel(){
$path = ROOT_PATH.'public'.DS.'system'.DS;
$res = $this->readExcel($path.'savedrecs.xls');
foreach ($res as $k => $v){
if($k<6||$v['C']<1){
continue;
}
$doi = explode('/', $v['B']);
$article = '';
if(isset($doi[1])){
$article = $this->article_obj->where('doi','like','%'.$doi[1].'%')->find();
}else{
$article = $this->article_obj->where('title',$v['A'])->find();
}
$cache = $this->readExcel1($path.($k+1).'.xls');
foreach ($cache as $key => $val){
if($key == 0){
continue;
}
$insert['article_id'] = $article['article_id'];
$insert['journal_id'] = $article['journal_id'];
$insert['journal_name'] = $val['journal'];
$insert['article_name'] = $val['title'];
$day = $val['day']==''?'':$val['day'].' ';
$insert['date'] = $day.$val['year'];
$insert['ctime'] = time();
$this->article_cite_obj->insert($insert);
}
}
}
/**
* 读取excel数据
*/
private function readExcel1($path) {
$extension = substr($path, strrpos($path, '.') + 1);
vendor("PHPExcel.PHPExcel");
if ($extension == 'xlsx') {
$objReader = new \PHPExcel_Reader_Excel2007();
$objPHPExcel = $objReader->load($path);
} else if ($extension == 'xls') {
$objReader = new \PHPExcel_Reader_Excel5();
$objPHPExcel = $objReader->load($path);
}
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$frag = [];
for ($i = 1; $i <= $highestRow; $i++) {
$cache['title'] = $objPHPExcel->getActiveSheet()->getCell("I".$i)->getValue();
$cache['journal'] = $objPHPExcel->getActiveSheet()->getCell("J".$i)->getValue();
$cache['year'] = $objPHPExcel->getActiveSheet()->getCell("AS".$i)->getValue();
$cache['day'] = $objPHPExcel->getActiveSheet()->getCell("AR".$i)->getValue();
$frag[] = $cache;
}
return $frag;
}
/**
* 读取excel数据
*/
private function readExcel($path) {
$extension = substr($path, strrpos($path, '.') + 1);
vendor("PHPExcel.PHPExcel");
if ($extension == 'xlsx') {
$objReader = new \PHPExcel_Reader_Excel2007();
$objPHPExcel = $objReader->load($path);
} else if ($extension == 'xls') {
$objReader = new \PHPExcel_Reader_Excel5();
$objPHPExcel = $objReader->load($path);
}
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$frag = [];
for ($i = 1; $i <= $highestRow; $i++) {
$cache['A'] = $objPHPExcel->getActiveSheet()->getCell("A".$i)->getValue();
$cache['B'] = $objPHPExcel->getActiveSheet()->getCell("B".$i)->getValue();
$cache['C'] = $objPHPExcel->getActiveSheet()->getCell("C".$i)->getValue();
$frag[] = $cache;
}
return $frag;
}
}