chore(notice): 规范修复与安装演练收尾

This commit is contained in:
augushong
2026-10-12 13:40:40 +00:00
parent 3b6cb66549
commit a756b8a1cd
23 changed files with 978 additions and 981 deletions

View File

@@ -115,12 +115,12 @@ class NoticeBase extends AdminController
$delivery = [];
foreach ($statusCount as $channel => $counts) {
$delivery[] = [
'channel' => $channel,
'channel' => $channel,
'channel_name' => $channelNames[$channel] ?? $channel,
'pending' => $counts[SystemNoticeTarget::STATUS_PENDING] ?? 0,
'sending' => $counts[SystemNoticeTarget::STATUS_SENDING] ?? 0,
'success' => $counts[SystemNoticeTarget::STATUS_SUCCESS] ?? 0,
'failed' => $counts[SystemNoticeTarget::STATUS_FAILED] ?? 0,
'pending' => $counts[SystemNoticeTarget::STATUS_PENDING] ?? 0,
'sending' => $counts[SystemNoticeTarget::STATUS_SENDING] ?? 0,
'success' => $counts[SystemNoticeTarget::STATUS_SUCCESS] ?? 0,
'failed' => $counts[SystemNoticeTarget::STATUS_FAILED] ?? 0,
];
}
@@ -140,22 +140,22 @@ class NoticeBase extends AdminController
SystemNoticeTarget::STATUS_PENDING => ['name' => '待发', 'class' => 'layui-badge layui-bg-blue'],
SystemNoticeTarget::STATUS_SENDING => ['name' => '发送中', 'class' => 'layui-badge layui-bg-orange'],
SystemNoticeTarget::STATUS_SUCCESS => ['name' => '成功', 'class' => 'layui-badge layui-bg-green'],
SystemNoticeTarget::STATUS_FAILED => ['name' => '失败', 'class' => 'layui-badge'],
SystemNoticeTarget::STATUS_FAILED => ['name' => '失败', 'class' => 'layui-badge'],
];
$targetRows = [];
foreach ($targets as $target) {
$status = (int) $target->status;
$targetRows[] = [
'id' => $target->id,
'id' => $target->id,
'admin_nickname' => $nicknames[$target->admin_id] ?? ('#' . $target->admin_id),
'target_addr' => $target->target_addr,
'channel_name' => $channelNames[$target->channel] ?? $target->channel,
'status' => $status,
'status_name' => $statusMeta[$status]['name'] ?? (string) $status,
'status_class' => $statusMeta[$status]['class'] ?? 'layui-badge layui-bg-gray',
'retry_count' => (int) $target->retry_count,
'error_message' => (string) $target->error_message,
'send_time' => (int) $target->send_time,
'target_addr' => $target->target_addr,
'channel_name' => $channelNames[$target->channel] ?? $target->channel,
'status' => $status,
'status_name' => $statusMeta[$status]['name'] ?? (string) $status,
'status_class' => $statusMeta[$status]['class'] ?? 'layui-badge layui-bg-gray',
'retry_count' => (int) $target->retry_count,
'error_message' => (string) $target->error_message,
'send_time' => (int) $target->send_time,
];
}
@@ -197,9 +197,9 @@ class NoticeBase extends AdminController
$this->checkPostRequest();
$post = $this->request->post();
$rule = [
'id|ID' => 'require',
'id|ID' => 'require',
'field|字段' => 'require',
'value|值' => 'require',
'value|值' => 'require',
];
$this->validate($post, $rule);
if (!in_array($post['field'], $this->allowModifyFields)) {
@@ -238,10 +238,10 @@ class NoticeBase extends AdminController
$query->where('id', $targetId);
}
$count = $query->update([
'status' => SystemNoticeTarget::STATUS_PENDING,
'retry_count' => 0,
'status' => SystemNoticeTarget::STATUS_PENDING,
'retry_count' => 0,
'next_retry_time' => 0,
'error_message' => '',
'error_message' => '',
]);
$count > 0
@@ -274,14 +274,14 @@ class NoticeBase extends AdminController
$rows = [];
foreach (NoticeService::scenes() as $scene => $item) {
$rows[] = [
'scene' => $scene,
'title' => $item['title'],
'scene' => $scene,
'title' => $item['title'],
'channel_names' => implode('、', array_map(function ($channel) use ($channelNames) {
return $channelNames[$channel] ?? $channel;
}, $item['channels'])),
'locked' => (int) $item['locked'],
'subscribed' => $subscribeCounts[$scene] ?? 0,
'total_admins' => $totalAdmins,
'locked' => (int) $item['locked'],
'subscribed' => $subscribeCounts[$scene] ?? 0,
'total_admins' => $totalAdmins,
];
}
@@ -297,10 +297,10 @@ class NoticeBase extends AdminController
private function channelNames(): array
{
return [
NoticeService::CHANNEL_INMAIL => '站内信',
NoticeService::CHANNEL_EMAIL => '邮件',
NoticeService::CHANNEL_SMS => '短信',
NoticeService::CHANNEL_WECHAT => '公众号',
NoticeService::CHANNEL_INMAIL => '站内信',
NoticeService::CHANNEL_EMAIL => '邮件',
NoticeService::CHANNEL_SMS => '短信',
NoticeService::CHANNEL_WECHAT => '公众号',
];
}
}