1
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -35,6 +35,7 @@ class Submision extends Controller {
|
||||
protected $subscribe_base_topic_obj = '';
|
||||
protected $medicament_obj = '';
|
||||
protected $article_to_medicament_obj = '';
|
||||
protected $article_main_obj = '';
|
||||
|
||||
public function __construct(\think\Request $request = null) {
|
||||
parent::__construct($request);
|
||||
@@ -57,6 +58,7 @@ class Submision extends Controller {
|
||||
$this->subscribe_base_topic_obj = Db::name('subscribe_base_topic');
|
||||
$this->medicament_obj = Db::name('medicament');
|
||||
$this->article_to_medicament_obj = Db::name('ArticleToMedicament');
|
||||
$this->article_main_obj = Db::name("article_main");
|
||||
}
|
||||
|
||||
public function getJournalStages(){
|
||||
@@ -114,6 +116,45 @@ class Submision extends Controller {
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
public function getTopicsByIssn(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'issn'=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$journal_info = $this->journal_obj->where('issn', $data['issn'])->find();
|
||||
$res = $this->journal_topic_obj
|
||||
->where('journal_id', $journal_info['journal_id'])
|
||||
->where('state', 0)
|
||||
->select();
|
||||
//处理数组
|
||||
$frag = [];
|
||||
foreach ($res as $v) {
|
||||
if ($v['parent_id'] == 0) {
|
||||
$frag[] = $v;
|
||||
}
|
||||
}
|
||||
foreach ($frag as $kk => $vv) {
|
||||
$frag[$kk] = $this->getChieldarr($vv, $res);
|
||||
}
|
||||
$re['topics'] = $frag;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
private function getChieldarr($vv, $res)
|
||||
{
|
||||
if ($vv['is_final'] == 1) {
|
||||
return $vv;
|
||||
}
|
||||
foreach ($res as $v) {
|
||||
if ($v['parent_id'] == $vv['journal_topic_id']) {
|
||||
$vv['children'][] = $this->getChieldarr($v, $res);
|
||||
}
|
||||
}
|
||||
return $vv;
|
||||
}
|
||||
|
||||
private function getAuthor($article)
|
||||
{
|
||||
$where['article_id'] = $article['article_id'];
|
||||
@@ -126,4 +167,32 @@ class Submision extends Controller {
|
||||
return $frag;
|
||||
}
|
||||
|
||||
public function getArticleMains(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$mains = $this->article_main_obj->where('article_id',$data['article_id'])->where('state',0)->select();
|
||||
$re['mains'] = $mains;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
public function delArticleMain(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_main_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->article_main_obj->where('article_main_id',$data['article_main_id'])->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user