diff --git a/application/module/Reference/Ris.php b/application/module/Reference/Ris.php index 849430cc..9e0facf3 100644 --- a/application/module/Reference/Ris.php +++ b/application/module/Reference/Ris.php @@ -140,7 +140,7 @@ class Ris } //将解析好的ris数据写入数据库 - public function pushToDataTable($data,$create_ref=false){ + public function pushToDataTable($data){ if(!is_array($data) || count($data) < 1) { @@ -162,13 +162,6 @@ class Ris $ref['ris'] = $this->makeRisData(array(0=>$this->ris_records[$k])); $reference = $this->makeReferenceFlag($ref); - if ($create_ref) - { - $ref['reference'] = $reference; - }else{ - $ref['reference'] = $ref['title'].'---'.date("Y-m-d H:i:s").".".microtime().rand(); - } - $results = $this->events()->trigger('checkLoad', $this, compact('ref')); $id = $results->bottom(); @@ -179,8 +172,13 @@ class Ris $this->events()->trigger('deleteAuthor', $this, compact('id')); $this->events()->trigger('deleteTag', $this, compact('id')); + unset($ref['reference']); + $dbh->update($this->table->reference,$ref," id=$id "); } else { + + $ref['reference'] = $reference; + $id = $dbh->insert($this->table->reference,$ref,true); } @@ -231,7 +229,7 @@ class Ris //创建reference 字段 public function makeReferenceFlag($ref){ $str = array(); - isset($ref['author']) ? $str[] = $ref['author']:""; + isset($ref['author']) ? $str[] = join(",",$ref['author']):""; isset($ref['title']) ? $str[] = $ref['title']:""; isset($ref['year']) ? $str[] = $ref['year']:""; isset($ref['volume']) ? $str[] = $ref['volume']:"";