20201112
This commit is contained in:
@@ -538,6 +538,24 @@ class Article extends Controller {
|
|||||||
return jsonSuccess($re);
|
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 ' ';
|
||||||
|
echo $val['author_name'].'('.$val['author_country'].')<br>';
|
||||||
|
}
|
||||||
|
echo '<br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 获取文章text文件
|
* @title 获取文章text文件
|
||||||
* @description 获取文章text文件
|
* @description 获取文章text文件
|
||||||
|
|||||||
@@ -744,6 +744,35 @@ class Journal extends Controller {
|
|||||||
$re['topics'] = $list;
|
$re['topics'] = $list;
|
||||||
return jsonSuccess($re);
|
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 添加期刊订阅
|
* @title 添加期刊订阅
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class Main extends Controller {
|
|||||||
protected $sys_book_obj = '';
|
protected $sys_book_obj = '';
|
||||||
protected $sys_not_obj = '';
|
protected $sys_not_obj = '';
|
||||||
protected $article_ltai_obj = '';
|
protected $article_ltai_obj = '';
|
||||||
|
protected $board_obj = '';
|
||||||
|
|
||||||
public function __construct(\think\Request $request = null) {
|
public function __construct(\think\Request $request = null) {
|
||||||
parent::__construct($request);
|
parent::__construct($request);
|
||||||
@@ -45,6 +46,7 @@ class Main extends Controller {
|
|||||||
$this->sys_book_obj = Db::name('system_books');
|
$this->sys_book_obj = Db::name('system_books');
|
||||||
$this->sys_not_obj = Db::name('system_notices');
|
$this->sys_not_obj = Db::name('system_notices');
|
||||||
$this->article_ltai_obj = Db::name('article_ltai');
|
$this->article_ltai_obj = Db::name('article_ltai');
|
||||||
|
$this->board_obj = Db::name('board');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ttest(){
|
public function ttest(){
|
||||||
@@ -355,7 +357,7 @@ class Main extends Controller {
|
|||||||
// $push_url = 'http://www.journal.com/api/Main/getImgFile';
|
// $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){
|
foreach ($list as $v){
|
||||||
$dir = $root_url."public/".$v."/".date('Ymd');
|
$dir = $root_url."public/".$v."/".date('Ymd');
|
||||||
@@ -570,7 +572,25 @@ class Main extends Controller {
|
|||||||
return jsonSuccess($re);
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class Special extends Controller {
|
|||||||
protected $sys_scient_obj = '';
|
protected $sys_scient_obj = '';
|
||||||
protected $sys_book_obj = '';
|
protected $sys_book_obj = '';
|
||||||
protected $journal_special_alert_obj = '';
|
protected $journal_special_alert_obj = '';
|
||||||
|
protected $article_cite_obj = '';
|
||||||
|
|
||||||
public function __construct(\think\Request $request = null) {
|
public function __construct(\think\Request $request = null) {
|
||||||
parent::__construct($request);
|
parent::__construct($request);
|
||||||
@@ -46,6 +47,7 @@ class Special extends Controller {
|
|||||||
$this->sys_scient_obj = Db::name('system_scient');
|
$this->sys_scient_obj = Db::name('system_scient');
|
||||||
$this->sys_book_obj = Db::name('system_books');
|
$this->sys_book_obj = Db::name('system_books');
|
||||||
$this->journal_special_alert_obj = Db::name('journal_special_alert');
|
$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);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,11 +19,6 @@ class Admin extends Controller
|
|||||||
$this->admin_obj = Db::name('admin');
|
$this->admin_obj = Db::name('admin');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 测试demo接口
|
* @title 测试demo接口
|
||||||
* @description 接口说明
|
* @description 接口说明
|
||||||
@@ -158,19 +153,22 @@ class Admin extends Controller
|
|||||||
* @title 数据同步
|
* @title 数据同步
|
||||||
* @description 数据同步
|
* @description 数据同步
|
||||||
* @author wangjinlei
|
* @author wangjinlei
|
||||||
* @url /master/Admin/synchronization
|
* @url /master/Admin/admin_synchronization
|
||||||
* @method POST
|
* @method POST
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function synchronization(){
|
public function admin_synchronization(){
|
||||||
$ptime = Cache::get('synchronization');
|
$ptime = Cache::get('synchronization');
|
||||||
if($ptime){
|
if($ptime){
|
||||||
jsonError('Synchronization minimum interval is 10 minute , last update time:'.$ptime);
|
jsonError('Synchronization minimum interval is 10 minute , last update time:'.$ptime);
|
||||||
}
|
}
|
||||||
Cache::set('synchronization',date('Y-m-d H:i:s'),10*60);
|
Cache::set('synchronization',date('Y-m-d H:i:s'),10*60);
|
||||||
$url = "http://api.tmrjournals.cn/public/index.php/master/Admin/cn_synchronization";
|
$url = "http://api.tmrjournals.cn/public/index.php/master/Admin/cn_synchronization";
|
||||||
$res = myPost($url);
|
$res = $this->object_to_array(json_decode(myPost($url)));
|
||||||
return $res;
|
if($res['code']==1){
|
||||||
|
return jsonError($res['msg']);
|
||||||
|
}else{
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -251,5 +249,15 @@ class Admin extends Controller
|
|||||||
return json(['code'=>0,'msg'=>'success']);
|
return json(['code'=>0,'msg'=>'success']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function object_to_array($obj){
|
||||||
|
$_arr=is_object($obj)?get_object_vars($obj):$obj;
|
||||||
|
$arr = null;
|
||||||
|
foreach($_arr as $key=>$val){
|
||||||
|
$val=(is_array($val))||is_object($val)?$this->object_to_array($val):$val;
|
||||||
|
$arr[$key]=$val;
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -431,6 +431,8 @@ class Article extends Controller {
|
|||||||
*
|
*
|
||||||
* @param name:article_id type:int require:1 desc:文章id
|
* @param name:article_id type:int require:1 desc:文章id
|
||||||
* @param name:title type:string require:1 desc:标题
|
* @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:icon type:string require:1 desc:图片
|
||||||
* @param name:tradition_tag type:string require:1 desc:封皮标签
|
* @param name:tradition_tag type:string require:1 desc:封皮标签
|
||||||
* @param name:tradition type:string require:1 desc:封皮简介
|
* @param name:tradition type:string require:1 desc:封皮简介
|
||||||
@@ -456,7 +458,9 @@ class Article extends Controller {
|
|||||||
$this->editArticleLtai($data['ltai'], $data['article_id']);
|
$this->editArticleLtai($data['ltai'], $data['article_id']);
|
||||||
}
|
}
|
||||||
$updata['icon'] = $data['icon'];
|
$updata['icon'] = $data['icon'];
|
||||||
$updata['title'] = $data['title'];
|
$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_stage_id'] = $data['journal_stage_id'];
|
||||||
$updata['journal_special_id'] = $data['journal_special_id'];
|
$updata['journal_special_id'] = $data['journal_special_id'];
|
||||||
$updata['tradition_tag'] = $data['tradition_tag'];
|
$updata['tradition_tag'] = $data['tradition_tag'];
|
||||||
@@ -514,7 +518,7 @@ class Article extends Controller {
|
|||||||
* @method POST
|
* @method POST
|
||||||
*
|
*
|
||||||
* @param name:article_id type:int require:1 desc:文章id
|
* @param name:article_id type:int require:1 desc:文章id
|
||||||
* @param name:filetype type:string require:1 desc:文件类型(PDF/HTML/SUB/SUB2/endNote/bibTex)
|
* @param name:filetype type:string require:1 desc:文件类型(PDF/HTML/SUB/SUB2/endNote/bibTex/CDF)
|
||||||
* @param name:fileURL type:string require:1 desc:文件地址
|
* @param name:fileURL type:string require:1 desc:文件地址
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -532,6 +536,8 @@ class Article extends Controller {
|
|||||||
$updata['endnote'] = $data['fileURL'];
|
$updata['endnote'] = $data['fileURL'];
|
||||||
} elseif ($data['filetype'] == 'bibTex') {
|
} elseif ($data['filetype'] == 'bibTex') {
|
||||||
$updata['bibtex'] = $data['fileURL'];
|
$updata['bibtex'] = $data['fileURL'];
|
||||||
|
}elseif($data['filetype'] == 'CDF'){
|
||||||
|
$updata['file_cdf'] = $data['fileURL'];
|
||||||
}
|
}
|
||||||
$this->article_obj->where('article_id', $data['article_id'])->update($updata);
|
$this->article_obj->where('article_id', $data['article_id'])->update($updata);
|
||||||
return json(['code' => 0, 'msg' => 'success']);
|
return json(['code' => 0, 'msg' => 'success']);
|
||||||
@@ -773,6 +779,29 @@ class Article extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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图片上传
|
* @title cite图片上传
|
||||||
@@ -796,6 +825,29 @@ class Article extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 文章文件上传
|
* @title 文章文件上传
|
||||||
@@ -804,8 +856,8 @@ class Article extends Controller {
|
|||||||
* @url /master/Article/article_file
|
* @url /master/Article/article_file
|
||||||
* @method GET
|
* @method GET
|
||||||
*
|
*
|
||||||
* @param name:name type:string require:1 desc:文件域名称(articlePDF/articleHTML/articleSUB/articleSUB2/bibTex/endNote)
|
* @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)
|
* @param name:type type:string require:1 desc:pathinfo(articlePDF/articleHTML/articleSUB/articleSUB2/bibTex/endNote/articleCDF)
|
||||||
*
|
*
|
||||||
* @return upurl:图片地址
|
* @return upurl:图片地址
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class Publish extends Controller{
|
|||||||
protected $board_obj = '';
|
protected $board_obj = '';
|
||||||
protected $board_group_obj = '';
|
protected $board_group_obj = '';
|
||||||
protected $visit_log_obj = '';
|
protected $visit_log_obj = '';
|
||||||
|
protected $article_cite_obj = '';
|
||||||
|
|
||||||
public function __construct(\think\Request $request = null) {
|
public function __construct(\think\Request $request = null) {
|
||||||
parent::__construct($request);
|
parent::__construct($request);
|
||||||
@@ -62,6 +63,7 @@ class Publish extends Controller{
|
|||||||
$this->board_obj = Db::name('board');
|
$this->board_obj = Db::name('board');
|
||||||
$this->board_group_obj = Db::name('board_group');
|
$this->board_group_obj = Db::name('board_group');
|
||||||
$this->visit_log_obj = Db::name('visit_log');
|
$this->visit_log_obj = Db::name('visit_log');
|
||||||
|
$this->article_cite_obj = Db::name('article_cite');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -257,6 +259,7 @@ class Publish extends Controller{
|
|||||||
*/
|
*/
|
||||||
public function addVisitNum(){
|
public function addVisitNum(){
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
|
// $data['type'] = 1;
|
||||||
$data['is_detail'] = isset($data['is_detail'])?$data['is_detail']:0;
|
$data['is_detail'] = isset($data['is_detail'])?$data['is_detail']:0;
|
||||||
$up_id = 0;
|
$up_id = 0;
|
||||||
if($data['type']=='de'){//数据库访问
|
if($data['type']=='de'){//数据库访问
|
||||||
@@ -280,7 +283,7 @@ class Publish extends Controller{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{//期刊访问
|
else{//期刊访问
|
||||||
$res = $this->visit_log_obj->where('type',$data['type'])->where('stime',date('Ym'))->find();
|
$res = $this->visit_log_obj->where('type',$data['type'])->where('is_detail',0)->where('stime',date('Ym'))->find();
|
||||||
if($res==null){
|
if($res==null){
|
||||||
$insert['type']= $data['type'];
|
$insert['type']= $data['type'];
|
||||||
$insert['stime'] = date('Ym');
|
$insert['stime'] = date('Ym');
|
||||||
@@ -524,4 +527,222 @@ class Publish extends Controller{
|
|||||||
}
|
}
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 获取全部期刊
|
||||||
|
* @description 获取全部期刊
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /super/Publish/getAllJournals
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @return journals:期刊列表#
|
||||||
|
*/
|
||||||
|
public function getAllJournals(){
|
||||||
|
$list = $this->journal_obj->where('state',0)->select();
|
||||||
|
|
||||||
|
$re['journals'] = $list;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 获取引用数据统计
|
||||||
|
* @description 获取引用数据统计
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /super/Publish/getCiteDate
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @param name:journal_id type:int require:1 desc:期刊id
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function getCiteDate(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
// $data['journal_id'] = 1;
|
||||||
|
$list = $this->article_cite_obj->where('journal_id',$data['journal_id'])->select();
|
||||||
|
$frag = [];
|
||||||
|
$frag['country'] = [];
|
||||||
|
$frag['topic'] = [];
|
||||||
|
$frag['time'] = [];
|
||||||
|
$frag['type'] = [];
|
||||||
|
$frag['articles'] = [];
|
||||||
|
foreach ($list as $v){
|
||||||
|
$cache_article = $this->article_obj->where('article_id',$v['article_id'])->find();
|
||||||
|
//判断国家
|
||||||
|
$cou_res = $this->checkCountry($cache_article);
|
||||||
|
if($cou_res=='n'){
|
||||||
|
isset($frag['country']['n'])?$frag['country']['n']++:$frag['country']['n']=1;
|
||||||
|
}else{
|
||||||
|
isset($frag['country']['w'])?$frag['country']['w']++:$frag['country']['w']=1;
|
||||||
|
}
|
||||||
|
//判断领域
|
||||||
|
$topic_res = $this->checkTopic($cache_article);
|
||||||
|
foreach ($topic_res as $key=>$val){
|
||||||
|
if(isset($frag['topic'][$val['title']])){
|
||||||
|
$frag['topic'][$val['title']] += 1;
|
||||||
|
}else{
|
||||||
|
$frag['topic'][$val['title']] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//关键词
|
||||||
|
$gjz = explode(',', $cache_article['keywords']);
|
||||||
|
foreach ($gjz as $key => $val){
|
||||||
|
if(isset($frag['gjz'][$val])){
|
||||||
|
$frag['gjz'][$val] +=1;
|
||||||
|
}else{
|
||||||
|
$frag['gjz'][$val] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//时间
|
||||||
|
$ca_time = $this->journal_stage_obj->where('journal_stage_id',$cache_article['journal_stage_id'])->find();
|
||||||
|
if(isset($frag['time'][$ca_time['stage_year']])){
|
||||||
|
$frag['time'][$ca_time['stage_year']] += 1;
|
||||||
|
}else{
|
||||||
|
$frag['time'][$ca_time['stage_year']] = 1;
|
||||||
|
}
|
||||||
|
//文章类型
|
||||||
|
if(isset($frag['type'][$cache_article['type']])){
|
||||||
|
$frag['type'][$cache_article['type']] += 1;
|
||||||
|
}else{
|
||||||
|
$frag['type'][$cache_article['type']] = 1;
|
||||||
|
}
|
||||||
|
//组成文章数组构建
|
||||||
|
if(isset($frag['articles'][$cache_article['article_id']])){
|
||||||
|
$frag['articles'][$cache_article['article_id']] += 1;
|
||||||
|
}else{
|
||||||
|
$frag['articles'][$cache_article['article_id']] =1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//阅读和下载量
|
||||||
|
$articles = $this->article_obj->field('j_article.*,(abs_num+pdf_num+html_num) num')
|
||||||
|
->where('journal_id',$data['journal_id'])
|
||||||
|
->where('state',0)
|
||||||
|
->order('num desc')->select();
|
||||||
|
|
||||||
|
foreach ($frag['articles'] as $k => $v){
|
||||||
|
$art = $this->article_obj->where('article_id',$k)->find();
|
||||||
|
$cnum = $v;
|
||||||
|
$frag['articles'][$k] = $art;
|
||||||
|
$frag['articles'][$k]['cite_num'] = $cnum;
|
||||||
|
//阅读和下载数
|
||||||
|
foreach ($articles as $key => $val){
|
||||||
|
if($val['article_id']==$k){
|
||||||
|
$frag['articles'][$k]['read_pm'] = $key+1;//阅读量排名
|
||||||
|
$frag['articles'][$k]['read_num'] = $val["num"];//阅读数
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$frag['read'] = $this->sort_art($frag['articles']);
|
||||||
|
//标题吸引力
|
||||||
|
$bty_articles = $this->article_obj->where('journal_id',$data['journal_id'])->where('state',0)->orderRaw('LENGTH(title) desc')->limit(10)->select();
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($bty_articles as $k => $v){
|
||||||
|
foreach ($frag['articles'] as $key => $val){
|
||||||
|
if($v['article_id'] == $val['article_id']){
|
||||||
|
$bty_articles[$k]['cite_num'] = $val['cite_num'];
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
$bty_articles[$k]['cite_num'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$frag['zs_title'] = $bty_articles;//标题字数
|
||||||
|
$btzf_articles = $this->article_obj
|
||||||
|
->where('journal_id',$data['journal_id'])
|
||||||
|
->where('state',0)
|
||||||
|
->where('title',['like','%?%'],['like','%!%'],'or')
|
||||||
|
->select();
|
||||||
|
foreach ($btzf_articles as $k => $v){
|
||||||
|
foreach ($frag['articles'] as $key => $val){
|
||||||
|
if($v['article_id'] == $val['article_id']){
|
||||||
|
$btzf_articles[$k]['cite_num'] = $val['cite_num'];
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
$btzf_articles[$k]['cite_num'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$frag['zf_title'] = $btzf_articles;
|
||||||
|
//摘要吸引力
|
||||||
|
$ab_articles = $this->article_obj->where('journal_id',$data['journal_id'])->where('state',0)->orderRaw('LENGTH(abstract) desc')->limit(10)->select();
|
||||||
|
foreach ($ab_articles as $k => $v){
|
||||||
|
foreach ($frag['articles'] as $key => $val){
|
||||||
|
if($v['article_id'] == $key){
|
||||||
|
$ab_articles[$k]['cite_num'] = $val['cite_num'];
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
$ab_articles[$k]['cite_num'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$frag['zs_abstract'] = $ab_articles;//摘要字数
|
||||||
|
$abzf_articles = $this->article_obj
|
||||||
|
->where('journal_id',$data['journal_id'])
|
||||||
|
->where('state',0)
|
||||||
|
->where('abstract',['like','%?%'],['like','%!%'],'or')
|
||||||
|
->select();
|
||||||
|
foreach ($abzf_articles as $k => $v){
|
||||||
|
foreach ($frag['articles'] as $key => $val){
|
||||||
|
if($v['article_id'] == $key){
|
||||||
|
$abzf_articles[$k]['cite_num'] = $val['cite_num'];
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
$abzf_articles[$k]['cite_num'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$frag['zf_abstract'] = $abzf_articles;
|
||||||
|
|
||||||
|
return jsonSuccess($frag);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function sort_art($articles){
|
||||||
|
$arr = array_values($articles);
|
||||||
|
for($i = 0;$i<count($arr);$i++){
|
||||||
|
for($j= $i;$j<count($arr)-1;$j++){
|
||||||
|
if($arr[$i]['read_num']<$arr[$j+1]['read_num']){
|
||||||
|
$data = $arr[$i];
|
||||||
|
$arr[$i] = $arr[$j+1];
|
||||||
|
$arr[$j+1] = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function checkTopic($article){
|
||||||
|
$tops = $this->article_to_topic_obj->where('article_id',$article['article_id'])->where('state',0)->select();
|
||||||
|
$frag = [];
|
||||||
|
foreach ($tops as $v){
|
||||||
|
$ca = $this->journal_topic_obj->where('journal_topic_id',$v['topic_id'])->find();
|
||||||
|
if($ca['level']==3){
|
||||||
|
$cac = $this->journal_topic_obj->where('journal_topic_id',$ca['parent_id'])->find();
|
||||||
|
if(isset($frag[$cac['journal_topic_id']])){
|
||||||
|
$frag[$cac['journal_topic_id']]['num'] += 1;
|
||||||
|
}else{
|
||||||
|
$frag[$cac['journal_topic_id']] = $cac;
|
||||||
|
$frag[$cac['journal_topic_id']]['num'] = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(isset($frag[$ca['journal_topic_id']])){
|
||||||
|
$frag[$ca['journal_topic_id']]['num'] += 1;
|
||||||
|
}else{
|
||||||
|
$frag[$ca['journal_topic_id']] = $ca;
|
||||||
|
$frag[$ca['journal_topic_id']]['num'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $frag;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkCountry($article){
|
||||||
|
$res = $this->article_author_obj->where('article_id',$article['article_id'])->where('state',0)->where('author_country','<>','China')->find();
|
||||||
|
return $res==null?'n':'w';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user