fix(server): ensure req.params.id string typing for banner routes
这个提交包含在:
@@ -671,7 +671,7 @@ app.post('/api/admin/banners', async (req: Request, res: Response) => {
|
||||
// 管理后台: 修改 Banner
|
||||
app.put('/api/admin/banners/:id', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const bannerId = req.params.id;
|
||||
const bannerId = String(req.params.id);
|
||||
const { title, subtitle, tag, badge, badgeType, bg, image, link, sortOrder, status } = req.body;
|
||||
|
||||
if (title) {
|
||||
@@ -707,7 +707,7 @@ app.put('/api/admin/banners/:id', async (req: Request, res: Response) => {
|
||||
// 管理后台: 切换 Banner 上架/下线状态
|
||||
app.post('/api/admin/banners/:id/status', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const bannerId = req.params.id;
|
||||
const bannerId = String(req.params.id);
|
||||
const { status } = req.body;
|
||||
if (status === undefined || (status !== 0 && status !== 1)) {
|
||||
return res.status(400).json({ code: 40000, message: '状态参数必须为 0 或 1' });
|
||||
@@ -727,7 +727,7 @@ app.post('/api/admin/banners/:id/status', async (req: Request, res: Response) =>
|
||||
// 管理后台: 删除 Banner
|
||||
app.delete('/api/admin/banners/:id', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const bannerId = req.params.id;
|
||||
const bannerId = String(req.params.id);
|
||||
const ok = await repo.deleteBanner(bannerId);
|
||||
if (!ok) {
|
||||
return res.status(404).json({ code: 40400, message: '轮播图不存在或已被删除' });
|
||||
|
||||
在新工单中引用
屏蔽一个用户