This commit is contained in:
wangjinlei
2023-07-14 18:23:25 +08:00
parent 3f289cebec
commit 32ae12e5b3
3 changed files with 51 additions and 3 deletions

View File

@@ -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节点 /**非doi形式添加refer节点
* @return void * @return void
*/ */

View File

@@ -688,7 +688,7 @@ class Production extends Base
$this->production_article_obj->where('p_article_id', $data['p_article_id'])->update($r_update); $this->production_article_obj->where('p_article_id', $data['p_article_id'])->update($r_update);
foreach($report_authors as $v){ foreach($report_authors as $v){
$iua['user_id'] = $v['user_id']; $iua['user_id'] = $v['user_id'];
$iua['w_article_id'] = $res['date']['article_id']; $iua['w_article_id'] = $res['data']['article_id'];
$iua['w_article_doi'] = '10.53388/'.$p_info['doi']; $iua['w_article_doi'] = '10.53388/'.$p_info['doi'];
$iua['journal_title'] = $journal_info['title']; $iua['journal_title'] = $journal_info['title'];
$this->user_author_obj->insert($iua); $this->user_author_obj->insert($iua);

View File

@@ -175,13 +175,18 @@ class Publish extends Base
return jsonError($rule->getError()); return jsonError($rule->getError());
} }
foreach ($data['contents'] as $k => $v){ foreach ($data['contents'] as $k => $v){
//处理content
if(strlen($v)<10){
continue;
}
$content = substr($v,stripos($v,".")+1);
$insert['p_article_id'] = $data['p_article_id']; $insert['p_article_id'] = $data['p_article_id'];
$insert['refer_frag'] = $v; $insert['refer_frag'] = $content;
$insert['refer_type'] = "other"; $insert['refer_type'] = "other";
$insert['cs'] = 0; $insert['cs'] = 0;
$insert['index'] = $k;
$this->production_article_refer_obj->insert($insert); $this->production_article_refer_obj->insert($insert);
} }
$this->refuseReferIndex($data['p_article_id']);
return jsonSuccess([]); return jsonSuccess([]);
} }