20201112
This commit is contained in:
@@ -106,6 +106,39 @@ class Article extends Controller {
|
||||
$re['cite'] = $cite;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取关键词相关文章
|
||||
* @description 获取关键词相关文章
|
||||
* @author wangjinlei
|
||||
* @url /api/Article/getArticleByKeywords
|
||||
* @method POST
|
||||
*
|
||||
* @param name:article_id type:int require:1 desc:文章id
|
||||
*
|
||||
*
|
||||
*/
|
||||
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([]);
|
||||
}
|
||||
$keywords = explode(',', $article_info['keywords']);
|
||||
$where = '';
|
||||
foreach ($keywords as $v){
|
||||
$where .= ' keywords like "%'.$v.'%" or';
|
||||
}
|
||||
$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();
|
||||
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();
|
||||
}
|
||||
return jsonSuccess($res);
|
||||
}
|
||||
|
||||
private function sys_author($authors, $organs, $atto) {
|
||||
$cache = [];
|
||||
foreach ($organs as $k => $v) {
|
||||
@@ -195,17 +228,6 @@ class Article extends Controller {
|
||||
return $frag;
|
||||
}
|
||||
|
||||
// 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 .= $v['author_name'].',';
|
||||
// }
|
||||
// return substr($frag,0, -1);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @title 获取stage文章列表
|
||||
* @description 获取stage文章列表
|
||||
@@ -605,19 +627,4 @@ class Article extends Controller {
|
||||
return $st[2].'/'.$yf.'/'.$st[0].'/';
|
||||
}
|
||||
|
||||
|
||||
// public function ggname(){
|
||||
// $list = $this->article_author_obj->where('article_author_id >= 1500')->select();
|
||||
// foreach ($list as $v){
|
||||
// $cache = explode(' ', $v['author_name']);
|
||||
// $first = str_replace('-', '', $cache[0]);
|
||||
// $last = isset($cache[1])?$cache[1]:'';
|
||||
// $this->article_author_obj->where('article_author_id',$v['article_author_id'])->update(['first_name'=>$first,'last_name'=>$last]);
|
||||
// }
|
||||
// echo '<pre>';
|
||||
// var_dump($list);
|
||||
// echo '</pre>';
|
||||
// die;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user