This commit is contained in:
wangjinlei
2022-07-13 12:03:08 +08:00
parent 4e0f62fab5
commit 809170fed6
7 changed files with 286 additions and 47 deletions

View File

@@ -31,6 +31,8 @@ class Article extends Controller {
protected $subscribe_topic_obj = '';
protected $base_topic_obj = '';
protected $subscribe_base_topic_obj = '';
protected $medicament_obj = '';
protected $article_to_medicament_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -51,6 +53,8 @@ class Article extends Controller {
$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');
$this->medicament_obj = Db::name('medicament');
$this->article_to_medicament_obj = Db::name('ArticleToMedicament');
}
/**
@@ -572,7 +576,12 @@ class Article extends Controller {
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');
$journals = [];
if(isset($data['editor_id'])&&$data['editor_id']!=''){
$journals = $this->journal_obj->where('editor_id', $data['editor_id'])->column('journal_id');
}else{
$journals = $this->journal_obj->where('state',0)->column('journal_id');
}
$where['j_article.journal_id'] = ['in', $journals];
}
if (intval($data['journal_stage_id']) !== 0) {
@@ -590,6 +599,16 @@ class Article extends Controller {
$cache_title = str_replace($val, '<i>' . $val . '</i>', $cache_title);
}
$article_list[$k]['title'] = $cache_title;
//获取药剂信息
$atm = $this->article_to_medicament_obj->where('article_id',$v['article_id'])->where('atm_state',0)->find();
if($atm){
$med_info = $this->medicament_obj->where('med_id',$atm['med_id'])->where('med_state',0)->find();
$article_list[$k]['med_title'] = $med_info['med_title'];
$article_list[$k]['med_ename'] = $med_info['med_ename'];
}else{
$article_list[$k]['med_title'] = '';
$article_list[$k]['med_ename'] = '';
}
}
$count = $this->article_obj->where($where)->count();
return json(['code' => 0, 'msg' => 'success', 'data' => ['count' => $count, 'articleList' => $article_list]]);