移除行业凭证回调开关

This commit is contained in:
yml2213
2026-07-08 11:38:11 +08:00
parent 010ca4e249
commit 2380e28bcc
17 changed files with 20 additions and 160 deletions
-1
View File
@@ -49,7 +49,6 @@ export function createDefaultRuntimeConfig(projectRoot: string): RuntimeConfig {
appSecret: "",
signSecret: "",
messageSecret: "",
sendCallbackEnabled: false,
provider: "kuaishou-industry",
platform: "kuaishou",
shopId: "kuaishou-industry",
-5
View File
@@ -246,11 +246,6 @@ export const ENV_OVERRIDES: readonly EnvOverride[] = [
"kuaishouIndustry",
"messageSecret",
]),
booleanEnv("KUASHOU_INDUSTRY_SEND_CALLBACK_ENABLED", [
"platforms",
"kuaishouIndustry",
"sendCallbackEnabled",
]),
stringEnv("KUASHOU_INDUSTRY_PROVIDER", [
"platforms",
"kuaishouIndustry",
@@ -44,7 +44,6 @@ router.post(
data: {
filePath: String(result.filePath || '').trim(),
enabled: Boolean(result.source?.enabled),
sendCallbackEnabled: Boolean(result.source?.sendCallbackEnabled),
hasAccessToken: Boolean(result.source?.hasAccessToken),
hasRefreshToken: Boolean(result.source?.hasRefreshToken),
accessTokenStatus: String(result.source?.accessTokenStatus || '').trim(),
@@ -35,9 +35,6 @@ export function updateAdminKuaishouIndustrySourceConfig(payload: JsonObject = {}
const saved = saveKuaishouIndustrySourceConfig({
...current,
enabled: hasPayloadField(payload, 'enabled') ? payload.enabled !== false : current.enabled !== false,
sendCallbackEnabled: hasPayloadField(payload, 'sendCallbackEnabled')
? payload.sendCallbackEnabled === true
: current.sendCallbackEnabled === true,
baseUrl: readConfigString(payload, 'baseUrl', current.baseUrl),
authBaseUrl: readConfigString(payload, 'authBaseUrl', current.authBaseUrl),
redirectUri: readConfigString(payload, 'redirectUri', current.redirectUri, { allowBlank: true }),
@@ -96,7 +93,6 @@ function mapAdminKuaishouIndustrySourceConfig(config: KuaishouIndustrySourceConf
return {
enabled: config.enabled !== false,
sendCallbackEnabled: config.sendCallbackEnabled === true,
baseUrl: config.baseUrl,
authBaseUrl: config.authBaseUrl,
redirectUri: config.redirectUri,
@@ -33,7 +33,6 @@ export function getKuaishouIndustryConfig(overrides: Partial<KuaishouIndustrySou
sellerId: String(config.sellerId || '').trim(),
lastRefreshedAt: String(config.lastRefreshedAt || '').trim(),
lastRefreshError: String(config.lastRefreshError || '').trim(),
sendCallbackEnabled: Boolean(config.sendCallbackEnabled),
provider: String(config.provider || KUISHOU_INDUSTRY_PROVIDER).trim() || KUISHOU_INDUSTRY_PROVIDER,
platform: String(config.platform || KUISHOU_INDUSTRY_PLATFORM).trim() || KUISHOU_INDUSTRY_PLATFORM,
shopId: String(config.shopId || KUISHOU_INDUSTRY_PROVIDER).trim() || KUISHOU_INDUSTRY_PROVIDER,
@@ -35,8 +35,8 @@ type ConsumeCallbackInput = {
export async function consumeCallback(input: ConsumeCallbackInput): Promise<{ success: boolean; response?: JsonObject; error?: string }> {
let config = getKuaishouIndustryConfig()
if (!config.enabled || !config.sendCallbackEnabled) {
logInfo('[kuaishou-industry/consume-callback]', '回调未启用,跳过')
if (!config.enabled) {
logInfo('[kuaishou-industry/consume-callback]', '行业电子凭证配置未启用,跳过核销回调')
return { success: true }
}
@@ -56,8 +56,9 @@ export async function consumeCallback(input: ConsumeCallbackInput): Promise<{ su
}
if (!config.accessToken) {
logWarn('[kuaishou-industry/consume-callback]', 'accessToken 未配置,跳过')
return { success: true }
const message = 'accessToken 未配置,无法发起核销回调'
logWarn('[kuaishou-industry/consume-callback]', message)
return { success: false, error: message }
}
const bizParams: JsonObject = {
@@ -25,8 +25,8 @@ type DestroyCallbackInput = {
export async function destroyCallback(input: DestroyCallbackInput): Promise<{ success: boolean; response?: JsonObject; error?: string }> {
let config = getKuaishouIndustryConfig()
if (!config.enabled || !config.sendCallbackEnabled) {
logInfo('[kuaishou-industry/destroy-callback]', '回调未启用,跳过')
if (!config.enabled) {
logInfo('[kuaishou-industry/destroy-callback]', '行业电子凭证配置未启用,跳过销毁回调')
return { success: true }
}
@@ -46,8 +46,9 @@ export async function destroyCallback(input: DestroyCallbackInput): Promise<{ su
}
if (!config.accessToken) {
logWarn('[kuaishou-industry/destroy-callback]', 'accessToken 未配置,跳过')
return { success: true }
const message = 'accessToken 未配置,无法发起销毁回调'
logWarn('[kuaishou-industry/destroy-callback]', message)
return { success: false, error: message }
}
const bizParams: JsonObject = {
@@ -31,8 +31,8 @@ type SendCallbackInput = {
export async function sendCallback(input: SendCallbackInput): Promise<{ success: boolean; response?: JsonObject; error?: string }> {
let config = getKuaishouIndustryConfig()
if (!config.enabled || !config.sendCallbackEnabled) {
logInfo('[kuaishou-industry/send-callback]', '发码回调未启用,跳过')
if (!config.enabled) {
logInfo('[kuaishou-industry/send-callback]', '行业电子凭证配置未启用,跳过发码回调')
return { success: true }
}
@@ -52,8 +52,9 @@ export async function sendCallback(input: SendCallbackInput): Promise<{ success:
}
if (!config.accessToken) {
logWarn('[kuaishou-industry/send-callback]', 'accessToken 未配置,跳过发码回调')
return { success: true }
const message = 'accessToken 未配置,无法发起发码回调'
logWarn('[kuaishou-industry/send-callback]', message)
return { success: false, error: message }
}
const bizParams: JsonObject = {
@@ -11,7 +11,6 @@ type JsonObject = Record<string, any>
export type KuaishouIndustrySourceConfig = {
enabled: boolean
sendCallbackEnabled: boolean
baseUrl: string
authBaseUrl: string
redirectUri: string
@@ -72,9 +71,6 @@ function normalizeKuaishouIndustrySourceConfig(rawValue: unknown): KuaishouIndus
return {
enabled: typeof source.enabled === 'boolean' ? source.enabled : fallback.enabled,
sendCallbackEnabled: typeof source.sendCallbackEnabled === 'boolean'
? source.sendCallbackEnabled
: fallback.sendCallbackEnabled,
baseUrl: normalizeUrlLike(source.baseUrl, fallback.baseUrl),
authBaseUrl: normalizeUrlLike(source.authBaseUrl, fallback.authBaseUrl),
redirectUri: normalizeString(source.redirectUri, fallback.redirectUri),
@@ -106,7 +102,6 @@ function createDefaultKuaishouIndustrySourceConfig(): KuaishouIndustrySourceConf
return {
enabled: true,
sendCallbackEnabled: Boolean(runtime.sendCallbackEnabled),
baseUrl: DEFAULT_CALLBACK_BASE_URL,
authBaseUrl: DEFAULT_AUTH_BASE_URL,
redirectUri: '',
@@ -42,7 +42,6 @@ function createConfig(
): KuaishouIndustrySourceConfig {
return {
enabled: true,
sendCallbackEnabled: true,
baseUrl: 'https://openapi.kwaixiaodian.com',
authBaseUrl: 'https://open.kwaixiaodian.com',
redirectUri: '',
@@ -14,7 +14,6 @@ export type AdminKuaishouEticketSourceConfigInput = {
export type AdminKuaishouIndustrySourceConfigInput = {
enabled?: boolean
sendCallbackEnabled?: boolean
baseUrl?: string
authBaseUrl?: string
redirectUri?: string
-1
View File
@@ -92,7 +92,6 @@ export type RuntimeConfig = {
appSecret: string;
signSecret: string;
messageSecret: string;
sendCallbackEnabled: boolean;
provider: string;
platform: string;
shopId: string;
@@ -1193,7 +1193,7 @@ function KuaishouIndustryPanel({
<div className="metric-grid four">
<MetricCard
label="回调状态"
value={source.enabled && source.sendCallbackEnabled ? '已启用' : '停用'}
value={source.enabled ? '已启用' : '停用'}
detail={source.enabled ? '配置启用' : '配置停用'}
/>
<MetricCard
@@ -1250,11 +1250,6 @@ function KuaishouIndustryPanel({
checked={source.enabled}
onChange={(enabled) => updateSource({ enabled })}
/>
<FieldSwitch
label="通知快手回调"
checked={source.sendCallbackEnabled}
onChange={(sendCallbackEnabled) => updateSource({ sendCallbackEnabled })}
/>
<LabeledInput
label="开放平台 API"
value={source.baseUrl}
@@ -7,7 +7,6 @@ export type AdminKuaishouIndustryAccessTokenStatus =
export interface AdminKuaishouIndustrySourceConfig {
enabled: boolean
sendCallbackEnabled: boolean
baseUrl: string
authBaseUrl: string
redirectUri: string