feat(admin-activity): 后台代改活动——小程序端无需发版
- server: GET /api/admin/activities(搜索/列表含创建者标签)+ PUT /api/admin/activities/:id(start/end 算时长跨天+24h,白名单部分更新,写 admin_logs) - admin-web: 新增「活动管理」面板+编辑弹窗(标题/地点/起止时间/名额/费用/组织者/标签/描述/签到) - create-activity: 预设时长下拉改「结束时间*」选择器,提交时前端算 duration;编辑/模板回显反推结束时间;跨天 +24h - E2E 13/13(改时间/跨天5h/非法值拒/用户端回读即时生效/恢复原值)+ Playwright UI 验证(面板4行/弹窗字段/零console错误)
This commit is contained in:
@@ -17,8 +17,7 @@ Page({
|
||||
location: '',
|
||||
date: '',
|
||||
startTime: '',
|
||||
duration: 2,
|
||||
durationIndex: 2,
|
||||
endTime: '',
|
||||
maxParticipants: 20,
|
||||
tags: [],
|
||||
checkinEnabled: false,
|
||||
@@ -32,12 +31,6 @@ Page({
|
||||
showTemplateModal: false,
|
||||
templates: [],
|
||||
templatesLoading: false,
|
||||
durationOptions: [
|
||||
{ label: '0.5小时', value: 0.5 },
|
||||
{ label: '1小时', value: 1 },
|
||||
{ label: '2小时', value: 2 },
|
||||
{ label: '3小时', value: 3 },
|
||||
],
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
@@ -131,16 +124,25 @@ Page({
|
||||
const tpl = this.data.templates[index];
|
||||
if (!tpl) return;
|
||||
|
||||
const duration = tpl.duration || 2;
|
||||
const durationIndex = this.data.durationOptions.findIndex(opt => opt.value === duration);
|
||||
// 从模板 start_time 推导默认结束时间(无 start_time 时留空)
|
||||
let endTime = '';
|
||||
if (tpl.startTime) {
|
||||
const normalized = String(tpl.startTime).replace('T', ' ');
|
||||
const timePart = normalized.split(' ')[1] || '';
|
||||
const hours = timePart.substring(0, 2);
|
||||
const minutes = timePart.substring(3, 5);
|
||||
if (hours) {
|
||||
const endH = (parseInt(hours, 10) + (tpl.duration || 2)) % 24;
|
||||
endTime = `${String(endH).padStart(2, '0')}:${minutes || '00'}`;
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
'form.title': tpl.title || '',
|
||||
'form.coverUrl': getFullImageUrl(tpl.coverUrl),
|
||||
'form.description': tpl.description || '',
|
||||
'form.location': tpl.location || '',
|
||||
'form.duration': duration,
|
||||
'form.durationIndex': durationIndex >= 0 ? durationIndex : 2,
|
||||
'form.endTime': endTime,
|
||||
'form.maxParticipants': tpl.maxParticipants || 20,
|
||||
'form.tags': tpl.tags || [],
|
||||
'form.checkinEnabled': tpl.checkinEnabled || false,
|
||||
@@ -166,8 +168,12 @@ Page({
|
||||
datePart = parts[0] || '';
|
||||
timePart = parts[1] ? parts[1].substring(0, 5) : '';
|
||||
}
|
||||
const duration = activity.duration || 2;
|
||||
const durationIndex = this.data.durationOptions.findIndex(opt => opt.value === duration);
|
||||
// 由开始时间+时长推导结束时间(跨天取模)
|
||||
let endTime = '';
|
||||
if (timePart) {
|
||||
const endH = (parseInt(timePart.substring(0, 2), 10) + (activity.duration || 2)) % 24;
|
||||
endTime = `${String(endH).padStart(2, '0')}:${timePart.substring(3, 5) || '00'}`;
|
||||
}
|
||||
this.setData({
|
||||
'form.title': activity.title || '',
|
||||
'form.coverUrl': getFullImageUrl(activity.coverUrl),
|
||||
@@ -175,8 +181,7 @@ Page({
|
||||
'form.location': activity.location || '',
|
||||
'form.date': datePart,
|
||||
'form.startTime': timePart,
|
||||
'form.duration': duration,
|
||||
'form.durationIndex': durationIndex >= 0 ? durationIndex : 2,
|
||||
'form.endTime': endTime,
|
||||
'form.maxParticipants': activity.maxParticipants || 20,
|
||||
'form.tags': activity.tags || [],
|
||||
'form.checkinEnabled': activity.checkinEnabled || false,
|
||||
@@ -255,12 +260,8 @@ Page({
|
||||
this.setData({ 'form.startTime': e.detail.value });
|
||||
},
|
||||
|
||||
onDurationChange(e) {
|
||||
const index = e.detail.value;
|
||||
this.setData({
|
||||
'form.duration': this.data.durationOptions[index].value,
|
||||
'form.durationIndex': index
|
||||
});
|
||||
onEndTimeChange(e) {
|
||||
this.setData({ 'form.endTime': e.detail.value });
|
||||
},
|
||||
|
||||
onParticipantsChange(e) {
|
||||
@@ -346,9 +347,19 @@ Page({
|
||||
return;
|
||||
}
|
||||
if (!form.date || !form.startTime) {
|
||||
wx.showToast({ title: '请选择活动日期和时间', icon: 'none' });
|
||||
wx.showToast({ title: '请选择活动日期和开始时间', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!form.endTime) {
|
||||
wx.showToast({ title: '请选择结束时间', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 由开始/结束时间计算时长(小时);结束时间早于开始时间视为跨天
|
||||
const toMinutes = (t) => parseInt(t.substring(0, 2), 10) * 60 + parseInt(t.substring(3, 5), 10);
|
||||
let diffMinutes = toMinutes(form.endTime) - toMinutes(form.startTime);
|
||||
if (diffMinutes <= 0) diffMinutes += 24 * 60;
|
||||
const duration = Math.round((diffMinutes / 60) * 100) / 100;
|
||||
|
||||
const startTime = `${form.date} ${form.startTime}:00`;
|
||||
|
||||
@@ -369,7 +380,7 @@ Page({
|
||||
description: form.description,
|
||||
location: form.location,
|
||||
startTime: startTime,
|
||||
duration: form.duration,
|
||||
duration: duration,
|
||||
maxParticipants: form.maxParticipants,
|
||||
tags: form.tags,
|
||||
checkinEnabled: form.checkinEnabled,
|
||||
@@ -388,7 +399,7 @@ Page({
|
||||
description: form.description,
|
||||
location: form.location,
|
||||
startTime: startTime,
|
||||
duration: form.duration,
|
||||
duration: duration,
|
||||
maxParticipants: form.maxParticipants,
|
||||
tags: form.tags,
|
||||
checkinEnabled: form.checkinEnabled,
|
||||
|
||||
@@ -71,10 +71,10 @@
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">预设时长</text>
|
||||
<picker mode="selector" range="{{durationOptions}}" range-key="label" value="{{form.durationIndex}}" bindchange="onDurationChange">
|
||||
<text class="form-label">结束时间 *</text>
|
||||
<picker mode="time" value="{{form.endTime}}" bindchange="onEndTimeChange">
|
||||
<view class="picker-value">
|
||||
{{durationOptions[form.durationIndex] && durationOptions[form.durationIndex].label || '2小时'}}
|
||||
{{form.endTime || '请选择结束时间'}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
@@ -162,6 +162,27 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel" id="panelActivities">
|
||||
<div class="panel-head">
|
||||
<h2>活动管理(后台代改 · 小程序端无需发版)</h2>
|
||||
<div class="search-box">
|
||||
<input id="actSearchInput" placeholder="搜索活动标题 / 地点 / 组织者 / 创建者" onkeydown="if(event.key==='Enter')loadActivities()">
|
||||
<button class="btn btn-primary btn-sm" style="width:auto" onclick="loadActivities()">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="overflow-x:auto">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>活动</th><th>开始时间</th><th>时长</th><th>名额</th><th>费用</th><th>状态</th><th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="actRows"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="actEmptyTip" class="empty hidden">暂无活动</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -237,6 +258,42 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 活动编辑弹窗(后台代改) -->
|
||||
<div class="modal-mask" id="actEditModal">
|
||||
<div class="modal" style="max-width:560px">
|
||||
<h3 id="au-title">编辑活动</h3>
|
||||
|
||||
<div class="section-title">基本信息</div>
|
||||
<div class="field"><label>活动标题</label><input id="au-title-field"></div>
|
||||
<div class="field"><label>活动地点</label><input id="au-location"></div>
|
||||
<div class="row2">
|
||||
<div class="field"><label>开始日期</label><input id="au-date" type="date"></div>
|
||||
<div class="field"><label>开始时间</label><input id="au-start" type="time"></div>
|
||||
</div>
|
||||
<div class="row2">
|
||||
<div class="field"><label>结束日期</label><input id="au-enddate" type="date"></div>
|
||||
<div class="field"><label>结束时间</label><input id="au-end" type="time"></div>
|
||||
</div>
|
||||
<div class="tip">结束时间早于开始时间时按跨天处理(+24h)。改动保存后小程序端立即生效,无需发版。</div>
|
||||
|
||||
<div class="section-title">报名与费用</div>
|
||||
<div class="row2">
|
||||
<div class="field"><label>名额上限</label><input id="au-maxp" type="number" min="1" max="9999"></div>
|
||||
<div class="field"><label>费用(元)</label><input id="au-fee" type="number" min="0" step="0.01"></div>
|
||||
</div>
|
||||
<div class="field"><label>组织者</label><input id="au-organizer"></div>
|
||||
<div class="field"><label>标签(用、分隔,最多5个)</label><input id="au-tags" placeholder="如:AI工具、拆书课"></div>
|
||||
<div class="field"><label>活动描述</label><textarea id="au-description" rows="4" style="width:100%;padding:8px 10px;border:1px solid #d7dee8;border-radius:6px;font:inherit"></textarea></div>
|
||||
<div class="field"><label style="display:flex;align-items:center;gap:6px;cursor:pointer"><input id="au-checkin" type="checkbox" style="width:auto"> 启用签到</label></div>
|
||||
|
||||
<div class="login-error" id="auError"></div>
|
||||
<div style="display:flex;gap:8px;margin-top:16px">
|
||||
<button class="btn btn-primary" onclick="saveActivity()">保存</button>
|
||||
<button class="btn" style="background:#f0f4f8" onclick="document.getElementById('actEditModal').classList.remove('show')">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script>
|
||||
@@ -295,7 +352,7 @@ function enterMain(username, displayName) {
|
||||
document.getElementById('loginPage').classList.add('hidden');
|
||||
document.getElementById('mainPage').classList.remove('hidden');
|
||||
document.getElementById('whoami').textContent = displayName || username || 'admin';
|
||||
loadStats(); loadUsers(1); loadAuditMode();
|
||||
loadStats(); loadUsers(1); loadAuditMode(); loadActivities();
|
||||
}
|
||||
let auditMode = false;
|
||||
async function loadAuditMode() {
|
||||
@@ -539,6 +596,100 @@ async function saveUser() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 活动管理(后台代改) ----------
|
||||
let editingActId = null;
|
||||
function fmtDur(h) {
|
||||
if (!h && h !== 0) return '-';
|
||||
const n = Number(h);
|
||||
if (n < 1) return Math.round(n * 60) + '分钟';
|
||||
if (n === Math.floor(n)) return n + '小时';
|
||||
return Math.floor(n) + '小时' + Math.round((n % 1) * 60) + '分';
|
||||
}
|
||||
function actEndTime(a) {
|
||||
if (!a || !a.startTime || !a.duration) return '';
|
||||
const d = new Date(String(a.startTime).replace('T', ' '));
|
||||
if (isNaN(d)) return '';
|
||||
d.setTime(d.getTime() + Number(a.duration) * 3600000);
|
||||
const p = (x) => String(x).padStart(2, '0');
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
||||
}
|
||||
async function loadActivities() {
|
||||
const search = document.getElementById('actSearchInput').value.trim();
|
||||
const r = await api(`/api/admin/activities?search=${encodeURIComponent(search)}`);
|
||||
if (!r.success) { showToast(r.message || '活动加载失败'); return; }
|
||||
const rows = r.data.list || [];
|
||||
document.getElementById('actEmptyTip').classList.toggle('hidden', rows.length > 0);
|
||||
document.getElementById('actRows').innerHTML = rows.map(a => `
|
||||
<tr>
|
||||
<td style="max-width:280px">
|
||||
<div class="name">${escapeHtml(a.title || '未命名')}</div>
|
||||
<div class="sub-line">${escapeHtml(a.location || '-')} · ${escapeHtml(a.organizer || a.creatorName || '')}</div>
|
||||
${(a.tags || []).length ? `<div class="sub-line">${a.tags.map(t => `<span class="tag tag-user">${escapeHtml(t)}</span>`).join(' ')}</div>` : ''}
|
||||
</td>
|
||||
<td>${escapeHtml(String(a.startTime || '-').replace('T', ' ').substring(0, 16))}</td>
|
||||
<td>${fmtDur(a.duration)}<div class="sub-line">至 ${actEndTime(a).substring(11, 16)}</div></td>
|
||||
<td>${a.participantCount || 0}/${a.maxParticipants || '-'}</td>
|
||||
<td>${a.fee > 0 ? '¥' + a.fee : '免费'}</td>
|
||||
<td>${a.status === 'active' ? '进行中' : escapeHtml(a.status || '-')}</td>
|
||||
<td><button class="btn btn-sm" style="background:#1a56b0;color:#fff" onclick="openEditActivity('${escapeHtml(a.id)}')">编辑</button></td>
|
||||
</tr>`).join('');
|
||||
}
|
||||
let actCache = [];
|
||||
async function openEditActivity(id) {
|
||||
const r = await api('/api/admin/activities');
|
||||
if (!r.success) { showToast(r.message || '加载失败'); return; }
|
||||
actCache = r.data.list || [];
|
||||
const a = actCache.find(x => x.id === id);
|
||||
if (!a) { showToast('未找到活动'); return; }
|
||||
editingActId = id;
|
||||
const st = String(a.startTime || '').replace('T', ' ');
|
||||
document.getElementById('au-title').textContent = `编辑活动:${a.title}`;
|
||||
document.getElementById('au-title-field').value = a.title || '';
|
||||
document.getElementById('au-location').value = a.location || '';
|
||||
document.getElementById('au-date').value = st.substring(0, 10);
|
||||
document.getElementById('au-start').value = st.substring(11, 16);
|
||||
const et = actEndTime(a);
|
||||
document.getElementById('au-enddate').value = et.substring(0, 10);
|
||||
document.getElementById('au-end').value = et.substring(11, 16);
|
||||
document.getElementById('au-maxp').value = a.maxParticipants || 20;
|
||||
document.getElementById('au-fee').value = a.fee || 0;
|
||||
document.getElementById('au-organizer').value = a.organizer || '';
|
||||
document.getElementById('au-tags').value = (a.tags || []).join('、');
|
||||
document.getElementById('au-description').value = (a.description || '').replace(/<[^>]+>/g, '');
|
||||
document.getElementById('au-checkin').checked = !!a.checkinEnabled;
|
||||
document.getElementById('auError').textContent = '';
|
||||
document.getElementById('actEditModal').classList.add('show');
|
||||
}
|
||||
async function saveActivity() {
|
||||
if (!editingActId) return;
|
||||
const errEl = document.getElementById('auError');
|
||||
errEl.textContent = '';
|
||||
const date = document.getElementById('au-date').value;
|
||||
const start = document.getElementById('au-start').value;
|
||||
const endDate = document.getElementById('au-enddate').value;
|
||||
const end = document.getElementById('au-end').value;
|
||||
if (!date || !start || !endDate || !end) { errEl.textContent = '请完整选择开始与结束的日期、时间'; return; }
|
||||
const maxp = Number(document.getElementById('au-maxp').value);
|
||||
if (!maxp || maxp < 1) { errEl.textContent = '名额需 ≥ 1'; return; }
|
||||
const body = {
|
||||
title: document.getElementById('au-title-field').value.trim(),
|
||||
location: document.getElementById('au-location').value.trim(),
|
||||
startTime: `${date} ${start}:00`,
|
||||
endTime: `${endDate} ${end}:00`,
|
||||
maxParticipants: maxp,
|
||||
fee: Number(document.getElementById('au-fee').value) || 0,
|
||||
organizer: document.getElementById('au-organizer').value.trim(),
|
||||
tags: document.getElementById('au-tags').value.split(/[,,、]/).map(s => s.trim()).filter(Boolean),
|
||||
description: document.getElementById('au-description').value,
|
||||
checkinEnabled: document.getElementById('au-checkin').checked,
|
||||
};
|
||||
const r = await api(`/api/admin/activities/${editingActId}`, { method: 'PUT', body });
|
||||
if (!r.success) { errEl.textContent = r.message || '保存失败'; return; }
|
||||
showToast('已保存,小程序端即时生效');
|
||||
document.getElementById('actEditModal').classList.remove('show');
|
||||
loadActivities();
|
||||
}
|
||||
|
||||
// ---------- 启动 ----------
|
||||
(async function init() {
|
||||
if (!token) return;
|
||||
|
||||
@@ -3324,6 +3324,114 @@ app.get('/api/admin/users', requireAdmin, (req, res) => {
|
||||
});
|
||||
|
||||
// 设置用户角色(v8 单表:行即会员身份,单点更新;会员角色即种子用户角色)
|
||||
// ===== 管理员活动管理(后台代改:小程序端无需发版即可改活动信息) =====
|
||||
|
||||
// 活动列表(含创建者昵称、报名数、标签)
|
||||
app.get('/api/admin/activities', requireAdmin, (req, res) => {
|
||||
try {
|
||||
const { search = '' } = req.query;
|
||||
const kw = `%${String(search).trim()}%`;
|
||||
const where = String(search).trim()
|
||||
? `WHERE a.title LIKE ? OR a.location LIKE ? OR IFNULL(a.organizer, '') LIKE ? OR a.id LIKE ? OR IFNULL(u.nickname, '') LIKE ? OR IFNULL(u.name, '') LIKE ?`
|
||||
: '';
|
||||
const args = String(search).trim() ? Array(6).fill(kw) : [];
|
||||
const rows = db.prepare(`
|
||||
SELECT a.id, a.title, a.cover_url, a.location, a.start_time, a.duration, a.max_participants, a.fee,
|
||||
a.organizer, a.checkin_enabled, a.status, a.participant_count, a.created_at, a.updated_at,
|
||||
a.creator_id, u.nickname AS creator_nickname, u.name AS creator_name,
|
||||
(SELECT GROUP_CONCAT(tag_name, '、') FROM activity_tags t WHERE t.activity_id = a.id) AS tags
|
||||
FROM activities a LEFT JOIN users u ON u.id = a.creator_id
|
||||
${where}
|
||||
ORDER BY a.start_time DESC LIMIT 200
|
||||
`).all(...args);
|
||||
res.json({
|
||||
success: true,
|
||||
data: {
|
||||
list: rows.map(r => ({
|
||||
id: r.id,
|
||||
title: r.title,
|
||||
coverUrl: r.cover_url,
|
||||
location: r.location,
|
||||
startTime: r.start_time,
|
||||
duration: r.duration,
|
||||
maxParticipants: r.max_participants,
|
||||
fee: r.fee,
|
||||
organizer: r.organizer,
|
||||
checkinEnabled: !!r.checkin_enabled,
|
||||
status: r.status,
|
||||
participantCount: r.participant_count,
|
||||
createdAt: r.created_at,
|
||||
updatedAt: r.updated_at,
|
||||
creatorId: r.creator_id,
|
||||
creatorName: r.creator_nickname || r.creator_name || r.creator_id,
|
||||
tags: r.tags ? r.tags.split('、') : [],
|
||||
})),
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('管理员获取活动列表失败:', error);
|
||||
res.status(500).json({ success: false, message: '获取活动列表失败' });
|
||||
}
|
||||
});
|
||||
|
||||
// 管理员代改活动(时间/名额/费用/地点/描述等;白名单部分更新)
|
||||
app.put('/api/admin/activities/:id', requireAdmin, (req, res) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
const activity = db.prepare('SELECT * FROM activities WHERE id = ?').get(id);
|
||||
if (!activity) return res.json({ success: false, message: '活动不存在' });
|
||||
|
||||
const b = req.body || {};
|
||||
// start_time / end_time 成对出现:由两者算 duration(小时);也接受直接传 duration
|
||||
let startTime = b.startTime !== undefined ? String(b.startTime).trim() : activity.start_time;
|
||||
let duration = activity.duration;
|
||||
if (b.endTime !== undefined) {
|
||||
const end = String(b.endTime).trim();
|
||||
const m = (d) => new Date(d).getTime();
|
||||
if (!m(startTime) || !m(end)) {
|
||||
return res.json({ success: false, message: '时间格式不正确(需 YYYY-MM-DD HH:mm:ss)' });
|
||||
}
|
||||
let diffH = (m(end) - m(startTime)) / 3600000;
|
||||
if (diffH <= 0) diffH += 24;
|
||||
duration = Math.round(diffH * 100) / 100;
|
||||
} else if (b.duration !== undefined) {
|
||||
const d = Number(b.duration);
|
||||
if (!d || d <= 0 || d > 720) return res.json({ success: false, message: '时长无效(0-720 小时)' });
|
||||
duration = d;
|
||||
}
|
||||
const maxP = b.maxParticipants !== undefined ? Number(b.maxParticipants) : activity.max_participants;
|
||||
if (!maxP || maxP < 1 || maxP > 9999) return res.json({ success: false, message: '名额无效(1-9999)' });
|
||||
const fee = b.fee !== undefined ? Number(b.fee) || 0 : activity.fee;
|
||||
if (fee < 0 || fee > 1000000) return res.json({ success: false, message: '费用无效' });
|
||||
|
||||
const now = new Date().toISOString();
|
||||
db.prepare(`UPDATE activities SET title = ?, location = ?, start_time = ?, duration = ?, max_participants = ?,
|
||||
fee = ?, organizer = ?, description = ?, checkin_enabled = ?, updated_at = ? WHERE id = ?`).run(
|
||||
b.title !== undefined ? String(b.title).trim() : activity.title,
|
||||
b.location !== undefined ? String(b.location).trim() : activity.location,
|
||||
startTime,
|
||||
duration,
|
||||
maxP,
|
||||
fee,
|
||||
b.organizer !== undefined ? String(b.organizer).trim() : activity.organizer,
|
||||
b.description !== undefined ? String(b.description) : activity.description,
|
||||
b.checkinEnabled === undefined ? activity.checkin_enabled : (b.checkinEnabled ? 1 : 0),
|
||||
now, id
|
||||
);
|
||||
if (Array.isArray(b.tags)) {
|
||||
db.prepare('DELETE FROM activity_tags WHERE activity_id = ?').run(id);
|
||||
const ins = db.prepare('INSERT INTO activity_tags (activity_id, tag_name) VALUES (?, ?)');
|
||||
b.tags.map(t => String(t).trim()).filter(Boolean).slice(0, 5).forEach(t => ins.run(id, t));
|
||||
}
|
||||
writeAdminLog(req.admin, 'update_activity', 'activity', id,
|
||||
`${activity.title}: 时间/时长/名额等已更新`);
|
||||
res.json({ success: true, data: { id, startTime: startTime, duration } });
|
||||
} catch (error) {
|
||||
console.error('管理员更新活动失败:', error);
|
||||
res.status(500).json({ success: false, message: '更新失败' });
|
||||
}
|
||||
});
|
||||
|
||||
app.put('/api/admin/users/:id/role', requireAdmin, (req, res) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
|
||||
Reference in New Issue
Block a user