Skip to content

Commit 79d8e2b

Browse files
authored
Merge pull request #223 from Enraged-Dun-Cookie-Development-Team/fix-公告cdn返回格式错误
🐛 修复公告cdn返回格式错误
2 parents 485b6d8 + d2d2a18 commit 79d8e2b

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

.github/workflows/checker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Rust toolchain Stable
2222
uses: actions-rs/toolchain@v1
2323
with:
24-
toolchain: 1.80.1
24+
toolchain: 1.81.0
2525
components: clippy
2626
default: true
2727
- name: Rust toolchain Nightly

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ page_next_id = { version = "0.1.0", path = "./libs/page_next_id" }
115115

116116

117117
[dependencies]
118-
119118
# async
120119
async-trait = { workspace = true }
121120
# axum

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1.2
2-
FROM lukemathwalker/cargo-chef:latest-rust-1.80.1 AS chef
2+
FROM lukemathwalker/cargo-chef:latest-rust-1.81.0 AS chef
33
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
44
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
55
--mount=type=cache,target=/var/lib/apt,sharing=locked \

logic/ceobe_operation_logic/src/view.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use persistence::{
1717
use serde::{Deserialize, Serialize};
1818
use tencent_cloud_server::cdn::purge_urls_cache::PurgeCachePath;
1919
use typed_builder::TypedBuilder;
20+
use url::Url;
2021

2122
use crate::error::LogicError;
2223

@@ -73,8 +74,7 @@ impl TryInto<ToolLinkResp> for FrontendToolLink {
7374
pub struct AnnouncementResp {
7475
pub start_time: String,
7576
pub over_time: String,
76-
pub content: String,
77-
pub img_url: String,
77+
pub html: String,
7878
pub notice: bool,
7979
}
8080

@@ -89,11 +89,16 @@ impl From<announcement::Model> for AnnouncementResp {
8989
..
9090
}: announcement::Model,
9191
) -> Self {
92+
let image = Url::parse(&img_url)
93+
.map(|url| url.to_string())
94+
.unwrap_or_else(|_| format!(r#"/assets/image/{img_url}.png"#));
95+
9296
Self {
9397
start_time: naive_date_time_format(start_time),
9498
over_time: naive_date_time_format(over_time),
95-
content,
96-
img_url,
99+
html: format!(
100+
r#"<div class="online-area"><img class="online-title-img radius" src="{image}"/><div>{content}</div></div>"#,
101+
),
97102
notice,
98103
}
99104
}

0 commit comments

Comments
 (0)