终审邀请界面,多加一些信息,,,,解决参考文献有时候的中文问题
This commit is contained in:
@@ -217,6 +217,24 @@ class Finalreview extends Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($aLists as $key => $value) {
|
||||
$rr = Db::name("article_reviewer_final")->where("reviewer_id",$value['user_id'])->order("id desc")->limit(1)->select();
|
||||
if(isset($rr[0])){
|
||||
$aLists[$key]['last_time'] = $rr[0]['invited_time'];
|
||||
}else{
|
||||
$aLists[$key]['last_time'] = 0;
|
||||
}
|
||||
$info = Db::name("user_reviewer_info")->field("field,field_ai")->where("reviewer_id",$value['user_id'])->find();
|
||||
if($info){
|
||||
$aLists[$key]['field'] = $info['field'];
|
||||
$aLists[$key]['field_ai'] = $info['field_ai'];
|
||||
}else{
|
||||
$aLists[$key]['field'] = '';
|
||||
$aLists[$key]['field_ai'] = '';
|
||||
}
|
||||
}
|
||||
return json_encode(['status' => 1,'msg' => 'success','data' => ['total' => $iCount,'lists' => $aLists]]);
|
||||
}
|
||||
|
||||
|
||||
@@ -273,26 +273,83 @@ class CrossrefService
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取标题
|
||||
* 提取标题(英文优先)
|
||||
*
|
||||
* CrossRef 的 title / original-title 可能包含多个语言版本(中文期刊/双语文章常见)。
|
||||
* 这里优先返回不含中日韩字符的版本,全部为中文时才退回第一个。
|
||||
*/
|
||||
public function getTitle($aDoiInfo = [])
|
||||
{
|
||||
return $aDoiInfo['title'][0] ?? '';
|
||||
$candidates = [];
|
||||
if (!empty($aDoiInfo['title']) && is_array($aDoiInfo['title'])) {
|
||||
$candidates = array_merge($candidates, $aDoiInfo['title']);
|
||||
}
|
||||
if (!empty($aDoiInfo['original-title']) && is_array($aDoiInfo['original-title'])) {
|
||||
$candidates = array_merge($candidates, $aDoiInfo['original-title']);
|
||||
}
|
||||
return $this->pickPreferredLatin($candidates);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取期刊/出版社相关信息
|
||||
* 提取期刊/出版社相关信息(期刊名英文优先)
|
||||
*/
|
||||
public function getPublisher($aDoiInfo = [])
|
||||
{
|
||||
$containerTitles = (!empty($aDoiInfo['container-title']) && is_array($aDoiInfo['container-title']))
|
||||
? $aDoiInfo['container-title'] : [];
|
||||
$shortTitles = (!empty($aDoiInfo['short-container-title']) && is_array($aDoiInfo['short-container-title']))
|
||||
? $aDoiInfo['short-container-title'] : [];
|
||||
|
||||
return [
|
||||
'title' => isset($aDoiInfo['container-title'][0]) ? $aDoiInfo['container-title'][0] : '',
|
||||
'short_title' => isset($aDoiInfo['short-container-title'][0]) ? $aDoiInfo['short-container-title'][0] : '',
|
||||
'title' => $this->pickPreferredLatin($containerTitles),
|
||||
'short_title' => $this->pickPreferredLatin($shortTitles),
|
||||
'ISSN' => $aDoiInfo['ISSN'] ?? [],
|
||||
'publisher' => $aDoiInfo['publisher'] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否包含中日韩(CJK)字符
|
||||
*/
|
||||
public function hasCjk($str)
|
||||
{
|
||||
$str = (string)$str;
|
||||
if ($str === '') {
|
||||
return false;
|
||||
}
|
||||
return preg_match('/[\x{4e00}-\x{9fff}\x{3040}-\x{30ff}\x{ac00}-\x{d7af}\x{3400}-\x{4dbf}]/u', $str) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从多个候选字符串中优先挑选「不含 CJK 字符」的一个;
|
||||
* 全部为空则返回空串,全部含 CJK 则返回第一个非空值。
|
||||
*
|
||||
* @param array $candidates
|
||||
* @return string
|
||||
*/
|
||||
private function pickPreferredLatin($candidates)
|
||||
{
|
||||
if (!is_array($candidates) || empty($candidates)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$firstNonEmpty = '';
|
||||
foreach ($candidates as $item) {
|
||||
$s = trim((string)$item);
|
||||
if ($s === '') {
|
||||
continue;
|
||||
}
|
||||
if ($firstNonEmpty === '') {
|
||||
$firstNonEmpty = $s;
|
||||
}
|
||||
if (!$this->hasCjk($s)) {
|
||||
return $s;
|
||||
}
|
||||
}
|
||||
|
||||
return $firstNonEmpty;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用 PubMed/NLM 反查期刊规范缩写(CrossRef 无缩写时的兜底)。
|
||||
* 任何异常都吞掉并返回空串,保证不影响主流程。
|
||||
|
||||
@@ -89,25 +89,31 @@ class ProductionArticleRefer
|
||||
]);
|
||||
$summary = $svc->fetchWorkSummary($doiNorm);
|
||||
if ($summary !== null && !empty($summary['doi'])) {
|
||||
$update_a = [];
|
||||
$title = trim((string)($summary['title'] ?? ''));
|
||||
$jouraRaw = trim((string)($summary['joura'] ?? ''));
|
||||
// 姓全写 + 名首字母,超过 3 个作者取前 3 个 + et al
|
||||
$authorCitation = $svc->getAuthorsCitation($summary['raw'] ?? [], 3);
|
||||
$dateno = trim((string)($summary['dateno'] ?? ''));
|
||||
$doilink = trim((string)($summary['doilink'] ?? ''));
|
||||
$update_a['title'] = $title;
|
||||
$update_a['author'] = $authorCitation !== '' ? $authorCitation . '.' : '';
|
||||
$update_a['joura'] = $jouraRaw;
|
||||
$update_a['dateno'] = $dateno;
|
||||
$update_a['refer_type'] = "journal";
|
||||
$update_a['is_ja'] = 1;
|
||||
$update_a['doilink'] = $doilink;
|
||||
$update_a['cs'] = 1;
|
||||
$update_a['update_time'] = time();
|
||||
$update_a['is_deal'] = 1;
|
||||
Db::name('production_article_refer')->where(['p_refer_id' => $iPReferId])->limit(1)->update($update_a);
|
||||
return json_encode(['status' => 1,'msg' => 'Update successful']);
|
||||
|
||||
// 英文优先兜底:若 CrossRef 结果的标题/期刊/作者仍含中日韩字符,
|
||||
// 说明该 DOI 元数据是中文,放弃 CrossRef 路径,改走下方 citation.doi.org(lang=en-US)
|
||||
$hasCjk = $svc->hasCjk($title) || $svc->hasCjk($jouraRaw) || $svc->hasCjk($authorCitation);
|
||||
if (!$hasCjk) {
|
||||
$update_a = [];
|
||||
$dateno = trim((string)($summary['dateno'] ?? ''));
|
||||
$doilink = trim((string)($summary['doilink'] ?? ''));
|
||||
$update_a['title'] = $title;
|
||||
$update_a['author'] = $authorCitation !== '' ? $authorCitation . '.' : '';
|
||||
$update_a['joura'] = $jouraRaw;
|
||||
$update_a['dateno'] = $dateno;
|
||||
$update_a['refer_type'] = "journal";
|
||||
$update_a['is_ja'] = 1;
|
||||
$update_a['doilink'] = $doilink;
|
||||
$update_a['cs'] = 1;
|
||||
$update_a['update_time'] = time();
|
||||
$update_a['is_deal'] = 1;
|
||||
Db::name('production_article_refer')->where(['p_refer_id' => $iPReferId])->limit(1)->update($update_a);
|
||||
return json_encode(['status' => 1,'msg' => 'Update successful']);
|
||||
}
|
||||
}
|
||||
|
||||
//结束---用crossref接口的方式处理数据
|
||||
|
||||
Reference in New Issue
Block a user