15m44s 工单 GitHub 三项:token继承+label打标+webhook联动关单
需求1(token继承): 玩家授权过且 access_token 仍有效→gh_oauth.php 发起授权前 先查 gh_auth_tokens 调 /user 验活,有效则 302 回 player.php?gh_inherit=1 直接继承 不弹 GitHub;真失效才重新走 OAuth。不再一股脑报'无效要重新授权'。 需求2(label打标): 撤单/用户回/管理回/驳回/完结 5 个动作调 ghSyncLabel,按 img.json repo.tag 映射(正常关单→已完成/驳回→已驳回/已回复/撤销)给对应 issue 打 label,并摘掉互斥状态类 label。gh_label_map 可配置,缺省中文兜底。 需求3(webhook联动关单): ghHandleWebhook issue 关闭事件按 state_reason 联动 PHP: completed(done)→已完结;not_planned→已驳回;缺省 done。 附件占位符 [图片N] 未替换根因=历史单(OPcache 跑旧编译)+漏清 OPcache,本轮部署 后会清 OPcache,新建单正常替换。
This commit is contained in:
@@ -66,6 +66,14 @@ function loadImgJson() {
|
||||
'gh_client_id' => '',
|
||||
'gh_client_secret' => '',
|
||||
'gh_webhook_secret' => '',
|
||||
// 15m44s: GitHub issue label(tag)映射,动作→label 名(可在 img.json repo.tag 配置)
|
||||
'gh_label_map' => [
|
||||
'正常关单' => '已完成',
|
||||
'驳回' => '已驳回',
|
||||
'已回复' => '已回复',
|
||||
'撤销' => '已撤销',
|
||||
'处理中' => '处理中',
|
||||
],
|
||||
];
|
||||
$file = __DIR__ . '/img.json';
|
||||
if (!is_readable($file)) return $cfg;
|
||||
@@ -121,6 +129,13 @@ function loadImgJson() {
|
||||
if (isset($j['repo']['webhook_secret'])) {
|
||||
$cfg['gh_webhook_secret'] = trim((string)$j['repo']['webhook_secret']);
|
||||
}
|
||||
// 15m44s: 读 repo.tag(动作→label 名 映射),中文键值。有则覆盖默认。
|
||||
if (isset($j['repo']['tag']) && is_array($j['repo']['tag'])) {
|
||||
foreach ($j['repo']['tag'] as $k => $v) {
|
||||
$k = trim((string)$k);
|
||||
if ($k !== '') $cfg['gh_label_map'][$k] = trim((string)$v);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($j['repo']['webhook_secret'])) {
|
||||
// 兼容旧顶层 webhook_secret(已部署的生产 img.json 可能是旧结构)
|
||||
|
||||
Reference in New Issue
Block a user