移除快手小店以及 api

This commit is contained in:
yml2213
2026-07-09 21:03:39 +08:00
parent a075b8acf7
commit ffbc19a9db
38 changed files with 110 additions and 2724 deletions
@@ -11,7 +11,6 @@ import {
} from '@ant-design/icons'
import {
Alert,
Avatar,
Button,
Card,
Empty,
@@ -39,20 +38,16 @@ import {
fetchAdminCloudtentaclesAsset,
fetchAdminCloudtentaclesSkuList,
fetchAdminCloudtentaclesSourceConfig,
fetchAdminKuaishouEticketSourceConfig,
fetchAdminKuaishouFeifeiConfig,
fetchAdminKuaishouIndustrySourceConfig,
fetchAdminNinetyoneOrders,
fetchAdminNotificationConfig,
fetchAdminScheduledJobsConfig,
matchAdminKuaishouFeifeiProduct,
queryAdminKuaishouEticketDetail,
queryAdminKuaishouEticketShopInfo,
refreshAdminKuaishouIndustryAccessToken,
retryAdminNinetyoneOrder,
runAdminScheduledJob,
saveAdminCloudtentaclesSourceConfig,
saveAdminKuaishouEticketSourceConfig,
saveAdminKuaishouFeifeiConfig,
saveAdminKuaishouIndustrySourceConfig,
saveAdminNotificationConfig,
@@ -66,10 +61,6 @@ import {
import type {
AdminCloudtentaclesSourceConfigResponse,
AdminCloudtentaclesSourceItem,
AdminKuaishouEticketDetailResult,
AdminKuaishouEticketShopConfigItem,
AdminKuaishouEticketShopInfoResult,
AdminKuaishouEticketSourceConfig,
AdminKuaishouIndustryConfigResponse,
AdminKuaishouIndustryShopConfig,
AdminKuaishouIndustrySourceConfig,
@@ -91,7 +82,6 @@ import { formatAdminDateTime } from '@/utils/admin-time'
type PlatformTab =
| 'ninetyone'
| 'notifications'
| 'kuaishouEticket'
| 'kuaishouIndustry'
| 'kuaishouFeifei'
| 'cloudtentacles'
@@ -119,7 +109,6 @@ type ScheduledJobsState = {
const platformTabs: PlatformTab[] = [
'ninetyone',
'notifications',
'kuaishouEticket',
'kuaishouIndustry',
'kuaishouFeifei',
'cloudtentacles',
@@ -132,10 +121,6 @@ export default function AdminPlatformShopsPage() {
const [errorMessage, setErrorMessage] = useState('')
const [notificationConfig, setNotificationConfig] = useState<NotificationConfigResponse | null>(null)
const [scheduledJobs, setScheduledJobs] = useState<ScheduledJobsState | null>(null)
const [eticketConfig, setEticketConfig] = useState<{
filePath: string
source: AdminKuaishouEticketSourceConfig
} | null>(null)
const [industryConfig, setIndustryConfig] = useState<AdminKuaishouIndustryConfigResponse | null>(null)
const [feifeiConfig, setFeifeiConfig] = useState<AdminKuaishouFeifeiConfigResponse | null>(null)
const [cloudtentaclesConfig, setCloudtentaclesConfig] =
@@ -159,7 +144,6 @@ export default function AdminPlatformShopsPage() {
const [
notificationResponse,
scheduledJobsResponse,
eticketResponse,
industryResponse,
feifeiResponse,
cloudtentaclesResponse,
@@ -167,7 +151,6 @@ export default function AdminPlatformShopsPage() {
] = await Promise.all([
fetchAdminNotificationConfig(),
fetchAdminScheduledJobsConfig(),
fetchAdminKuaishouEticketSourceConfig(),
fetchAdminKuaishouIndustrySourceConfig(),
fetchAdminKuaishouFeifeiConfig(),
fetchAdminCloudtentaclesSourceConfig(),
@@ -176,7 +159,6 @@ export default function AdminPlatformShopsPage() {
setNotificationConfig(notificationResponse.data)
setScheduledJobs(scheduledJobsResponse.data)
setEticketConfig(eticketResponse.data)
setIndustryConfig(industryResponse.data)
setFeifeiConfig(feifeiResponse.data)
setCloudtentaclesConfig(cloudtentaclesResponse.data)
@@ -246,18 +228,6 @@ export default function AdminPlatformShopsPage() {
<Empty description="通知配置未加载" />
),
},
{
key: 'kuaishouEticket',
label: '快手小店核销',
children: eticketConfig ? (
<KuaishouEticketPanel
config={eticketConfig}
onChange={setEticketConfig}
/>
) : (
<Empty description="快手小店配置未加载" />
),
},
{
key: 'kuaishouIndustry',
label: '行业电子凭证',
@@ -838,232 +808,6 @@ function ScheduledJobCard({
)
}
function KuaishouEticketPanel({
config,
onChange,
}: {
config: { filePath: string; source: AdminKuaishouEticketSourceConfig }
onChange: (config: { filePath: string; source: AdminKuaishouEticketSourceConfig }) => void
}) {
const [saving, setSaving] = useState(false)
const [querying, setQuerying] = useState(false)
const [selectedShopId, setSelectedShopId] = useState(config.source.shops[0]?.shopId || '')
const [ticketCode, setTicketCode] = useState('')
const [shopInfoResult, setShopInfoResult] = useState<AdminKuaishouEticketShopInfoResult | null>(null)
const [detailResult, setDetailResult] = useState<AdminKuaishouEticketDetailResult | null>(null)
const source = config.source
const selectedShop = source.shops.find((shop) => shop.shopId === selectedShopId) || source.shops[0] || null
async function saveConfig() {
setSaving(true)
try {
const response = await saveAdminKuaishouEticketSourceConfig(source)
onChange(response.data)
showSuccess('快手小店核销配置已保存')
} catch (error) {
showError(error instanceof Error ? error.message : '保存快手小店核销配置失败')
} finally {
setSaving(false)
}
}
async function queryShopInfo(shop = selectedShop) {
if (!shop?.cookie) {
showError('请先选择并填写店铺 Cookie')
return
}
setQuerying(true)
try {
const response = await queryAdminKuaishouEticketShopInfo({
baseUrl: source.baseUrl,
shopId: shop.shopId,
cookie: shop.cookie,
})
setShopInfoResult(response.data)
updateShop(shop.shopId, {
shopId: response.data.shop.shopId || shop.shopId,
kshopName: response.data.shop.kshopName || shop.kshopName,
userAvatar: response.data.shop.userAvatar || shop.userAvatar,
})
showSuccess(`已识别店铺:${response.data.shop.kshopName || response.data.shop.shopId}`)
} catch (error) {
showError(error instanceof Error ? error.message : '读取快手小店店铺信息失败')
} finally {
setQuerying(false)
}
}
async function queryDetail() {
if (!selectedShop?.cookie) {
showError('请先选择并填写店铺 Cookie')
return
}
if (!ticketCode.trim()) {
showError('请输入查询券码')
return
}
setQuerying(true)
try {
const response = await queryAdminKuaishouEticketDetail({
baseUrl: source.baseUrl,
shopId: selectedShop.shopId,
cookie: selectedShop.cookie,
eTicketId: ticketCode.trim(),
})
setDetailResult(response.data)
showSuccess('核销券详情查询完成')
} catch (error) {
showError(error instanceof Error ? error.message : '查询核销券详情失败')
} finally {
setQuerying(false)
}
}
function updateSource(nextSource: AdminKuaishouEticketSourceConfig) {
onChange({ ...config, source: nextSource })
}
function updateShop(shopId: string, patch: Partial<AdminKuaishouEticketShopConfigItem>) {
updateSource({
...source,
shops: source.shops.map((shop) => (shop.shopId === shopId ? { ...shop, ...patch } : shop)),
})
}
function addShop() {
const shopId = `shop_${Date.now()}`
updateSource({
...source,
shops: [
...source.shops,
{
shopId,
kshopName: '',
cookie: '',
cookieMasked: '',
hasCookie: false,
userAvatar: '',
enabled: true,
},
],
})
setSelectedShopId(shopId)
}
return (
<section className="platform-panel-stack">
<Card
title="快手小店核销源"
extra={
<Space wrap>
<Typography.Text type="secondary">{config.filePath || '默认配置'}</Typography.Text>
<Button type="primary" icon={<SaveOutlined />} loading={saving} onClick={saveConfig}>
</Button>
</Space>
}
>
<div className="platform-form-grid">
<FieldSwitch
label="启用"
checked={source.enabled}
onChange={(enabled) => updateSource({ ...source, enabled })}
/>
<div>
<Typography.Text type="secondary"></Typography.Text>
<Input
value={source.baseUrl}
onChange={(event) => updateSource({ ...source, baseUrl: event.target.value })}
/>
</div>
</div>
<Card size="small" title="店铺凭据" className="platform-section-gap" extra={<Button icon={<PlusOutlined />} onClick={addShop}></Button>}>
{source.shops.length === 0 ? (
<Empty description="暂无店铺配置" />
) : (
<Space direction="vertical" className="full-width" size={12}>
{source.shops.map((shop) => (
<div key={shop.shopId} className="platform-shop-row">
<Switch checked={shop.enabled !== false} onChange={(enabled) => updateShop(shop.shopId, { enabled })} />
<Avatar src={shop.userAvatar}>{shop.kshopName?.slice(0, 1) || '店'}</Avatar>
<Input
value={shop.shopId}
placeholder="shopId"
onChange={(event) => updateShop(shop.shopId, { shopId: event.target.value })}
onFocus={() => setSelectedShopId(shop.shopId)}
/>
<Input
value={shop.kshopName}
placeholder="店铺名称"
onChange={(event) => updateShop(shop.shopId, { kshopName: event.target.value })}
/>
<Input.Password
value={shop.cookie}
placeholder={shop.cookieMasked || 'Cookie'}
onChange={(event) =>
updateShop(shop.shopId, {
cookie: event.target.value,
hasCookie: Boolean(event.target.value.trim()),
})
}
/>
<Button loading={querying && selectedShopId === shop.shopId} onClick={() => queryShopInfo(shop)}>
</Button>
<Button
danger
icon={<DeleteOutlined />}
onClick={() =>
updateSource({
...source,
shops: source.shops.filter((item) => item.shopId !== shop.shopId),
})
}
/>
</div>
))}
</Space>
)}
</Card>
</Card>
<Card title="核销调试">
<Space wrap className="full-width">
<Select
value={selectedShop?.shopId}
style={{ minWidth: 220 }}
placeholder="选择店铺"
options={source.shops.map((shop) => ({
label: shop.kshopName || shop.shopId,
value: shop.shopId,
}))}
onChange={setSelectedShopId}
/>
<Input
value={ticketCode}
placeholder="券码 / eTicketId"
style={{ width: 260 }}
onChange={(event) => setTicketCode(event.target.value)}
onPressEnter={queryDetail}
/>
<Button icon={<SearchOutlined />} loading={querying} onClick={queryDetail}>
</Button>
</Space>
{shopInfoResult || detailResult ? (
<pre className="json-preview platform-section-gap">
{JSON.stringify(detailResult || shopInfoResult, null, 2)}
</pre>
) : null}
</Card>
</section>
)
}
function KuaishouIndustryPanel({
config,
onChange,