20201112
This commit is contained in:
@@ -109,7 +109,6 @@ class Article extends Controller {
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
public function myttt() {
|
||||
echo 'ok';
|
||||
}
|
||||
@@ -156,9 +155,9 @@ class Article extends Controller {
|
||||
public function getArticleByKeywords() {
|
||||
$data = $this->request->post();
|
||||
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
|
||||
if($article_info['keywords']==''){
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
$res_key = [];
|
||||
$res_rel = $this->article_obj->where("article_id","in", object_to_array(json_decode($article_info['related'])))->where('state',0)->select();
|
||||
if ($article_info['keywords'] != ''&& count($res_rel)<5){
|
||||
$keywords = explode(',', $article_info['keywords']);
|
||||
$where = '';
|
||||
foreach ($keywords as $v) {
|
||||
@@ -166,7 +165,10 @@ class Article extends Controller {
|
||||
}
|
||||
$whe = substr($where, 0, -2);
|
||||
$wstr = 'journal_id = ' . $article_info['journal_id'] . ' and state = 0 and article_id<>' . $data['article_id'] . ' and (' . $whe . ')';
|
||||
$res = $this->article_obj->where($wstr)->limit(5)->select();
|
||||
$res_key = $this->article_obj->where($wstr)->limit(5-count($res_rel))->select();
|
||||
}
|
||||
|
||||
$res = array_merge($res_key,$res_rel);
|
||||
foreach ($res as $k => $v) {
|
||||
$res[$k]['journal'] = $this->journal_obj->where('journal_id', $v['journal_id'])->find();
|
||||
$res[$k]['stage'] = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find();
|
||||
@@ -252,6 +254,7 @@ class Article extends Controller {
|
||||
$re['count'] = $count;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
private function getAuthor($article) {
|
||||
$where['article_id'] = $article['article_id'];
|
||||
$where['state'] = 0;
|
||||
@@ -455,7 +458,8 @@ class Article extends Controller {
|
||||
$ris .= 'JO - ' . $journal['title'] . "\n";
|
||||
$ris .= 'VL - ' . $stage_info['stage_vol'] . "\n";
|
||||
$ca_fq = explode('-', $stage_info['stage_page']);
|
||||
$ris .= 'SP - '.$ca_fq[0]."\n";if(isset($ca_fq[1])){
|
||||
$ris .= 'SP - ' . $ca_fq[0] . "\n";
|
||||
if (isset($ca_fq[1])) {
|
||||
$ris .= 'EP - ' . $ca_fq[1] . "\n";
|
||||
}
|
||||
$ris .= 'PY - ' . $stage_info['stage_year'] . "\n";
|
||||
|
||||
@@ -1395,6 +1395,96 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
|
||||
file_put_contents($txt, $xml);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 增加相关文章
|
||||
* @description 增加相关文章
|
||||
* @author wangjinlei
|
||||
* @url /master/Article/addRelatedArticle
|
||||
* @method POST
|
||||
*
|
||||
* @param name:article_id type:int require:1 desc:文章id
|
||||
* @param name:add_article_id type:int require:1 desc:增加的文章id
|
||||
*/
|
||||
public function addRelatedArticle(){
|
||||
$data = $this->request->post();
|
||||
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
||||
$frag = [];
|
||||
if($article_info['related']==""){
|
||||
$frag[] = $data['add_article_id'];
|
||||
}else{
|
||||
if(in_array($data['add_article_id'], object_to_array(json_decode($article_info['related'])))){
|
||||
return jsonError("重复添加!!");
|
||||
}
|
||||
$frag = array_merge(object_to_array(json_decode($article_info['related'])),[$data['add_article_id']]);
|
||||
}
|
||||
$this->article_obj->where("article_id",$data['article_id'])->update(['related'=> json_encode($frag)]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除相关文章
|
||||
* @description 删除相关文章
|
||||
* @author wangjinlei
|
||||
* @url /master/Article/delRelatedArticle
|
||||
* @method POST
|
||||
*
|
||||
* @param name:article_id type:int require:1 desc:文章id
|
||||
* @param name:del_article_id type:int require:1 desc:增加的文章id
|
||||
*/
|
||||
public function delRelatedArticle(){
|
||||
$data = $this->request->post();
|
||||
$article_info = $this->article_obj->where("article_id",$data['article_id'])->find();
|
||||
$frag = object_to_array(json_decode($article_info['related']));
|
||||
foreach ($frag as $k => $v){
|
||||
if($v==$data['del_article_id']){
|
||||
unset($frag[$k]);
|
||||
}
|
||||
}
|
||||
$this->article_obj->where("article_id",$data['article_id'])->update(['related'=> json_encode($frag)]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取相关文章
|
||||
* @description 获取相关文章
|
||||
* @author wangjinlei
|
||||
* @url /master/Article/getRelatedArticles
|
||||
* @method POST
|
||||
*
|
||||
* @param name:article_id type:int require:1 desc:文章id
|
||||
*
|
||||
* @return articles:文章列表#
|
||||
*/
|
||||
public function getRelatedArticles(){
|
||||
$data = $this->request->post();
|
||||
$article_info = $this->article_obj->where("article_id",$data['article_id'])->find();
|
||||
$list = $this->article_obj->where("article_id","in", object_to_array(json_decode($article_info['related'])))->select();
|
||||
$re['articles'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊分期文章
|
||||
* @description 获取期刊分期文章
|
||||
* @author wangjinlei
|
||||
* @url /master/Article/getArticlesByStages
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
* @return stages:文章列表#
|
||||
*/
|
||||
public function getArticlesByStages(){
|
||||
$data = $this->request->post();
|
||||
//获取期刊分期
|
||||
$stage = $this->journal_stage_obj->where('journal_id',$data['journal_id'])->where("state",0)->order('stage_vol desc,stage_no')->select();
|
||||
foreach ($stage as $k => $v){
|
||||
$stage[$k]['articles'] = $this->article_obj->where('journal_stage_id',$v['journal_stage_id'])->where('state',0)->select();
|
||||
}
|
||||
$re['stages'] = $stage;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 注册doi
|
||||
* @description 注册doi
|
||||
|
||||
Reference in New Issue
Block a user