1
This commit is contained in:
@@ -545,7 +545,7 @@ class Article extends Controller
|
||||
Db::commit();
|
||||
$this->pushDoiToCrossref($data['doi'], $aid);
|
||||
$this->pushEmailToAuthor($aid);
|
||||
$this->addArticleMain($aid,$data['p_article_id']);
|
||||
// $this->addArticleMain($aid,$data['p_article_id']);
|
||||
return jsonSuccess(['article_id' => $aid]);
|
||||
} else {
|
||||
Db::rollback();
|
||||
@@ -1100,7 +1100,7 @@ class Article extends Controller
|
||||
$article_list[$k]['med_title'] = '';
|
||||
$article_list[$k]['med_ename'] = '';
|
||||
}
|
||||
$article_list[$k]['mains'] = $this->article_main_obj->where('article_id',$v['article_id'])->where('state',0)->select();
|
||||
$article_list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
}
|
||||
$count = $this->article_obj
|
||||
->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'], ['j_journal', 'j_journal.journal_id=j_article.journal_id', 'LEFT']))
|
||||
@@ -1108,6 +1108,100 @@ class Article extends Controller
|
||||
return json(['code' => 0, 'msg' => 'success', 'data' => ['count' => $count, 'articleList' => $article_list]]);
|
||||
}
|
||||
|
||||
|
||||
public function getArticleMainsForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
||||
$mains = getArticleMains($data['article_id']);
|
||||
$re['article'] = $article_info;
|
||||
$re['mains'] = $mains;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
public function delArticleMainForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_main_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$main_info = $this->article_main_obj->where('article_main_id',$data['article_main_id'])->find();
|
||||
$next = $this->article_main_obj->where('pre_id',$data['article_main_id'])->where('state',0)->find();
|
||||
if($next){
|
||||
//找到目标删除点的上位节点
|
||||
$pre = $this->article_main_obj
|
||||
->where('article_main_id','<',$main_info['article_main_id']-1)
|
||||
->order("article_main_id desc")
|
||||
->limit(1)->select();
|
||||
$pre_id = $pre[0]['article_main_id'];
|
||||
$find_add = true;
|
||||
while ($find_add){
|
||||
$fi = $this->article_main_obj->where('pre_id',$pre_id)->where('state',0)->find();
|
||||
if($fi){
|
||||
$pre_id = $fi['article_main_id'];
|
||||
}else{
|
||||
$find_add = false;
|
||||
}
|
||||
}
|
||||
$this->article_main_obj->where('article_main_id',$next['article_main_id'])->update(['pre_id'=>$pre_id]);
|
||||
}
|
||||
$this->article_main_obj->where('article_main_id',$data['article_main_id'])->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function editArticleMainForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_main_id"=>"require",
|
||||
"type"=>"require",
|
||||
"content"=>"require",
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
if($data['type']=="img"){
|
||||
$update['content'] = $data['content'];
|
||||
$update['width'] = $data['width'];
|
||||
$update['note'] = $data['note'];
|
||||
}else{
|
||||
$update['content'] = trim($data['content']);
|
||||
}
|
||||
$this->article_main_obj->where('article_main_id',$data['article_main_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function addArticleMainAddForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>'require',
|
||||
"pre_id"=>"require",
|
||||
"type"=>"require",
|
||||
"content"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$insert['article_id'] = $data['article_id'];
|
||||
$insert['pre_id'] = $data['pre_id'];
|
||||
$insert['is_add'] = 1;
|
||||
$insert['content'] = trim($data['content']);
|
||||
if($data['type']=="img"){
|
||||
$insert['width'] = $data['width'];
|
||||
$insert['note'] = trim($data['note']);
|
||||
}
|
||||
$this->article_main_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取文章对应期刊话题
|
||||
* @description 获取文章对应期刊话题
|
||||
|
||||
@@ -167,32 +167,5 @@ 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