feat(ops): 下单与核销纳入接口访问百分比
总部可按成功百分比拦截现场提货、配送下单,以及扫码、手机号和弱网核销,规则写入 v4 文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -200,7 +200,11 @@ export default function ApiAccessPage() {
|
||||
? '不拦截审核,只按比例丢弃门店审核通知'
|
||||
: row.featureKey === 'login'
|
||||
? 'C 端、门店、合伙人登录;总部登录始终放行'
|
||||
: '命中后直接返回失败文案',
|
||||
: row.featureKey === 'order_create'
|
||||
? '现场提货和选择地址配送都拦截,并返回失败文案'
|
||||
: row.featureKey === 'redeem_confirm'
|
||||
? '扫码核销、手机号核销和弱网待处理都拦截,并返回失败文案'
|
||||
: '命中后直接返回失败文案',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { REDEEM_WEAKNET_FAIL_THRESHOLD } from '@dukang/shared-types';
|
||||
import { API_ACCESS_ERROR_KINDS, REDEEM_WEAKNET_FAIL_THRESHOLD } from '@dukang/shared-types';
|
||||
import type { RedeemErrorClass, RedeemFailureReportResult } from '@dukang/shared-types';
|
||||
import { request } from './api';
|
||||
|
||||
const API_ACCESS_DENIAL_REASONS = new Set<string>(API_ACCESS_ERROR_KINDS);
|
||||
|
||||
export function isNetworkError(e: unknown): boolean {
|
||||
const err = e as Error & { status?: number };
|
||||
const err = e as Error & { status?: number; reason?: string };
|
||||
if (err.reason && API_ACCESS_DENIAL_REASONS.has(err.reason)) return false;
|
||||
const status = err.status;
|
||||
const message = (err.message ?? String(e)).toLowerCase();
|
||||
if (status != null && status >= 500) return true;
|
||||
|
||||
@@ -164,7 +164,9 @@ export default function OrderConfirmPickupPage() {
|
||||
try {
|
||||
await doSubmit();
|
||||
} catch (e) {
|
||||
setMsg(e instanceof Error ? e.message : '下单失败');
|
||||
const tip = e instanceof Error ? e.message : '下单失败';
|
||||
setMsg(tip);
|
||||
toast(tip);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -296,7 +296,9 @@ export default function OrderConfirmPage() {
|
||||
try {
|
||||
await doSubmit();
|
||||
} catch (e) {
|
||||
setMsg(e instanceof Error ? e.message : '下单失败');
|
||||
const tip = e instanceof Error ? e.message : '下单失败';
|
||||
setMsg(tip);
|
||||
toast(tip);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user