Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e81bab6ea |
+1
-1
@@ -3,7 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3001",
|
||||
"dev": "next dev -p 3002",
|
||||
"build": "next build",
|
||||
"start": "next start -p 3001",
|
||||
"lint": "next lint"
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Card,
|
||||
Descriptions,
|
||||
InputNumber,
|
||||
Popconfirm,
|
||||
Space,
|
||||
Spin,
|
||||
Switch,
|
||||
@@ -21,6 +24,10 @@ import type { GuideVideoConfig as GuideCfg } from '@/lib/types';
|
||||
|
||||
const { Text } = Typography;
|
||||
const MAX_BYTES = 100 * 1024 * 1024;
|
||||
const MIN_PLAYS = 1;
|
||||
const MAX_PLAYS = 50;
|
||||
const MIN_REWARD_COIN = 10;
|
||||
const MAX_REWARD_COIN = 10000;
|
||||
type Scene = 'coupon' | 'comparison';
|
||||
|
||||
const META: Record<Scene, { title: string; action: string }> = {
|
||||
@@ -28,16 +35,29 @@ const META: Record<Scene, { title: string; action: string }> = {
|
||||
comparison: { title: '开始比价引导视频', action: '开始比价' },
|
||||
};
|
||||
|
||||
function formatDuration(durationMs: number | null | undefined) {
|
||||
if (durationMs == null || !Number.isFinite(durationMs)) return '—';
|
||||
return `${(durationMs / 1000).toFixed(3).replace(/\.?0+$/, '')} 秒`;
|
||||
}
|
||||
|
||||
function SceneConfig({ scene }: { scene: Scene }) {
|
||||
const meta = META[scene];
|
||||
const [cfg, setCfg] = useState<GuideCfg | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [uploading, setUploading] = useState(false);
|
||||
const [enabled, setEnabled] = useState(true);
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
const [maxPlays, setMaxPlays] = useState(3);
|
||||
const [rewardCoin, setRewardCoin] = useState(100);
|
||||
const canEdit = canDo(['operator']);
|
||||
const configValid =
|
||||
Number.isInteger(maxPlays) &&
|
||||
maxPlays >= MIN_PLAYS &&
|
||||
maxPlays <= MAX_PLAYS &&
|
||||
Number.isInteger(rewardCoin) &&
|
||||
rewardCoin >= MIN_REWARD_COIN &&
|
||||
rewardCoin <= MAX_REWARD_COIN &&
|
||||
rewardCoin % 10 === 0;
|
||||
|
||||
const sync = (value: GuideCfg) => {
|
||||
setCfg(value);
|
||||
@@ -49,9 +69,7 @@ function SceneConfig({ scene }: { scene: Scene }) {
|
||||
const load = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await api.get<GuideCfg>('/admin/api/guide-video', {
|
||||
params: { scene },
|
||||
});
|
||||
const { data } = await api.get<GuideCfg>('/admin/api/guide-video', { params: { scene } });
|
||||
sync(data);
|
||||
} catch (e) {
|
||||
message.error(errMsg(e));
|
||||
@@ -65,15 +83,15 @@ function SceneConfig({ scene }: { scene: Scene }) {
|
||||
}, [scene]);
|
||||
|
||||
const save = async () => {
|
||||
if (!configValid) {
|
||||
message.error('请检查配置:播放次数为 1~50,每次金币为 10~10000 且必须是 10 的倍数');
|
||||
return;
|
||||
}
|
||||
setSaving(true);
|
||||
try {
|
||||
const { data } = await api.patch<GuideCfg>(
|
||||
'/admin/api/guide-video',
|
||||
{
|
||||
enabled,
|
||||
reward_coin: rewardCoin,
|
||||
...(scene === 'comparison' ? { max_plays: maxPlays } : {}),
|
||||
},
|
||||
{ enabled, max_plays: maxPlays, reward_coin: rewardCoin },
|
||||
{ params: { scene } },
|
||||
);
|
||||
sync(data);
|
||||
@@ -98,7 +116,7 @@ function SceneConfig({ scene }: { scene: Scene }) {
|
||||
sync(data);
|
||||
message.success(`${meta.title}已更新`);
|
||||
} catch (e) {
|
||||
message.error(errMsg(e));
|
||||
message.error(`${errMsg(e)},原视频和配置未改变`);
|
||||
} finally {
|
||||
setUploading(false);
|
||||
}
|
||||
@@ -106,7 +124,7 @@ function SceneConfig({ scene }: { scene: Scene }) {
|
||||
|
||||
const beforeUpload = (file: File) => {
|
||||
if (file.type !== 'video/mp4' && !/\.mp4$/i.test(file.name)) {
|
||||
message.error('仅支持 MP4 视频(H.264 编码)');
|
||||
message.error('仅支持 MP4 视频(H.264 或 HEVC/H.265 编码)');
|
||||
return Upload.LIST_IGNORE;
|
||||
}
|
||||
if (file.size > MAX_BYTES) {
|
||||
@@ -138,20 +156,11 @@ function SceneConfig({ scene }: { scene: Scene }) {
|
||||
size="small"
|
||||
title={meta.title}
|
||||
style={{ marginBottom: 16 }}
|
||||
extra={
|
||||
cfg?.updated_at ? (
|
||||
<Text type="secondary">
|
||||
更新于 {new Date(cfg.updated_at).toLocaleString('zh-CN')}
|
||||
</Text>
|
||||
) : null
|
||||
}
|
||||
extra={cfg?.updated_at ? <Text type="secondary">更新于 {new Date(cfg.updated_at).toLocaleString('zh-CN')}</Text> : null}
|
||||
>
|
||||
<p style={{ color: '#777', marginTop: 0 }}>
|
||||
Android 用户点击「{meta.action}」后,前 {cfg?.max_plays ?? 3}{' '}
|
||||
次在等候浮层广告位播放本视频并奖励金币。次数按账号、按功能分别计算;
|
||||
开播即计次,播完或中途关闭均发放当次配置的金币。
|
||||
{scene === 'coupon' &&
|
||||
'领券引导视频的播放次数上限请在「监控审计 → 白名单」中调整。'}
|
||||
Android 用户点击「{meta.action}」后,符合次数条件时播放本视频。次数按账号、按功能分别计算,
|
||||
每完整观看 1/10 视频立即发放 1/10 金币;中途退出只保留已完成圈的奖励。
|
||||
</p>
|
||||
{loading || !cfg ? (
|
||||
<Spin style={{ display: 'block', margin: '24px 0' }} />
|
||||
@@ -163,97 +172,115 @@ function SceneConfig({ scene }: { scene: Scene }) {
|
||||
<video
|
||||
src={mediaUrl(cfg.video_url)}
|
||||
controls
|
||||
style={{
|
||||
width: 240,
|
||||
maxHeight: 420,
|
||||
borderRadius: 12,
|
||||
background: '#000',
|
||||
}}
|
||||
style={{ width: 240, maxHeight: 420, borderRadius: 12, background: '#000' }}
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
style={{
|
||||
height: 280,
|
||||
border: '1px dashed #d9d9d9',
|
||||
borderRadius: 12,
|
||||
display: 'grid',
|
||||
placeItems: 'center',
|
||||
color: '#aaa',
|
||||
}}
|
||||
>
|
||||
<div style={{ height: 280, border: '1px dashed #d9d9d9', borderRadius: 12, display: 'grid', placeItems: 'center', color: '#aaa' }}>
|
||||
未上传视频
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<Space direction="vertical" size="middle" style={{ minWidth: 390 }}>
|
||||
{cfg.analysis_status === 'invalid' || cfg.analysis_error ? (
|
||||
<Alert
|
||||
type="error"
|
||||
showIcon
|
||||
message="视频分析异常,当前场景不可启用"
|
||||
description={cfg.analysis_error || '请重新上传符合要求的视频'}
|
||||
/>
|
||||
) : null}
|
||||
<Space>
|
||||
<span>启用:</span>
|
||||
<Switch
|
||||
checked={enabled}
|
||||
disabled={!canEdit}
|
||||
disabled={!canEdit || (!enabled && cfg.analysis_status !== 'valid')}
|
||||
onChange={setEnabled}
|
||||
/>
|
||||
{!enabled && <Tag color="orange">已关闭</Tag>}
|
||||
{!enabled && cfg.analysis_status !== 'valid' && <Text type="secondary">请先上传并通过视频分析</Text>}
|
||||
</Space>
|
||||
{scene === 'comparison' && (
|
||||
<Space>
|
||||
<span>播放次数:</span>
|
||||
<InputNumber
|
||||
min={0}
|
||||
max={50}
|
||||
precision={0}
|
||||
value={maxPlays}
|
||||
disabled={!canEdit}
|
||||
onChange={(value) => setMaxPlays(value ?? 0)}
|
||||
/>
|
||||
<Text type="secondary">每个账号前 N 次(默认 3)</Text>
|
||||
</Space>
|
||||
)}
|
||||
<Space>
|
||||
<span>每次金币:</span>
|
||||
<span>播放次数:</span>
|
||||
<InputNumber
|
||||
min={0}
|
||||
max={10000}
|
||||
min={MIN_PLAYS}
|
||||
max={MAX_PLAYS}
|
||||
precision={0}
|
||||
status={maxPlays < MIN_PLAYS || maxPlays > MAX_PLAYS ? 'error' : undefined}
|
||||
value={maxPlays}
|
||||
disabled={!canEdit}
|
||||
onChange={(v) => setMaxPlays(v ?? MIN_PLAYS)}
|
||||
/>
|
||||
<Text type="secondary">每个账号 1~50 次(默认 3)</Text>
|
||||
</Space>
|
||||
<Space>
|
||||
<span>每次金币总价:</span>
|
||||
<InputNumber
|
||||
min={MIN_REWARD_COIN}
|
||||
max={MAX_REWARD_COIN}
|
||||
step={10}
|
||||
precision={0}
|
||||
status={
|
||||
rewardCoin < MIN_REWARD_COIN ||
|
||||
rewardCoin > MAX_REWARD_COIN ||
|
||||
rewardCoin % 10 !== 0
|
||||
? 'error'
|
||||
: undefined
|
||||
}
|
||||
value={rewardCoin}
|
||||
disabled={!canEdit}
|
||||
onChange={(value) => setRewardCoin(value ?? 0)}
|
||||
onChange={(v) => setRewardCoin(v ?? MIN_REWARD_COIN)}
|
||||
/>
|
||||
<Text type="secondary">默认 100</Text>
|
||||
<Text type="secondary">10~10000,必须是 10 的倍数(默认 100)</Text>
|
||||
</Space>
|
||||
{cfg.video_url ? (
|
||||
<Descriptions size="small" bordered column={2}>
|
||||
<Descriptions.Item label="总时长">{formatDuration(cfg.duration_ms)}</Descriptions.Item>
|
||||
<Descriptions.Item label="单圈时长">
|
||||
{formatDuration(cfg.circle_duration_ms ?? (cfg.duration_ms == null ? null : cfg.duration_ms / 10))}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="单圈金币">
|
||||
{rewardCoin === cfg.reward_coin ? cfg.reward_per_circle : rewardCoin / cfg.circle_count}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="编码">
|
||||
视频 {cfg.video_codec || '—'} / 音频 {cfg.audio_codec || '无'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="分析状态" span={2}>
|
||||
<Tag color={cfg.analysis_status === 'valid' ? 'green' : 'orange'}>
|
||||
{cfg.analysis_status === 'valid'
|
||||
? '分析完成'
|
||||
: cfg.analysis_status === 'invalid'
|
||||
? '分析异常'
|
||||
: '未上传'}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
) : null}
|
||||
<Space wrap>
|
||||
<Upload
|
||||
accept="video/mp4,.mp4"
|
||||
showUploadList={false}
|
||||
beforeUpload={beforeUpload}
|
||||
disabled={!canEdit}
|
||||
>
|
||||
<Button
|
||||
icon={<UploadOutlined />}
|
||||
loading={uploading}
|
||||
disabled={!canEdit}
|
||||
>
|
||||
<Upload accept="video/mp4,.mp4" showUploadList={false} beforeUpload={beforeUpload} disabled={!canEdit}>
|
||||
<Button icon={<UploadOutlined />} loading={uploading} disabled={!canEdit}>
|
||||
{cfg.video_url ? '更换视频' : '上传视频'}
|
||||
</Button>
|
||||
</Upload>
|
||||
{cfg.video_url && (
|
||||
<Button icon={<DeleteOutlined />} danger loading={uploading} disabled={!canEdit} onClick={removeVideo}>
|
||||
移除视频
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title={`确认移除${meta.title}?`}
|
||||
description="移除后该场景的新播放将无法使用引导视频,已经开始的播放不受影响。"
|
||||
okText="确认移除"
|
||||
cancelText="取消"
|
||||
okButtonProps={{ danger: true }}
|
||||
onConfirm={removeVideo}
|
||||
disabled={!canEdit}
|
||||
>
|
||||
<Button icon={<DeleteOutlined />} danger loading={uploading} disabled={!canEdit}>
|
||||
移除视频
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
<Text type="secondary">MP4(H.264),≤100MB</Text>
|
||||
<Text type="secondary">MP4(H.264 或 HEVC/H.265,可无音轨;有音轨须 AAC),30~180 秒,≤100MB</Text>
|
||||
</Space>
|
||||
<Button
|
||||
type="primary"
|
||||
loading={saving}
|
||||
disabled={!canEdit}
|
||||
onClick={save}
|
||||
>
|
||||
<Button type="primary" loading={saving} disabled={!canEdit || !configValid} onClick={save}>
|
||||
保存配置
|
||||
</Button>
|
||||
<Text type="secondary">
|
||||
累计播放 {cfg.total_plays} 次,已发币 {cfg.granted_plays} 次
|
||||
</Text>
|
||||
</Space>
|
||||
</Space>
|
||||
)}
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
ProfileOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
SecurityScanOutlined,
|
||||
StopOutlined,
|
||||
SettingOutlined,
|
||||
ShareAltOutlined,
|
||||
TeamOutlined,
|
||||
@@ -106,7 +105,6 @@ const NAV_GROUPS: NavGroup[] = [
|
||||
{ key: '/analytics-health', icon: <LineChartOutlined />, label: '埋点成功率' },
|
||||
{ key: '/event-logs', icon: <DatabaseOutlined />, label: '埋点日志' },
|
||||
{ key: '/audit-logs', icon: <FileSearchOutlined />, label: '审计日志' },
|
||||
{ key: '/limit-whitelist', icon: <StopOutlined />, label: '白名单' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,6 @@ import {
|
||||
CopyOutlined,
|
||||
DownOutlined,
|
||||
EditOutlined,
|
||||
PlusCircleOutlined,
|
||||
ReloadOutlined,
|
||||
RightOutlined,
|
||||
} from '@ant-design/icons';
|
||||
@@ -70,8 +69,8 @@ type IncidentStatus = 'open' | 'blocked';
|
||||
const RULE_LIMITS: Record<RiskKind, { min: number; max: number; help: string }> = {
|
||||
sms: {
|
||||
min: 1,
|
||||
max: 100000,
|
||||
help: '统计成功下发;告警阈值与短信硬限制分别配置。',
|
||||
max: 5,
|
||||
help: '统计成功下发;最高5次,与现有每设备每小时发送上限一致。',
|
||||
},
|
||||
oneclick: {
|
||||
min: 1,
|
||||
@@ -80,8 +79,8 @@ const RULE_LIMITS: Record<RiskKind, { min: number; max: number; help: string }>
|
||||
},
|
||||
compare: {
|
||||
min: 1,
|
||||
max: 100000,
|
||||
help: '同一账户按北京时间自然日累计;告警阈值与比价硬限制分别配置。',
|
||||
max: 100,
|
||||
help: '同一账户按北京时间自然日累计;最高100次,与比价每日上限一致。',
|
||||
},
|
||||
};
|
||||
const utcTime = (value: string | null, withDate = true) =>
|
||||
@@ -598,40 +597,6 @@ export default function RiskMonitorPage() {
|
||||
[lists, loadAll, message, modal],
|
||||
);
|
||||
|
||||
const addToWhitelist = useCallback(
|
||||
(row: RiskIncidentItem) => {
|
||||
const isCompare = row.kind === 'compare';
|
||||
const subjectValue = isCompare ? row.phone : row.subject_id;
|
||||
if (!isCompare && subjectValue?.startsWith('legacy-ip:')) {
|
||||
void message.error(
|
||||
'旧客户端未上报真实设备 ID,无法加入设备白名单,请升级客户端后重试',
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!subjectValue) {
|
||||
void message.error(
|
||||
isCompare
|
||||
? '该风险记录没有关联手机号,暂时无法加入白名单'
|
||||
: '该风险记录没有设备 ID,暂时无法加入白名单',
|
||||
);
|
||||
return;
|
||||
}
|
||||
const ruleCode: Record<RiskKind, string> = {
|
||||
sms: 'risk.sms.hourly',
|
||||
oneclick: 'risk.oneclick.daily',
|
||||
compare: 'risk.compare.daily',
|
||||
};
|
||||
const params = new URLSearchParams({
|
||||
create: '1',
|
||||
subject_type: isCompare ? 'phone' : 'device',
|
||||
subject_value: subjectValue,
|
||||
rule_code: ruleCode[row.kind],
|
||||
});
|
||||
window.location.assign(`/limit-whitelist?${params.toString()}`);
|
||||
},
|
||||
[message],
|
||||
);
|
||||
|
||||
const columns = useCallback(
|
||||
(kind: RiskKind): ColumnsType<RiskIncidentItem> => {
|
||||
const actionColumn = {
|
||||
@@ -639,12 +604,9 @@ export default function RiskMonitorPage() {
|
||||
key: 'actions',
|
||||
align: 'right' as const,
|
||||
fixed: 'right' as const,
|
||||
width: 280,
|
||||
width: 180,
|
||||
render: (_: unknown, row: RiskIncidentItem) => {
|
||||
const open = expanded.has(row.incident_id);
|
||||
const canAddToWhitelist =
|
||||
row.kind === 'compare' ||
|
||||
!row.subject_id.startsWith('legacy-ip:');
|
||||
return (
|
||||
<span className={styles.actionGroup}>
|
||||
<Button
|
||||
@@ -656,24 +618,6 @@ export default function RiskMonitorPage() {
|
||||
>
|
||||
{open ? '收起' : '展开'}
|
||||
</Button>
|
||||
<Tooltip
|
||||
title={
|
||||
canAddToWhitelist
|
||||
? undefined
|
||||
: '旧客户端未上报真实设备 ID,无法加入设备白名单'
|
||||
}
|
||||
>
|
||||
<span>
|
||||
<Button
|
||||
size="small"
|
||||
icon={<PlusCircleOutlined />}
|
||||
disabled={!canAddToWhitelist}
|
||||
onClick={() => addToWhitelist(row)}
|
||||
>
|
||||
加入白名单
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
{row.status === 'open' && (
|
||||
<>
|
||||
<Button
|
||||
@@ -756,16 +700,7 @@ export default function RiskMonitorPage() {
|
||||
actionColumn,
|
||||
];
|
||||
},
|
||||
[
|
||||
acting,
|
||||
addToWhitelist,
|
||||
copy,
|
||||
detailLoading,
|
||||
expanded,
|
||||
revokeRestriction,
|
||||
runAction,
|
||||
toggle,
|
||||
],
|
||||
[acting, copy, detailLoading, expanded, revokeRestriction, runAction, toggle],
|
||||
);
|
||||
|
||||
const cards = useMemo(() => {
|
||||
|
||||
+13
-84
@@ -414,17 +414,23 @@ export interface FeedbackQrConfig {
|
||||
updated_at: string | null;
|
||||
}
|
||||
|
||||
/** 领券等候浮层的「新手引导视频」配置(前 3 次用它替代广告,默认每次固定 100 金币)。
|
||||
* 后台只开放 enabled + 换片;下面几个字段接口仍返回,但页面不展示、也不回传。 */
|
||||
/** 领券/比价等候浮层的引导视频配置。视频分析结果均由服务端 ffprobe 生成。 */
|
||||
export interface GuideVideoConfig {
|
||||
scene: 'coupon' | 'comparison';
|
||||
enabled: boolean;
|
||||
video_url: string | null; // /media/guide_video/xxx.mp4;null = 未配片(浮层照旧只放广告)
|
||||
max_plays: number; // 每个账号前 N 次浮层放引导视频(服务端默认 3,后台不开放调整)
|
||||
reward_coin: number; // 每次固定金币(服务端默认 100,播完 / 中途关闭都发)
|
||||
video_url: string | null;
|
||||
max_plays: number;
|
||||
reward_coin: number;
|
||||
updated_at: string | null;
|
||||
total_plays: number; // 只读统计:全站已播次数(后台不再展示)
|
||||
granted_plays: number; // 只读统计:其中已发币次数(后台不再展示)
|
||||
duration_ms: number | null;
|
||||
circle_duration_ms: number | null;
|
||||
circle_count: 10;
|
||||
reward_per_circle: number;
|
||||
video_codec: string | null;
|
||||
audio_codec: string | null;
|
||||
analysis_status: 'missing' | 'valid' | 'invalid';
|
||||
analysis_error: string | null;
|
||||
config_version: number;
|
||||
}
|
||||
|
||||
export interface AuditLog {
|
||||
@@ -895,80 +901,3 @@ export interface HealthTrendPoint extends HealthMetrics {
|
||||
export interface HealthBreakdownRow extends HealthMetrics {
|
||||
key: string; // 维度值(event 名 / app_ver / oem);缺失为 "(unknown)"
|
||||
}
|
||||
|
||||
// ===== 统一限制策略 / 白名单 =====
|
||||
export type LimitSubjectType = 'phone' | 'device';
|
||||
export type LimitPolicyMode =
|
||||
| 'inherit'
|
||||
| 'override'
|
||||
| 'unlimited'
|
||||
| 'suppress_alert';
|
||||
|
||||
export interface LimitRule {
|
||||
code: string;
|
||||
label: string;
|
||||
group: string;
|
||||
global_limit: number;
|
||||
default_limit: number;
|
||||
window_label: string;
|
||||
subject_types: LimitSubjectType[];
|
||||
allowed_modes: LimitPolicyMode[];
|
||||
min_value: number;
|
||||
max_value: number;
|
||||
supports_reset: boolean;
|
||||
alert_only: boolean;
|
||||
}
|
||||
|
||||
export interface LimitDeviceCandidate {
|
||||
device_id: string;
|
||||
source: string;
|
||||
source_label: string;
|
||||
user_id: number | null;
|
||||
username: string | null;
|
||||
phone: string | null;
|
||||
nickname: string | null;
|
||||
device_model: string | null;
|
||||
last_active_at: string;
|
||||
}
|
||||
|
||||
export interface LimitOverride {
|
||||
id: number;
|
||||
subject_type: LimitSubjectType;
|
||||
subject_value: string;
|
||||
rule_code: string;
|
||||
rule_label: string;
|
||||
rule_group: string;
|
||||
mode: LimitPolicyMode;
|
||||
limit_value: number | null;
|
||||
global_limit: number;
|
||||
effective_limit: number | null;
|
||||
enabled: boolean;
|
||||
starts_at: string | null;
|
||||
expires_at: string | null;
|
||||
reset_at: string | null;
|
||||
reason: string | null;
|
||||
status: 'active' | 'scheduled' | 'expired' | 'disabled';
|
||||
created_by_admin_id: number | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface LimitOverrideList {
|
||||
items: LimitOverride[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface LimitSubject {
|
||||
subject_type: LimitSubjectType;
|
||||
subject_value: string;
|
||||
group_counts: Record<string, number>;
|
||||
total_rules: number;
|
||||
items: LimitOverride[];
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface LimitSubjectList {
|
||||
items: LimitSubject[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# 一键启动傻瓜比价本地联调:用户侧 API(8770) + 运营后台 API(8771) + 运营后台前端(3001)。
|
||||
# 一键启动傻瓜比价本地联调:用户侧 API(8772) + 运营后台 API(8773) + 运营后台前端(3002)。
|
||||
# 跨平台:Windows(Git Bash)与 macOS 通用。停止用 ./stop.sh。
|
||||
#
|
||||
# 路径相对本脚本推导(本脚本在 shaguabijia-admin-web 内,server 是它的同级目录),
|
||||
@@ -93,19 +93,19 @@ start_uvicorn() {
|
||||
}
|
||||
|
||||
# 用户侧绑 0.0.0.0,真机/模拟器可经局域网 IP 访问;后台只本机用,绑 127.0.0.1
|
||||
start_uvicorn "user-api" "app.main:app" 8770 "0.0.0.0"
|
||||
start_uvicorn "admin-api" "app.admin.main:admin_app" 8771 "127.0.0.1"
|
||||
start_uvicorn "user-api" "app.main:app" 8772 "0.0.0.0"
|
||||
start_uvicorn "admin-api" "app.admin.main:admin_app" 8773 "127.0.0.1"
|
||||
|
||||
if port_in_use 3001; then
|
||||
echo "↺ admin-web 已在 :3001(跳过)"
|
||||
if port_in_use 3002; then
|
||||
echo "↺ admin-web 已在 :3002(跳过)"
|
||||
else
|
||||
cd "$WEB_DIR" || exit 1
|
||||
nohup npm run dev > "$LOG_DIR/admin-web.log" 2>&1 &
|
||||
echo "$!" > "$LOG_DIR/admin-web.pid"
|
||||
echo "✅ admin-web 起在 :3001 (日志 $LOG_DIR/admin-web.log)"
|
||||
echo "✅ admin-web 起在 :3002 (日志 $LOG_DIR/admin-web.log)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "⏳ 前端首次编译要几秒,然后开 👉 http://localhost:3001 (admin / admin12345)"
|
||||
echo " 用户侧 API: http://127.0.0.1:8770 | 后台 API: http://127.0.0.1:8771/admin/docs"
|
||||
echo "⏳ 前端首次编译要几秒,然后开 👉 http://localhost:3002 (admin / admin12345)"
|
||||
echo " 用户侧 API: http://127.0.0.1:8772 | 后台 API: http://127.0.0.1:8773/admin/docs"
|
||||
echo " 看日志: tail -f $LOG_DIR/admin-web.log | 停止: bash \"$SCRIPT_DIR/stop.sh\""
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# 停止 start.sh 起的三个服务:用户侧 API(8770) + 后台 API(8771) + 前端(3001)。
|
||||
# 停止 start.sh 起的三个服务:用户侧 API(8772) + 后台 API(8773) + 前端(3002)。
|
||||
# 双保险:先按 start.sh 落的 PID 文件杀,再按端口兜底(Windows 走 PowerShell,mac 走 lsof)。
|
||||
# (PG 若由 brew 自启,本脚本不停它。)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
@@ -32,8 +32,8 @@ kill_port() {
|
||||
fi
|
||||
}
|
||||
|
||||
for port in 8770 8771 3001; do
|
||||
for port in 8772 8773 3002; do
|
||||
kill_port "$port"
|
||||
done
|
||||
|
||||
echo "✅ 已停止(用户侧 8770 / 后台 8771 / 前端 3001)。"
|
||||
echo "✅ 已停止(用户侧 8772 / 后台 8773 / 前端 3002)。"
|
||||
|
||||
Reference in New Issue
Block a user