main bug 修复
This commit is contained in:
@@ -587,39 +587,39 @@ class Article extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function addArticleMainForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require",
|
||||
"p_article_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$check = $this->article_main_obj->where('article_id',$data['article_id'])->where('state',0)->find();
|
||||
if($check){
|
||||
return jsonError("Repeated submission");
|
||||
}
|
||||
$this->addArticleMain($data['article_id'],$data['p_article_id']);
|
||||
// public function addArticleMainForSubmission(){
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// "article_id"=>"require",
|
||||
// "p_article_id"=>"require"
|
||||
// ]);
|
||||
// if(!$rule->check($data)){
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $check = $this->article_main_obj->where('article_id',$data['article_id'])->where('state',0)->find();
|
||||
// if($check){
|
||||
// return jsonError("Repeated submission");
|
||||
// }
|
||||
// $this->addArticleMain($data['article_id'],$data['p_article_id']);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
private function addArticleMain($now_id,$p_id){
|
||||
$url = "http://api.tmrjournals.com/public/index.php/api/Production/getProductionMains";
|
||||
$pra['p_article_id'] = $p_id;
|
||||
$res = object_to_array(json_decode(myPost($url,$pra)));
|
||||
$mains = $res['data']['mains'];
|
||||
if(count($mains)==0){
|
||||
return ;
|
||||
}
|
||||
foreach ($mains as $k => $v){
|
||||
$insert['article_id'] = $now_id;
|
||||
$insert['width'] = isset($v['width'])?$v['width']:0;
|
||||
$insert['content'] = $v['content'];
|
||||
$insert['note'] = isset($v['note'])?$v['note']:'';
|
||||
$this->article_main_obj->insert($insert);
|
||||
}
|
||||
}
|
||||
// private function addArticleMain($now_id,$p_id){
|
||||
// $url = "http://api.tmrjournals.com/public/index.php/api/Production/getProductionMains";
|
||||
// $pra['p_article_id'] = $p_id;
|
||||
// $res = object_to_array(json_decode(myPost($url,$pra)));
|
||||
// $mains = $res['data']['mains'];
|
||||
// if(count($mains)==0){
|
||||
// return ;
|
||||
// }
|
||||
// foreach ($mains as $k => $v){
|
||||
// $insert['article_id'] = $now_id;
|
||||
// $insert['width'] = isset($v['width'])?$v['width']:0;
|
||||
// $insert['content'] = $v['content'];
|
||||
// $insert['note'] = isset($v['note'])?$v['note']:'';
|
||||
// $this->article_main_obj->insert($insert);
|
||||
// }
|
||||
// }
|
||||
|
||||
private function pushDoiToCrossref($doi, $article_id)
|
||||
{
|
||||
@@ -1377,33 +1377,33 @@ class Article extends Controller
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
$pre_info = $this->article_main_obj->where('article_main_id',$data['pre_id'])->find();
|
||||
$next_info = $this->article_main_obj->where('pre_id',$pre_info['article_main_id'])->where('state',0)->find();
|
||||
$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']);
|
||||
}
|
||||
$now_id = $this->article_main_obj->insertGetId($insert);
|
||||
if($next_info){//如果原节点的下级存在,那么要变换下个节点的父节点
|
||||
$this->article_main_obj->where('article_main_id',$next_info['article_main_id'])->update(['pre_id'=>$now_id]);
|
||||
}
|
||||
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());
|
||||
// }
|
||||
// $pre_info = $this->article_main_obj->where('article_main_id',$data['pre_id'])->find();
|
||||
// $next_info = $this->article_main_obj->where('pre_id',$pre_info['article_main_id'])->where('state',0)->find();
|
||||
// $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']);
|
||||
// }
|
||||
// $now_id = $this->article_main_obj->insertGetId($insert);
|
||||
// if($next_info){//如果原节点的下级存在,那么要变换下个节点的父节点
|
||||
// $this->article_main_obj->where('article_main_id',$next_info['article_main_id'])->update(['pre_id'=>$now_id]);
|
||||
// }
|
||||
// return jsonSuccess([]);
|
||||
// }
|
||||
|
||||
public function clearArticleMainForSubmission(){
|
||||
$data = $this->request->post();
|
||||
@@ -1417,53 +1417,53 @@ class Article extends Controller
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function addArticleMainsAddForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>'require',
|
||||
"pre_id"=>"require",
|
||||
"contents"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$pre_id = $data['pre_id'];
|
||||
$next_info = $this->article_main_obj->where('pre_id',$pre_id)->where('state',0)->find();
|
||||
$contents = json_decode($data['contents']);
|
||||
foreach ($contents as $k => $v){
|
||||
$insert['article_id'] = $data['article_id'];
|
||||
$insert['pre_id'] = $pre_id;
|
||||
$insert['is_add'] = 1;
|
||||
$insert['content'] = trim($v);
|
||||
$pre_id=$this->article_main_obj->insertGetId($insert);
|
||||
}
|
||||
if ($next_info){
|
||||
$this->article_main_obj->where('article_main_id',$next_info['article_main_id'])->update(['pre_id'=>$pre_id]);
|
||||
}
|
||||
return jsonSuccess($contents);
|
||||
}
|
||||
// public function addArticleMainsAddForSubmission(){
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// "article_id"=>'require',
|
||||
// "pre_id"=>"require",
|
||||
// "contents"=>"require"
|
||||
// ]);
|
||||
// if(!$rule->check($data)){
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $pre_id = $data['pre_id'];
|
||||
// $next_info = $this->article_main_obj->where('pre_id',$pre_id)->where('state',0)->find();
|
||||
// $contents = json_decode($data['contents']);
|
||||
// foreach ($contents as $k => $v){
|
||||
// $insert['article_id'] = $data['article_id'];
|
||||
// $insert['pre_id'] = $pre_id;
|
||||
// $insert['is_add'] = 1;
|
||||
// $insert['content'] = trim($v);
|
||||
// $pre_id=$this->article_main_obj->insertGetId($insert);
|
||||
// }
|
||||
// if ($next_info){
|
||||
// $this->article_main_obj->where('article_main_id',$next_info['article_main_id'])->update(['pre_id'=>$pre_id]);
|
||||
// }
|
||||
// return jsonSuccess($contents);
|
||||
// }
|
||||
|
||||
public function addArticleMainAddEmptyForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>'require',
|
||||
"pre_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$pre_info = $this->article_main_obj->where('article_main_id',$data['pre_id'])->find();
|
||||
$next_info = $this->article_main_obj->where('pre_id',$pre_info['article_main_id'])->where('state',0)->find();
|
||||
$insert['article_id'] = $data['article_id'];
|
||||
$insert['pre_id'] = $data['pre_id'];
|
||||
$insert['is_add'] = 1;
|
||||
$insert['content'] = "";
|
||||
$now_id = $this->article_main_obj->insertGetId($insert);
|
||||
if($next_info){//如果原节点的下级存在,那么要变换下个节点的父节点
|
||||
$this->article_main_obj->where('article_main_id',$next_info['article_main_id'])->update(['pre_id'=>$now_id]);
|
||||
}
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
// public function addArticleMainAddEmptyForSubmission(){
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// "article_id"=>'require',
|
||||
// "pre_id"=>"require"
|
||||
// ]);
|
||||
// if(!$rule->check($data)){
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $pre_info = $this->article_main_obj->where('article_main_id',$data['pre_id'])->find();
|
||||
// $next_info = $this->article_main_obj->where('pre_id',$pre_info['article_main_id'])->where('state',0)->find();
|
||||
// $insert['article_id'] = $data['article_id'];
|
||||
// $insert['pre_id'] = $data['pre_id'];
|
||||
// $insert['is_add'] = 1;
|
||||
// $insert['content'] = "";
|
||||
// $now_id = $this->article_main_obj->insertGetId($insert);
|
||||
// if($next_info){//如果原节点的下级存在,那么要变换下个节点的父节点
|
||||
// $this->article_main_obj->where('article_main_id',$next_info['article_main_id'])->update(['pre_id'=>$now_id]);
|
||||
// }
|
||||
// return jsonSuccess([]);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @title 获取文章对应期刊话题
|
||||
|
||||
Reference in New Issue
Block a user