作者堆叠 专刊

This commit is contained in:
wyn
2026-07-29 17:05:42 +08:00
parent f583f67e24
commit 1ee795b6b9
10 changed files with 2833 additions and 141 deletions

View File

@@ -25,6 +25,21 @@ class References extends Base
public function __construct(\think\Request $request = null) {
parent::__construct($request);
}
/**
* 参考文献堆叠统计可视化页
* 访问:/api/References/index?p_article_id=xxx
*/
public function index()
{
$pArticleId = intval($this->request->param('p_article_id', 0));
$this->assign([
'api_stats_js' => json_encode((string) url('api/References/referenceStackingStats'), JSON_UNESCAPED_SLASHES),
'init_p_article_id' => $pArticleId,
]);
return $this->fetch('references/index');
}
//OPENAI token
private $sApiKey = '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';
//OPENAI URL
@@ -1847,6 +1862,8 @@ class References extends Base
/**
* 参考文献引用堆叠统计(同作者>15%、同刊>20%、自引>10%,实时计算)
* 仅读本地库,不实时请求 Crossref/OpenAlex。
* 额外返回 author_data_issues未获取到作者 / 作者信息不全的参考文献列表
*
* POST/GET: p_article_id必填
*/
@@ -1871,6 +1888,66 @@ class References extends Base
}
}
/**
* 参考文献堆叠摘要(展示用)
* 返回:同作者名称+比例、同刊名称+比例、自引比例(仅超阈值的同作者/同刊)
*
* POST/GET: p_article_id必填
*/
public function referenceStackingSummary()
{
$aParam = $this->request->post();
if (empty($aParam)) {
$aParam = $this->request->param();
}
$iPArticleId = empty($aParam['p_article_id']) ? 0 : intval($aParam['p_article_id']);
if ($iPArticleId <= 0) {
return json_encode(array('status' => 2, 'msg' => 'Please select an article'));
}
try {
$svc = new ReferenceStackingStatsService();
$result = $svc->getStackingSummaryByPArticleId($iPArticleId);
return jsonSuccess($result);
} catch (\Exception $e) {
return jsonError($e->getMessage());
}
}
/**
* 获取单条参考文献作者信息:先 Crossref/OpenAlex或兜底 refer.author同步入库再返回明细
*
* POST/GET: p_article_id必填, p_refer_id必填
*/
public function referenceReferAuthors()
{
$aParam = $this->request->post();
if (empty($aParam)) {
$aParam = $this->request->param();
}
$iPArticleId = empty($aParam['p_article_id']) ? 0 : intval($aParam['p_article_id']);
$iPReferId = empty($aParam['p_refer_id']) ? 0 : intval($aParam['p_refer_id']);
if ($iPArticleId <= 0) {
return json_encode(array('status' => 2, 'msg' => 'Please select an article'));
}
if ($iPReferId <= 0) {
return jsonError('p_refer_id is required');
}
try {
$svc = new ReferenceReferAuthorService();
$result = $svc->fetchAuthorsByPReferId($iPArticleId, $iPReferId);
if (empty($result['refer'])) {
return jsonError('Reference not found');
}
return jsonSuccess($result);
} catch (\Exception $e) {
return jsonError($e->getMessage());
}
}
/**
* 测试:同步参考文献作者明细到 t_production_article_refer_author
* POST/GET: p_article_id必填, p_refer_id可选仅同步单条, include_authors可选默认 01 返回作者明细), sleep_ms可选默认 120