diff --git a/application/api/controller/Preaccept.php b/application/api/controller/Preaccept.php index ca28762..0bbce01 100644 --- a/application/api/controller/Preaccept.php +++ b/application/api/controller/Preaccept.php @@ -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 */ diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index cb84519..280fef3 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -688,7 +688,7 @@ class Production extends Base $this->production_article_obj->where('p_article_id', $data['p_article_id'])->update($r_update); foreach($report_authors as $v){ $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['journal_title'] = $journal_info['title']; $this->user_author_obj->insert($iua); diff --git a/application/api/controller/Publish.php b/application/api/controller/Publish.php index b2d71a1..3301037 100644 --- a/application/api/controller/Publish.php +++ b/application/api/controller/Publish.php @@ -175,13 +175,18 @@ class Publish extends Base return jsonError($rule->getError()); } 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['refer_frag'] = $v; + $insert['refer_frag'] = $content; $insert['refer_type'] = "other"; $insert['cs'] = 0; - $insert['index'] = $k; $this->production_article_refer_obj->insert($insert); } + $this->refuseReferIndex($data['p_article_id']); return jsonSuccess([]); }