15m44p 工单附件列表视图解码 images + GitHub 关 issue 带 state_reason
- api/ticket.php: ticketMyList/ticketListAll 返回前 decodeTicketImages 把 images JSON 串解码成数组(与 ticketDetail 对齐)。旧版列表给前端的是字符串, applyTicketImgs(desc, t.images) 收字符串导致 [图片N] 占位符替换不到、 @gh: 附件名渲染不出来(用户实测'附件还是不对'根因)。 - gh_api.php: ghSyncClose 关 issue 加 state_reason——完结→completed(GitHub 显示 done)、驳回→not_planned(显示 not planned)。旧版只传 state=closed 不带 reason, GitHub 不会改成 done/not-planned 语义。
This commit is contained in:
@@ -593,6 +593,11 @@ function ticketMyList() {
|
|||||||
|
|
||||||
$list = [];
|
$list = [];
|
||||||
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
// ★ 15m44p: 列表视图 images 必须解码成数组,与 ticketDetail 对齐。
|
||||||
|
// 旧版列表直接返回原始 JSON 字符串,前端 applyTicketImgs(desc, images)
|
||||||
|
// 收到的是字符串而非数组 → [图片N] 占位符替换不到、@gh: 附件名渲染不出来
|
||||||
|
// (用户实测「附件还是不对」的根因)。
|
||||||
|
$row['images'] = decodeTicketImages(isset($row['images']) ? $row['images'] : null);
|
||||||
$list[] = $row;
|
$list[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -796,6 +801,8 @@ function ticketListAll() {
|
|||||||
|
|
||||||
$list = [];
|
$list = [];
|
||||||
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
// ★ 15m44p: 列表视图 images 必须解码成数组(同 ticketMyList),与 ticketDetail 对齐
|
||||||
|
$row['images'] = decodeTicketImages(isset($row['images']) ? $row['images'] : null);
|
||||||
$list[] = $row;
|
$list[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -199,9 +199,13 @@ function ghSyncClose($ticketId, $kind, $token, $sender = 'admin') {
|
|||||||
$closeComment = ($kind === 'completed')
|
$closeComment = ($kind === 'completed')
|
||||||
? GH_TICKET_PREFIX . $ticketId . '][' . $sender . '] ✅ 工单已完结'
|
? GH_TICKET_PREFIX . $ticketId . '][' . $sender . '] ✅ 工单已完结'
|
||||||
: GH_TICKET_PREFIX . $ticketId . '][' . $sender . '] 🚫 工单已驳回';
|
: GH_TICKET_PREFIX . $ticketId . '][' . $sender . '] 🚫 工单已驳回';
|
||||||
// 先评论(留痕)再关 issue
|
// 先评论(留痕)
|
||||||
ghApiRequest('POST', '/repos/' . $repo . '/issues/' . $issueNo . '/comments', ['body' => $closeComment], $token);
|
ghApiRequest('POST', '/repos/' . $repo . '/issues/' . $issueNo . '/comments', ['body' => $closeComment], $token);
|
||||||
$r = ghApiRequest('POST', '/repos/' . $repo . '/issues/' . $issueNo . '/close', ['state' => 'closed'], $token);
|
// ★ 15m44p: 关 issue 带 state_reason —— 完结→completed(GitHub显示done) / 驳回→not_planned(显示not planned)
|
||||||
|
// 旧版只传 state=closed 没带 reason,GitHub 不会改成 done/not-planned 语义。
|
||||||
|
$stateReason = ($kind === 'rejected') ? 'not_planned' : 'completed';
|
||||||
|
$r = ghApiRequest('POST', '/repos/' . $repo . '/issues/' . $issueNo . '/close',
|
||||||
|
['state' => 'closed', 'state_reason' => $stateReason], $token);
|
||||||
if (!$r['ok']) ghLog('close issue #' . $issueNo . ' failed: ' . $r['msg']);
|
if (!$r['ok']) ghLog('close issue #' . $issueNo . ' failed: ' . $r['msg']);
|
||||||
return $r['ok'];
|
return $r['ok'];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user