1
This commit is contained in:
@@ -139,6 +139,49 @@ class Preaccept extends Base
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
public function addReferByParticleid(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"p_article_id" => "require",
|
||||
"pre_p_refer_id" => "require",
|
||||
"refer_type"=>"require"
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
|
||||
$pre_refer = $this->production_article_refer_obj->where('p_refer_id', $data['pre_p_refer_id'])->find();
|
||||
$insert['p_article_id'] = $p_info['p_article_id'];
|
||||
$insert['index'] = $pre_refer['index'] + 1;
|
||||
$insert['ctime'] = time();
|
||||
$insert['is_change'] = 1;
|
||||
$insert['refer_type'] = $data['refer_type'];
|
||||
if($data['refer_type']=="journal"){
|
||||
$insert['refer_doi'] = isset($data['doi'])?$data['doi']:'';
|
||||
$insert['author'] = trim($data['author']);
|
||||
$insert['title'] = trim($data['title']);
|
||||
$insert['joura'] = trim($data['joura']);
|
||||
$insert['dateno'] = $data['dateno'];
|
||||
$insert['doilink'] = $data['doilink'];
|
||||
$insert['cs'] = 1;
|
||||
$insert['is_ja'] = 1;
|
||||
}elseif($data['refer_type']=="book"){
|
||||
$insert['author'] = trim($data['author']);
|
||||
$insert['title'] = trim($data['title']);
|
||||
$insert['dateno'] = $data['dateno'];
|
||||
$insert['isbn'] = $data['isbn'];
|
||||
$insert['cs'] = 1;
|
||||
$insert['is_ja'] = 1;
|
||||
}else{
|
||||
$insert['cs'] = 0;
|
||||
$insert['refer_frag'] = trim($data['content']);
|
||||
}
|
||||
$adId= $this->production_article_refer_obj->insertGetId($insert);
|
||||
$this->production_article_refer_obj->where('p_article_id', $p_info['p_article_id'])->where("p_refer_id", "<>", $adId)->where("index", ">", $pre_refer['index'])->where('state', 0)->setInc('index');
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**非doi形式添加refer节点
|
||||
* @return void
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user