Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3166467518 | |||
| 0ff61c2cd1 | |||
| e68eb4d38c | |||
| b375fab44a |
@@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<meta name="robots" content="noindex, nofollow, noarchive" />
|
||||||
<title>杜康好客 · HQ 管理后台</title>
|
<title>杜康好客 · HQ 管理后台</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow: /
|
||||||
@@ -25,6 +25,7 @@ import FulfillmentProvidersPage from './pages/FulfillmentProvidersPage';
|
|||||||
import StoreMediaPage from './pages/StoreMediaPage';
|
import StoreMediaPage from './pages/StoreMediaPage';
|
||||||
import StoreCategoriesPage from './pages/StoreCategoriesPage';
|
import StoreCategoriesPage from './pages/StoreCategoriesPage';
|
||||||
import PromoCodesPage from './pages/PromoCodesPage';
|
import PromoCodesPage from './pages/PromoCodesPage';
|
||||||
|
import ActivityPostersPage from './pages/ActivityPostersPage';
|
||||||
import PromoCodeDetailLayout from './pages/promo/PromoCodeDetailLayout';
|
import PromoCodeDetailLayout from './pages/promo/PromoCodeDetailLayout';
|
||||||
import PromoCodeDetailPage from './pages/promo/PromoCodeDetailPage';
|
import PromoCodeDetailPage from './pages/promo/PromoCodeDetailPage';
|
||||||
import PromoCodeUsersPage from './pages/promo/PromoCodeUsersPage';
|
import PromoCodeUsersPage from './pages/promo/PromoCodeUsersPage';
|
||||||
@@ -86,6 +87,7 @@ export default function App() {
|
|||||||
<Route path="/wechat-bindings" element={<WechatBindingsPage />} />
|
<Route path="/wechat-bindings" element={<WechatBindingsPage />} />
|
||||||
<Route path="/orders" element={<OrdersPage />} />
|
<Route path="/orders" element={<OrdersPage />} />
|
||||||
<Route path="/promo-codes" element={<PromoCodesPage />} />
|
<Route path="/promo-codes" element={<PromoCodesPage />} />
|
||||||
|
<Route path="/activity-posters" element={<ActivityPostersPage />} />
|
||||||
<Route path="/promo-codes/:id" element={<PromoCodeDetailLayout />}>
|
<Route path="/promo-codes/:id" element={<PromoCodeDetailLayout />}>
|
||||||
<Route index element={<PromoCodeDetailPage />} />
|
<Route index element={<PromoCodeDetailPage />} />
|
||||||
<Route path="users" element={<PromoCodeUsersPage />} />
|
<Route path="users" element={<PromoCodeUsersPage />} />
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
import { useCallback, useRef } from 'react';
|
||||||
|
import { DEFAULT_ACTIVITY_POSTER_QR_SLOT, type ActivityPosterQrSlot } from '@dukang/shared-types';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
imageUrl?: string;
|
||||||
|
value?: ActivityPosterQrSlot;
|
||||||
|
onChange?: (slot: ActivityPosterQrSlot) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function ActivityPosterQrSlotEditor({ imageUrl, value, onChange }: Props) {
|
||||||
|
const boxRef = useRef<HTMLDivElement>(null);
|
||||||
|
const dragRef = useRef<{
|
||||||
|
mode: 'move' | 'resize';
|
||||||
|
startX: number;
|
||||||
|
startY: number;
|
||||||
|
start: ActivityPosterQrSlot;
|
||||||
|
} | null>(null);
|
||||||
|
const slot = value ?? DEFAULT_ACTIVITY_POSTER_QR_SLOT;
|
||||||
|
|
||||||
|
const apply = useCallback((next: ActivityPosterQrSlot) => {
|
||||||
|
const size = Math.min(50, Math.max(5, next.qrSizePct));
|
||||||
|
const box = boxRef.current;
|
||||||
|
const ratio = box && box.clientHeight > 0 ? box.clientWidth / box.clientHeight : 1;
|
||||||
|
const heightPct = size * ratio;
|
||||||
|
const x = Math.min(100 - size, Math.max(0, next.qrXPct));
|
||||||
|
const y = Math.min(Math.max(0, 100 - heightPct), Math.max(0, next.qrYPct));
|
||||||
|
onChange?.({
|
||||||
|
qrXPct: Number(x.toFixed(2)),
|
||||||
|
qrYPct: Number(y.toFixed(2)),
|
||||||
|
qrSizePct: Number(size.toFixed(2)),
|
||||||
|
});
|
||||||
|
}, [onChange]);
|
||||||
|
|
||||||
|
function onPointerDown(mode: 'move' | 'resize', e: React.PointerEvent) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);
|
||||||
|
dragRef.current = { mode, startX: e.clientX, startY: e.clientY, start: { ...slot } };
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPointerMove(e: React.PointerEvent) {
|
||||||
|
const drag = dragRef.current;
|
||||||
|
const box = boxRef.current;
|
||||||
|
if (!drag || !box) return;
|
||||||
|
const dx = ((e.clientX - drag.startX) / box.clientWidth) * 100;
|
||||||
|
const dy = ((e.clientY - drag.startY) / box.clientHeight) * 100;
|
||||||
|
if (drag.mode === 'move') {
|
||||||
|
apply({
|
||||||
|
...drag.start,
|
||||||
|
qrXPct: drag.start.qrXPct + dx,
|
||||||
|
qrYPct: drag.start.qrYPct + dy,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
apply({ ...drag.start, qrSizePct: drag.start.qrSizePct + dx });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function endDrag() {
|
||||||
|
dragRef.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!imageUrl) {
|
||||||
|
return <div style={{ color: 'rgba(0,0,0,0.45)' }}>请先上传活动图,再拖拽定位方形码栏</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
ref={boxRef}
|
||||||
|
style={{ position: 'relative', width: '100%', maxWidth: 420, userSelect: 'none', touchAction: 'none' }}
|
||||||
|
onPointerMove={onPointerMove}
|
||||||
|
onPointerUp={endDrag}
|
||||||
|
onPointerCancel={endDrag}
|
||||||
|
>
|
||||||
|
<img src={imageUrl} alt="活动图预览" style={{ width: '100%', display: 'block' }} draggable={false} />
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: `${slot.qrXPct}%`,
|
||||||
|
top: `${slot.qrYPct}%`,
|
||||||
|
width: `${slot.qrSizePct}%`,
|
||||||
|
aspectRatio: '1',
|
||||||
|
border: '2px dashed #1677ff',
|
||||||
|
background: 'rgba(22,119,255,0.14)',
|
||||||
|
cursor: 'move',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
}}
|
||||||
|
onPointerDown={(e) => onPointerDown('move', e)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
right: -6,
|
||||||
|
bottom: -6,
|
||||||
|
width: 14,
|
||||||
|
height: 14,
|
||||||
|
background: '#1677ff',
|
||||||
|
borderRadius: 2,
|
||||||
|
cursor: 'nwse-resize',
|
||||||
|
}}
|
||||||
|
onPointerDown={(e) => onPointerDown('resize', e)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style={{ marginTop: 8, color: 'rgba(0,0,0,0.45)', fontSize: 12 }}>
|
||||||
|
拖拽移动码栏,拉右下角调整大小(边长相对图宽 {slot.qrSizePct}%)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { Image, Input, Modal, Space, Typography } from 'antd';
|
||||||
|
import { PAYMENT_PROOF_IMAGE_MAX_COUNT } from '@dukang/shared-types';
|
||||||
|
import MultiImageUpload from './MultiImageUpload';
|
||||||
|
|
||||||
|
export function parsePaymentProofUrls(raw: unknown): string[] {
|
||||||
|
if (!Array.isArray(raw)) return [];
|
||||||
|
return raw.map((u) => String(u ?? '').trim()).filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function PaymentProofGallery({ urls }: { urls?: unknown }) {
|
||||||
|
const list = parsePaymentProofUrls(urls);
|
||||||
|
if (!list.length) return <>—</>;
|
||||||
|
return (
|
||||||
|
<Image.PreviewGroup>
|
||||||
|
<Space wrap size={8}>
|
||||||
|
{list.map((url, index) => (
|
||||||
|
<Image
|
||||||
|
key={`${url}-${index}`}
|
||||||
|
src={url}
|
||||||
|
width={72}
|
||||||
|
height={72}
|
||||||
|
style={{ objectFit: 'cover', borderRadius: 6, border: '1px solid #f0f0f0' }}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Space>
|
||||||
|
</Image.PreviewGroup>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
type FinancePayProofModalProps = {
|
||||||
|
open: boolean;
|
||||||
|
title: string;
|
||||||
|
hint: string;
|
||||||
|
okText: string;
|
||||||
|
confirmLoading?: boolean;
|
||||||
|
onCancel: () => void;
|
||||||
|
onOk: (payload: { paymentRef?: string; paymentProofUrls?: string[] }) => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function FinancePayProofModal({
|
||||||
|
open,
|
||||||
|
title,
|
||||||
|
hint,
|
||||||
|
okText,
|
||||||
|
confirmLoading,
|
||||||
|
onCancel,
|
||||||
|
onOk,
|
||||||
|
}: FinancePayProofModalProps) {
|
||||||
|
const [paymentRef, setPaymentRef] = useState('');
|
||||||
|
const [proofUrls, setProofUrls] = useState<string[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (open) {
|
||||||
|
setPaymentRef('');
|
||||||
|
setProofUrls([]);
|
||||||
|
}
|
||||||
|
}, [open]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title={title}
|
||||||
|
open={open}
|
||||||
|
okText={okText}
|
||||||
|
cancelText="取消"
|
||||||
|
confirmLoading={confirmLoading}
|
||||||
|
destroyOnClose
|
||||||
|
width={480}
|
||||||
|
onCancel={onCancel}
|
||||||
|
onOk={async () => {
|
||||||
|
await onOk({
|
||||||
|
paymentRef: paymentRef.trim() || undefined,
|
||||||
|
paymentProofUrls: proofUrls.length ? proofUrls : undefined,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography.Paragraph style={{ marginBottom: 12 }}>{hint}</Typography.Paragraph>
|
||||||
|
<Input
|
||||||
|
placeholder="打款凭证号(可选)"
|
||||||
|
value={paymentRef}
|
||||||
|
onChange={(e) => setPaymentRef(e.target.value)}
|
||||||
|
style={{ marginBottom: 12 }}
|
||||||
|
/>
|
||||||
|
<Typography.Text type="secondary">打款凭证照片(可选,银行转账回单等)</Typography.Text>
|
||||||
|
<div style={{ marginTop: 8 }}>
|
||||||
|
<MultiImageUpload
|
||||||
|
bizType="PAYMENT_PROOF"
|
||||||
|
value={proofUrls}
|
||||||
|
onChange={setProofUrls}
|
||||||
|
maxCount={PAYMENT_PROOF_IMAGE_MAX_COUNT}
|
||||||
|
buttonText="上传凭证照片"
|
||||||
|
tip={`最多 ${PAYMENT_PROOF_IMAGE_MAX_COUNT} 张,支持一次选择多张`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
SettingOutlined,
|
SettingOutlined,
|
||||||
AccountBookOutlined,
|
AccountBookOutlined,
|
||||||
ProjectOutlined,
|
ProjectOutlined,
|
||||||
|
PictureOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
hasAnySystemSettingsPermission,
|
hasAnySystemSettingsPermission,
|
||||||
@@ -118,6 +119,7 @@ const MENU_ITEMS: MenuProps['items'] = [
|
|||||||
},
|
},
|
||||||
{ key: '/invoices', icon: <FileTextOutlined />, label: '发票' },
|
{ key: '/invoices', icon: <FileTextOutlined />, label: '发票' },
|
||||||
{ key: '/promo-codes', icon: <GiftOutlined />, label: '推广码' },
|
{ key: '/promo-codes', icon: <GiftOutlined />, label: '推广码' },
|
||||||
|
{ key: '/activity-posters', icon: <PictureOutlined />, label: '活动图' },
|
||||||
{ key: '/wechat-bindings', icon: <UserOutlined />, label: '微信绑定' },
|
{ key: '/wechat-bindings', icon: <UserOutlined />, label: '微信绑定' },
|
||||||
{
|
{
|
||||||
key: 'wecom-group',
|
key: 'wecom-group',
|
||||||
@@ -180,6 +182,7 @@ function menuAllowed(key: string, permissionKeys: string[]): boolean {
|
|||||||
'/product-detail-templates': 'products',
|
'/product-detail-templates': 'products',
|
||||||
'/orders': 'orders',
|
'/orders': 'orders',
|
||||||
'/promo-codes': 'promo_codes',
|
'/promo-codes': 'promo_codes',
|
||||||
|
'/activity-posters': 'activity_posters',
|
||||||
'/wecom/bots': 'wecom_bots',
|
'/wecom/bots': 'wecom_bots',
|
||||||
'/wecom/pushes': 'wecom_bots',
|
'/wecom/pushes': 'wecom_bots',
|
||||||
'wecom-group': 'wecom_bots',
|
'wecom-group': 'wecom_bots',
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ export const RESOURCE_BIZ_TYPE_LABELS: Record<string, string> = {
|
|||||||
QRCODE: '二维码',
|
QRCODE: '二维码',
|
||||||
SIGN_PHOTO: '签收照',
|
SIGN_PHOTO: '签收照',
|
||||||
VIDEO: '视频',
|
VIDEO: '视频',
|
||||||
|
ACTIVITY_POSTER: '活动图',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RESOURCE_STATUS_LABELS: Record<string, string> = {
|
export const RESOURCE_STATUS_LABELS: Record<string, string> = {
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export const REF_TYPE_LABELS: Record<string, string> = {
|
|||||||
INVOICE: '发票',
|
INVOICE: '发票',
|
||||||
PROMO: '推广码',
|
PROMO: '推广码',
|
||||||
PROMO_CODE: '推广码',
|
PROMO_CODE: '推广码',
|
||||||
|
ACTIVITY_POSTER: '活动图',
|
||||||
HQ: '总部',
|
HQ: '总部',
|
||||||
HQ_ACCOUNT: 'HQ 账号',
|
HQ_ACCOUNT: 'HQ 账号',
|
||||||
STORE_ACCOUNT: '门店账号',
|
STORE_ACCOUNT: '门店账号',
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ export const HQ_OPERATION_ACTION_OPTIONS = [
|
|||||||
{ value: 'PARTNER_BILL_BATCH_MARK_PAID', label: '批量合伙人账单结算' },
|
{ value: 'PARTNER_BILL_BATCH_MARK_PAID', label: '批量合伙人账单结算' },
|
||||||
{ value: 'WINERY_BILL_CONFIRM', label: '酒厂对账单确认打款' },
|
{ value: 'WINERY_BILL_CONFIRM', label: '酒厂对账单确认打款' },
|
||||||
{ value: 'WINERY_BILL_BATCH_CONFIRM', label: '批量酒厂对账单打款' },
|
{ value: 'WINERY_BILL_BATCH_CONFIRM', label: '批量酒厂对账单打款' },
|
||||||
|
{ value: 'ACTIVITY_POSTER_CREATE', label: '新增活动图' },
|
||||||
|
{ value: 'ACTIVITY_POSTER_UPDATE', label: '编辑活动图' },
|
||||||
|
{ value: 'ACTIVITY_POSTER_UPDATE_STATUS', label: '活动图上下架' },
|
||||||
|
{ value: 'ACTIVITY_POSTER_DELETE', label: '删除活动图' },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const HQ_OPERATION_ACTION_LABELS: Record<string, string> = Object.fromEntries(
|
export const HQ_OPERATION_ACTION_LABELS: Record<string, string> = Object.fromEntries(
|
||||||
|
|||||||
@@ -0,0 +1,242 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import {
|
||||||
|
Button, Form, Image, Input, InputNumber, Modal, Popconfirm, Select, Space, Table, Tag, message,
|
||||||
|
} from 'antd';
|
||||||
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
|
import {
|
||||||
|
ACTIVITY_POSTER_STATUS_LABELS,
|
||||||
|
DEFAULT_ACTIVITY_POSTER_QR_SLOT,
|
||||||
|
type ActivityPosterItem,
|
||||||
|
type ActivityPosterQrSlot,
|
||||||
|
type ActivityPosterStatus,
|
||||||
|
} from '@dukang/shared-types';
|
||||||
|
import { request } from '../lib/api';
|
||||||
|
import { fmtTime } from '../lib/constants';
|
||||||
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
import OssUpload from '../components/OssUpload';
|
||||||
|
import ActivityPosterQrSlotEditor from '../components/ActivityPosterQrSlotEditor';
|
||||||
|
|
||||||
|
type FormValues = {
|
||||||
|
title: string;
|
||||||
|
copyText?: string;
|
||||||
|
imageUrl: string;
|
||||||
|
qrXPct: number;
|
||||||
|
qrYPct: number;
|
||||||
|
qrSizePct: number;
|
||||||
|
sortOrder?: number;
|
||||||
|
status?: ActivityPosterStatus;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function ActivityPostersPage() {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const [editForm] = Form.useForm<FormValues>();
|
||||||
|
const [filters, setFilters] = useState<Record<string, string>>({});
|
||||||
|
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<ActivityPosterItem>(
|
||||||
|
'/admin/activity-posters',
|
||||||
|
() => {
|
||||||
|
const qs = new URLSearchParams();
|
||||||
|
if (filters.status) qs.set('status', filters.status);
|
||||||
|
return qs;
|
||||||
|
},
|
||||||
|
[filters],
|
||||||
|
);
|
||||||
|
const [modalOpen, setModalOpen] = useState(false);
|
||||||
|
const [editing, setEditing] = useState<ActivityPosterItem | null>(null);
|
||||||
|
|
||||||
|
const imageUrl = Form.useWatch('imageUrl', editForm);
|
||||||
|
const qrXPct = Form.useWatch('qrXPct', editForm);
|
||||||
|
const qrYPct = Form.useWatch('qrYPct', editForm);
|
||||||
|
const qrSizePct = Form.useWatch('qrSizePct', editForm);
|
||||||
|
const slot: ActivityPosterQrSlot = {
|
||||||
|
qrXPct: qrXPct ?? DEFAULT_ACTIVITY_POSTER_QR_SLOT.qrXPct,
|
||||||
|
qrYPct: qrYPct ?? DEFAULT_ACTIVITY_POSTER_QR_SLOT.qrYPct,
|
||||||
|
qrSizePct: qrSizePct ?? DEFAULT_ACTIVITY_POSTER_QR_SLOT.qrSizePct,
|
||||||
|
};
|
||||||
|
|
||||||
|
function openCreate() {
|
||||||
|
setEditing(null);
|
||||||
|
editForm.setFieldsValue({
|
||||||
|
title: '',
|
||||||
|
copyText: '',
|
||||||
|
imageUrl: '',
|
||||||
|
...DEFAULT_ACTIVITY_POSTER_QR_SLOT,
|
||||||
|
sortOrder: 0,
|
||||||
|
status: 'ACTIVE',
|
||||||
|
});
|
||||||
|
setModalOpen(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function openEdit(row: ActivityPosterItem) {
|
||||||
|
setEditing(row);
|
||||||
|
editForm.setFieldsValue({
|
||||||
|
title: row.title,
|
||||||
|
copyText: row.copyText,
|
||||||
|
imageUrl: row.imageUrl,
|
||||||
|
qrXPct: row.qrXPct,
|
||||||
|
qrYPct: row.qrYPct,
|
||||||
|
qrSizePct: row.qrSizePct,
|
||||||
|
sortOrder: row.sortOrder,
|
||||||
|
status: row.status,
|
||||||
|
});
|
||||||
|
setModalOpen(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
const v = await editForm.validateFields();
|
||||||
|
const body = JSON.stringify(v);
|
||||||
|
if (editing) {
|
||||||
|
await request(`/admin/activity-posters/${editing.id}`, { method: 'PUT', body });
|
||||||
|
message.success('已保存');
|
||||||
|
} else {
|
||||||
|
await request('/admin/activity-posters', { method: 'POST', body });
|
||||||
|
message.success('已创建');
|
||||||
|
}
|
||||||
|
setModalOpen(false);
|
||||||
|
void reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseColumns: ColumnsType<ActivityPosterItem> = [
|
||||||
|
{
|
||||||
|
title: '标题',
|
||||||
|
dataIndex: 'title',
|
||||||
|
width: 180,
|
||||||
|
render: (v, row) => <AdminPrimaryLink onClick={() => openEdit(row)}>{v}</AdminPrimaryLink>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '封面',
|
||||||
|
dataIndex: 'imageUrl',
|
||||||
|
width: 90,
|
||||||
|
render: (url: string) => <Image src={url} width={56} height={56} style={{ objectFit: 'cover' }} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '文案',
|
||||||
|
dataIndex: 'copyText',
|
||||||
|
width: 240,
|
||||||
|
render: (v: string) => v || '—',
|
||||||
|
},
|
||||||
|
{ title: '排序', dataIndex: 'sortOrder', width: 70 },
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
width: 80,
|
||||||
|
render: (s: ActivityPosterStatus) => (
|
||||||
|
<Tag color={s === 'ACTIVE' ? 'green' : 'default'}>{ACTIVITY_POSTER_STATUS_LABELS[s] || s}</Tag>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ title: '更新', dataIndex: 'updatedAt', width: 160, render: fmtTime },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 200,
|
||||||
|
render: (_, row) => (
|
||||||
|
<Space>
|
||||||
|
<Button type="link" size="small" onClick={() => openEdit(row)}>编辑</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
onClick={async () => {
|
||||||
|
const next = row.status === 'ACTIVE' ? 'DISABLED' : 'ACTIVE';
|
||||||
|
await request(`/admin/activity-posters/${row.id}/status`, {
|
||||||
|
method: 'PUT',
|
||||||
|
body: JSON.stringify({ status: next }),
|
||||||
|
});
|
||||||
|
message.success(next === 'ACTIVE' ? '已上架' : '已下架');
|
||||||
|
void reload();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{row.status === 'ACTIVE' ? '下架' : '上架'}
|
||||||
|
</Button>
|
||||||
|
<Popconfirm
|
||||||
|
title="确认删除该活动图?"
|
||||||
|
onConfirm={async () => {
|
||||||
|
await request(`/admin/activity-posters/${row.id}`, { method: 'DELETE' });
|
||||||
|
message.success('已删除');
|
||||||
|
void reload();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button type="link" size="small" danger>删除</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const { columns, settingsButton, settingsModal } = useAdminListColumns('activity-posters', baseColumns, {
|
||||||
|
page,
|
||||||
|
pageSize,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{settingsModal}
|
||||||
|
<AdminListHeader
|
||||||
|
title="活动图"
|
||||||
|
settings={settingsButton}
|
||||||
|
actions={<Button type="primary" onClick={openCreate}>新建活动图</Button>}
|
||||||
|
/>
|
||||||
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
||||||
|
<Form.Item name="status" label="状态">
|
||||||
|
<Select
|
||||||
|
allowClear
|
||||||
|
style={{ width: 120 }}
|
||||||
|
options={Object.entries(ACTIVITY_POSTER_STATUS_LABELS).map(([value, label]) => ({ value, label }))}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item><Button type="primary" htmlType="submit">查询</Button></Form.Item>
|
||||||
|
</Form>
|
||||||
|
<Table
|
||||||
|
rowKey="id"
|
||||||
|
className="admin-table-nowrap"
|
||||||
|
loading={loading}
|
||||||
|
columns={columns}
|
||||||
|
dataSource={data?.items ?? []}
|
||||||
|
scroll={{ x: 'max-content' }}
|
||||||
|
pagination={{
|
||||||
|
current: page,
|
||||||
|
pageSize,
|
||||||
|
total: data?.total ?? 0,
|
||||||
|
showSizeChanger: true,
|
||||||
|
onChange: (p, ps) => { setPage(p); setPageSize(ps); },
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
title={editing ? '编辑活动图' : '新建活动图'}
|
||||||
|
open={modalOpen}
|
||||||
|
onCancel={() => setModalOpen(false)}
|
||||||
|
onOk={() => void save()}
|
||||||
|
width={720}
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
|
<Form form={editForm} layout="vertical">
|
||||||
|
<Form.Item name="title" label="标题" rules={[{ required: true, message: '请填写标题' }]}>
|
||||||
|
<Input maxLength={128} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="imageUrl" label="活动图" rules={[{ required: true, message: '请上传活动图' }]}>
|
||||||
|
<OssUpload bizType="ACTIVITY_POSTER" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="qrXPct" hidden><InputNumber /></Form.Item>
|
||||||
|
<Form.Item name="qrYPct" hidden><InputNumber /></Form.Item>
|
||||||
|
<Form.Item name="qrSizePct" hidden><InputNumber /></Form.Item>
|
||||||
|
<Form.Item label="二维码栏">
|
||||||
|
<ActivityPosterQrSlotEditor
|
||||||
|
imageUrl={imageUrl}
|
||||||
|
value={slot}
|
||||||
|
onChange={(next) => editForm.setFieldsValue(next)}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="copyText" label="推广文案">
|
||||||
|
<Input.TextArea rows={4} maxLength={4000} placeholder="合伙人可一键复制" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="sortOrder" label="排序" initialValue={0}>
|
||||||
|
<InputNumber min={0} style={{ width: '100%' }} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="status" label="状态" initialValue="ACTIVE">
|
||||||
|
<Select options={Object.entries(ACTIVITY_POSTER_STATUS_LABELS).map(([value, label]) => ({ value, label }))} />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
message,
|
message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
|
import { FinancePayProofModal, PaymentProofGallery } from '../components/FinancePayProof';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import type { Dayjs } from 'dayjs';
|
import type { Dayjs } from 'dayjs';
|
||||||
import {
|
import {
|
||||||
@@ -113,6 +114,13 @@ export default function StoreBillsPage() {
|
|||||||
pendingCount: number;
|
pendingCount: number;
|
||||||
overdueCount: number;
|
overdueCount: number;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
const [payModal, setPayModal] = useState<{
|
||||||
|
ids: string[];
|
||||||
|
amountHint?: number;
|
||||||
|
} | null>(null);
|
||||||
|
const [paySubmitting, setPaySubmitting] = useState(false);
|
||||||
|
const [withdrawApproveId, setWithdrawApproveId] = useState<string | null>(null);
|
||||||
|
const [withdrawSubmitting, setWithdrawSubmitting] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
@@ -134,77 +142,11 @@ export default function StoreBillsPage() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
function confirmPay(ids: string[], amountHint?: number) {
|
function confirmPay(ids: string[], amountHint?: number) {
|
||||||
let paymentRef = '';
|
setPayModal({ ids, amountHint });
|
||||||
Modal.confirm({
|
|
||||||
title: '确认打款?',
|
|
||||||
content: (
|
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
将确认 {ids.length} 笔 T+1 门店对账单
|
|
||||||
{amountHint != null ? `,合计约 ¥${amountHint.toFixed(2)}` : ''}。此操作不可撤销。
|
|
||||||
</div>
|
|
||||||
<Input
|
|
||||||
placeholder="打款凭证号(可选)"
|
|
||||||
style={{ marginTop: 8 }}
|
|
||||||
onChange={(e) => {
|
|
||||||
paymentRef = e.target.value;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
okText: '确认打款',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
const body = JSON.stringify({ paymentRef: paymentRef.trim() || undefined });
|
|
||||||
if (ids.length === 1) {
|
|
||||||
await request(`/admin/store-bills/${ids[0]}/confirm`, { method: 'POST', body });
|
|
||||||
} else {
|
|
||||||
setBatchLoading(true);
|
|
||||||
try {
|
|
||||||
await request('/admin/store-bills/batch-confirm', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ ids }),
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setBatchLoading(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
message.success('已确认打款');
|
|
||||||
setSelectedKeys([]);
|
|
||||||
reload();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function approveWithdraw(id: string) {
|
function approveWithdraw(id: string) {
|
||||||
let paymentRef = '';
|
setWithdrawApproveId(id);
|
||||||
Modal.confirm({
|
|
||||||
title: '审核通过并标记已结算?',
|
|
||||||
content: (
|
|
||||||
<Input
|
|
||||||
placeholder="打款凭证号(可选)"
|
|
||||||
onChange={(e) => {
|
|
||||||
paymentRef = e.target.value;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
okText: '通过并结算',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
await request(`/admin/store-withdrawals/${id}/approve`, {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ paymentRef: paymentRef.trim() || undefined }),
|
|
||||||
});
|
|
||||||
message.success('已通过并标记已结算');
|
|
||||||
setDrawerOpen(false);
|
|
||||||
reload();
|
|
||||||
void request<{ pendingCount: number; overdueCount: number }>(
|
|
||||||
'/admin/store-withdrawals/overdue-summary',
|
|
||||||
)
|
|
||||||
.then(setOverdueSummary)
|
|
||||||
.catch(() => {});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rejectWithdraw(id: string) {
|
function rejectWithdraw(id: string) {
|
||||||
@@ -565,6 +507,9 @@ export default function StoreBillsPage() {
|
|||||||
<Descriptions.Item label="打款凭证">
|
<Descriptions.Item label="打款凭证">
|
||||||
{detail.paymentRef ? String(detail.paymentRef) : '—'}
|
{detail.paymentRef ? String(detail.paymentRef) : '—'}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="凭证照片">
|
||||||
|
<PaymentProofGallery urls={detail.paymentProofUrls} />
|
||||||
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
{(detail.storeAccount as {
|
{(detail.storeAccount as {
|
||||||
bankAccountName?: string;
|
bankAccountName?: string;
|
||||||
@@ -649,6 +594,9 @@ export default function StoreBillsPage() {
|
|||||||
<Descriptions.Item label="打款凭证">
|
<Descriptions.Item label="打款凭证">
|
||||||
{detail.paymentRef ? String(detail.paymentRef) : '—'}
|
{detail.paymentRef ? String(detail.paymentRef) : '—'}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="凭证照片">
|
||||||
|
<PaymentProofGallery urls={detail.paymentProofUrls} />
|
||||||
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
{storeAccount ? (
|
{storeAccount ? (
|
||||||
<>
|
<>
|
||||||
@@ -719,6 +667,71 @@ export default function StoreBillsPage() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
||||||
|
<FinancePayProofModal
|
||||||
|
open={!!payModal}
|
||||||
|
title="确认打款?"
|
||||||
|
hint={`将确认 ${payModal?.ids.length ?? 0} 笔 T+1 门店对账单${
|
||||||
|
payModal?.amountHint != null ? `,合计约 ¥${payModal.amountHint.toFixed(2)}` : ''
|
||||||
|
}。此操作不可撤销。`}
|
||||||
|
okText="确认打款"
|
||||||
|
confirmLoading={paySubmitting}
|
||||||
|
onCancel={() => setPayModal(null)}
|
||||||
|
onOk={async (payload) => {
|
||||||
|
if (!payModal) return;
|
||||||
|
const { ids } = payModal;
|
||||||
|
setPaySubmitting(true);
|
||||||
|
if (ids.length > 1) setBatchLoading(true);
|
||||||
|
try {
|
||||||
|
const body = JSON.stringify({
|
||||||
|
...payload,
|
||||||
|
...(ids.length > 1 ? { ids } : {}),
|
||||||
|
});
|
||||||
|
if (ids.length === 1) {
|
||||||
|
await request(`/admin/store-bills/${ids[0]}/confirm`, { method: 'POST', body });
|
||||||
|
} else {
|
||||||
|
await request('/admin/store-bills/batch-confirm', { method: 'POST', body });
|
||||||
|
}
|
||||||
|
message.success('已确认打款');
|
||||||
|
setPayModal(null);
|
||||||
|
setSelectedKeys([]);
|
||||||
|
reload();
|
||||||
|
} finally {
|
||||||
|
setPaySubmitting(false);
|
||||||
|
setBatchLoading(false);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FinancePayProofModal
|
||||||
|
open={!!withdrawApproveId}
|
||||||
|
title="审核通过并标记已结算?"
|
||||||
|
hint="通过后将标记该提现为已结算,此操作不可撤销。"
|
||||||
|
okText="通过并结算"
|
||||||
|
confirmLoading={withdrawSubmitting}
|
||||||
|
onCancel={() => setWithdrawApproveId(null)}
|
||||||
|
onOk={async (payload) => {
|
||||||
|
if (!withdrawApproveId) return;
|
||||||
|
setWithdrawSubmitting(true);
|
||||||
|
try {
|
||||||
|
await request(`/admin/store-withdrawals/${withdrawApproveId}/approve`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
});
|
||||||
|
message.success('已通过并标记已结算');
|
||||||
|
setWithdrawApproveId(null);
|
||||||
|
setDrawerOpen(false);
|
||||||
|
reload();
|
||||||
|
void request<{ pendingCount: number; overdueCount: number }>(
|
||||||
|
'/admin/store-withdrawals/overdue-summary',
|
||||||
|
)
|
||||||
|
.then(setOverdueSummary)
|
||||||
|
.catch(() => {});
|
||||||
|
} finally {
|
||||||
|
setWithdrawSubmitting(false);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import { useAdminList } from '../lib/useAdminList';
|
|||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
import { AdminListHeader } from '../components/AdminListHeader';
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
import { FinancePayProofModal, PaymentProofGallery } from '../components/FinancePayProof';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -70,6 +71,8 @@ export default function StoreWithdrawalsPage() {
|
|||||||
pendingCount: number;
|
pendingCount: number;
|
||||||
overdueCount: number;
|
overdueCount: number;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
const [approveId, setApproveId] = useState<string | null>(null);
|
||||||
|
const [approveSubmitting, setApproveSubmitting] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
void request<Paginated<StoreOption>>(`/admin/stores?pageSize=${ADMIN_OPTIONS_PAGE_SIZE}`)
|
void request<Paginated<StoreOption>>(`/admin/stores?pageSize=${ADMIN_OPTIONS_PAGE_SIZE}`)
|
||||||
@@ -89,34 +92,7 @@ export default function StoreWithdrawalsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function approve(id: string) {
|
function approve(id: string) {
|
||||||
let paymentRef = '';
|
setApproveId(id);
|
||||||
Modal.confirm({
|
|
||||||
title: '审核通过并标记已结算?',
|
|
||||||
content: (
|
|
||||||
<Input
|
|
||||||
placeholder="打款凭证号(可选)"
|
|
||||||
onChange={(e) => {
|
|
||||||
paymentRef = e.target.value;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
okText: '通过并结算',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
await request(`/admin/store-withdrawals/${id}/approve`, {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ paymentRef: paymentRef.trim() || undefined }),
|
|
||||||
});
|
|
||||||
message.success('已通过并标记已结算');
|
|
||||||
setDrawerOpen(false);
|
|
||||||
reload();
|
|
||||||
void request<{ pendingCount: number; overdueCount: number }>(
|
|
||||||
'/admin/store-withdrawals/overdue-summary',
|
|
||||||
)
|
|
||||||
.then(setOverdueSummary)
|
|
||||||
.catch(() => {});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function reject(id: string) {
|
function reject(id: string) {
|
||||||
@@ -356,6 +332,9 @@ export default function StoreWithdrawalsPage() {
|
|||||||
{detail.paymentRef ? (
|
{detail.paymentRef ? (
|
||||||
<Descriptions.Item label="打款凭证">{String(detail.paymentRef)}</Descriptions.Item>
|
<Descriptions.Item label="打款凭证">{String(detail.paymentRef)}</Descriptions.Item>
|
||||||
) : null}
|
) : null}
|
||||||
|
<Descriptions.Item label="凭证照片">
|
||||||
|
<PaymentProofGallery urls={detail.paymentProofUrls} />
|
||||||
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="收款户名">
|
<Descriptions.Item label="收款户名">
|
||||||
{storeAccount?.bankAccountName || '—'}
|
{storeAccount?.bankAccountName || '—'}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
@@ -394,6 +373,36 @@ export default function StoreWithdrawalsPage() {
|
|||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
||||||
|
<FinancePayProofModal
|
||||||
|
open={!!approveId}
|
||||||
|
title="审核通过并标记已结算?"
|
||||||
|
hint="通过后将标记该提现为已结算,此操作不可撤销。"
|
||||||
|
okText="通过并结算"
|
||||||
|
confirmLoading={approveSubmitting}
|
||||||
|
onCancel={() => setApproveId(null)}
|
||||||
|
onOk={async (payload) => {
|
||||||
|
if (!approveId) return;
|
||||||
|
setApproveSubmitting(true);
|
||||||
|
try {
|
||||||
|
await request(`/admin/store-withdrawals/${approveId}/approve`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
});
|
||||||
|
message.success('已通过并标记已结算');
|
||||||
|
setApproveId(null);
|
||||||
|
setDrawerOpen(false);
|
||||||
|
reload();
|
||||||
|
void request<{ pendingCount: number; overdueCount: number }>(
|
||||||
|
'/admin/store-withdrawals/overdue-summary',
|
||||||
|
)
|
||||||
|
.then(setOverdueSummary)
|
||||||
|
.catch(() => {});
|
||||||
|
} finally {
|
||||||
|
setApproveSubmitting(false);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
||||||
|
<meta name="robots" content="noindex, nofollow, noarchive" />
|
||||||
<title>城市合伙人</title>
|
<title>城市合伙人</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow: /
|
||||||
@@ -25,6 +25,7 @@ import LeaderboardPage from './pages/LeaderboardPage';
|
|||||||
import UsersManagePage from './pages/UsersManagePage';
|
import UsersManagePage from './pages/UsersManagePage';
|
||||||
import AssocOrdersPage from './pages/AssocOrdersPage';
|
import AssocOrdersPage from './pages/AssocOrdersPage';
|
||||||
import CommissionOrdersPage from './pages/CommissionOrdersPage';
|
import CommissionOrdersPage from './pages/CommissionOrdersPage';
|
||||||
|
import ActivityPostersPage from './pages/ActivityPostersPage';
|
||||||
|
|
||||||
function PrimaryRoutes() {
|
function PrimaryRoutes() {
|
||||||
return (
|
return (
|
||||||
@@ -41,6 +42,7 @@ function PrimaryRoutes() {
|
|||||||
<Route path="/center/settlement" element={<SettlementPage />} />
|
<Route path="/center/settlement" element={<SettlementPage />} />
|
||||||
<Route path="/center/staff" element={<StaffListPage />} />
|
<Route path="/center/staff" element={<StaffListPage />} />
|
||||||
<Route path="/center/staff/new" element={<StaffCreatePage />} />
|
<Route path="/center/staff/new" element={<StaffCreatePage />} />
|
||||||
|
<Route path="/center/activity-posters" element={<ActivityPostersPage />} />
|
||||||
<Route path="/center/assoc" element={<Navigate to="/users" replace />} />
|
<Route path="/center/assoc" element={<Navigate to="/users" replace />} />
|
||||||
<Route path="/center/assoc/users" element={<Navigate to="/users" replace />} />
|
<Route path="/center/assoc/users" element={<Navigate to="/users" replace />} />
|
||||||
<Route path="/users/orders" element={<AssocOrdersPage />} />
|
<Route path="/users/orders" element={<AssocOrdersPage />} />
|
||||||
|
|||||||
@@ -0,0 +1,246 @@
|
|||||||
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
import type { ActivityPosterItem, PartnerAssocSummary } from '@dukang/shared-types';
|
||||||
|
import { request } from '../lib/api';
|
||||||
|
import {
|
||||||
|
copyActivityCopy,
|
||||||
|
downloadBlob,
|
||||||
|
fetchActivityPosterImage,
|
||||||
|
fetchAssocQrcodeImage,
|
||||||
|
getActivityPosterSelection,
|
||||||
|
listActivityPosters,
|
||||||
|
saveActivityPosterSelection,
|
||||||
|
} from '../lib/activity-posters';
|
||||||
|
import { toastError, toastSuccess } from '../lib/toast';
|
||||||
|
import { isWechatEnv } from '../lib/weixin';
|
||||||
|
|
||||||
|
const NONE_ID = 'none';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
initialId?: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function ActivityPosterPicker({ initialId }: Props) {
|
||||||
|
const [items, setItems] = useState<ActivityPosterItem[]>([]);
|
||||||
|
const [qrcodeUrl, setQrcodeUrl] = useState<string | null>(null);
|
||||||
|
const [partnerId, setPartnerId] = useState<string>('');
|
||||||
|
const [selectedId, setSelectedId] = useState<string>(NONE_ID);
|
||||||
|
const [previewUrls, setPreviewUrls] = useState<Record<string, string>>({});
|
||||||
|
const [listLoading, setListLoading] = useState(true);
|
||||||
|
const [previewLoading, setPreviewLoading] = useState(false);
|
||||||
|
const [downloading, setDownloading] = useState(false);
|
||||||
|
const blobsRef = useRef(new Map<string, Blob>());
|
||||||
|
const urlsRef = useRef<string[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => () => {
|
||||||
|
urlsRef.current.forEach((url) => URL.revokeObjectURL(url));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let cancelled = false;
|
||||||
|
Promise.all([
|
||||||
|
listActivityPosters(),
|
||||||
|
request<PartnerAssocSummary>('PARTNER_H5', '/partner/assoc', { silent: true }),
|
||||||
|
getActivityPosterSelection().catch(() => ({ posterId: null })),
|
||||||
|
])
|
||||||
|
.then(([list, assoc, selection]) => {
|
||||||
|
if (cancelled) return;
|
||||||
|
setItems(list);
|
||||||
|
setQrcodeUrl(assoc.qrcodeUrl);
|
||||||
|
setPartnerId(assoc.partnerId);
|
||||||
|
const saved = selection.posterId && list.some((item) => item.id === selection.posterId)
|
||||||
|
? selection.posterId
|
||||||
|
: null;
|
||||||
|
const fromQuery = initialId && list.some((item) => item.id === initialId) ? initialId : null;
|
||||||
|
const next = saved || fromQuery || NONE_ID;
|
||||||
|
setSelectedId(next);
|
||||||
|
if (!saved && fromQuery) {
|
||||||
|
void saveActivityPosterSelection(fromQuery).catch((err) => {
|
||||||
|
toastError(err instanceof Error ? err.message : '保存失败');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => toastError(e instanceof Error ? e.message : '加载活动图失败'))
|
||||||
|
.finally(() => {
|
||||||
|
if (!cancelled) setListLoading(false);
|
||||||
|
});
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
};
|
||||||
|
}, [initialId]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedId === NONE_ID || previewUrls[selectedId] || blobsRef.current.has(selectedId)) return;
|
||||||
|
let cancelled = false;
|
||||||
|
setPreviewLoading(true);
|
||||||
|
fetchActivityPosterImage(selectedId)
|
||||||
|
.then((blob) => {
|
||||||
|
if (cancelled) return;
|
||||||
|
blobsRef.current.set(selectedId, blob);
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
urlsRef.current.push(url);
|
||||||
|
setPreviewUrls((prev) => ({ ...prev, [selectedId]: url }));
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
if (!cancelled) toastError(e instanceof Error ? e.message : '预览失败');
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
if (!cancelled) setPreviewLoading(false);
|
||||||
|
});
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
};
|
||||||
|
}, [selectedId, previewUrls]);
|
||||||
|
|
||||||
|
const selected = items.find((item) => item.id === selectedId) ?? null;
|
||||||
|
const previewUrl = selectedId !== NONE_ID ? previewUrls[selectedId] : undefined;
|
||||||
|
|
||||||
|
async function downloadSelected() {
|
||||||
|
setDownloading(true);
|
||||||
|
try {
|
||||||
|
if (selectedId === NONE_ID) {
|
||||||
|
const blob = await fetchAssocQrcodeImage();
|
||||||
|
if (isWechatEnv()) {
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
urlsRef.current.push(url);
|
||||||
|
setQrcodeUrl(url);
|
||||||
|
toastSuccess('请长按上方图片保存到相册');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
downloadBlob(blob, `partner-assoc-${partnerId || 'qr'}.png`);
|
||||||
|
toastSuccess('已开始下载');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!selected) return;
|
||||||
|
let blob = blobsRef.current.get(selected.id);
|
||||||
|
if (!blob) {
|
||||||
|
blob = await fetchActivityPosterImage(selected.id);
|
||||||
|
blobsRef.current.set(selected.id, blob);
|
||||||
|
}
|
||||||
|
if (isWechatEnv()) {
|
||||||
|
let url = previewUrls[selected.id];
|
||||||
|
if (!url) {
|
||||||
|
url = URL.createObjectURL(blob);
|
||||||
|
urlsRef.current.push(url);
|
||||||
|
setPreviewUrls((prev) => ({ ...prev, [selected.id]: url }));
|
||||||
|
}
|
||||||
|
toastSuccess('请长按上方图片保存到相册');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
downloadBlob(blob, `activity-poster-${selected.id}.png`);
|
||||||
|
toastSuccess('已开始下载');
|
||||||
|
} catch (e) {
|
||||||
|
toastError(e instanceof Error ? e.message : '下载失败');
|
||||||
|
} finally {
|
||||||
|
setDownloading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function selectPoster(id: string) {
|
||||||
|
const prev = selectedId;
|
||||||
|
setSelectedId(id);
|
||||||
|
try {
|
||||||
|
await saveActivityPosterSelection(id === NONE_ID ? null : id);
|
||||||
|
} catch (e) {
|
||||||
|
setSelectedId(prev);
|
||||||
|
toastError(e instanceof Error ? e.message : '保存失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderRadioRow(id: string, label: string) {
|
||||||
|
return (
|
||||||
|
<label className="partner-activity-radio-row">
|
||||||
|
<span className="headline-md">{label}</span>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="activity-poster"
|
||||||
|
checked={selectedId === id}
|
||||||
|
onChange={() => void selectPoster(id)}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listLoading) {
|
||||||
|
return <div className="empty">加载活动图…</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="partner-activity-picker">
|
||||||
|
<section className="partner-bill-card" style={{ overflow: 'hidden' }}>
|
||||||
|
{renderRadioRow(NONE_ID, '无')}
|
||||||
|
{selectedId === NONE_ID && (
|
||||||
|
<div className="partner-activity-panel">
|
||||||
|
{qrcodeUrl ? (
|
||||||
|
<div className="partner-activity-preview partner-activity-preview--qr">
|
||||||
|
<img src={qrcodeUrl} alt="关联码" />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="body-md text-muted" style={{ marginBottom: 12 }}>关联码尚未生成</p>
|
||||||
|
)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="partner-btn-primary"
|
||||||
|
disabled={downloading || !qrcodeUrl}
|
||||||
|
onClick={() => void downloadSelected()}
|
||||||
|
>
|
||||||
|
{downloading ? '下载中…' : '下载二维码'}
|
||||||
|
</button>
|
||||||
|
{isWechatEnv() && (
|
||||||
|
<p className="label-md text-muted" style={{ marginTop: 12 }}>
|
||||||
|
微信内请长按上方图片保存
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{items.map((item) => (
|
||||||
|
<section key={item.id} className="partner-bill-card" style={{ marginTop: 12, overflow: 'hidden' }}>
|
||||||
|
{renderRadioRow(item.id, item.title)}
|
||||||
|
{selectedId === item.id && (
|
||||||
|
<div className="partner-activity-panel">
|
||||||
|
<div className="partner-activity-preview">
|
||||||
|
<img src={previewUrl || item.imageUrl} alt={item.title} />
|
||||||
|
{previewLoading && !previewUrl && (
|
||||||
|
<div className="partner-activity-preview-mask">正在贴入二维码…</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{item.copyText ? (
|
||||||
|
<p className="body-md" style={{ whiteSpace: 'pre-wrap', margin: '12px 0' }}>{item.copyText}</p>
|
||||||
|
) : (
|
||||||
|
<p className="body-md text-muted" style={{ margin: '12px 0' }}>暂无推广文案</p>
|
||||||
|
)}
|
||||||
|
<div style={{ display: 'flex', gap: 12 }}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="partner-btn-outline"
|
||||||
|
onClick={() => {
|
||||||
|
void copyActivityCopy(item.copyText)
|
||||||
|
.then(() => toastSuccess('文案已复制'))
|
||||||
|
.catch((e) => toastError(e instanceof Error ? e.message : '复制失败'));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
复制文案
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="partner-btn-primary"
|
||||||
|
style={{ flex: 1, width: 'auto', padding: 0, height: 48 }}
|
||||||
|
disabled={downloading || previewLoading}
|
||||||
|
onClick={() => void downloadSelected()}
|
||||||
|
>
|
||||||
|
{downloading || previewLoading ? '生成中…' : '下载活动图'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{previewUrl && isWechatEnv() && (
|
||||||
|
<p className="label-md text-muted" style={{ marginTop: 12 }}>
|
||||||
|
微信内请长按上方图片保存
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import type { ActivityPosterItem, ActivityPosterSelection } from '@dukang/shared-types';
|
||||||
|
import { request } from './api';
|
||||||
|
|
||||||
|
export async function listActivityPosters() {
|
||||||
|
const data = await request<ActivityPosterItem[]>('PARTNER_H5', '/partner/activity-posters', {
|
||||||
|
silent: true,
|
||||||
|
});
|
||||||
|
return Array.isArray(data) ? data : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchAssocQrcodeImage(): Promise<Blob> {
|
||||||
|
const token = localStorage.getItem('accessToken');
|
||||||
|
const res = await fetch('/api/v1/partner/assoc/qrcode', {
|
||||||
|
headers: {
|
||||||
|
Authorization: token ? `Bearer ${token}` : '',
|
||||||
|
'X-Client-App': 'PARTNER_H5',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!res.ok) throw new Error('下载二维码失败');
|
||||||
|
return res.blob();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchActivityPosterImage(id: string): Promise<Blob> {
|
||||||
|
const token = localStorage.getItem('accessToken');
|
||||||
|
const res = await fetch(`/api/v1/partner/activity-posters/${id}/image`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: token ? `Bearer ${token}` : '',
|
||||||
|
'X-Client-App': 'PARTNER_H5',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!res.ok) {
|
||||||
|
const json = await res.json().catch(() => null) as { message?: string } | null;
|
||||||
|
throw new Error(json?.message || '生成活动图失败');
|
||||||
|
}
|
||||||
|
return res.blob();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function downloadBlob(blob: Blob, fileName: string) {
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = fileName;
|
||||||
|
a.click();
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getActivityPosterSelection() {
|
||||||
|
return request<ActivityPosterSelection>('PARTNER_H5', '/partner/activity-posters/selection', {
|
||||||
|
silent: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function saveActivityPosterSelection(posterId: string | null) {
|
||||||
|
return request<ActivityPosterSelection>('PARTNER_H5', '/partner/activity-posters/selection', {
|
||||||
|
method: 'PUT',
|
||||||
|
body: JSON.stringify({ posterId }),
|
||||||
|
silent: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function copyActivityCopy(text: string) {
|
||||||
|
const value = text.trim();
|
||||||
|
if (!value) throw new Error('暂无文案');
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(value);
|
||||||
|
} catch {
|
||||||
|
const ta = document.createElement('textarea');
|
||||||
|
ta.value = value;
|
||||||
|
document.body.appendChild(ta);
|
||||||
|
ta.select();
|
||||||
|
document.execCommand('copy');
|
||||||
|
document.body.removeChild(ta);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
|
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||||
|
import PageHeader from '@dukang/shared-ui/PageHeader';
|
||||||
|
import ActivityPosterPicker from '../components/ActivityPosterPicker';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
|
export default function ActivityPostersPage() {
|
||||||
|
usePartnerPageView('partner_activity_posters_view');
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [searchParams] = useSearchParams();
|
||||||
|
const initialId = searchParams.get('id');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = '活动图';
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<PageHeader title="活动图" onBack={() => navigate(-1)} />
|
||||||
|
<div style={{ padding: 16 }}>
|
||||||
|
<ActivityPosterPicker initialId={initialId} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -219,6 +219,15 @@ export default function CenterPage({ variant = 'primary', roleLabel }: CenterPag
|
|||||||
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Link to="/center/activity-posters" className="partner-menu-item">
|
||||||
|
<div className="partner-menu-item-left">
|
||||||
|
<div className="partner-menu-icon">
|
||||||
|
<span className="material-symbols-outlined">image</span>
|
||||||
|
</div>
|
||||||
|
<span className="body-md" style={{ fontSize: 16 }}>活动图</span>
|
||||||
|
</div>
|
||||||
|
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
||||||
|
</Link>
|
||||||
<Link to="/users" className="partner-menu-item">
|
<Link to="/users" className="partner-menu-item">
|
||||||
<div className="partner-menu-item-left">
|
<div className="partner-menu-item-left">
|
||||||
<div className="partner-menu-icon">
|
<div className="partner-menu-icon">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
import { Link, useNavigate, useSearchParams } from 'react-router-dom';
|
||||||
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
||||||
import type {
|
import type {
|
||||||
PartnerAssocSummary,
|
PartnerAssocSummary,
|
||||||
@@ -7,6 +7,11 @@ import type {
|
|||||||
PartnerAssocUserSort,
|
PartnerAssocUserSort,
|
||||||
} from '@dukang/shared-types';
|
} from '@dukang/shared-types';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import {
|
||||||
|
downloadBlob,
|
||||||
|
fetchActivityPosterImage,
|
||||||
|
fetchAssocQrcodeImage,
|
||||||
|
} from '../lib/activity-posters';
|
||||||
import { toastError, toastSuccess } from '../lib/toast';
|
import { toastError, toastSuccess } from '../lib/toast';
|
||||||
import { isWechatEnv } from '../lib/weixin';
|
import { isWechatEnv } from '../lib/weixin';
|
||||||
import { usePartnerPageView } from '../lib/usePageView';
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
@@ -36,6 +41,8 @@ export default function UsersManagePage() {
|
|||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const [summary, setSummary] = useState<PartnerAssocSummary | null>(null);
|
const [summary, setSummary] = useState<PartnerAssocSummary | null>(null);
|
||||||
const [previewUrl, setPreviewUrl] = useState<string | null>(null);
|
const [previewUrl, setPreviewUrl] = useState<string | null>(null);
|
||||||
|
const [heroUrl, setHeroUrl] = useState<string | null>(null);
|
||||||
|
const [heroLoading, setHeroLoading] = useState(false);
|
||||||
const [items, setItems] = useState<PartnerAssocUserItem[]>([]);
|
const [items, setItems] = useState<PartnerAssocUserItem[]>([]);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
@@ -54,6 +61,34 @@ export default function UsersManagePage() {
|
|||||||
if (previewUrl) URL.revokeObjectURL(previewUrl);
|
if (previewUrl) URL.revokeObjectURL(previewUrl);
|
||||||
}, [previewUrl]);
|
}, [previewUrl]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const posterId = summary?.activityPosterId;
|
||||||
|
if (!posterId) {
|
||||||
|
setHeroUrl(null);
|
||||||
|
setHeroLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let cancelled = false;
|
||||||
|
const acc = { url: null as string | null };
|
||||||
|
setHeroLoading(true);
|
||||||
|
fetchActivityPosterImage(posterId)
|
||||||
|
.then((blob) => {
|
||||||
|
if (cancelled) return;
|
||||||
|
acc.url = URL.createObjectURL(blob);
|
||||||
|
setHeroUrl(acc.url);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
if (!cancelled) setHeroUrl(null);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
if (!cancelled) setHeroLoading(false);
|
||||||
|
});
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
if (acc.url) URL.revokeObjectURL(acc.url);
|
||||||
|
};
|
||||||
|
}, [summary?.activityPosterId]);
|
||||||
|
|
||||||
const loadSummary = useCallback(async () => {
|
const loadSummary = useCallback(async () => {
|
||||||
const data = await request<PartnerAssocSummary>('PARTNER_H5', '/partner/assoc');
|
const data = await request<PartnerAssocSummary>('PARTNER_H5', '/partner/assoc');
|
||||||
setSummary(data);
|
setSummary(data);
|
||||||
@@ -93,31 +128,23 @@ export default function UsersManagePage() {
|
|||||||
if (uid) navigate(`/users/${uid}/orders`, { replace: true });
|
if (uid) navigate(`/users/${uid}/orders`, { replace: true });
|
||||||
}, [searchParams, navigate]);
|
}, [searchParams, navigate]);
|
||||||
|
|
||||||
async function downloadQr() {
|
async function downloadMainImage() {
|
||||||
const token = localStorage.getItem('accessToken');
|
const posterId = summary?.activityPosterId;
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/v1/partner/assoc/qrcode', {
|
const blob = posterId
|
||||||
headers: {
|
? await fetchActivityPosterImage(posterId)
|
||||||
Authorization: token ? `Bearer ${token}` : '',
|
: await fetchAssocQrcodeImage();
|
||||||
'X-Client-App': 'PARTNER_H5',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (!res.ok) throw new Error('下载失败');
|
|
||||||
const blob = await res.blob();
|
|
||||||
const url = URL.createObjectURL(blob);
|
|
||||||
if (isWechatEnv()) {
|
if (isWechatEnv()) {
|
||||||
setPreviewUrl(url);
|
setPreviewUrl(URL.createObjectURL(blob));
|
||||||
toastSuccess('请长按图片保存到相册');
|
toastSuccess('请长按图片保存到相册');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const a = document.createElement('a');
|
downloadBlob(blob, posterId
|
||||||
a.href = url;
|
? `activity-poster-${posterId}.png`
|
||||||
a.download = `partner-assoc-${summary?.partnerId || 'qr'}.png`;
|
: `partner-assoc-${summary?.partnerId || 'qr'}.png`);
|
||||||
a.click();
|
|
||||||
URL.revokeObjectURL(url);
|
|
||||||
toastSuccess('已开始下载');
|
toastSuccess('已开始下载');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (summary?.qrcodeUrl) {
|
if (!posterId && summary?.qrcodeUrl) {
|
||||||
setPreviewUrl(summary.qrcodeUrl);
|
setPreviewUrl(summary.qrcodeUrl);
|
||||||
toastSuccess('请长按图片保存到相册');
|
toastSuccess('请长按图片保存到相册');
|
||||||
return;
|
return;
|
||||||
@@ -153,9 +180,17 @@ export default function UsersManagePage() {
|
|||||||
<p className="body-md text-muted" style={{ marginBottom: 12 }}>
|
<p className="body-md text-muted" style={{ marginBottom: 12 }}>
|
||||||
用户扫码后首次锁定,后续购酒计入关联订单
|
用户扫码后首次锁定,后续购酒计入关联订单
|
||||||
</p>
|
</p>
|
||||||
{summary?.qrcodeUrl ? (
|
{summary?.activityPosterId && (previewUrl || heroUrl) ? (
|
||||||
<img
|
<img
|
||||||
src={previewUrl || summary.qrcodeUrl}
|
src={previewUrl || heroUrl || ''}
|
||||||
|
alt="活动图"
|
||||||
|
style={{ width: '100%', maxWidth: 360, background: '#f5f5f5' }}
|
||||||
|
/>
|
||||||
|
) : summary?.activityPosterId && heroLoading ? (
|
||||||
|
<p className="body-md text-muted">正在生成活动图…</p>
|
||||||
|
) : previewUrl || summary?.qrcodeUrl ? (
|
||||||
|
<img
|
||||||
|
src={previewUrl || summary?.qrcodeUrl || ''}
|
||||||
alt="关联码"
|
alt="关联码"
|
||||||
style={{ width: 200, height: 200, background: '#fff' }}
|
style={{ width: 200, height: 200, background: '#fff' }}
|
||||||
/>
|
/>
|
||||||
@@ -165,14 +200,26 @@ export default function UsersManagePage() {
|
|||||||
<p className="label-md text-muted" style={{ marginTop: 8 }}>
|
<p className="label-md text-muted" style={{ marginTop: 8 }}>
|
||||||
已关联 {summary?.userCount ?? total} 人
|
已关联 {summary?.userCount ?? total} 人
|
||||||
</p>
|
</p>
|
||||||
<button type="button" className="partner-btn-primary" style={{ marginTop: 16 }} onClick={() => void downloadQr()}>
|
<button type="button" className="partner-btn-primary" style={{ marginTop: 16 }} onClick={() => void downloadMainImage()}>
|
||||||
下载二维码
|
{summary?.activityPosterId ? '下载活动图' : '下载二维码'}
|
||||||
</button>
|
</button>
|
||||||
{previewUrl && isWechatEnv() && (
|
{previewUrl && isWechatEnv() && (
|
||||||
<p className="label-md text-muted" style={{ marginTop: 8 }}>微信内请长按上方图片保存</p>
|
<p className="label-md text-muted" style={{ marginTop: 8 }}>微信内请长按上方图片保存</p>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<Link to="/center/activity-posters" className="partner-menu-card" style={{ display: 'block', marginBottom: 20, textDecoration: 'none', color: 'inherit' }}>
|
||||||
|
<div className="partner-menu-item">
|
||||||
|
<div className="partner-menu-item-left">
|
||||||
|
<div className="partner-menu-icon">
|
||||||
|
<span className="material-symbols-outlined">image</span>
|
||||||
|
</div>
|
||||||
|
<span className="body-md" style={{ fontSize: 16 }}>活动图</span>
|
||||||
|
</div>
|
||||||
|
<span className="material-symbols-outlined text-muted">chevron_right</span>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
|
||||||
<h2 className="headline-md" style={{ marginBottom: 12 }}>已关联用户</h2>
|
<h2 className="headline-md" style={{ marginBottom: 12 }}>已关联用户</h2>
|
||||||
<div className="partner-search">
|
<div className="partner-search">
|
||||||
<span className="material-symbols-outlined">search</span>
|
<span className="material-symbols-outlined">search</span>
|
||||||
|
|||||||
@@ -3971,3 +3971,119 @@ header:has(> .app-page-title:only-child),
|
|||||||
padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
|
padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.partner-activity-scroll {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-chip {
|
||||||
|
flex: 0 0 92px;
|
||||||
|
border: 1px solid var(--color-outline-variant, #eee);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 6px;
|
||||||
|
text-align: left;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-chip img {
|
||||||
|
width: 100%;
|
||||||
|
height: 92px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: block;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-chip span {
|
||||||
|
display: block;
|
||||||
|
margin-top: 6px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-chip.is-active {
|
||||||
|
border-color: var(--color-heritage-red);
|
||||||
|
box-shadow: 0 0 0 1px var(--color-heritage-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-preview {
|
||||||
|
position: relative;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-preview img {
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-preview-mask {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgba(255, 255, 255, 0.62);
|
||||||
|
color: var(--color-on-surface-variant, #666);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-center-card {
|
||||||
|
flex: 0 0 120px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-center-card img {
|
||||||
|
width: 100%;
|
||||||
|
height: 120px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 12px;
|
||||||
|
display: block;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-center-card span {
|
||||||
|
display: block;
|
||||||
|
margin-top: 6px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-radio-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 14px 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-radio-row input[type='radio'] {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
accent-color: var(--color-heritage-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-panel {
|
||||||
|
padding: 0 16px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-preview--qr {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
background: #fff;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-activity-preview--qr img {
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
|
<meta name="robots" content="noindex, nofollow, noarchive" />
|
||||||
<title>门店管理中心</title>
|
<title>门店管理中心</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow: /
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
@import './styles/mine.css';
|
@import './styles/mine.css';
|
||||||
@import './styles/address.css';
|
@import './styles/address.css';
|
||||||
@import './styles/benefit-promo.css';
|
@import './styles/benefit-promo.css';
|
||||||
@import './components/JiuzuSplash.css';
|
@import './components/HomeSplash.css';
|
||||||
|
|
||||||
page,
|
page,
|
||||||
body {
|
body {
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ import { patchTaroH5Hooks } from './lib/patch-taro-h5-hooks';
|
|||||||
import { handleWechatOrderConfirmShow } from './lib/wechat-order-confirm';
|
import { handleWechatOrderConfirmShow } from './lib/wechat-order-confirm';
|
||||||
import { installClientErrorReporting } from './lib/client-error';
|
import { installClientErrorReporting } from './lib/client-error';
|
||||||
import { prefetchShareBrandAssets } from './lib/wechat-share';
|
import { prefetchShareBrandAssets } from './lib/wechat-share';
|
||||||
import { prefetchJiuzuSplashAssets } from './lib/jiuzu-splash';
|
|
||||||
import './app.css';
|
import './app.css';
|
||||||
|
|
||||||
// H5:在首屏 page hooks 执行前,把 Taro.useDidShow 等绑到与 createReactApp 同一份 runtime
|
// H5:在首屏 page hooks 执行前,把 Taro.useDidShow 等绑到与 createReactApp 同一份 runtime
|
||||||
patchTaroH5Hooks();
|
patchTaroH5Hooks();
|
||||||
installClientErrorReporting();
|
installClientErrorReporting();
|
||||||
prefetchShareBrandAssets();
|
prefetchShareBrandAssets();
|
||||||
prefetchJiuzuSplashAssets();
|
|
||||||
|
|
||||||
function App({ children }: PropsWithChildren) {
|
function App({ children }: PropsWithChildren) {
|
||||||
const handlingRef = useRef(false);
|
const handlingRef = useRef(false);
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import Taro, { useDidShow } from '@tarojs/taro';
|
|||||||
import { handleWechatOrderConfirmShow } from './lib/wechat-order-confirm';
|
import { handleWechatOrderConfirmShow } from './lib/wechat-order-confirm';
|
||||||
import { installClientErrorReporting } from './lib/client-error';
|
import { installClientErrorReporting } from './lib/client-error';
|
||||||
import { prefetchShareBrandAssets } from './lib/wechat-share';
|
import { prefetchShareBrandAssets } from './lib/wechat-share';
|
||||||
import { prefetchJiuzuSplashAssets } from './lib/jiuzu-splash';
|
import { prefetchHomeSplashAssets } from './lib/home-splash';
|
||||||
import { capturePromoSceneAndTouchScan } from './lib/promo';
|
import { capturePromoSceneAndTouchScan } from './lib/promo';
|
||||||
import { initClientVersionChecks } from './lib/client-version';
|
import { initClientVersionChecks } from './lib/client-version';
|
||||||
import './app.css';
|
import './app.css';
|
||||||
|
|
||||||
installClientErrorReporting();
|
installClientErrorReporting();
|
||||||
prefetchShareBrandAssets();
|
prefetchShareBrandAssets();
|
||||||
prefetchJiuzuSplashAssets();
|
prefetchHomeSplashAssets();
|
||||||
|
|
||||||
function App({ children }: PropsWithChildren) {
|
function App({ children }: PropsWithChildren) {
|
||||||
const handlingRef = useRef(false);
|
const handlingRef = useRef(false);
|
||||||
|
|||||||
@@ -0,0 +1,272 @@
|
|||||||
|
/* 首页开场:半透明底 + 酒瓶 + 分流光 + 文字渐显 */
|
||||||
|
|
||||||
|
.home-splash {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 10010;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash--out {
|
||||||
|
animation: home-splash-out 0.8s ease-in forwards;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-veil {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
background-color: rgba(20, 8, 8, 0.58);
|
||||||
|
background-image: radial-gradient(
|
||||||
|
ellipse at 50% 48%,
|
||||||
|
rgba(166, 29, 36, 0.42) 0%,
|
||||||
|
rgba(20, 8, 8, 0.62) 62%,
|
||||||
|
rgba(10, 4, 4, 0.72) 100%
|
||||||
|
);
|
||||||
|
opacity: 0;
|
||||||
|
animation: home-splash-fade 0.7s ease-out forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-copy {
|
||||||
|
position: relative;
|
||||||
|
z-index: 3;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-title {
|
||||||
|
font-family: 'Songti SC', 'STSong', 'Noto Serif SC', 'PingFang SC', serif;
|
||||||
|
font-size: 40px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.2;
|
||||||
|
letter-spacing: 0.22em;
|
||||||
|
color: #f5d76e;
|
||||||
|
text-shadow: 0 0 14px rgba(255, 191, 0, 0.55), 0 2px 10px rgba(20, 8, 8, 0.45);
|
||||||
|
opacity: 0;
|
||||||
|
animation: home-splash-fade 1.1s 0.65s ease-out forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-sub {
|
||||||
|
margin-top: 10px;
|
||||||
|
font-size: 13px;
|
||||||
|
letter-spacing: 0.16em;
|
||||||
|
color: rgba(255, 248, 210, 0.88);
|
||||||
|
opacity: 0;
|
||||||
|
animation: home-splash-fade 1.1s 1.35s ease-out forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-stage {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
width: 220px;
|
||||||
|
height: 420px;
|
||||||
|
overflow: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
animation: home-splash-fade 1s 0.2s ease-out forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-glow {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 0;
|
||||||
|
left: 18px;
|
||||||
|
right: 18px;
|
||||||
|
top: 18%;
|
||||||
|
bottom: 8%;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: radial-gradient(ellipse at 50% 50%, rgba(255, 191, 0, 0.34) 0%, rgba(255, 191, 0, 0) 72%);
|
||||||
|
opacity: 0;
|
||||||
|
animation: home-splash-glow 2.6s 0.8s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-beam {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 50%;
|
||||||
|
width: 46px;
|
||||||
|
margin-left: -23px;
|
||||||
|
background: linear-gradient(
|
||||||
|
180deg,
|
||||||
|
rgba(255, 248, 210, 0) 0%,
|
||||||
|
rgba(255, 248, 210, 0.16) 28%,
|
||||||
|
rgba(255, 191, 0, 0.22) 50%,
|
||||||
|
rgba(255, 248, 210, 0.1) 78%,
|
||||||
|
rgba(255, 248, 210, 0) 100%
|
||||||
|
);
|
||||||
|
opacity: 0;
|
||||||
|
animation: home-splash-beam 3.2s 1.1s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-bottle {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
display: block;
|
||||||
|
width: 220px;
|
||||||
|
height: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-bottle img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-lights {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 3;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 220px;
|
||||||
|
height: 420px;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
-webkit-mask-size: contain;
|
||||||
|
mask-size: contain;
|
||||||
|
-webkit-mask-repeat: no-repeat;
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
-webkit-mask-position: center;
|
||||||
|
mask-mode: alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-sheen {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 3;
|
||||||
|
top: -12%;
|
||||||
|
bottom: -12%;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-sheen--a {
|
||||||
|
width: 48px;
|
||||||
|
left: 0;
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
rgba(255, 255, 255, 0) 0%,
|
||||||
|
rgba(255, 248, 210, 0.08) 28%,
|
||||||
|
rgba(255, 248, 210, 0.55) 50%,
|
||||||
|
rgba(255, 191, 0, 0.18) 72%,
|
||||||
|
rgba(255, 255, 255, 0) 100%
|
||||||
|
);
|
||||||
|
transform: translateX(-70px) skewX(-22deg);
|
||||||
|
animation: home-splash-sheen-a 2.8s 1.4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-sheen--b {
|
||||||
|
width: 22px;
|
||||||
|
left: 0;
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
rgba(255, 255, 255, 0) 0%,
|
||||||
|
rgba(255, 255, 255, 0.42) 50%,
|
||||||
|
rgba(255, 255, 255, 0) 100%
|
||||||
|
);
|
||||||
|
transform: translateX(-50px) skewX(-18deg);
|
||||||
|
animation: home-splash-sheen-b 3.6s 2.3s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-skip {
|
||||||
|
position: absolute;
|
||||||
|
top: 16px;
|
||||||
|
right: 16px;
|
||||||
|
z-index: 4;
|
||||||
|
padding: 6px 14px;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 1px solid rgba(245, 215, 110, 0.45);
|
||||||
|
background: rgba(20, 8, 8, 0.35);
|
||||||
|
opacity: 0;
|
||||||
|
animation: home-splash-fade 0.6s 0.35s ease-out forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-splash-skip-text {
|
||||||
|
color: rgba(255, 248, 210, 0.92);
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.4;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes home-splash-fade {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes home-splash-out {
|
||||||
|
from {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes home-splash-glow {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 0.35;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes home-splash-beam {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
40% {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
70% {
|
||||||
|
opacity: 0.15;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes home-splash-sheen-a {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(-70px) skewX(-22deg);
|
||||||
|
}
|
||||||
|
18% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
82% {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(250px) skewX(-22deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes home-splash-sheen-b {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(-40px) skewX(-18deg);
|
||||||
|
}
|
||||||
|
22% {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(240px) skewX(-18deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
import { Image, Text, View } from '@tarojs/components';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import { HOME_SPLASH_BOTTLE_URL } from '@dukang/shared-types';
|
||||||
|
import { markHomeSplashPlayed } from '../lib/home-splash';
|
||||||
|
|
||||||
|
const SPLASH_NAV_BG = '#140808';
|
||||||
|
const HOME_NAV_BG = '#FAF9F7';
|
||||||
|
const FADE_AT_MS = 4800;
|
||||||
|
const FADE_MS = 800;
|
||||||
|
|
||||||
|
type HomeSplashProps = {
|
||||||
|
onDone: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
function applySplashChrome() {
|
||||||
|
try {
|
||||||
|
void Taro.hideTabBar({ animation: false });
|
||||||
|
} catch {
|
||||||
|
/* H5 无原生 TabBar */
|
||||||
|
}
|
||||||
|
void Taro.setNavigationBarColor({
|
||||||
|
frontColor: '#ffffff',
|
||||||
|
backgroundColor: SPLASH_NAV_BG,
|
||||||
|
animation: { duration: 200, timingFunc: 'easeIn' },
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
function restoreChrome() {
|
||||||
|
try {
|
||||||
|
void Taro.showTabBar({ animation: false });
|
||||||
|
} catch {
|
||||||
|
/* H5 无原生 TabBar */
|
||||||
|
}
|
||||||
|
void Taro.setNavigationBarColor({
|
||||||
|
frontColor: '#000000',
|
||||||
|
backgroundColor: HOME_NAV_BG,
|
||||||
|
animation: { duration: 200, timingFunc: 'easeOut' },
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function HomeSplash({ onDone }: HomeSplashProps) {
|
||||||
|
const finishedRef = useRef(false);
|
||||||
|
const fadingRef = useRef(false);
|
||||||
|
const onDoneRef = useRef(onDone);
|
||||||
|
onDoneRef.current = onDone;
|
||||||
|
const [leaving, setLeaving] = useState(false);
|
||||||
|
|
||||||
|
const finish = useCallback(() => {
|
||||||
|
if (finishedRef.current) return;
|
||||||
|
finishedRef.current = true;
|
||||||
|
restoreChrome();
|
||||||
|
onDoneRef.current();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const beginExit = useCallback(() => {
|
||||||
|
if (fadingRef.current || finishedRef.current) return;
|
||||||
|
fadingRef.current = true;
|
||||||
|
setLeaving(true);
|
||||||
|
setTimeout(finish, FADE_MS);
|
||||||
|
}, [finish]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
markHomeSplashPlayed();
|
||||||
|
applySplashChrome();
|
||||||
|
const timer = setTimeout(beginExit, FADE_AT_MS);
|
||||||
|
return () => {
|
||||||
|
clearTimeout(timer);
|
||||||
|
if (!finishedRef.current) restoreChrome();
|
||||||
|
};
|
||||||
|
}, [beginExit]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
className={`home-splash${leaving ? ' home-splash--out' : ''}`}
|
||||||
|
catchMove
|
||||||
|
onTouchMove={(e) => {
|
||||||
|
e.stopPropagation?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View className="home-splash-veil" />
|
||||||
|
|
||||||
|
<View className="home-splash-copy">
|
||||||
|
<Text className="home-splash-title">杜康好客</Text>
|
||||||
|
<Text className="home-splash-sub">购杜康好酒,赠好客权益</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View className="home-splash-stage">
|
||||||
|
<View className="home-splash-glow" />
|
||||||
|
<Image
|
||||||
|
className="home-splash-bottle"
|
||||||
|
src={HOME_SPLASH_BOTTLE_URL}
|
||||||
|
mode="aspectFit"
|
||||||
|
style={{ width: '220px', height: '420px' }}
|
||||||
|
/>
|
||||||
|
<View
|
||||||
|
className="home-splash-lights"
|
||||||
|
style={{
|
||||||
|
width: '220px',
|
||||||
|
height: '420px',
|
||||||
|
WebkitMaskImage: `url(${HOME_SPLASH_BOTTLE_URL})`,
|
||||||
|
maskImage: `url(${HOME_SPLASH_BOTTLE_URL})`,
|
||||||
|
WebkitMaskSize: 'contain',
|
||||||
|
maskSize: 'contain',
|
||||||
|
WebkitMaskRepeat: 'no-repeat',
|
||||||
|
maskRepeat: 'no-repeat',
|
||||||
|
WebkitMaskPosition: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View className="home-splash-beam" />
|
||||||
|
<View className="home-splash-sheen home-splash-sheen--a" />
|
||||||
|
<View className="home-splash-sheen home-splash-sheen--b" />
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View className="home-splash-skip" onClick={finish}>
|
||||||
|
<Text className="home-splash-skip-text">跳过</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,266 +0,0 @@
|
|||||||
/* 酒祖杜康开场:黑红底 → GIF 播完消失 → 四字上移 → 副标题跟上 */
|
|
||||||
|
|
||||||
.jiuzu-splash {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 10010;
|
|
||||||
overflow: hidden;
|
|
||||||
background-color: #140808;
|
|
||||||
background-image: radial-gradient(ellipse at 50% 42%, #5a1014 0%, #2a080a 48%, #140808 100%);
|
|
||||||
animation: jiuzu-bg-in 0.35s ease-out both;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash--out {
|
|
||||||
animation: jiuzu-bg-out 0.8s ease-in forwards;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-mist {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 0;
|
|
||||||
border-radius: 50%;
|
|
||||||
pointer-events: none;
|
|
||||||
filter: blur(48px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-mist--a {
|
|
||||||
width: 280px;
|
|
||||||
height: 280px;
|
|
||||||
left: -72px;
|
|
||||||
top: 12%;
|
|
||||||
background: rgba(166, 29, 36, 0.38);
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-mist--b {
|
|
||||||
width: 240px;
|
|
||||||
height: 240px;
|
|
||||||
right: -56px;
|
|
||||||
bottom: 16%;
|
|
||||||
background: rgba(90, 16, 20, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-gif {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 5;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-gif--out {
|
|
||||||
animation: jiuzu-bg-out 0.35s ease-in forwards;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-gif img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-copy {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 2;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
top: 26%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-lockup {
|
|
||||||
position: relative;
|
|
||||||
width: 320px;
|
|
||||||
height: 180px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-title {
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(48vh);
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash--after-gif .jiuzu-splash-title {
|
|
||||||
animation: jiuzu-title-rise 2.4s cubic-bezier(0.22, 1, 0.32, 1) forwards;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-mark {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 0;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 320px;
|
|
||||||
height: 180px;
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash--after-gif .jiuzu-splash-mark {
|
|
||||||
animation: fadeInTo4 1s ease-out both;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-mark img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-chars {
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
overflow: hidden;
|
|
||||||
padding: 8px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-char {
|
|
||||||
width: 52px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-char-text {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
font-family: 'Songti SC', 'STSong', 'Noto Serif SC', 'PingFang SC', serif;
|
|
||||||
font-size: 46px;
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 1.15;
|
|
||||||
text-align: center;
|
|
||||||
color: #f5d76e;
|
|
||||||
text-shadow: 0 0 12px rgba(255, 191, 0, 0.85), 0 0 28px rgba(20, 8, 8, 0.65);
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-shimmer {
|
|
||||||
position: absolute;
|
|
||||||
top: -10%;
|
|
||||||
bottom: -10%;
|
|
||||||
width: 36px;
|
|
||||||
z-index: 3;
|
|
||||||
pointer-events: none;
|
|
||||||
opacity: 0;
|
|
||||||
background: linear-gradient(
|
|
||||||
90deg,
|
|
||||||
rgba(255, 255, 255, 0) 0%,
|
|
||||||
rgba(255, 248, 210, 0.55) 50%,
|
|
||||||
rgba(255, 255, 255, 0) 100%
|
|
||||||
);
|
|
||||||
transform: translateX(-80px) skewX(-18deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash--after-gif .jiuzu-splash-shimmer {
|
|
||||||
animation: jiuzu-shimmer 0.7s 2.2s ease-out both;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-sub {
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
margin-top: 4px;
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(36vh);
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash--after-gif .jiuzu-splash-sub {
|
|
||||||
animation: jiuzu-sub-rise 0.4s 1.3s cubic-bezier(0.22, 1, 0.32, 1) forwards;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-sub-text {
|
|
||||||
font-size: 13px;
|
|
||||||
letter-spacing: 0.28em;
|
|
||||||
color: rgba(245, 215, 110, 0.88);
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-skip {
|
|
||||||
position: absolute;
|
|
||||||
top: 16px;
|
|
||||||
right: 16px;
|
|
||||||
z-index: 6;
|
|
||||||
padding: 6px 14px;
|
|
||||||
border-radius: 999px;
|
|
||||||
border: 1px solid rgba(245, 215, 110, 0.45);
|
|
||||||
background: rgba(20, 8, 8, 0.35);
|
|
||||||
}
|
|
||||||
|
|
||||||
.jiuzu-splash-skip-text {
|
|
||||||
color: rgba(255, 248, 210, 0.92);
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 1.4;
|
|
||||||
letter-spacing: 0.08em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fadeInTo4 {
|
|
||||||
0% { opacity: 0; }
|
|
||||||
100% { opacity: 0.4; }
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes jiuzu-bg-in {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes jiuzu-bg-out {
|
|
||||||
from {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes jiuzu-title-rise {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(48vh);
|
|
||||||
}
|
|
||||||
14% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(48vh);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes jiuzu-sub-rise {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(36vh);
|
|
||||||
}
|
|
||||||
18% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(36vh);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes jiuzu-shimmer {
|
|
||||||
from {
|
|
||||||
transform: translateX(-80px) skewX(-18deg);
|
|
||||||
opacity: 0.2;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: translateX(280px) skewX(-18deg);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
||||||
import { Image, Text, View } from '@tarojs/components';
|
|
||||||
import Taro from '@tarojs/taro';
|
|
||||||
import { JIUZU_SPLASH_GIF_URL, JIUZU_SPLASH_MARK_URL } from '@dukang/shared-types';
|
|
||||||
import { markJiuzuSplashPlayed } from '../lib/jiuzu-splash';
|
|
||||||
|
|
||||||
const CHARS = ['酒', '祖', '杜', '康'] as const;
|
|
||||||
|
|
||||||
const SPLASH_NAV_BG = '#140808';
|
|
||||||
const HOME_NAV_BG = '#FAF9F7';
|
|
||||||
/** GIF 21 帧 × 80ms,略提前淡出避免循环 */
|
|
||||||
const GIF_MS = 1650;
|
|
||||||
const GIF_FADE_MS = 350;
|
|
||||||
/** 四字显现并升到偏上位置 */
|
|
||||||
const TITLE_MS = 2400;
|
|
||||||
/** 副标题在四字到位后再升起 */
|
|
||||||
const SUB_DELAY_MS = 2300;
|
|
||||||
const SUB_MS = 1400;
|
|
||||||
const HOLD_MS = 900;
|
|
||||||
const FADE_MS = 800;
|
|
||||||
const FADE_AT_MS = GIF_MS + SUB_DELAY_MS + SUB_MS + HOLD_MS;
|
|
||||||
|
|
||||||
type JiuzuSplashProps = {
|
|
||||||
onDone: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
function applySplashChrome() {
|
|
||||||
try {
|
|
||||||
void Taro.hideTabBar({ animation: false });
|
|
||||||
} catch {
|
|
||||||
/* H5 无原生 TabBar */
|
|
||||||
}
|
|
||||||
void Taro.setNavigationBarColor({
|
|
||||||
frontColor: '#ffffff',
|
|
||||||
backgroundColor: SPLASH_NAV_BG,
|
|
||||||
animation: { duration: 200, timingFunc: 'easeIn' },
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
|
||||||
|
|
||||||
function restoreChrome() {
|
|
||||||
try {
|
|
||||||
void Taro.showTabBar({ animation: false });
|
|
||||||
} catch {
|
|
||||||
/* H5 无原生 TabBar */
|
|
||||||
}
|
|
||||||
void Taro.setNavigationBarColor({
|
|
||||||
frontColor: '#000000',
|
|
||||||
backgroundColor: HOME_NAV_BG,
|
|
||||||
animation: { duration: 200, timingFunc: 'easeOut' },
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function JiuzuSplash({ onDone }: JiuzuSplashProps) {
|
|
||||||
const finishedRef = useRef(false);
|
|
||||||
const fadingRef = useRef(false);
|
|
||||||
const onDoneRef = useRef(onDone);
|
|
||||||
onDoneRef.current = onDone;
|
|
||||||
const [leaving, setLeaving] = useState(false);
|
|
||||||
const [gifDone, setGifDone] = useState(false);
|
|
||||||
const [gifGone, setGifGone] = useState(false);
|
|
||||||
|
|
||||||
const finish = useCallback(() => {
|
|
||||||
if (finishedRef.current) return;
|
|
||||||
finishedRef.current = true;
|
|
||||||
restoreChrome();
|
|
||||||
onDoneRef.current();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const beginExit = useCallback(() => {
|
|
||||||
if (fadingRef.current || finishedRef.current) return;
|
|
||||||
fadingRef.current = true;
|
|
||||||
setLeaving(true);
|
|
||||||
setTimeout(finish, FADE_MS);
|
|
||||||
}, [finish]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
markJiuzuSplashPlayed();
|
|
||||||
applySplashChrome();
|
|
||||||
const gifTimer = setTimeout(() => setGifDone(true), GIF_MS);
|
|
||||||
const gifGoneTimer = setTimeout(() => setGifGone(true), GIF_MS + GIF_FADE_MS);
|
|
||||||
const exitTimer = setTimeout(beginExit, FADE_AT_MS);
|
|
||||||
return () => {
|
|
||||||
clearTimeout(gifTimer);
|
|
||||||
clearTimeout(gifGoneTimer);
|
|
||||||
clearTimeout(exitTimer);
|
|
||||||
if (!finishedRef.current) restoreChrome();
|
|
||||||
};
|
|
||||||
}, [beginExit]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
className={`jiuzu-splash${gifDone ? ' jiuzu-splash--after-gif' : ''}${leaving ? ' jiuzu-splash--out' : ''}`}
|
|
||||||
catchMove
|
|
||||||
onTouchMove={(e) => {
|
|
||||||
e.stopPropagation?.();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View className="jiuzu-splash-mist jiuzu-splash-mist--a" />
|
|
||||||
<View className="jiuzu-splash-mist jiuzu-splash-mist--b" />
|
|
||||||
|
|
||||||
{gifGone ? null : (
|
|
||||||
<Image
|
|
||||||
className={`jiuzu-splash-gif${gifDone ? ' jiuzu-splash-gif--out' : ''}`}
|
|
||||||
src={JIUZU_SPLASH_GIF_URL}
|
|
||||||
mode="aspectFill"
|
|
||||||
style={{ width: '100%', height: '100%' }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<View className="jiuzu-splash-copy">
|
|
||||||
<View className="jiuzu-splash-lockup">
|
|
||||||
<Image
|
|
||||||
className="jiuzu-splash-mark"
|
|
||||||
src={JIUZU_SPLASH_MARK_URL}
|
|
||||||
mode="aspectFit"
|
|
||||||
style={{ width: '320px', height: '180px' }}
|
|
||||||
/>
|
|
||||||
<View className="jiuzu-splash-title">
|
|
||||||
<View className="jiuzu-splash-chars">
|
|
||||||
<View className="jiuzu-splash-shimmer" />
|
|
||||||
{CHARS.map((ch) => (
|
|
||||||
<View key={ch} className="jiuzu-splash-char">
|
|
||||||
<Text className="jiuzu-splash-char-text">{ch}</Text>
|
|
||||||
</View>
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View className="jiuzu-splash-sub">
|
|
||||||
<Text className="jiuzu-splash-sub-text">千年酒祖 · 杜康好客</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View className="jiuzu-splash-skip" onClick={finish}>
|
|
||||||
<Text className="jiuzu-splash-skip-text">跳过</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import { HOME_SPLASH_BOTTLE_URL } from '@dukang/shared-types';
|
||||||
|
|
||||||
|
/** 冷启动会话内是否已播过首页开场(进程级,切 Tab 不重播) */
|
||||||
|
|
||||||
|
let played = false;
|
||||||
|
|
||||||
|
export function hasHomeSplashPlayed() {
|
||||||
|
return played;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function markHomeSplashPlayed() {
|
||||||
|
played = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 冷启动预拉 OSS 开场图(仅 weapp;H5 的 getImageInfo 会走 CORS) */
|
||||||
|
export function prefetchHomeSplashAssets() {
|
||||||
|
if (played) return;
|
||||||
|
if (process.env.TARO_ENV !== 'weapp') return;
|
||||||
|
void Taro.getImageInfo({ src: HOME_SPLASH_BOTTLE_URL }).catch(() => {});
|
||||||
|
}
|
||||||
@@ -1,316 +0,0 @@
|
|||||||
/** Canvas 金龙:盘成一圈,仿照立体金龙的鳞片、须、角、爪与光晕 */
|
|
||||||
|
|
||||||
export type DragonCanvasNode = {
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
getContext: (type: '2d') => CanvasRenderingContext2D;
|
|
||||||
requestAnimationFrame?: (cb: (time: number) => void) => number;
|
|
||||||
cancelAnimationFrame?: (id: number) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
type SpinePt = {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
ang: number;
|
|
||||||
nx: number;
|
|
||||||
ny: number;
|
|
||||||
w: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
const GOLD_HI = '#fff6c8';
|
|
||||||
const GOLD = '#ffbf00';
|
|
||||||
const GOLD_MID = '#e8a800';
|
|
||||||
const GOLD_DEEP = '#b87500';
|
|
||||||
|
|
||||||
function lerp(a: number, b: number, t: number) {
|
|
||||||
return a + (b - a) * t;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fillOval(
|
|
||||||
ctx: CanvasRenderingContext2D,
|
|
||||||
x: number,
|
|
||||||
y: number,
|
|
||||||
rw: number,
|
|
||||||
rh: number,
|
|
||||||
rot: number,
|
|
||||||
) {
|
|
||||||
ctx.save();
|
|
||||||
ctx.translate(x, y);
|
|
||||||
ctx.rotate(rot);
|
|
||||||
ctx.scale(Math.max(0.01, rw), Math.max(0.01, rh));
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.arc(0, 0, 1, 0, Math.PI * 2);
|
|
||||||
ctx.fill();
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
function easeInCubic(t: number) {
|
|
||||||
return t * t * t;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildSpine(cx: number, cy: number, r: number, phase: number, segs: number): SpinePt[] {
|
|
||||||
const pts: SpinePt[] = [];
|
|
||||||
const turns = 0.94;
|
|
||||||
for (let i = 0; i < segs; i++) {
|
|
||||||
const u = i / (segs - 1);
|
|
||||||
const ang = -Math.PI / 2 + u * Math.PI * 2 * turns;
|
|
||||||
const wobble = Math.sin(u * 14 + phase) * r * 0.042 + Math.sin(u * 5.5 - phase * 0.7) * r * 0.02;
|
|
||||||
const rr = r + wobble;
|
|
||||||
const nx = Math.cos(ang);
|
|
||||||
const ny = Math.sin(ang);
|
|
||||||
pts.push({
|
|
||||||
x: cx + nx * rr,
|
|
||||||
y: cy + ny * rr,
|
|
||||||
ang,
|
|
||||||
nx,
|
|
||||||
ny,
|
|
||||||
w: lerp(20, 6.5, u ** 0.62),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return pts;
|
|
||||||
}
|
|
||||||
|
|
||||||
function strokeRibbon(
|
|
||||||
ctx: CanvasRenderingContext2D,
|
|
||||||
pts: SpinePt[],
|
|
||||||
widthScale: number,
|
|
||||||
color: string,
|
|
||||||
alpha: number,
|
|
||||||
) {
|
|
||||||
if (pts.length < 2) return;
|
|
||||||
ctx.save();
|
|
||||||
ctx.globalAlpha = alpha;
|
|
||||||
ctx.strokeStyle = color;
|
|
||||||
ctx.lineCap = 'round';
|
|
||||||
ctx.lineJoin = 'round';
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(pts[0].x, pts[0].y);
|
|
||||||
for (let i = 1; i < pts.length; i++) ctx.lineTo(pts[i].x, pts[i].y);
|
|
||||||
ctx.lineWidth = pts[Math.floor(pts.length * 0.15)].w * widthScale;
|
|
||||||
ctx.stroke();
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawScales(ctx: CanvasRenderingContext2D, pts: SpinePt[]) {
|
|
||||||
for (let i = 2; i < pts.length - 1; i += 1) {
|
|
||||||
const p = pts[i];
|
|
||||||
const u = i / (pts.length - 1);
|
|
||||||
const ox = p.x + p.nx * p.w * 0.18;
|
|
||||||
const oy = p.y + p.ny * p.w * 0.18;
|
|
||||||
ctx.save();
|
|
||||||
ctx.translate(ox, oy);
|
|
||||||
ctx.rotate(p.ang + Math.PI / 2);
|
|
||||||
ctx.fillStyle = i % 2 === 0 ? GOLD_HI : GOLD;
|
|
||||||
ctx.globalAlpha = 0.55 + (1 - u) * 0.25;
|
|
||||||
fillOval(ctx, 0, 0, p.w * 0.55, p.w * 0.38, 0);
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawSpines(ctx: CanvasRenderingContext2D, pts: SpinePt[]) {
|
|
||||||
ctx.fillStyle = GOLD_HI;
|
|
||||||
for (let i = 3; i < pts.length - 6; i += 3) {
|
|
||||||
const p = pts[i];
|
|
||||||
const len = p.w * 1.35;
|
|
||||||
ctx.save();
|
|
||||||
ctx.globalAlpha = 0.85;
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(p.x + p.nx * p.w * 0.2, p.y + p.ny * p.w * 0.2);
|
|
||||||
ctx.lineTo(
|
|
||||||
p.x + p.nx * (p.w + len),
|
|
||||||
p.y + p.ny * (p.w + len),
|
|
||||||
);
|
|
||||||
const tx = -p.ny;
|
|
||||||
const ty = p.nx;
|
|
||||||
ctx.lineTo(p.x + tx * 2.2, p.y + ty * 2.2);
|
|
||||||
ctx.closePath();
|
|
||||||
ctx.fill();
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawClaw(ctx: CanvasRenderingContext2D, p: SpinePt, side: number) {
|
|
||||||
const tx = -p.ny * side;
|
|
||||||
const ty = p.nx * side;
|
|
||||||
const baseX = p.x + tx * p.w * 0.7;
|
|
||||||
const baseY = p.y + ty * p.w * 0.7;
|
|
||||||
ctx.save();
|
|
||||||
ctx.translate(baseX, baseY);
|
|
||||||
ctx.rotate(Math.atan2(ty, tx));
|
|
||||||
ctx.fillStyle = GOLD;
|
|
||||||
ctx.strokeStyle = GOLD_DEEP;
|
|
||||||
ctx.lineWidth = 0.8;
|
|
||||||
for (let k = -1; k <= 1; k++) {
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(0, k * 4);
|
|
||||||
ctx.quadraticCurveTo(10, k * 6 - 2, 18, k * 5);
|
|
||||||
ctx.quadraticCurveTo(10, k * 4, 0, k * 3);
|
|
||||||
ctx.closePath();
|
|
||||||
ctx.fill();
|
|
||||||
ctx.stroke();
|
|
||||||
}
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawHead(ctx: CanvasRenderingContext2D, p: SpinePt, phase: number) {
|
|
||||||
ctx.save();
|
|
||||||
ctx.translate(p.x + p.nx * 10, p.y + p.ny * 10);
|
|
||||||
ctx.rotate(Math.atan2(p.ny, p.nx) + Math.PI / 2);
|
|
||||||
|
|
||||||
const mane = 6;
|
|
||||||
for (let i = 0; i < mane; i++) {
|
|
||||||
const a = -0.9 + (i / (mane - 1)) * 1.8;
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.strokeStyle = i % 2 ? GOLD_HI : GOLD;
|
|
||||||
ctx.globalAlpha = 0.7;
|
|
||||||
ctx.lineWidth = 2.2;
|
|
||||||
ctx.moveTo(Math.sin(a) * 6, -4);
|
|
||||||
ctx.quadraticCurveTo(Math.sin(a) * 16, -18 - Math.sin(phase + i) * 3, Math.sin(a) * 8, -28);
|
|
||||||
ctx.stroke();
|
|
||||||
}
|
|
||||||
ctx.globalAlpha = 1;
|
|
||||||
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(-7, -18);
|
|
||||||
ctx.quadraticCurveTo(-16, -32, -5, -38);
|
|
||||||
ctx.quadraticCurveTo(-2, -26, -3, -16);
|
|
||||||
ctx.fillStyle = GOLD_MID;
|
|
||||||
ctx.fill();
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(7, -18);
|
|
||||||
ctx.quadraticCurveTo(16, -32, 5, -38);
|
|
||||||
ctx.quadraticCurveTo(2, -26, 3, -16);
|
|
||||||
ctx.fill();
|
|
||||||
|
|
||||||
const g = ctx.createRadialGradient(-4, -4, 2, 0, 4, 20);
|
|
||||||
g.addColorStop(0, GOLD_HI);
|
|
||||||
g.addColorStop(0.45, GOLD);
|
|
||||||
g.addColorStop(1, GOLD_DEEP);
|
|
||||||
ctx.fillStyle = g;
|
|
||||||
fillOval(ctx, 0, 2, 16, 18, 0);
|
|
||||||
|
|
||||||
ctx.fillStyle = GOLD_MID;
|
|
||||||
fillOval(ctx, 0, 10, 9, 8, 0);
|
|
||||||
|
|
||||||
for (const sx of [-6.5, 6.5]) {
|
|
||||||
ctx.fillStyle = '#3a1a00';
|
|
||||||
fillOval(ctx, sx, -2, 3.2, 3.6, 0);
|
|
||||||
ctx.fillStyle = '#ffe566';
|
|
||||||
fillOval(ctx, sx, -2.4, 1.5, 1.7, 0);
|
|
||||||
ctx.fillStyle = '#fff';
|
|
||||||
fillOval(ctx, sx - 0.5, -3, 0.6, 0.6, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.strokeStyle = GOLD_HI;
|
|
||||||
ctx.lineWidth = 1.15;
|
|
||||||
ctx.globalAlpha = 0.9;
|
|
||||||
for (const side of [-1, 1]) {
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(side * 12, 6);
|
|
||||||
ctx.quadraticCurveTo(side * 36, 10 + Math.sin(phase) * 2, side * 42, 22);
|
|
||||||
ctx.stroke();
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(side * 10, 9);
|
|
||||||
ctx.quadraticCurveTo(side * 28, 18, side * 34, 28);
|
|
||||||
ctx.stroke();
|
|
||||||
}
|
|
||||||
ctx.globalAlpha = 1;
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawSparks(
|
|
||||||
ctx: CanvasRenderingContext2D,
|
|
||||||
cx: number,
|
|
||||||
cy: number,
|
|
||||||
r: number,
|
|
||||||
phase: number,
|
|
||||||
) {
|
|
||||||
for (let i = 0; i < 28; i++) {
|
|
||||||
const a = (i / 28) * Math.PI * 2 + phase * 0.35;
|
|
||||||
const rr = r * (0.72 + ((i * 17) % 10) / 40);
|
|
||||||
const x = cx + Math.cos(a) * rr + Math.sin(phase * 1.4 + i) * 4;
|
|
||||||
const y = cy + Math.sin(a) * rr + Math.cos(phase * 1.1 + i) * 3;
|
|
||||||
const s = 1.1 + (i % 5) * 0.35;
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.globalAlpha = 0.25 + (Math.sin(phase * 2 + i) + 1) * 0.25;
|
|
||||||
ctx.fillStyle = i % 3 === 0 ? GOLD_HI : GOLD;
|
|
||||||
ctx.arc(x, y, s, 0, Math.PI * 2);
|
|
||||||
ctx.fill();
|
|
||||||
}
|
|
||||||
ctx.globalAlpha = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function drawJiuzuDragonFrame(
|
|
||||||
ctx: CanvasRenderingContext2D,
|
|
||||||
width: number,
|
|
||||||
height: number,
|
|
||||||
elapsedMs: number,
|
|
||||||
) {
|
|
||||||
const cx = width / 2;
|
|
||||||
const cy = height * 0.42;
|
|
||||||
const radius = Math.min(width, height) * 0.3;
|
|
||||||
|
|
||||||
const fadeIn = Math.min(1, elapsedMs / 380);
|
|
||||||
const spinT = Math.min(1, Math.max(0, (elapsedMs - 120) / 2050));
|
|
||||||
const flyT = Math.min(1, Math.max(0, (elapsedMs - 2200) / 1200));
|
|
||||||
const spin = spinT * Math.PI * 2;
|
|
||||||
const fly = easeInCubic(flyT);
|
|
||||||
const phase = elapsedMs / 220;
|
|
||||||
|
|
||||||
ctx.clearRect(0, 0, width, height);
|
|
||||||
ctx.save();
|
|
||||||
ctx.globalAlpha = fadeIn * (1 - fly);
|
|
||||||
ctx.translate(cx, cy + fly * -height * 0.42);
|
|
||||||
ctx.scale(1 + fly * 0.55, 1 + fly * 0.55);
|
|
||||||
ctx.rotate(spin);
|
|
||||||
ctx.translate(-cx, -cy);
|
|
||||||
|
|
||||||
const pts = buildSpine(cx, cy, radius, phase, 56);
|
|
||||||
strokeRibbon(ctx, pts, 2.4, 'rgba(255, 191, 0, 0.18)', 1);
|
|
||||||
strokeRibbon(ctx, pts, 1.55, 'rgba(255, 214, 80, 0.4)', 1);
|
|
||||||
|
|
||||||
ctx.save();
|
|
||||||
ctx.lineCap = 'round';
|
|
||||||
ctx.lineJoin = 'round';
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(pts[0].x, pts[0].y);
|
|
||||||
for (let i = 1; i < pts.length; i++) ctx.lineTo(pts[i].x, pts[i].y);
|
|
||||||
const bodyGrad = ctx.createLinearGradient(cx - radius, cy, cx + radius, cy);
|
|
||||||
bodyGrad.addColorStop(0, GOLD_DEEP);
|
|
||||||
bodyGrad.addColorStop(0.5, GOLD);
|
|
||||||
bodyGrad.addColorStop(1, GOLD_HI);
|
|
||||||
ctx.strokeStyle = bodyGrad;
|
|
||||||
ctx.lineWidth = pts[0].w * 1.15;
|
|
||||||
ctx.shadowColor = 'rgba(255, 191, 0, 0.7)';
|
|
||||||
ctx.shadowBlur = 16;
|
|
||||||
ctx.stroke();
|
|
||||||
ctx.shadowBlur = 0;
|
|
||||||
ctx.restore();
|
|
||||||
|
|
||||||
drawScales(ctx, pts);
|
|
||||||
drawSpines(ctx, pts);
|
|
||||||
drawClaw(ctx, pts[Math.floor(pts.length * 0.32)], 1);
|
|
||||||
drawClaw(ctx, pts[Math.floor(pts.length * 0.68)], -1);
|
|
||||||
drawHead(ctx, pts[0], phase);
|
|
||||||
drawSparks(ctx, cx, cy, radius, phase);
|
|
||||||
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function scheduleDragonFrame(
|
|
||||||
canvas: DragonCanvasNode,
|
|
||||||
cb: (time: number) => void,
|
|
||||||
): number {
|
|
||||||
if (typeof canvas.requestAnimationFrame === 'function') {
|
|
||||||
return canvas.requestAnimationFrame(cb);
|
|
||||||
}
|
|
||||||
return requestAnimationFrame(cb);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function cancelDragonFrame(canvas: DragonCanvasNode, id: number) {
|
|
||||||
if (typeof canvas.cancelAnimationFrame === 'function') {
|
|
||||||
canvas.cancelAnimationFrame(id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cancelAnimationFrame(id);
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import Taro from '@tarojs/taro';
|
|
||||||
import { JIUZU_SPLASH_GIF_URL, JIUZU_SPLASH_MARK_URL } from '@dukang/shared-types';
|
|
||||||
|
|
||||||
/** 冷启动会话内是否已播过「酒祖杜康」开场(进程级,切 Tab 不重播) */
|
|
||||||
|
|
||||||
let played = false;
|
|
||||||
|
|
||||||
export function hasJiuzuSplashPlayed() {
|
|
||||||
return played;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function markJiuzuSplashPlayed() {
|
|
||||||
played = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 冷启动预拉 OSS 开场图(仅 weapp;H5 的 getImageInfo 会走 CORS) */
|
|
||||||
export function prefetchJiuzuSplashAssets() {
|
|
||||||
if (played) return;
|
|
||||||
if (process.env.TARO_ENV !== 'weapp') return;
|
|
||||||
void Taro.getImageInfo({ src: JIUZU_SPLASH_GIF_URL }).catch(() => {});
|
|
||||||
void Taro.getImageInfo({ src: JIUZU_SPLASH_MARK_URL }).catch(() => {});
|
|
||||||
}
|
|
||||||
@@ -13,9 +13,9 @@ import BenefitSloganBar from '../../components/BenefitSloganBar';
|
|||||||
import { BENEFIT_GIFT_TAG, BENEFIT_TAG } from '../../lib/benefit-copy';
|
import { BENEFIT_GIFT_TAG, BENEFIT_TAG } from '../../lib/benefit-copy';
|
||||||
import WechatShareReady from '../../components/WechatShareReady';
|
import WechatShareReady from '../../components/WechatShareReady';
|
||||||
import UserTabBar, { shouldRenderPageTabBar, syncTabBarSelected } from '../../components/UserTabBar';
|
import UserTabBar, { shouldRenderPageTabBar, syncTabBarSelected } from '../../components/UserTabBar';
|
||||||
import JiuzuSplash from '../../components/JiuzuSplash';
|
import HomeSplash from '../../components/HomeSplash';
|
||||||
import { goLogin } from '../../lib/auth-nav';
|
import { goLogin } from '../../lib/auth-nav';
|
||||||
import { hasJiuzuSplashPlayed } from '../../lib/jiuzu-splash';
|
import { hasHomeSplashPlayed } from '../../lib/home-splash';
|
||||||
import { getToken, isLoggedIn, request, toast } from '../../lib/api';
|
import { getToken, isLoggedIn, request, toast } from '../../lib/api';
|
||||||
import {
|
import {
|
||||||
getHomeCatalogCache,
|
getHomeCatalogCache,
|
||||||
@@ -83,7 +83,7 @@ function formatBenefitCorner(p: Product): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
const [showSplash, setShowSplash] = useState(() => !hasJiuzuSplashPlayed());
|
const [showSplash, setShowSplash] = useState(() => !hasHomeSplashPlayed());
|
||||||
const [activeAroma, setActiveAroma] = useState<AromaKey>('QINGXIANG');
|
const [activeAroma, setActiveAroma] = useState<AromaKey>('QINGXIANG');
|
||||||
const [products, setProducts] = useState<Product[]>([]);
|
const [products, setProducts] = useState<Product[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
@@ -428,7 +428,7 @@ export default function HomePage() {
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{shouldRenderPageTabBar() && !showSplash ? <UserTabBar selected={0} /> : null}
|
{shouldRenderPageTabBar() && !showSplash ? <UserTabBar selected={0} /> : null}
|
||||||
{showSplash ? <JiuzuSplash onDone={() => setShowSplash(false)} /> : null}
|
{showSplash ? <HomeSplash onDone={() => setShowSplash(false)} /> : null}
|
||||||
</PageShell>
|
</PageShell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ server {
|
|||||||
client_max_body_size 50m;
|
client_max_body_size 50m;
|
||||||
|
|
||||||
include /opt/dukang-staging/deploy/nginx-mp-verify-staging.conf;
|
include /opt/dukang-staging/deploy/nginx-mp-verify-staging.conf;
|
||||||
|
include /opt/dukang-staging/deploy/nginx-no-crawler.conf;
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://127.0.0.1:8190;
|
proxy_pass http://127.0.0.1:8190;
|
||||||
@@ -142,6 +143,7 @@ server {
|
|||||||
client_max_body_size 50m;
|
client_max_body_size 50m;
|
||||||
|
|
||||||
include /opt/dukang-staging/deploy/nginx-mp-verify-staging.conf;
|
include /opt/dukang-staging/deploy/nginx-mp-verify-staging.conf;
|
||||||
|
include /opt/dukang-staging/deploy/nginx-no-crawler.conf;
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://127.0.0.1:8190;
|
proxy_pass http://127.0.0.1:8190;
|
||||||
@@ -179,6 +181,8 @@ server {
|
|||||||
|
|
||||||
client_max_body_size 50m;
|
client_max_body_size 50m;
|
||||||
|
|
||||||
|
include /opt/dukang-staging/deploy/nginx-no-crawler.conf;
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://127.0.0.1:8190;
|
proxy_pass http://127.0.0.1:8190;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ server {
|
|||||||
client_max_body_size 50m;
|
client_max_body_size 50m;
|
||||||
|
|
||||||
include /opt/dukang/deploy/nginx-mp-verify.conf;
|
include /opt/dukang/deploy/nginx-mp-verify.conf;
|
||||||
|
include /opt/dukang/deploy/nginx-no-crawler.conf;
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://127.0.0.1:8090;
|
proxy_pass http://127.0.0.1:8090;
|
||||||
@@ -132,6 +133,7 @@ server {
|
|||||||
client_max_body_size 50m;
|
client_max_body_size 50m;
|
||||||
|
|
||||||
include /opt/dukang/deploy/nginx-mp-verify.conf;
|
include /opt/dukang/deploy/nginx-mp-verify.conf;
|
||||||
|
include /opt/dukang/deploy/nginx-no-crawler.conf;
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://127.0.0.1:8090;
|
proxy_pass http://127.0.0.1:8090;
|
||||||
@@ -169,6 +171,8 @@ server {
|
|||||||
|
|
||||||
client_max_body_size 50m;
|
client_max_body_size 50m;
|
||||||
|
|
||||||
|
include /opt/dukang/deploy/nginx-no-crawler.conf;
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://127.0.0.1:8090;
|
proxy_pass http://127.0.0.1:8090;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# 禁止搜索引擎抓取(shop / partner / admin,含测试域)
|
||||||
|
# 合规爬虫读 robots.txt;X-Robots-Tag 覆盖不先读 robots.txt 的抓取器
|
||||||
|
|
||||||
|
add_header X-Robots-Tag "noindex, nofollow, noarchive" always;
|
||||||
|
|
||||||
|
location = /robots.txt {
|
||||||
|
default_type text/plain;
|
||||||
|
charset utf-8;
|
||||||
|
add_header X-Robots-Tag "noindex, nofollow, noarchive" always;
|
||||||
|
return 200 "User-agent: *\nDisallow: /\n";
|
||||||
|
}
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
# 杜康好客 · V3.0 PRD
|
# 杜康好客 · V3.0 PRD
|
||||||
|
|
||||||
> **v3.0**(2026-07-10)· 3.x 产品事实源 · 冲突时 **V3 > V2**
|
> **v3.0**(2026-07-10)· 3.x 产品事实源 · 冲突时 **V3 > V2**
|
||||||
> **4.0 起**(关联码 / 订单佣金归属 / 合伙人账单明细)见 [`杜康好客-v4-PRD.md`](./杜康好客-v4-PRD.md),冲突时 **V4 > V3**。
|
> **4.0 起**(关联码 / 订单佣金归属 / 合伙人账单明细 / 活动图)见 [`杜康好客-v4-PRD.md`](./杜康好客-v4-PRD.md),冲突时 **V4 > V3**。
|
||||||
> 实现:[`v3编码手册`](./杜康好客-v3编码手册.md) · 审计:[`v3-现状对照`](./杜康好客-v3-现状对照.md)
|
> 实现:[`v3编码手册`](./杜康好客-v3编码手册.md) · 审计:[`v3-现状对照`](./杜康好客-v3-现状对照.md)
|
||||||
|
|
||||||
## 0. 说明
|
## 0. 说明
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
**HQ 财务打款信息**(`admin-web` 财务四页,v3.5.6):
|
**HQ 财务打款信息**(`admin-web` 财务四页,v3.5.6):
|
||||||
|
|
||||||
- 门店/合伙人/酒厂/物流账单列表、详情、导出展示收款账户(户名、账号、开户行)
|
- 门店/合伙人/酒厂/物流账单列表、详情、导出展示收款账户(户名、账号、开户行)
|
||||||
- 确认打款时可填写打款凭证号(`paymentRef`),已打款后在详情与导出中展示
|
- 确认打款时可填写打款凭证号(`paymentRef`),并可上传凭证照片(`paymentProofUrls`,最多 9 张);已打款后在详情与导出中展示
|
||||||
- 门店账单统一列表:T+1 终态「已打款」、手动提现终态「已结算」(均为 `PAID`,文案区分业务类型)
|
- 门店账单统一列表:T+1 终态「已打款」、手动提现终态「已结算」(均为 `PAID`,文案区分业务类型)
|
||||||
- 门店 T+1「出账日」= 出账当天(核销窗口「昨日 00:00–今日 00:00」中的今天)
|
- 门店 T+1「出账日」= 出账当天(核销窗口「昨日 00:00–今日 00:00」中的今天)
|
||||||
- 核销详情展示核销门店主账户收款信息
|
- 核销详情展示核销门店主账户收款信息
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
|
|
||||||
| 日期 | 说明 |
|
| 日期 | 说明 |
|
||||||
|------|------|
|
|------|------|
|
||||||
|
| 2026-08-30 | HQ 门店账单确认打款支持上传凭证照片(`payment_proof_urls`) |
|
||||||
| 2026-08-26 | v3.5.14:`order_submit`/`pay_success` 埋点改用真实 `clientApp`;线上这两类 `USER_H5` 回填为 `USER_MINI` |
|
| 2026-08-26 | v3.5.14:`order_submit`/`pay_success` 埋点改用真实 `clientApp`;线上这两类 `USER_H5` 回填为 `USER_MINI` |
|
||||||
| 2026-08-26 | v3.5.12:订单大屏循环 BGM;HQ 日志/订单状态流转/用户行为时间线英文码改中文;修复删除门店分类后被 `ensureDefaults` 回种;HQ 侧栏按业务前 11 项重排、系统设置置底 |
|
| 2026-08-26 | v3.5.12:订单大屏循环 BGM;HQ 日志/订单状态流转/用户行为时间线英文码改中文;修复删除门店分类后被 `ensureDefaults` 回种;HQ 侧栏按业务前 11 项重排、系统设置置底 |
|
||||||
| 2026-08-26 | v3.5.11:城市三种履约起购;企微补提交人/订单规格物流收货/核销用户(昵称+明文手机+HQ备注);`alert.settlement` 改名「结算任务失败通知」归入系统监控;补提现通过与四账单(城市/合伙人、笔数、累计金额、收款人账号开户行) |
|
| 2026-08-26 | v3.5.11:城市三种履约起购;企微补提交人/订单规格物流收货/核销用户(昵称+明文手机+HQ备注);`alert.settlement` 改名「结算任务失败通知」归入系统监控;补提现通过与四账单(城市/合伙人、笔数、累计金额、收款人账号开户行) |
|
||||||
|
|||||||
+5
-1
@@ -1,7 +1,7 @@
|
|||||||
# 杜康好客 · V3 编码手册(交付业务版)
|
# 杜康好客 · V3 编码手册(交付业务版)
|
||||||
|
|
||||||
> **事实源**:[`杜康好客-v3-PRD.md`](./杜康好客-v3-PRD.md) · **审计**:[`杜康好客-v3-现状对照.md`](./杜康好客-v3-现状对照.md)
|
> **事实源**:[`杜康好客-v3-PRD.md`](./杜康好客-v3-PRD.md) · **审计**:[`杜康好客-v3-现状对照.md`](./杜康好客-v3-现状对照.md)
|
||||||
> **佣金归属 / 关联码 / 合伙人账单明细(v4.0.1)**:[`杜康好客-v4-PRD.md`](./杜康好客-v4-PRD.md),冲突时 **V4 > V3**。
|
> **佣金归属 / 关联码 / 合伙人账单明细(v4.0.1)· 活动图(v4.0.2)**:[`杜康好客-v4-PRD.md`](./杜康好客-v4-PRD.md),冲突时 **V4 > V3**。
|
||||||
> V2/preV1 **非需求依据**。总部交付 = **`apps/admin-web`**(非 H5)。
|
> V2/preV1 **非需求依据**。总部交付 = **`apps/admin-web`**(非 H5)。
|
||||||
|
|
||||||
## 1. 交付目标(六条)
|
## 1. 交付目标(六条)
|
||||||
@@ -54,6 +54,10 @@ C 端购酒核销 · 门店扫码核销+打款 · 合伙人拓店履约 · WebAd
|
|||||||
|
|
||||||
**用户日志端(v3.5.14)**:`order_submit` / `pay_success` 的 `clientApp` 取 JWT(小程序 `USER_MINI`);微信支付回调沿用该订单已有埋点,缺省小程序。禁止再写死 `USER_H5`。
|
**用户日志端(v3.5.14)**:`order_submit` / `pay_success` 的 `clientApp` 取 JWT(小程序 `USER_MINI`);微信支付回调沿用该订单已有埋点,缺省小程序。禁止再写死 `USER_H5`。
|
||||||
|
|
||||||
|
**HQ 门店账单打款凭证**:确认打款 / 提现通过可填 `paymentRef`,并可上传照片(`paymentProofUrls`,OSS `PAYMENT_PROOF`,最多 9 张)。详情与 T+1 导出展示。
|
||||||
|
|
||||||
|
**活动图(v4.0.2)**:规则见 v4-PRD §6。表 `activity_poster`;HQ `GET/POST/PUT/DELETE /admin/activity-posters`(权限 `activity_posters`);合伙人 `GET /partner/activity-posters` · `GET/PUT /partner/activity-posters/selection`(写入 `partner_account.activity_poster_id`)· `GET /partner/activity-posters/:id/image`(合成本人关联码)。`GET /partner/assoc` 返回 `activityPosterId`。码栏百分比相对图宽。子账号无入口。
|
||||||
|
|
||||||
**合伙人关联与订单佣金(v4.0.1)**:规则见 v4-PRD。`user_user.assoc_partner_account_id` 首次扫码锁定;`user_order.partner_account_id_at_pay` 仅关联或代下单显式选择写入(禁止区县解析)。`partner_bill_item` 分酒单 / 核销两段。合伙人备注独立表 `partner_user_note`(勿写 `hq_remark`)。`POST /user/partner-assoc/bind` · `GET /partner/assoc` · `GET /partner/assoc/stats`(关联用户 / 当前关联用户已付购酒单,本日/本月)· `GET /partner/assoc/users?keyword&sort`(合伙人侧返回 `partnerRemark`,不返回 `hqRemark`)· `GET /partner/assoc/users/:userId/orders` · `GET /partner/assoc/orders` · `PUT /partner/assoc/users/:userId/remark` · HQ `GET /admin/users` 支持 `keyword`、`assocPartnerAccountId`(`none` / `any` / 主账号 ID)· `GET /admin/orders` 支持 `assocPartnerAccountId`(筛本单快照,`none`=无快照)· `PUT /admin/users/:id/assoc`(权限 `users_partner_assoc`)改绑/解绑 · 开城合伙人关联用户快链 `/users?assocPartnerAccountId=` · `PUT /admin/partners/:id` 改费率用 `Decimal(toFixed(4))`。
|
**合伙人关联与订单佣金(v4.0.1)**:规则见 v4-PRD。`user_user.assoc_partner_account_id` 首次扫码锁定;`user_order.partner_account_id_at_pay` 仅关联或代下单显式选择写入(禁止区县解析)。`partner_bill_item` 分酒单 / 核销两段。合伙人备注独立表 `partner_user_note`(勿写 `hq_remark`)。`POST /user/partner-assoc/bind` · `GET /partner/assoc` · `GET /partner/assoc/stats`(关联用户 / 当前关联用户已付购酒单,本日/本月)· `GET /partner/assoc/users?keyword&sort`(合伙人侧返回 `partnerRemark`,不返回 `hqRemark`)· `GET /partner/assoc/users/:userId/orders` · `GET /partner/assoc/orders` · `PUT /partner/assoc/users/:userId/remark` · HQ `GET /admin/users` 支持 `keyword`、`assocPartnerAccountId`(`none` / `any` / 主账号 ID)· `GET /admin/orders` 支持 `assocPartnerAccountId`(筛本单快照,`none`=无快照)· `PUT /admin/users/:id/assoc`(权限 `users_partner_assoc`)改绑/解绑 · 开城合伙人关联用户快链 `/users?assocPartnerAccountId=` · `PUT /admin/partners/:id` 改费率用 `Decimal(toFixed(4))`。
|
||||||
|
|
||||||
## 5. 验收用例(必过)
|
## 5. 验收用例(必过)
|
||||||
|
|||||||
+16
-4
@@ -1,14 +1,15 @@
|
|||||||
# 杜康好客 · V4 PRD
|
# 杜康好客 · V4 PRD
|
||||||
|
|
||||||
> **v4.0**(2026-08-29)· 关联码与分佣事实源
|
> **v4.0**(2026-08-29)· 关联码与分佣事实源
|
||||||
> 未改规则仍见 [`杜康好客-v3-PRD.md`](./杜康好客-v3-PRD.md)。**冲突时 V4 > V3**(仅本主题:订单佣金归属、关联码、合伙人账单明细)。
|
> 未改规则仍见 [`杜康好客-v3-PRD.md`](./杜康好客-v3-PRD.md)。**冲突时 V4 > V3**(本主题:订单佣金归属、关联码、合伙人账单明细、活动图)。
|
||||||
> 实现:[`v4.0.1 开发文档`](./杜康好客-v4.0.1-开发文档.md) · 审计:[`v4-现状对照`](./杜康好客-v4-现状对照.md)
|
> 实现:[`v4.0.1 开发文档`](./杜康好客-v4.0.1-开发文档.md) · [`v4.0.2 开发文档`](./杜康好客-v4.0.2-开发文档.md) · 审计:[`v4-现状对照`](./杜康好客-v4-现状对照.md)
|
||||||
|
|
||||||
## 0. 版本
|
## 0. 版本
|
||||||
|
|
||||||
| 版 | 日期 | 要点 | 开发文档 |
|
| 版 | 日期 | 要点 | 开发文档 |
|
||||||
|----|------|------|----------|
|
|----|------|------|----------|
|
||||||
| 4.0.1 | 08-29 / 08-30 | 合伙人关联码;订单佣金只认关联;账单酒单/核销分列;去掉区县酒单佣金;HQ 关联筛选与快链;合伙人 H5 用户管理与首页统计 | [`v4.0.1`](./杜康好客-v4.0.1-开发文档.md) |
|
| 4.0.1 | 08-29 / 08-30 | 合伙人关联码;订单佣金只认关联;账单酒单/核销分列;去掉区县酒单佣金;HQ 关联筛选与快链;合伙人 H5 用户管理与首页统计 | [`v4.0.1`](./杜康好客-v4.0.1-开发文档.md) |
|
||||||
|
| 4.0.2 | 08-30 | HQ 活动图模板(底图 + 方形码栏 + 文案);合伙人下载合成关联码;所选图写入库并作为用户管理主图 | [`v4.0.2`](./杜康好客-v4.0.2-开发文档.md) |
|
||||||
|
|
||||||
## 1. 锚点(沿用 V3,佣金归属改写)
|
## 1. 锚点(沿用 V3,佣金归属改写)
|
||||||
|
|
||||||
@@ -63,6 +64,17 @@
|
|||||||
|
|
||||||
HQ 财务详情与合伙人确认页均展示两段列表。不再「无快照则全城已付单 × 当前费率」。
|
HQ 财务详情与合伙人确认页均展示两段列表。不再「无快照则全城已付单 × 当前费率」。
|
||||||
|
|
||||||
## 6. 不做
|
## 6. 活动图
|
||||||
|
|
||||||
改推广码体系;改核销归属;子账号自己的码;回刷已打款账单;区县佣金双轨。
|
- 一套活动图 = 底图 + 方形码栏(相对坐标)+ 标题 + 推广文案 + 排序 + 上架状态。文案由 HQ 手填,不自动生成。
|
||||||
|
- 码栏用相对百分比存储,与底图像素无关:`qrXPct` / `qrYPct` 为左上角,`qrSizePct` 为边长(相对**图宽**,保证正方形)。HQ 上传后在预览图上拖拽定位、拉角改尺寸。
|
||||||
|
- 合入的码固定为 **主合伙人关联码**(v4.0.1,`getwxacodeunlimit`,scene=`pa_{partnerId}`)。不复用推广码。
|
||||||
|
- 合伙人 H5(仅主账号)可浏览已上架活动图、一键复制文案、下载合成图。下载时服务端把本人关联码 PNG 贴进码栏后返回整图。
|
||||||
|
- 列表第一项「无」= 只用关联码。单选立即写入 `partner_account.activity_poster_id`(空=无);用户管理主图按该选择展示,下次登录仍有效。下架/删除后回退为关联码。
|
||||||
|
- 微信内下载失败则预览 + 长按保存(与关联码下载一致)。
|
||||||
|
- 合伙人只看 `ACTIVE`;下架后列表不再出现。无关联码则不可下载并明确报错。
|
||||||
|
- HQ 持权限 `activity_posters`(默认超管 + 运营)可增删改、上下架。
|
||||||
|
|
||||||
|
## 7. 不做
|
||||||
|
|
||||||
|
改推广码体系;改核销归属;子账号自己的码;回刷已打款账单;区县佣金双轨;AI 出图/出文案;C 端/门店端活动图;预生成每人缓存图。
|
||||||
|
|||||||
@@ -3,22 +3,25 @@
|
|||||||
> 基准:[`杜康好客-v4-PRD.md`](./杜康好客-v4-PRD.md)
|
> 基准:[`杜康好客-v4-PRD.md`](./杜康好客-v4-PRD.md)
|
||||||
> V3 进度仍见 [`杜康好客-v3-现状对照.md`](./杜康好客-v3-现状对照.md),不混表。
|
> V3 进度仍见 [`杜康好客-v3-现状对照.md`](./杜康好客-v3-现状对照.md),不混表。
|
||||||
|
|
||||||
## 0. 总览(2026-08-29)
|
## 0. 总览(2026-08-30)
|
||||||
|
|
||||||
| 维度 | 结论 |
|
| 维度 | 结论 |
|
||||||
|------|------|
|
|------|------|
|
||||||
| 版本线 | **v4.0.1** 关联码 + 分佣账单 |
|
| 版本线 | **v4.0.2** 活动图模板 + 关联码合成 |
|
||||||
| 订单佣金 | 区县归属已删除;只认关联 / 代下单选择 |
|
| 订单佣金 | 区县归属已删除;只认关联 / 代下单选择 |
|
||||||
| 账单 | 酒订单 / 核销订单分列 |
|
| 账单 | 酒订单 / 核销订单分列 |
|
||||||
|
| 活动图 | HQ 上传底图/码栏/文案;合伙人选择写入库;用户管理主图跟选择走 |
|
||||||
|
|
||||||
## 1. 版本交付
|
## 1. 版本交付
|
||||||
|
|
||||||
| 版本 | 文档 | 状态 |
|
| 版本 | 文档 | 状态 |
|
||||||
|------|------|------|
|
|------|------|------|
|
||||||
| 4.0.1 | [`关联码与分佣账单`](./杜康好客-v4.0.1-开发文档.md) | ✅ 已实现 |
|
| 4.0.1 | [`关联码与分佣账单`](./杜康好客-v4.0.1-开发文档.md) | ✅ 已实现 |
|
||||||
|
| 4.0.2 | [`活动图模板与关联码合成`](./杜康好客-v4.0.2-开发文档.md) | ✅ 已实现 |
|
||||||
|
|
||||||
| 日期 | 说明 |
|
| 日期 | 说明 |
|
||||||
|------|------|
|
|------|------|
|
||||||
| 2026-08-29 | v4.0.1:合伙人关联码、订单佣金只认关联、账单两段明细、去掉区县酒单佣金、HQ 改费率修复 |
|
| 2026-08-29 | v4.0.1:合伙人关联码、订单佣金只认关联、账单两段明细、去掉区县酒单佣金、HQ 改费率修复 |
|
||||||
| 2026-08-30 | HQ 订单/用户详情展示关联合伙人;改绑权限 `users_partner_assoc`;用户/订单筛选关联合伙人;开城关联用户快链 |
|
| 2026-08-30 | HQ 订单/用户详情展示关联合伙人;改绑权限 `users_partner_assoc`;用户/订单筛选关联合伙人;开城关联用户快链 |
|
||||||
| 2026-08-30 | 合伙人 H5:首页关联用户/关联用户订单统计;用户管理 Tab(关联码+列表+备注);`partner_user_note` 与 HQ `hqRemark` 隔离 |
|
| 2026-08-30 | 合伙人 H5:首页关联用户/关联用户订单统计;用户管理 Tab(关联码+列表+备注);`partner_user_note` 与 HQ `hqRemark` 隔离 |
|
||||||
|
| 2026-08-30 | v4.0.2:HQ 活动图(底图 + 拖拽码栏 + 文案);合伙人复制文案、下载合成关联码;选择写入库,用户管理主图下次登录仍显示 |
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# 杜康好客 · v4.0.2 开发文档
|
||||||
|
|
||||||
|
> **2026-08-30** · ops / common / store / admin-web / h5-partner
|
||||||
|
> **主题**:HQ 活动图模板(底图 + 方形码栏 + 文案);合伙人下载时合成本人关联码;所选图写入库并作为用户管理主图
|
||||||
|
|
||||||
|
需求事实源:[`杜康好客-v4-PRD.md`](./杜康好客-v4-PRD.md) §6
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. 版本目标
|
||||||
|
|
||||||
|
| # | 任务 | 类型 | 交付 |
|
||||||
|
|---|------|------|------|
|
||||||
|
| 1 | HQ 活动图管理 | 需求 | 上传底图、拖拽方形码栏、手填文案、排序、上下架、删除 |
|
||||||
|
| 2 | 合伙人下载 | 需求 | 主账号列表已上架图;复制文案;服务端把关联码贴进码栏后返回 PNG |
|
||||||
|
| 3 | 微信保存 | 需求 | 下载失败则预览 + 长按保存(复用关联码下载) |
|
||||||
|
| 4 | 选择持久化 | 需求 | 单选立即写入 `partner_account.activity_poster_id`;用户管理主图跟选择走,下次登录仍显示 |
|
||||||
|
|
||||||
|
**不做**:AI 出图/出文案;子账号码;C 端/门店端;预生成每人缓存图。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 规则
|
||||||
|
|
||||||
|
见 v4-PRD §6。码栏百分比相对图宽;合入码 = 主合伙人关联码。列表第一项「无」= 只用关联码。下架/删除后回退为关联码。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. 变更面
|
||||||
|
|
||||||
|
- 表 [`activity_poster`](../server/dukang-api/prisma/schema.prisma);SQL [`migrate-activity-poster-v402.sql`](../server/dukang-api/prisma/migrate-activity-poster-v402.sql) · [`migrate-partner-activity-poster-pref-v402.sql`](../server/dukang-api/prisma/migrate-partner-activity-poster-pref-v402.sql)
|
||||||
|
- `ResourceBizType` 增 `ACTIVITY_POSTER`
|
||||||
|
- HQ:`/admin/activity-posters` CRUD + 状态;权限 `activity_posters`(超管全量;运营默认含此项,存量 OPS 角色需执行 SQL 或在权限分配中勾选)
|
||||||
|
- 合伙人:`GET /partner/activity-posters` · `GET/PUT /partner/activity-posters/selection` · `GET /partner/activity-posters/:id/image`
|
||||||
|
- `partner_account.activity_poster_id` 记所选活动图;`GET /partner/assoc` 返回 `activityPosterId`
|
||||||
|
- admin-web:`/activity-posters` 列表 + 拖拽码栏编辑器
|
||||||
|
- h5-partner:中心 / 用户管理入口 → `/center/activity-posters`;用户管理主图按选择展示合成图或关联码
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 验收
|
||||||
|
|
||||||
|
- HQ 上传后可拖出方形栏并保存;改位置/尺寸后合伙人下载落点一致
|
||||||
|
- 文案保存后合伙人可一键复制
|
||||||
|
- 下架图不出现在合伙人列表
|
||||||
|
- 合成图为本人关联码;无码时明确报错
|
||||||
|
- 浏览器可下载 PNG;微信内可长按保存
|
||||||
|
- 子账号无入口
|
||||||
|
- 合伙人单选活动图后立即写入 `partner_account.activity_poster_id`;用户管理主图跟选择走,重新登录仍显示
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { activityPosterQrSlotPx } from './activity-poster';
|
||||||
|
|
||||||
|
describe('activityPosterQrSlotPx', () => {
|
||||||
|
it('uses width for square size', () => {
|
||||||
|
expect(activityPosterQrSlotPx(1000, 2000, 10, 20, 18)).toEqual({
|
||||||
|
left: 100,
|
||||||
|
top: 400,
|
||||||
|
size: 180,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('clamps slot inside the canvas', () => {
|
||||||
|
expect(activityPosterQrSlotPx(100, 80, 90, 90, 30)).toEqual({
|
||||||
|
left: 70,
|
||||||
|
top: 50,
|
||||||
|
size: 30,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
export const ACTIVITY_POSTER_STATUSES = ['ACTIVE', 'DISABLED'] as const;
|
||||||
|
export type ActivityPosterStatus = (typeof ACTIVITY_POSTER_STATUSES)[number];
|
||||||
|
|
||||||
|
export const ACTIVITY_POSTER_STATUS_LABELS: Record<ActivityPosterStatus, string> = {
|
||||||
|
ACTIVE: '上架',
|
||||||
|
DISABLED: '下架',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DEFAULT_ACTIVITY_POSTER_QR_SLOT = {
|
||||||
|
qrXPct: 78,
|
||||||
|
qrYPct: 78,
|
||||||
|
qrSizePct: 18,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ActivityPosterQrSlot = {
|
||||||
|
qrXPct: number;
|
||||||
|
qrYPct: number;
|
||||||
|
qrSizePct: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ActivityPosterItem = {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
copyText: string;
|
||||||
|
imageUrl: string;
|
||||||
|
qrXPct: number;
|
||||||
|
qrYPct: number;
|
||||||
|
qrSizePct: number;
|
||||||
|
sortOrder: number;
|
||||||
|
status: ActivityPosterStatus;
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ActivityPosterUpsertRequest = {
|
||||||
|
title: string;
|
||||||
|
copyText?: string;
|
||||||
|
imageUrl: string;
|
||||||
|
qrXPct: number;
|
||||||
|
qrYPct: number;
|
||||||
|
qrSizePct: number;
|
||||||
|
sortOrder?: number;
|
||||||
|
status?: ActivityPosterStatus;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ActivityPosterStatusRequest = {
|
||||||
|
status: ActivityPosterStatus;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ActivityPosterSelection = {
|
||||||
|
posterId: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ActivityPosterSelectionRequest = {
|
||||||
|
posterId?: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 码栏百分比 → 像素。size 相对图宽,保证正方形;落点夹在画布内。 */
|
||||||
|
export function activityPosterQrSlotPx(
|
||||||
|
width: number,
|
||||||
|
height: number,
|
||||||
|
qrXPct: number,
|
||||||
|
qrYPct: number,
|
||||||
|
qrSizePct: number,
|
||||||
|
): { left: number; top: number; size: number } {
|
||||||
|
const w = Math.max(1, Math.round(width));
|
||||||
|
const h = Math.max(1, Math.round(height));
|
||||||
|
const size = Math.max(1, Math.min(w, Math.round((qrSizePct / 100) * w)));
|
||||||
|
const left = Math.max(0, Math.min(w - size, Math.round((qrXPct / 100) * w)));
|
||||||
|
const top = Math.max(0, Math.min(h - size, Math.round((qrYPct / 100) * h)));
|
||||||
|
return { left, top, size };
|
||||||
|
}
|
||||||
@@ -54,16 +54,13 @@ export const BRAND_LOGO_MARK_URL = `${BRAND_LOGO_OSS_BASE}logo2.png`;
|
|||||||
|
|
||||||
/** 小程序静态资源根路径(默认;系统设置 MINI_USER_STATIC_OSS_BASE 可覆盖) */
|
/** 小程序静态资源根路径(默认;系统设置 MINI_USER_STATIC_OSS_BASE 可覆盖) */
|
||||||
export const MINI_USER_STATIC_OSS_BASE =
|
export const MINI_USER_STATIC_OSS_BASE =
|
||||||
'https://dukang-dev.oss-cn-beijing.aliyuncs.com/static/mini-user/';
|
'https://dukang-prod.oss-cn-hangzhou.aliyuncs.com/static/mini-user/';
|
||||||
|
|
||||||
/** 「我的」页资质公示长图(默认;系统设置 QUALIFICATION_DISCLOSURE_URL 可覆盖) */
|
/** 「我的」页资质公示长图(默认;系统设置 QUALIFICATION_DISCLOSURE_URL 可覆盖) */
|
||||||
export const QUALIFICATION_DISCLOSURE_URL = `${MINI_USER_STATIC_OSS_BASE}qualification-disclosure.png`;
|
export const QUALIFICATION_DISCLOSURE_URL = `${MINI_USER_STATIC_OSS_BASE}qualification-disclosure.png`;
|
||||||
|
|
||||||
/** 小程序开场金龙 GIF(冷启动;不进主包,走 OSS) */
|
/** 首页开场酒瓶图(不进主包,走 OSS) */
|
||||||
export const JIUZU_SPLASH_GIF_URL = `${MINI_USER_STATIC_OSS_BASE}jiuzu-dragon.gif`;
|
export const HOME_SPLASH_BOTTLE_URL = `${MINI_USER_STATIC_OSS_BASE}home-splash-bottle.png`;
|
||||||
|
|
||||||
/** 小程序开场酒祖印记图(冷启动;不进主包,走 OSS) */
|
|
||||||
export const JIUZU_SPLASH_MARK_URL = `${MINI_USER_STATIC_OSS_BASE}jiuzu-dragon-mark.png`;
|
|
||||||
|
|
||||||
/** 总部客服电话(默认;系统设置 CUSTOMER_SERVICE_PHONE 可覆盖) */
|
/** 总部客服电话(默认;系统设置 CUSTOMER_SERVICE_PHONE 可覆盖) */
|
||||||
export const CUSTOMER_SERVICE_PHONE = '13203801799';
|
export const CUSTOMER_SERVICE_PHONE = '13203801799';
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export const HQ_LIST_COLUMN_KEYS = [
|
|||||||
'orders',
|
'orders',
|
||||||
'promo-codes',
|
'promo-codes',
|
||||||
'promo-code-users',
|
'promo-code-users',
|
||||||
|
'activity-posters',
|
||||||
'wecom-bots',
|
'wecom-bots',
|
||||||
'wecom-pushes',
|
'wecom-pushes',
|
||||||
'llm-configs',
|
'llm-configs',
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export const HQ_PERMISSION_CATALOG = [
|
|||||||
{ key: 'products', label: '商品管理', group: '业务' },
|
{ key: 'products', label: '商品管理', group: '业务' },
|
||||||
{ key: 'orders', label: '订单管理', group: '业务' },
|
{ key: 'orders', label: '订单管理', group: '业务' },
|
||||||
{ key: 'promo_codes', label: '推广码', group: '业务' },
|
{ key: 'promo_codes', label: '推广码', group: '业务' },
|
||||||
|
{ key: 'activity_posters', label: '活动图', group: '业务' },
|
||||||
{ key: 'stores', label: '门店列表', group: '业务' },
|
{ key: 'stores', label: '门店列表', group: '业务' },
|
||||||
{ key: 'store_audits', label: '门店审核', group: '业务' },
|
{ key: 'store_audits', label: '门店审核', group: '业务' },
|
||||||
{ key: 'store_ratings', label: '门店评价', group: '业务' },
|
{ key: 'store_ratings', label: '门店评价', group: '业务' },
|
||||||
@@ -178,6 +179,7 @@ export const HQ_ROLE_DEFAULT_PERMISSIONS: Record<HqAdminRoleValue, HqPermissionK
|
|||||||
'products',
|
'products',
|
||||||
'orders',
|
'orders',
|
||||||
'promo_codes',
|
'promo_codes',
|
||||||
|
'activity_posters',
|
||||||
...OPS_STORE_KEYS,
|
...OPS_STORE_KEYS,
|
||||||
'store_categories_delete',
|
'store_categories_delete',
|
||||||
'partners',
|
'partners',
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export * from './hq-permissions';
|
|||||||
export * from './hq-list-columns';
|
export * from './hq-list-columns';
|
||||||
export * from './partner';
|
export * from './partner';
|
||||||
export * from './partner-assoc';
|
export * from './partner-assoc';
|
||||||
|
export * from './activity-poster';
|
||||||
export * from './shop';
|
export * from './shop';
|
||||||
export * from './city-partner';
|
export * from './city-partner';
|
||||||
export * from './city-warehouse';
|
export * from './city-warehouse';
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ export type PartnerAssocSummary = {
|
|||||||
userCount: number;
|
userCount: number;
|
||||||
companyName?: string | null;
|
companyName?: string | null;
|
||||||
name: string;
|
name: string;
|
||||||
|
/** 所选活动图;空表示用户管理主图只用关联码 */
|
||||||
|
activityPosterId?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PartnerAssocStats = {
|
export type PartnerAssocStats = {
|
||||||
|
|||||||
@@ -66,6 +66,14 @@ export interface StoreWithdrawSummaryDto {
|
|||||||
bankAccount?: StoreWithdrawBankAccountDto | null;
|
bankAccount?: StoreWithdrawBankAccountDto | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 确认打款 / 提现通过时可附带的凭证照片上限 */
|
||||||
|
export const PAYMENT_PROOF_IMAGE_MAX_COUNT = 9;
|
||||||
|
|
||||||
|
export interface ConfirmFinancePayDto {
|
||||||
|
paymentRef?: string;
|
||||||
|
paymentProofUrls?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface StoreWithdrawRequestDto {
|
export interface StoreWithdrawRequestDto {
|
||||||
id: string;
|
id: string;
|
||||||
withdrawNo: string;
|
withdrawNo: string;
|
||||||
@@ -78,6 +86,7 @@ export interface StoreWithdrawRequestDto {
|
|||||||
reviewedAt?: string | null;
|
reviewedAt?: string | null;
|
||||||
paidAt?: string | null;
|
paidAt?: string | null;
|
||||||
paymentRef?: string | null;
|
paymentRef?: string | null;
|
||||||
|
paymentProofUrls?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StorePayoutDto {
|
export interface StorePayoutDto {
|
||||||
@@ -171,6 +180,8 @@ export interface StoreBillDto {
|
|||||||
payoutAmount: number;
|
payoutAmount: number;
|
||||||
status: FinancePayStatus;
|
status: FinancePayStatus;
|
||||||
paidAt?: string | null;
|
paidAt?: string | null;
|
||||||
|
paymentRef?: string | null;
|
||||||
|
paymentProofUrls?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WineryBillDto {
|
export interface WineryBillDto {
|
||||||
|
|||||||
Generated
+296
-2
@@ -391,6 +391,9 @@ importers:
|
|||||||
rxjs:
|
rxjs:
|
||||||
specifier: ^7.8.1
|
specifier: ^7.8.1
|
||||||
version: 7.8.2
|
version: 7.8.2
|
||||||
|
sharp:
|
||||||
|
specifier: ^0.34.5
|
||||||
|
version: 0.34.5
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@nestjs/cli':
|
'@nestjs/cli':
|
||||||
specifier: ^10.4.0
|
specifier: ^10.4.0
|
||||||
@@ -1196,6 +1199,9 @@ packages:
|
|||||||
'@dual-bundle/import-meta-resolve@4.2.1':
|
'@dual-bundle/import-meta-resolve@4.2.1':
|
||||||
resolution: {integrity: sha512-id+7YRUgoUX6CgV0DtuhirQWodeeA7Lf4i2x71JS/vtA5pRb/hIGWlw+G6MeXvsM+MXrz0VAydTGElX1rAfgPg==}
|
resolution: {integrity: sha512-id+7YRUgoUX6CgV0DtuhirQWodeeA7Lf4i2x71JS/vtA5pRb/hIGWlw+G6MeXvsM+MXrz0VAydTGElX1rAfgPg==}
|
||||||
|
|
||||||
|
'@emnapi/runtime@1.11.3':
|
||||||
|
resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==}
|
||||||
|
|
||||||
'@emotion/hash@0.8.0':
|
'@emotion/hash@0.8.0':
|
||||||
resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==}
|
resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==}
|
||||||
|
|
||||||
@@ -1427,6 +1433,159 @@ packages:
|
|||||||
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
|
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
|
||||||
engines: {node: '>=18.18'}
|
engines: {node: '>=18.18'}
|
||||||
|
|
||||||
|
'@img/colour@1.1.0':
|
||||||
|
resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
|
'@img/sharp-darwin-arm64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@img/sharp-darwin-x64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-darwin-arm64@1.2.4':
|
||||||
|
resolution: {integrity: sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-darwin-x64@1.2.4':
|
||||||
|
resolution: {integrity: sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-arm64@1.2.4':
|
||||||
|
resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-arm@1.2.4':
|
||||||
|
resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-ppc64@1.2.4':
|
||||||
|
resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==}
|
||||||
|
cpu: [ppc64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-riscv64@1.2.4':
|
||||||
|
resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==}
|
||||||
|
cpu: [riscv64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-s390x@1.2.4':
|
||||||
|
resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==}
|
||||||
|
cpu: [s390x]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-x64@1.2.4':
|
||||||
|
resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linuxmusl-arm64@1.2.4':
|
||||||
|
resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linuxmusl-x64@1.2.4':
|
||||||
|
resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@img/sharp-linux-arm64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-linux-arm@0.34.5':
|
||||||
|
resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-linux-ppc64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [ppc64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-linux-riscv64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [riscv64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-linux-s390x@0.34.5':
|
||||||
|
resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [s390x]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-linux-x64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@img/sharp-linuxmusl-arm64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@img/sharp-linuxmusl-x64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@img/sharp-wasm32@0.34.5':
|
||||||
|
resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [wasm32]
|
||||||
|
|
||||||
|
'@img/sharp-win32-arm64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@img/sharp-win32-ia32@0.34.5':
|
||||||
|
resolution: {integrity: sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [ia32]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@img/sharp-win32-x64@0.34.5':
|
||||||
|
resolution: {integrity: sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
'@ioredis/commands@1.10.0':
|
'@ioredis/commands@1.10.0':
|
||||||
resolution: {integrity: sha512-UmeW7z4LfctwoQ5wkhVzgq8tXkreED2xZGpX+Bg+zA+WJFZCT6c062AfCK/Dfk81xZnnwdhJCUMkitihRaoC2Q==}
|
resolution: {integrity: sha512-UmeW7z4LfctwoQ5wkhVzgq8tXkreED2xZGpX+Bg+zA+WJFZCT6c062AfCK/Dfk81xZnnwdhJCUMkitihRaoC2Q==}
|
||||||
|
|
||||||
@@ -6072,6 +6231,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==}
|
resolution: {integrity: sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
|
sharp@0.34.5:
|
||||||
|
resolution: {integrity: sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==}
|
||||||
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
|
|
||||||
shebang-command@2.0.0:
|
shebang-command@2.0.0:
|
||||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@@ -8007,6 +8170,11 @@ snapshots:
|
|||||||
|
|
||||||
'@dual-bundle/import-meta-resolve@4.2.1': {}
|
'@dual-bundle/import-meta-resolve@4.2.1': {}
|
||||||
|
|
||||||
|
'@emnapi/runtime@1.11.3':
|
||||||
|
dependencies:
|
||||||
|
tslib: 2.8.1
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@emotion/hash@0.8.0': {}
|
'@emotion/hash@0.8.0': {}
|
||||||
|
|
||||||
'@emotion/unitless@0.7.5': {}
|
'@emotion/unitless@0.7.5': {}
|
||||||
@@ -8198,6 +8366,102 @@ snapshots:
|
|||||||
|
|
||||||
'@humanwhocodes/retry@0.4.3': {}
|
'@humanwhocodes/retry@0.4.3': {}
|
||||||
|
|
||||||
|
'@img/colour@1.1.0': {}
|
||||||
|
|
||||||
|
'@img/sharp-darwin-arm64@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-darwin-arm64': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-darwin-x64@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-darwin-x64': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-darwin-arm64@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-darwin-x64@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-arm64@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-arm@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-ppc64@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-riscv64@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-s390x@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linux-x64@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linuxmusl-arm64@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-libvips-linuxmusl-x64@1.2.4':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-linux-arm64@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-linux-arm64': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-linux-arm@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-linux-arm': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-linux-ppc64@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-linux-ppc64': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-linux-riscv64@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-linux-riscv64': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-linux-s390x@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-linux-s390x': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-linux-x64@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-linux-x64': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-linuxmusl-arm64@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-linuxmusl-arm64': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-linuxmusl-x64@0.34.5':
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-libvips-linuxmusl-x64': 1.2.4
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-wasm32@0.34.5':
|
||||||
|
dependencies:
|
||||||
|
'@emnapi/runtime': 1.11.3
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-win32-arm64@0.34.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-win32-ia32@0.34.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@img/sharp-win32-x64@0.34.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@ioredis/commands@1.10.0': {}
|
'@ioredis/commands@1.10.0': {}
|
||||||
|
|
||||||
'@ioredis/commands@1.5.1': {}
|
'@ioredis/commands@1.5.1': {}
|
||||||
@@ -10685,8 +10949,7 @@ snapshots:
|
|||||||
|
|
||||||
destroy@1.2.0: {}
|
destroy@1.2.0: {}
|
||||||
|
|
||||||
detect-libc@2.1.2:
|
detect-libc@2.1.2: {}
|
||||||
optional: true
|
|
||||||
|
|
||||||
dfa@1.2.0: {}
|
dfa@1.2.0: {}
|
||||||
|
|
||||||
@@ -13367,6 +13630,37 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
kind-of: 6.0.3
|
kind-of: 6.0.3
|
||||||
|
|
||||||
|
sharp@0.34.5:
|
||||||
|
dependencies:
|
||||||
|
'@img/colour': 1.1.0
|
||||||
|
detect-libc: 2.1.2
|
||||||
|
semver: 7.8.5
|
||||||
|
optionalDependencies:
|
||||||
|
'@img/sharp-darwin-arm64': 0.34.5
|
||||||
|
'@img/sharp-darwin-x64': 0.34.5
|
||||||
|
'@img/sharp-libvips-darwin-arm64': 1.2.4
|
||||||
|
'@img/sharp-libvips-darwin-x64': 1.2.4
|
||||||
|
'@img/sharp-libvips-linux-arm': 1.2.4
|
||||||
|
'@img/sharp-libvips-linux-arm64': 1.2.4
|
||||||
|
'@img/sharp-libvips-linux-ppc64': 1.2.4
|
||||||
|
'@img/sharp-libvips-linux-riscv64': 1.2.4
|
||||||
|
'@img/sharp-libvips-linux-s390x': 1.2.4
|
||||||
|
'@img/sharp-libvips-linux-x64': 1.2.4
|
||||||
|
'@img/sharp-libvips-linuxmusl-arm64': 1.2.4
|
||||||
|
'@img/sharp-libvips-linuxmusl-x64': 1.2.4
|
||||||
|
'@img/sharp-linux-arm': 0.34.5
|
||||||
|
'@img/sharp-linux-arm64': 0.34.5
|
||||||
|
'@img/sharp-linux-ppc64': 0.34.5
|
||||||
|
'@img/sharp-linux-riscv64': 0.34.5
|
||||||
|
'@img/sharp-linux-s390x': 0.34.5
|
||||||
|
'@img/sharp-linux-x64': 0.34.5
|
||||||
|
'@img/sharp-linuxmusl-arm64': 0.34.5
|
||||||
|
'@img/sharp-linuxmusl-x64': 0.34.5
|
||||||
|
'@img/sharp-wasm32': 0.34.5
|
||||||
|
'@img/sharp-win32-arm64': 0.34.5
|
||||||
|
'@img/sharp-win32-ia32': 0.34.5
|
||||||
|
'@img/sharp-win32-x64': 0.34.5
|
||||||
|
|
||||||
shebang-command@2.0.0:
|
shebang-command@2.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
shebang-regex: 3.0.0
|
shebang-regex: 3.0.0
|
||||||
|
|||||||
@@ -16,3 +16,4 @@ allowBuilds:
|
|||||||
esbuild: true
|
esbuild: true
|
||||||
msgpackr-extract: true
|
msgpackr-extract: true
|
||||||
prisma: true
|
prisma: true
|
||||||
|
sharp: true
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
/**
|
||||||
|
* 把本地文件上传到 OSS `static/mini-user/`(不进小程序主包)。
|
||||||
|
* 凭证优先读 system_config,其次 server/dukang-api/.env。
|
||||||
|
*
|
||||||
|
* 用法:node scripts/upload-mini-user-static.mjs <localFile> [objectName]
|
||||||
|
*/
|
||||||
|
import { readFileSync, existsSync } from 'node:fs';
|
||||||
|
import { basename, resolve, dirname } from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
import { createRequire } from 'node:module';
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const root = resolve(__dirname, '..');
|
||||||
|
const apiRoot = resolve(root, 'server/dukang-api');
|
||||||
|
const require = createRequire(resolve(apiRoot, 'package.json'));
|
||||||
|
const OSS = require('ali-oss');
|
||||||
|
const { PrismaClient } = require('@prisma/client');
|
||||||
|
|
||||||
|
function loadEnvFile(path) {
|
||||||
|
if (!existsSync(path)) return;
|
||||||
|
for (const line of readFileSync(path, 'utf8').split(/\r?\n/)) {
|
||||||
|
const trimmed = line.trim();
|
||||||
|
if (!trimmed || trimmed.startsWith('#')) continue;
|
||||||
|
const eq = trimmed.indexOf('=');
|
||||||
|
if (eq <= 0) continue;
|
||||||
|
const key = trimmed.slice(0, eq).trim();
|
||||||
|
let value = trimmed.slice(eq + 1).trim();
|
||||||
|
if (
|
||||||
|
(value.startsWith('"') && value.endsWith('"')) ||
|
||||||
|
(value.startsWith("'") && value.endsWith("'"))
|
||||||
|
) {
|
||||||
|
value = value.slice(1, -1);
|
||||||
|
}
|
||||||
|
if (process.env[key] === undefined) process.env[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadEnvFile(resolve(apiRoot, '.env'));
|
||||||
|
loadEnvFile(resolve(apiRoot, '.env.local'));
|
||||||
|
|
||||||
|
const localFile = process.argv[2];
|
||||||
|
if (!localFile) {
|
||||||
|
console.error('用法:node scripts/upload-mini-user-static.mjs <localFile> [objectName]');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const absFile = resolve(process.cwd(), localFile);
|
||||||
|
if (!existsSync(absFile)) {
|
||||||
|
console.error(`文件不存在:${absFile}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const objectName = process.argv[3] || basename(absFile);
|
||||||
|
const ossKey = `static/mini-user/${objectName.replace(/^\/+/, '')}`;
|
||||||
|
|
||||||
|
const prisma = new PrismaClient();
|
||||||
|
const rows = await prisma.systemConfig.findMany({
|
||||||
|
where: {
|
||||||
|
configKey: {
|
||||||
|
in: [
|
||||||
|
'OSS_ACCESS_KEY_ID',
|
||||||
|
'OSS_ACCESS_KEY_SECRET',
|
||||||
|
'OSS_BUCKET',
|
||||||
|
'OSS_REGION',
|
||||||
|
'OSS_ENDPOINT',
|
||||||
|
'OSS_CDN_BASE',
|
||||||
|
'OSS_AUTHORIZATION_V4',
|
||||||
|
'MINI_USER_STATIC_OSS_BASE',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await prisma.$disconnect();
|
||||||
|
|
||||||
|
for (const row of rows) {
|
||||||
|
if (row.value?.trim()) process.env[row.configKey] = row.value.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
const accessKeyId = process.env.OSS_ACCESS_KEY_ID ?? '';
|
||||||
|
const accessKeySecret = process.env.OSS_ACCESS_KEY_SECRET ?? '';
|
||||||
|
const bucket = process.env.OSS_BUCKET ?? '';
|
||||||
|
const region = process.env.OSS_REGION ?? 'oss-cn-hangzhou';
|
||||||
|
const endpoint = process.env.OSS_ENDPOINT ?? '';
|
||||||
|
const cdnBase = (process.env.OSS_CDN_BASE ?? '').replace(/\/$/, '');
|
||||||
|
const staticBase = (process.env.MINI_USER_STATIC_OSS_BASE ?? '').replace(/\/$/, '/');
|
||||||
|
|
||||||
|
if (!accessKeyId || !accessKeySecret || !bucket) {
|
||||||
|
console.error('OSS 未配置:请在 HQ 系统设置或 .env 填写 OSS_ACCESS_KEY_ID / SECRET / BUCKET');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const client = new OSS({
|
||||||
|
region,
|
||||||
|
accessKeyId,
|
||||||
|
accessKeySecret,
|
||||||
|
bucket,
|
||||||
|
...(endpoint ? { endpoint } : {}),
|
||||||
|
...(process.env.OSS_AUTHORIZATION_V4 === 'true' ? { authorizationV4: true } : {}),
|
||||||
|
});
|
||||||
|
|
||||||
|
const mime =
|
||||||
|
absFile.endsWith('.png')
|
||||||
|
? 'image/png'
|
||||||
|
: absFile.endsWith('.gif')
|
||||||
|
? 'image/gif'
|
||||||
|
: absFile.endsWith('.jpg') || absFile.endsWith('.jpeg')
|
||||||
|
? 'image/jpeg'
|
||||||
|
: 'application/octet-stream';
|
||||||
|
|
||||||
|
const result = await client.put(ossKey, absFile, {
|
||||||
|
mime,
|
||||||
|
headers: {
|
||||||
|
'Content-Disposition': 'inline',
|
||||||
|
'Cache-Control': 'public, max-age=31536000',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const publicUrl =
|
||||||
|
(staticBase ? `${staticBase}${objectName}` : '') ||
|
||||||
|
(cdnBase ? `${cdnBase}/${ossKey}` : result.url);
|
||||||
|
|
||||||
|
console.log(`uploaded bucket=${bucket} region=${region}`);
|
||||||
|
console.log(`key=${ossKey}`);
|
||||||
|
console.log(`url=${publicUrl}`);
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
| **benefit** | BenefitCoupon | jacy-dukang |
|
| **benefit** | BenefitCoupon | jacy-dukang |
|
||||||
| **redeem** | RedeemRecord, StoreRating | 刘景尧 |
|
| **redeem** | RedeemRecord, StoreRating | 刘景尧 |
|
||||||
| **settlement** | StorePayout, PartnerBill | jacy-dukang |
|
| **settlement** | StorePayout, PartnerBill | jacy-dukang |
|
||||||
| **ops** | 只读聚合 | jacy-dukang |
|
| **ops** | 只读聚合、ActivityPoster | jacy-dukang |
|
||||||
| **analytics** | LogUserAnalytics | jacy-dukang |
|
| **analytics** | LogUserAnalytics | jacy-dukang |
|
||||||
| **common** | CommonResource, CommonEvent, CommonTicket | jacy-dukang |
|
| **common** | CommonResource, CommonEvent, CommonTicket | jacy-dukang |
|
||||||
| **integrations** | 无表 | jacy-dukang |
|
| **integrations** | 无表 | jacy-dukang |
|
||||||
|
|||||||
@@ -54,7 +54,8 @@
|
|||||||
"pdfkit": "^0.19.1",
|
"pdfkit": "^0.19.1",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.2.2",
|
||||||
"rxjs": "^7.8.1"
|
"rxjs": "^7.8.1",
|
||||||
|
"sharp": "^0.34.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nestjs/cli": "^10.4.0",
|
"@nestjs/cli": "^10.4.0",
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
-- v4.0.2:活动图模板(底图 + 方形码栏 + 文案)
|
||||||
|
|
||||||
|
ALTER TABLE `common_resource`
|
||||||
|
MODIFY COLUMN `biz_type` ENUM(
|
||||||
|
'COVER',
|
||||||
|
'ENV',
|
||||||
|
'CONTRACT',
|
||||||
|
'CAROUSEL',
|
||||||
|
'DETAIL',
|
||||||
|
'AVATAR',
|
||||||
|
'QRCODE',
|
||||||
|
'SIGN_PHOTO',
|
||||||
|
'VIDEO',
|
||||||
|
'REDEEM_PENDING_PHOTO',
|
||||||
|
'ACTIVITY_POSTER'
|
||||||
|
) NOT NULL;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `activity_poster` (
|
||||||
|
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`title` VARCHAR(128) NOT NULL,
|
||||||
|
`copy_text` TEXT NOT NULL,
|
||||||
|
`image_url` VARCHAR(512) NOT NULL,
|
||||||
|
`qr_x_pct` DECIMAL(5,2) NOT NULL,
|
||||||
|
`qr_y_pct` DECIMAL(5,2) NOT NULL,
|
||||||
|
`qr_size_pct` DECIMAL(5,2) NOT NULL,
|
||||||
|
`sort_order` INT NOT NULL DEFAULT 0,
|
||||||
|
`status` VARCHAR(16) NOT NULL DEFAULT 'ACTIVE',
|
||||||
|
`created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||||
|
`updated_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_activity_poster_status_sort` (`status`, `sort_order`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='HQ 活动图模板';
|
||||||
|
|
||||||
|
INSERT IGNORE INTO `hq_role_permission` (`admin_role`, `permission_key`)
|
||||||
|
SELECT 'OPS', 'activity_posters'
|
||||||
|
FROM DUAL
|
||||||
|
WHERE EXISTS (SELECT 1 FROM `hq_role_permission` WHERE `admin_role` = 'OPS');
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
-- v4.0.2:主合伙人记住所选活动图(空=仅二维码)
|
||||||
|
|
||||||
|
ALTER TABLE `partner_account`
|
||||||
|
ADD COLUMN `activity_poster_id` BIGINT UNSIGNED DEFAULT NULL AFTER `assoc_qrcode_resource_id`,
|
||||||
|
ADD KEY `idx_partner_account_activity_poster` (`activity_poster_id`);
|
||||||
|
|
||||||
|
ALTER TABLE `partner_account`
|
||||||
|
ADD CONSTRAINT `fk_partner_account_activity_poster`
|
||||||
|
FOREIGN KEY (`activity_poster_id`) REFERENCES `activity_poster`(`id`) ON DELETE SET NULL;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
-- 门店账单 / 手动提现:确认打款凭证照片
|
||||||
|
ALTER TABLE `store_bill`
|
||||||
|
ADD COLUMN `payment_proof_urls` JSON NULL AFTER `payment_ref`;
|
||||||
|
ALTER TABLE `store_withdraw_request`
|
||||||
|
ADD COLUMN `payment_proof_urls` JSON NULL AFTER `payment_ref`;
|
||||||
@@ -44,6 +44,7 @@ enum ResourceBizType {
|
|||||||
SIGN_PHOTO
|
SIGN_PHOTO
|
||||||
VIDEO
|
VIDEO
|
||||||
REDEEM_PENDING_PHOTO
|
REDEEM_PENDING_PHOTO
|
||||||
|
ACTIVITY_POSTER
|
||||||
}
|
}
|
||||||
|
|
||||||
enum RedeemPendingStatus {
|
enum RedeemPendingStatus {
|
||||||
@@ -1204,6 +1205,7 @@ model PartnerAccount {
|
|||||||
managedWarehouseId BigInt? @unique @map("managed_warehouse_id") @db.UnsignedBigInt
|
managedWarehouseId BigInt? @unique @map("managed_warehouse_id") @db.UnsignedBigInt
|
||||||
assocQrcodeId String? @unique @map("assoc_qrcode_id") @db.VarChar(64)
|
assocQrcodeId String? @unique @map("assoc_qrcode_id") @db.VarChar(64)
|
||||||
assocQrcodeResourceId BigInt? @map("assoc_qrcode_resource_id") @db.UnsignedBigInt
|
assocQrcodeResourceId BigInt? @map("assoc_qrcode_resource_id") @db.UnsignedBigInt
|
||||||
|
activityPosterId BigInt? @map("activity_poster_id") @db.UnsignedBigInt
|
||||||
/// 测试合伙人账号
|
/// 测试合伙人账号
|
||||||
isTest Boolean @default(false) @map("is_test")
|
isTest Boolean @default(false) @map("is_test")
|
||||||
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
||||||
@@ -1219,6 +1221,7 @@ model PartnerAccount {
|
|||||||
assocUsers User[] @relation("UserPartnerAssoc")
|
assocUsers User[] @relation("UserPartnerAssoc")
|
||||||
userNotes PartnerUserNote[]
|
userNotes PartnerUserNote[]
|
||||||
assocQrcodeResource CommonResource? @relation("PartnerAssocQrcode", fields: [assocQrcodeResourceId], references: [id], onDelete: SetNull)
|
assocQrcodeResource CommonResource? @relation("PartnerAssocQrcode", fields: [assocQrcodeResourceId], references: [id], onDelete: SetNull)
|
||||||
|
activityPoster ActivityPoster? @relation(fields: [activityPosterId], references: [id], onDelete: SetNull)
|
||||||
|
|
||||||
@@index([cityId, scopeType])
|
@@index([cityId, scopeType])
|
||||||
@@index([cityId, isPrimary])
|
@@index([cityId, isPrimary])
|
||||||
@@ -1226,6 +1229,7 @@ model PartnerAccount {
|
|||||||
@@index([wxOpenId])
|
@@index([wxOpenId])
|
||||||
@@index([contactPhone])
|
@@index([contactPhone])
|
||||||
@@index([isTest])
|
@@index([isTest])
|
||||||
|
@@index([activityPosterId])
|
||||||
@@map("partner_account")
|
@@map("partner_account")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1246,6 +1250,26 @@ model PartnerUserNote {
|
|||||||
@@map("partner_user_note")
|
@@map("partner_user_note")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// HQ 活动图模板:底图 + 方形码栏(相对百分比)+ 文案
|
||||||
|
model ActivityPoster {
|
||||||
|
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||||
|
title String @db.VarChar(128)
|
||||||
|
copyText String @map("copy_text") @db.Text
|
||||||
|
imageUrl String @map("image_url") @db.VarChar(512)
|
||||||
|
qrXPct Decimal @map("qr_x_pct") @db.Decimal(5, 2)
|
||||||
|
qrYPct Decimal @map("qr_y_pct") @db.Decimal(5, 2)
|
||||||
|
qrSizePct Decimal @map("qr_size_pct") @db.Decimal(5, 2)
|
||||||
|
sortOrder Int @default(0) @map("sort_order")
|
||||||
|
status String @default("ACTIVE") @db.VarChar(16)
|
||||||
|
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
||||||
|
updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
|
||||||
|
|
||||||
|
selectedByPartners PartnerAccount[]
|
||||||
|
|
||||||
|
@@index([status, sortOrder])
|
||||||
|
@@map("activity_poster")
|
||||||
|
}
|
||||||
|
|
||||||
model PartnerBill {
|
model PartnerBill {
|
||||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||||
billNo String @unique @map("bill_no") @db.VarChar(32)
|
billNo String @unique @map("bill_no") @db.VarChar(32)
|
||||||
@@ -1955,6 +1979,7 @@ model StoreBill {
|
|||||||
payoutAmount Decimal @map("payout_amount") @db.Decimal(10, 2)
|
payoutAmount Decimal @map("payout_amount") @db.Decimal(10, 2)
|
||||||
status FinancePayStatus @default(UNPAID)
|
status FinancePayStatus @default(UNPAID)
|
||||||
paymentRef String? @map("payment_ref") @db.VarChar(128)
|
paymentRef String? @map("payment_ref") @db.VarChar(128)
|
||||||
|
paymentProofUrls Json? @map("payment_proof_urls")
|
||||||
paidAt DateTime? @map("paid_at") @db.DateTime(3)
|
paidAt DateTime? @map("paid_at") @db.DateTime(3)
|
||||||
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
||||||
|
|
||||||
@@ -2004,6 +2029,7 @@ model StoreWithdrawRequest {
|
|||||||
reviewedByHqId BigInt? @map("reviewed_by_hq_id") @db.UnsignedBigInt
|
reviewedByHqId BigInt? @map("reviewed_by_hq_id") @db.UnsignedBigInt
|
||||||
paidAt DateTime? @map("paid_at") @db.DateTime(3)
|
paidAt DateTime? @map("paid_at") @db.DateTime(3)
|
||||||
paymentRef String? @map("payment_ref") @db.VarChar(128)
|
paymentRef String? @map("payment_ref") @db.VarChar(128)
|
||||||
|
paymentProofUrls Json? @map("payment_proof_urls")
|
||||||
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
||||||
updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
|
updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ export const HqOperationAction = {
|
|||||||
DEV_PLAN_DISPATCH_TEST: 'DEV_PLAN_DISPATCH_TEST',
|
DEV_PLAN_DISPATCH_TEST: 'DEV_PLAN_DISPATCH_TEST',
|
||||||
SUPPORT_TICKET_REVIEW: 'SUPPORT_TICKET_REVIEW',
|
SUPPORT_TICKET_REVIEW: 'SUPPORT_TICKET_REVIEW',
|
||||||
SUPPORT_TICKET_BATCH_REVIEW: 'SUPPORT_TICKET_BATCH_REVIEW',
|
SUPPORT_TICKET_BATCH_REVIEW: 'SUPPORT_TICKET_BATCH_REVIEW',
|
||||||
|
ACTIVITY_POSTER_CREATE: 'ACTIVITY_POSTER_CREATE',
|
||||||
|
ACTIVITY_POSTER_UPDATE: 'ACTIVITY_POSTER_UPDATE',
|
||||||
|
ACTIVITY_POSTER_UPDATE_STATUS: 'ACTIVITY_POSTER_UPDATE_STATUS',
|
||||||
|
ACTIVITY_POSTER_DELETE: 'ACTIVITY_POSTER_DELETE',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type HqOperationActionCode = (typeof HqOperationAction)[keyof typeof HqOperationAction];
|
export type HqOperationActionCode = (typeof HqOperationAction)[keyof typeof HqOperationAction];
|
||||||
@@ -249,6 +253,10 @@ export const HQ_OPERATION_ACTION_LABELS: Record<string, string> = {
|
|||||||
[HqOperationAction.DEV_PLAN_DISPATCH_TEST]: '测试任务派发助手',
|
[HqOperationAction.DEV_PLAN_DISPATCH_TEST]: '测试任务派发助手',
|
||||||
[HqOperationAction.SUPPORT_TICKET_REVIEW]: '技术支持工单审批',
|
[HqOperationAction.SUPPORT_TICKET_REVIEW]: '技术支持工单审批',
|
||||||
[HqOperationAction.SUPPORT_TICKET_BATCH_REVIEW]: '技术支持批量审批',
|
[HqOperationAction.SUPPORT_TICKET_BATCH_REVIEW]: '技术支持批量审批',
|
||||||
|
[HqOperationAction.ACTIVITY_POSTER_CREATE]: '新增活动图',
|
||||||
|
[HqOperationAction.ACTIVITY_POSTER_UPDATE]: '编辑活动图',
|
||||||
|
[HqOperationAction.ACTIVITY_POSTER_UPDATE_STATUS]: '活动图上下架',
|
||||||
|
[HqOperationAction.ACTIVITY_POSTER_DELETE]: '删除活动图',
|
||||||
STORE_PAYOUT: '门店打款确认',
|
STORE_PAYOUT: '门店打款确认',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,188 @@
|
|||||||
|
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
|
||||||
|
import { Prisma } from '@prisma/client';
|
||||||
|
import { activityPosterQrSlotPx } from '@dukang/shared-types';
|
||||||
|
import sharp from 'sharp';
|
||||||
|
import { PrismaService } from '../../common/prisma/prisma.module';
|
||||||
|
import { serializeBigInt } from '../../common/decorators/current-user.decorator';
|
||||||
|
import { PartnerAssocService } from '../store/partner-assoc.service';
|
||||||
|
import type {
|
||||||
|
ActivityPosterQueryDto,
|
||||||
|
UpdateActivityPosterStatusDto,
|
||||||
|
UpsertActivityPosterDto,
|
||||||
|
} from './dto/activity-poster.dto';
|
||||||
|
|
||||||
|
type PosterRow = {
|
||||||
|
id: bigint;
|
||||||
|
title: string;
|
||||||
|
copyText: string;
|
||||||
|
imageUrl: string;
|
||||||
|
qrXPct: Prisma.Decimal;
|
||||||
|
qrYPct: Prisma.Decimal;
|
||||||
|
qrSizePct: Prisma.Decimal;
|
||||||
|
sortOrder: number;
|
||||||
|
status: string;
|
||||||
|
createdAt: Date;
|
||||||
|
updatedAt: Date;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ActivityPosterService {
|
||||||
|
constructor(
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
private readonly partnerAssoc: PartnerAssocService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
async adminList(query: ActivityPosterQueryDto) {
|
||||||
|
const page = query.page ?? 1;
|
||||||
|
const pageSize = query.pageSize ?? 20;
|
||||||
|
const where: Prisma.ActivityPosterWhereInput = {};
|
||||||
|
if (query.status) where.status = query.status;
|
||||||
|
|
||||||
|
const [items, total] = await Promise.all([
|
||||||
|
this.prisma.activityPoster.findMany({
|
||||||
|
where,
|
||||||
|
orderBy: [{ sortOrder: 'asc' }, { id: 'desc' }],
|
||||||
|
skip: (page - 1) * pageSize,
|
||||||
|
take: pageSize,
|
||||||
|
}),
|
||||||
|
this.prisma.activityPoster.count({ where }),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return serializeBigInt({
|
||||||
|
items: items.map((row) => this.format(row)),
|
||||||
|
total,
|
||||||
|
page,
|
||||||
|
pageSize,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async adminDetail(id: bigint) {
|
||||||
|
return serializeBigInt(this.format(await this.require(id)));
|
||||||
|
}
|
||||||
|
|
||||||
|
async create(dto: UpsertActivityPosterDto) {
|
||||||
|
const row = await this.prisma.activityPoster.create({
|
||||||
|
data: this.toCreateData(dto),
|
||||||
|
});
|
||||||
|
return serializeBigInt(this.format(row));
|
||||||
|
}
|
||||||
|
|
||||||
|
async update(id: bigint, dto: UpsertActivityPosterDto) {
|
||||||
|
await this.require(id);
|
||||||
|
const row = await this.prisma.activityPoster.update({
|
||||||
|
where: { id },
|
||||||
|
data: this.toCreateData(dto),
|
||||||
|
});
|
||||||
|
return serializeBigInt(this.format(row));
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateStatus(id: bigint, dto: UpdateActivityPosterStatusDto) {
|
||||||
|
await this.require(id);
|
||||||
|
const row = await this.prisma.activityPoster.update({
|
||||||
|
where: { id },
|
||||||
|
data: { status: dto.status },
|
||||||
|
});
|
||||||
|
return serializeBigInt(this.format(row));
|
||||||
|
}
|
||||||
|
|
||||||
|
async remove(id: bigint) {
|
||||||
|
await this.require(id);
|
||||||
|
await this.prisma.activityPoster.delete({ where: { id } });
|
||||||
|
return { ok: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
async listForPartner() {
|
||||||
|
const items = await this.prisma.activityPoster.findMany({
|
||||||
|
where: { status: 'ACTIVE' },
|
||||||
|
orderBy: [{ sortOrder: 'asc' }, { id: 'desc' }],
|
||||||
|
});
|
||||||
|
return serializeBigInt(items.map((row) => this.format(row)));
|
||||||
|
}
|
||||||
|
|
||||||
|
getSelection(partnerAccountId: bigint) {
|
||||||
|
return this.partnerAssoc.getSelectedActivityPosterId(partnerAccountId).then((posterId) => ({ posterId }));
|
||||||
|
}
|
||||||
|
|
||||||
|
setSelection(partnerAccountId: bigint, posterId: bigint | null) {
|
||||||
|
return this.partnerAssoc.setSelectedActivityPoster(partnerAccountId, posterId);
|
||||||
|
}
|
||||||
|
|
||||||
|
async composeForPartner(partnerAccountId: bigint, posterId: bigint) {
|
||||||
|
const poster = await this.require(posterId);
|
||||||
|
if (poster.status !== 'ACTIVE') {
|
||||||
|
throw new NotFoundException('活动图不存在或已下架');
|
||||||
|
}
|
||||||
|
|
||||||
|
let qr: { buffer: Buffer; fileName: string };
|
||||||
|
try {
|
||||||
|
qr = await this.partnerAssoc.getQrcodeBuffer(partnerAccountId);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof NotFoundException) {
|
||||||
|
throw new BadRequestException('关联码尚未生成,无法合成活动图');
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
const template = await this.fetchPngLike(poster.imageUrl, '活动图底图下载失败');
|
||||||
|
|
||||||
|
const buffer = await this.compose(template, qr.buffer, poster);
|
||||||
|
return { buffer, fileName: `activity-poster-${poster.id}.png` };
|
||||||
|
}
|
||||||
|
|
||||||
|
private async compose(template: Buffer, qrPng: Buffer, poster: PosterRow) {
|
||||||
|
const base = sharp(template);
|
||||||
|
const meta = await base.metadata();
|
||||||
|
if (!meta.width || !meta.height) {
|
||||||
|
throw new BadRequestException('活动图底图无法读取尺寸');
|
||||||
|
}
|
||||||
|
const { left, top, size } = activityPosterQrSlotPx(
|
||||||
|
meta.width,
|
||||||
|
meta.height,
|
||||||
|
Number(poster.qrXPct),
|
||||||
|
Number(poster.qrYPct),
|
||||||
|
Number(poster.qrSizePct),
|
||||||
|
);
|
||||||
|
const qr = await sharp(qrPng).resize(size, size, { fit: 'fill' }).png().toBuffer();
|
||||||
|
return base.composite([{ input: qr, left, top }]).png().toBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async fetchPngLike(url: string, failMessage: string) {
|
||||||
|
const res = await fetch(url);
|
||||||
|
if (!res.ok) throw new BadRequestException(failMessage);
|
||||||
|
return Buffer.from(await res.arrayBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
private async require(id: bigint) {
|
||||||
|
const row = await this.prisma.activityPoster.findUnique({ where: { id } });
|
||||||
|
if (!row) throw new NotFoundException('活动图不存在');
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
private toCreateData(dto: UpsertActivityPosterDto): Prisma.ActivityPosterCreateInput {
|
||||||
|
return {
|
||||||
|
title: dto.title.trim(),
|
||||||
|
copyText: (dto.copyText ?? '').trim(),
|
||||||
|
imageUrl: dto.imageUrl.trim(),
|
||||||
|
qrXPct: new Prisma.Decimal(dto.qrXPct.toFixed(2)),
|
||||||
|
qrYPct: new Prisma.Decimal(dto.qrYPct.toFixed(2)),
|
||||||
|
qrSizePct: new Prisma.Decimal(dto.qrSizePct.toFixed(2)),
|
||||||
|
sortOrder: dto.sortOrder ?? 0,
|
||||||
|
status: dto.status ?? 'ACTIVE',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private format(row: PosterRow) {
|
||||||
|
return {
|
||||||
|
id: row.id.toString(),
|
||||||
|
title: row.title,
|
||||||
|
copyText: row.copyText,
|
||||||
|
imageUrl: row.imageUrl,
|
||||||
|
qrXPct: Number(row.qrXPct),
|
||||||
|
qrYPct: Number(row.qrYPct),
|
||||||
|
qrSizePct: Number(row.qrSizePct),
|
||||||
|
sortOrder: row.sortOrder,
|
||||||
|
status: row.status,
|
||||||
|
createdAt: row.createdAt.toISOString(),
|
||||||
|
updatedAt: row.updatedAt.toISOString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import { Body, Controller, Delete, Get, Param, Post, Put, Query, UseGuards } from '@nestjs/common';
|
||||||
|
import { HqAuthGuard } from '../../common/guards/hq-auth.guard';
|
||||||
|
import { HqPermissionGuard, RequireHqPermissions } from '../../common/guards/hq-permission.guard';
|
||||||
|
import { HqOperation } from '../../common/hq-operation/hq-operation.decorator';
|
||||||
|
import { HqOperationAction } from '../../common/hq-operation/hq-operation.constants';
|
||||||
|
import { ActivityPosterService } from './activity-poster.service';
|
||||||
|
import {
|
||||||
|
ActivityPosterQueryDto,
|
||||||
|
UpdateActivityPosterStatusDto,
|
||||||
|
UpsertActivityPosterDto,
|
||||||
|
} from './dto/activity-poster.dto';
|
||||||
|
|
||||||
|
@Controller('admin/activity-posters')
|
||||||
|
@UseGuards(HqAuthGuard, HqPermissionGuard)
|
||||||
|
@RequireHqPermissions('activity_posters')
|
||||||
|
export class AdminActivityPostersController {
|
||||||
|
constructor(private readonly service: ActivityPosterService) {}
|
||||||
|
|
||||||
|
@Get()
|
||||||
|
list(@Query() query: ActivityPosterQueryDto) {
|
||||||
|
return this.service.adminList(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get(':id')
|
||||||
|
detail(@Param('id') id: string) {
|
||||||
|
return this.service.adminDetail(BigInt(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post()
|
||||||
|
@HqOperation({
|
||||||
|
action: HqOperationAction.ACTIVITY_POSTER_CREATE,
|
||||||
|
refType: 'ACTIVITY_POSTER',
|
||||||
|
refIdField: 'id',
|
||||||
|
includeBody: true,
|
||||||
|
})
|
||||||
|
create(@Body() dto: UpsertActivityPosterDto) {
|
||||||
|
return this.service.create(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Put(':id')
|
||||||
|
@HqOperation({
|
||||||
|
action: HqOperationAction.ACTIVITY_POSTER_UPDATE,
|
||||||
|
refType: 'ACTIVITY_POSTER',
|
||||||
|
refIdParam: 'id',
|
||||||
|
includeBody: true,
|
||||||
|
})
|
||||||
|
update(@Param('id') id: string, @Body() dto: UpsertActivityPosterDto) {
|
||||||
|
return this.service.update(BigInt(id), dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Put(':id/status')
|
||||||
|
@HqOperation({
|
||||||
|
action: HqOperationAction.ACTIVITY_POSTER_UPDATE_STATUS,
|
||||||
|
refType: 'ACTIVITY_POSTER',
|
||||||
|
refIdParam: 'id',
|
||||||
|
includeBody: true,
|
||||||
|
})
|
||||||
|
updateStatus(@Param('id') id: string, @Body() dto: UpdateActivityPosterStatusDto) {
|
||||||
|
return this.service.updateStatus(BigInt(id), dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete(':id')
|
||||||
|
@HqOperation({
|
||||||
|
action: HqOperationAction.ACTIVITY_POSTER_DELETE,
|
||||||
|
refType: 'ACTIVITY_POSTER',
|
||||||
|
refIdParam: 'id',
|
||||||
|
})
|
||||||
|
remove(@Param('id') id: string) {
|
||||||
|
return this.service.remove(BigInt(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import { Type } from 'class-transformer';
|
||||||
|
import {
|
||||||
|
IsIn,
|
||||||
|
IsInt,
|
||||||
|
IsNumber,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
Max,
|
||||||
|
MaxLength,
|
||||||
|
Min,
|
||||||
|
MinLength,
|
||||||
|
ValidateIf,
|
||||||
|
} from 'class-validator';
|
||||||
|
import { ACTIVITY_POSTER_STATUSES } from '@dukang/shared-types';
|
||||||
|
import { PaginationQueryDto } from './admin-query.dto';
|
||||||
|
|
||||||
|
export class ActivityPosterQueryDto extends PaginationQueryDto {
|
||||||
|
@IsOptional()
|
||||||
|
@IsIn([...ACTIVITY_POSTER_STATUSES])
|
||||||
|
status?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpsertActivityPosterDto {
|
||||||
|
@IsString()
|
||||||
|
@MinLength(1)
|
||||||
|
@MaxLength(128)
|
||||||
|
title!: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(4000)
|
||||||
|
copyText?: string;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
@MinLength(1)
|
||||||
|
@MaxLength(512)
|
||||||
|
imageUrl!: string;
|
||||||
|
|
||||||
|
@Type(() => Number)
|
||||||
|
@IsNumber()
|
||||||
|
@Min(0)
|
||||||
|
@Max(100)
|
||||||
|
qrXPct!: number;
|
||||||
|
|
||||||
|
@Type(() => Number)
|
||||||
|
@IsNumber()
|
||||||
|
@Min(0)
|
||||||
|
@Max(100)
|
||||||
|
qrYPct!: number;
|
||||||
|
|
||||||
|
@Type(() => Number)
|
||||||
|
@IsNumber()
|
||||||
|
@Min(5)
|
||||||
|
@Max(50)
|
||||||
|
qrSizePct!: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@Type(() => Number)
|
||||||
|
@IsInt()
|
||||||
|
@Min(0)
|
||||||
|
sortOrder?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsIn([...ACTIVITY_POSTER_STATUSES])
|
||||||
|
status?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UpdateActivityPosterStatusDto {
|
||||||
|
@IsIn([...ACTIVITY_POSTER_STATUSES])
|
||||||
|
status!: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ActivityPosterSelectionDto {
|
||||||
|
@IsOptional()
|
||||||
|
@ValidateIf((_, value) => value != null)
|
||||||
|
@IsString()
|
||||||
|
posterId?: string | null;
|
||||||
|
}
|
||||||
@@ -82,6 +82,9 @@ import { AdminFulfillmentProvidersController } from './admin-fulfillment-provide
|
|||||||
import { AdminDomainEventsController } from './admin-domain-events.controller';
|
import { AdminDomainEventsController } from './admin-domain-events.controller';
|
||||||
import { AdminDomainEventsService } from './admin-domain-events.service';
|
import { AdminDomainEventsService } from './admin-domain-events.service';
|
||||||
import { AdminTestWhitelistController } from './admin-test-whitelist.controller';
|
import { AdminTestWhitelistController } from './admin-test-whitelist.controller';
|
||||||
|
import { ActivityPosterService } from './activity-poster.service';
|
||||||
|
import { AdminActivityPostersController } from './admin-activity-posters.controller';
|
||||||
|
import { PartnerActivityPostersController } from './partner-activity-posters.controller';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [CityScopeModule, IamModule, TradeModule, AnalyticsModule, FulfillmentModule, BenefitModule, CommonModule, IntegrationsModule, WecomModule, LlmModule, RedeemModule, StoreModule, DevPlanModule],
|
imports: [CityScopeModule, IamModule, TradeModule, AnalyticsModule, FulfillmentModule, BenefitModule, CommonModule, IntegrationsModule, WecomModule, LlmModule, RedeemModule, StoreModule, DevPlanModule],
|
||||||
@@ -132,6 +135,8 @@ import { AdminTestWhitelistController } from './admin-test-whitelist.controller'
|
|||||||
AdminDevPlanController,
|
AdminDevPlanController,
|
||||||
AdminFulfillmentProvidersController,
|
AdminFulfillmentProvidersController,
|
||||||
AdminTestWhitelistController,
|
AdminTestWhitelistController,
|
||||||
|
AdminActivityPostersController,
|
||||||
|
PartnerActivityPostersController,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
AdminDashboardService,
|
AdminDashboardService,
|
||||||
@@ -165,6 +170,7 @@ import { AdminTestWhitelistController } from './admin-test-whitelist.controller'
|
|||||||
AdminLlmConfigsService,
|
AdminLlmConfigsService,
|
||||||
AdminKnowledgeBasesService,
|
AdminKnowledgeBasesService,
|
||||||
SuperAdminGuard,
|
SuperAdminGuard,
|
||||||
|
ActivityPosterService,
|
||||||
],
|
],
|
||||||
exports: [CityScopeModule],
|
exports: [CityScopeModule],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { Body, Controller, Get, Param, Put, Res, UseGuards } from '@nestjs/common';
|
||||||
|
import type { Response } from 'express';
|
||||||
|
import { JwtAuthGuard, AuthUser } from '../../common/guards/jwt-auth.guard';
|
||||||
|
import { PartnerPrimaryGuard } from '../../common/guards/partner-primary.guard';
|
||||||
|
import { CurrentUser } from '../../common/decorators/current-user.decorator';
|
||||||
|
import { ActivityPosterService } from './activity-poster.service';
|
||||||
|
import { ActivityPosterSelectionDto } from './dto/activity-poster.dto';
|
||||||
|
|
||||||
|
@Controller('partner/activity-posters')
|
||||||
|
@UseGuards(JwtAuthGuard, PartnerPrimaryGuard)
|
||||||
|
export class PartnerActivityPostersController {
|
||||||
|
constructor(private readonly service: ActivityPosterService) {}
|
||||||
|
|
||||||
|
@Get()
|
||||||
|
list() {
|
||||||
|
return this.service.listForPartner();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('selection')
|
||||||
|
getSelection(@CurrentUser() user: AuthUser) {
|
||||||
|
return this.service.getSelection(user.actorId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Put('selection')
|
||||||
|
setSelection(@CurrentUser() user: AuthUser, @Body() dto: ActivityPosterSelectionDto) {
|
||||||
|
const raw = dto.posterId?.trim();
|
||||||
|
const posterId = raw && /^\d+$/.test(raw) ? BigInt(raw) : null;
|
||||||
|
return this.service.setSelection(user.actorId, posterId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get(':id/image')
|
||||||
|
async image(@CurrentUser() user: AuthUser, @Param('id') id: string, @Res() res: Response) {
|
||||||
|
const { buffer, fileName } = await this.service.composeForPartner(user.actorId, BigInt(id));
|
||||||
|
res.setHeader('Content-Type', 'image/png');
|
||||||
|
res.setHeader('Content-Disposition', `attachment; filename="${fileName}"`);
|
||||||
|
res.send(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -133,7 +133,7 @@ export class AdminStoreWithdrawController {
|
|||||||
approve(
|
approve(
|
||||||
@CurrentUser() user: AuthUser,
|
@CurrentUser() user: AuthUser,
|
||||||
@Param('id') id: string,
|
@Param('id') id: string,
|
||||||
@Body() body: { paymentRef?: string },
|
@Body() body: { paymentRef?: string; paymentProofUrls?: string[] },
|
||||||
) {
|
) {
|
||||||
return this.settlementService.approveStoreWithdraw(BigInt(id), user.actorId, body);
|
return this.settlementService.approveStoreWithdraw(BigInt(id), user.actorId, body);
|
||||||
}
|
}
|
||||||
@@ -287,8 +287,10 @@ export class AdminStoreBillController {
|
|||||||
batch: true,
|
batch: true,
|
||||||
includeBody: true,
|
includeBody: true,
|
||||||
})
|
})
|
||||||
batchConfirm(@Body() body: { ids: string[] }) {
|
batchConfirm(
|
||||||
return this.settlementService.batchConfirmStoreBills(body.ids ?? []);
|
@Body() body: { ids: string[]; paymentRef?: string; paymentProofUrls?: string[] },
|
||||||
|
) {
|
||||||
|
return this.settlementService.batchConfirmStoreBills(body.ids ?? [], body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
@@ -302,7 +304,10 @@ export class AdminStoreBillController {
|
|||||||
refType: 'STORE_BILL',
|
refType: 'STORE_BILL',
|
||||||
refIdParam: 'id',
|
refIdParam: 'id',
|
||||||
})
|
})
|
||||||
confirm(@Param('id') id: string, @Body() body: { paymentRef?: string }) {
|
confirm(
|
||||||
|
@Param('id') id: string,
|
||||||
|
@Body() body: { paymentRef?: string; paymentProofUrls?: string[] },
|
||||||
|
) {
|
||||||
return this.settlementService.confirmStoreBill(BigInt(id), body);
|
return this.settlementService.confirmStoreBill(BigInt(id), body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
DEFAULT_STORE_WITHDRAW_DAILY_LIMIT,
|
DEFAULT_STORE_WITHDRAW_DAILY_LIMIT,
|
||||||
DEFAULT_XFX_LOGISTICS_PRICING,
|
DEFAULT_XFX_LOGISTICS_PRICING,
|
||||||
LOGISTICS_SETTLEMENT_METHOD_LABELS,
|
LOGISTICS_SETTLEMENT_METHOD_LABELS,
|
||||||
|
PAYMENT_PROOF_IMAGE_MAX_COUNT,
|
||||||
WINERY_SETTLEMENT_LAG_DAYS,
|
WINERY_SETTLEMENT_LAG_DAYS,
|
||||||
WINERY_SETTLEMENT_RATE,
|
WINERY_SETTLEMENT_RATE,
|
||||||
} from '@dukang/shared-types';
|
} from '@dukang/shared-types';
|
||||||
@@ -50,6 +51,19 @@ function csvEscape(value: string) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parsePaymentProofUrls(raw: unknown): string[] {
|
||||||
|
if (!Array.isArray(raw)) return [];
|
||||||
|
return raw
|
||||||
|
.map((u) => String(u ?? '').trim())
|
||||||
|
.filter((u) => /^https?:\/\//i.test(u))
|
||||||
|
.slice(0, PAYMENT_PROOF_IMAGE_MAX_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
|
function paymentProofUrlsInput(urls?: string[]): Prisma.InputJsonValue | typeof Prisma.JsonNull {
|
||||||
|
const parsed = parsePaymentProofUrls(urls);
|
||||||
|
return parsed.length ? (parsed as Prisma.InputJsonValue) : Prisma.JsonNull;
|
||||||
|
}
|
||||||
|
|
||||||
/** 上海时区自然日 00:00(用本地 Date 构造;服务器需设 Asia/Shanghai 或等价) */
|
/** 上海时区自然日 00:00(用本地 Date 构造;服务器需设 Asia/Shanghai 或等价) */
|
||||||
function startOfDay(d: Date) {
|
function startOfDay(d: Date) {
|
||||||
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0);
|
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0);
|
||||||
@@ -715,6 +729,7 @@ export class SettlementService implements OnModuleInit {
|
|||||||
if (!row) throw new NotFoundException('提现申请不存在');
|
if (!row) throw new NotFoundException('提现申请不存在');
|
||||||
return serializeBigInt({
|
return serializeBigInt({
|
||||||
...row,
|
...row,
|
||||||
|
paymentProofUrls: parsePaymentProofUrls(row.paymentProofUrls),
|
||||||
overdue:
|
overdue:
|
||||||
row.status === 'PENDING_REVIEW' ? isWithdrawOverdue(row.appliedAt) : false,
|
row.status === 'PENDING_REVIEW' ? isWithdrawOverdue(row.appliedAt) : false,
|
||||||
});
|
});
|
||||||
@@ -723,7 +738,7 @@ export class SettlementService implements OnModuleInit {
|
|||||||
async approveStoreWithdraw(
|
async approveStoreWithdraw(
|
||||||
id: bigint,
|
id: bigint,
|
||||||
hqAccountId: bigint,
|
hqAccountId: bigint,
|
||||||
dto?: { paymentRef?: string },
|
dto?: { paymentRef?: string; paymentProofUrls?: string[] },
|
||||||
) {
|
) {
|
||||||
const row = await this.prisma.storeWithdrawRequest.findUnique({
|
const row = await this.prisma.storeWithdrawRequest.findUnique({
|
||||||
where: { id },
|
where: { id },
|
||||||
@@ -744,6 +759,7 @@ export class SettlementService implements OnModuleInit {
|
|||||||
reviewedByHqId: hqAccountId,
|
reviewedByHqId: hqAccountId,
|
||||||
paidAt,
|
paidAt,
|
||||||
paymentRef: dto?.paymentRef?.trim() || null,
|
paymentRef: dto?.paymentRef?.trim() || null,
|
||||||
|
paymentProofUrls: paymentProofUrlsInput(dto?.paymentProofUrls),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await tx.storePayout.updateMany({
|
await tx.storePayout.updateMany({
|
||||||
@@ -764,6 +780,7 @@ export class SettlementService implements OnModuleInit {
|
|||||||
extraJson: {
|
extraJson: {
|
||||||
amount: Number(row.amount),
|
amount: Number(row.amount),
|
||||||
paymentRef: dto?.paymentRef,
|
paymentRef: dto?.paymentRef,
|
||||||
|
paymentProofCount: parsePaymentProofUrls(dto?.paymentProofUrls).length,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1425,10 +1442,18 @@ export class SettlementService implements OnModuleInit {
|
|||||||
});
|
});
|
||||||
if (!bill) throw new NotFoundException('门店对账单不存在');
|
if (!bill) throw new NotFoundException('门店对账单不存在');
|
||||||
const storeAccount = await loadStorePrimaryBank(this.prisma, bill.storeId);
|
const storeAccount = await loadStorePrimaryBank(this.prisma, bill.storeId);
|
||||||
return serializeBigInt({ ...bill, billDate: shanghaiYmd(bill.billDate), storeAccount });
|
return serializeBigInt({
|
||||||
|
...bill,
|
||||||
|
billDate: shanghaiYmd(bill.billDate),
|
||||||
|
storeAccount,
|
||||||
|
paymentProofUrls: parsePaymentProofUrls(bill.paymentProofUrls),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async confirmStoreBill(id: bigint, dto: { paymentRef?: string } = {}) {
|
async confirmStoreBill(
|
||||||
|
id: bigint,
|
||||||
|
dto: { paymentRef?: string; paymentProofUrls?: string[] } = {},
|
||||||
|
) {
|
||||||
const bill = await this.prisma.storeBill.findUnique({ where: { id } });
|
const bill = await this.prisma.storeBill.findUnique({ where: { id } });
|
||||||
if (!bill) throw new NotFoundException('门店对账单不存在');
|
if (!bill) throw new NotFoundException('门店对账单不存在');
|
||||||
if (bill.status !== 'UNPAID') throw new BadRequestException('仅未打款账单可确认打款');
|
if (bill.status !== 'UNPAID') throw new BadRequestException('仅未打款账单可确认打款');
|
||||||
@@ -1441,6 +1466,7 @@ export class SettlementService implements OnModuleInit {
|
|||||||
status: 'PAID',
|
status: 'PAID',
|
||||||
paidAt,
|
paidAt,
|
||||||
paymentRef: dto.paymentRef?.trim() || null,
|
paymentRef: dto.paymentRef?.trim() || null,
|
||||||
|
paymentProofUrls: paymentProofUrlsInput(dto.paymentProofUrls),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await tx.storePayout.updateMany({
|
await tx.storePayout.updateMany({
|
||||||
@@ -1449,14 +1475,20 @@ export class SettlementService implements OnModuleInit {
|
|||||||
});
|
});
|
||||||
return b;
|
return b;
|
||||||
});
|
});
|
||||||
return serializeBigInt(updated);
|
return serializeBigInt({
|
||||||
|
...updated,
|
||||||
|
paymentProofUrls: parsePaymentProofUrls(updated.paymentProofUrls),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async batchConfirmStoreBills(ids: string[]) {
|
async batchConfirmStoreBills(
|
||||||
|
ids: string[],
|
||||||
|
dto: { paymentRef?: string; paymentProofUrls?: string[] } = {},
|
||||||
|
) {
|
||||||
const results: Array<{ id: string; ok: boolean; message?: string }> = [];
|
const results: Array<{ id: string; ok: boolean; message?: string }> = [];
|
||||||
for (const id of ids) {
|
for (const id of ids) {
|
||||||
try {
|
try {
|
||||||
await this.confirmStoreBill(BigInt(id));
|
await this.confirmStoreBill(BigInt(id), dto);
|
||||||
results.push({ id, ok: true });
|
results.push({ id, ok: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
results.push({ id, ok: false, message: e instanceof Error ? e.message : '失败' });
|
results.push({ id, ok: false, message: e instanceof Error ? e.message : '失败' });
|
||||||
@@ -1493,6 +1525,7 @@ export class SettlementService implements OnModuleInit {
|
|||||||
'状态',
|
'状态',
|
||||||
'打款时间',
|
'打款时间',
|
||||||
'打款凭证',
|
'打款凭证',
|
||||||
|
'打款凭证照片',
|
||||||
'收款户名',
|
'收款户名',
|
||||||
'收款账号',
|
'收款账号',
|
||||||
'开户行',
|
'开户行',
|
||||||
@@ -1511,6 +1544,7 @@ export class SettlementService implements OnModuleInit {
|
|||||||
b.status,
|
b.status,
|
||||||
b.paidAt ? b.paidAt.toISOString().slice(0, 19).replace('T', ' ') : '',
|
b.paidAt ? b.paidAt.toISOString().slice(0, 19).replace('T', ' ') : '',
|
||||||
csvEscape(b.paymentRef ?? ''),
|
csvEscape(b.paymentRef ?? ''),
|
||||||
|
csvEscape(parsePaymentProofUrls(b.paymentProofUrls).join(' ')),
|
||||||
csvEscape(bank?.bankAccountName ?? ''),
|
csvEscape(bank?.bankAccountName ?? ''),
|
||||||
csvEscape(bank?.bankAccountNo ?? ''),
|
csvEscape(bank?.bankAccountNo ?? ''),
|
||||||
csvEscape(bank?.bankBranch ?? ''),
|
csvEscape(bank?.bankBranch ?? ''),
|
||||||
|
|||||||
@@ -136,15 +136,51 @@ export class PartnerAssocService {
|
|||||||
const userCount = await this.prisma.user.count({
|
const userCount = await this.prisma.user.count({
|
||||||
where: { assocPartnerAccountId: primary.id },
|
where: { assocPartnerAccountId: primary.id },
|
||||||
});
|
});
|
||||||
|
const selectedPoster = primary.activityPosterId
|
||||||
|
? await this.prisma.activityPoster.findUnique({
|
||||||
|
where: { id: primary.activityPosterId },
|
||||||
|
select: { id: true, status: true },
|
||||||
|
})
|
||||||
|
: null;
|
||||||
|
const activityPosterId =
|
||||||
|
selectedPoster?.status === 'ACTIVE' ? selectedPoster.id.toString() : null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
partnerId: primary.id.toString(),
|
partnerId: primary.id.toString(),
|
||||||
qrcodeUrl: ensured.qrcodeUrl,
|
qrcodeUrl: ensured.qrcodeUrl,
|
||||||
userCount,
|
userCount,
|
||||||
companyName: primary.companyName,
|
companyName: primary.companyName,
|
||||||
name: primary.name,
|
name: primary.name,
|
||||||
|
activityPosterId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getSelectedActivityPosterId(partnerAccountId: bigint): Promise<string | null> {
|
||||||
|
const primary = await this.partnerCityService.resolvePrimaryAccount(partnerAccountId);
|
||||||
|
if (!primary.activityPosterId) return null;
|
||||||
|
const poster = await this.prisma.activityPoster.findUnique({
|
||||||
|
where: { id: primary.activityPosterId },
|
||||||
|
select: { id: true, status: true },
|
||||||
|
});
|
||||||
|
return poster?.status === 'ACTIVE' ? poster.id.toString() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async setSelectedActivityPoster(partnerAccountId: bigint, posterId: bigint | null) {
|
||||||
|
const primary = await this.partnerCityService.resolvePrimaryAccount(partnerAccountId);
|
||||||
|
if (posterId) {
|
||||||
|
const poster = await this.prisma.activityPoster.findFirst({
|
||||||
|
where: { id: posterId, status: 'ACTIVE' },
|
||||||
|
select: { id: true },
|
||||||
|
});
|
||||||
|
if (!poster) throw new BadRequestException('活动图不存在或已下架');
|
||||||
|
}
|
||||||
|
await this.prisma.partnerAccount.update({
|
||||||
|
where: { id: primary.id },
|
||||||
|
data: { activityPosterId: posterId },
|
||||||
|
});
|
||||||
|
return { posterId: posterId?.toString() ?? null };
|
||||||
|
}
|
||||||
|
|
||||||
async getStats(partnerAccountId: bigint) {
|
async getStats(partnerAccountId: bigint) {
|
||||||
const primary = await this.partnerCityService.resolvePrimaryAccount(partnerAccountId);
|
const primary = await this.partnerCityService.resolvePrimaryAccount(partnerAccountId);
|
||||||
const { todayStart, monthStart } = dayBounds();
|
const { todayStart, monthStart } = dayBounds();
|
||||||
|
|||||||
Reference in New Issue
Block a user