fix: 接口参数占位符 $Token 大小写,并修复 Query/Header 空值删除无法落库
All checks were successful
Build and Deploy Front / deploy (push) Successful in 5m51s
All checks were successful
Build and Deploy Front / deploy (push) Successful in 5m51s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
50b3eac99c
commit
2612a225ad
@ -3905,7 +3905,7 @@
|
||||
<li><strong>参数名</strong>:与服务商文档、curl、Mapping Body / Body 参数树、前置脚本写入字段名保持一致(如 <code>_aop_signature</code>、<code>notifyBizEventDTO</code>)。</li>
|
||||
<li><strong>参数值</strong>:使用<strong>占位符</strong>或留空,不要填写 curl 中的真实签名/业务样例;转发前由 Like API 替换。</li>
|
||||
<li><code>$FromMappingBody</code>(FormUrlEncoded):Query 上承载业务 JSON 的字段(如 <code>*DTO</code>)填此占位符,映射结果来自 <strong>Mapping Body</strong> 参数树;POST 参数仅在 URL、无 Body 时,DTO 应配置在 Query 而非 Body 表单。</li>
|
||||
<li><code>$FromAccount</code>:按参数名从<strong>服务商账户</strong>取值;<code>$TimeStamp</code> / <code>$DateTime</code>:时间;<code>$token</code>:令牌;<code>$Url</code>:当前请求地址。</li>
|
||||
<li><code>$FromAccount</code>:按参数名从<strong>服务商账户</strong>取值;<code>$TimeStamp</code> / <code>$DateTime</code>:时间;<code>$Token</code>:令牌;<code>$Url</code>:当前请求地址。</li>
|
||||
<li><strong>留空</strong>:签名类参数(如 <code>sign</code>、<code>_aop_signature</code>)由<strong>前置脚本</strong>写入。</li>
|
||||
<li><strong>参数描述</strong>:可记录备注或 curl 片段,便于对照映射,不参与转发。</li>
|
||||
</ul>
|
||||
|
||||
@ -100,7 +100,7 @@ export const ParameterPlaceholderText: Record<number, string> = {
|
||||
[ParameterPlaceholder.TimeStamp]: '$TimeStamp',
|
||||
[ParameterPlaceholder.DateTime]: '$DateTime',
|
||||
[ParameterPlaceholder.Url]: '$Url',
|
||||
[ParameterPlaceholder.Token]: '$token',
|
||||
[ParameterPlaceholder.Token]: '$Token',
|
||||
[ParameterPlaceholder.FromMappingBody]: '$FromMappingBody',
|
||||
};
|
||||
|
||||
|
||||
@ -399,6 +399,14 @@ function isSameFormKvRow(row: any, baseline: NormalizedParamRow): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
function isPersistableFormKvRow(p: any) {
|
||||
// 删除只依赖 id;参数值允许留空(签名类由前置脚本写入)
|
||||
if (Number(p?.optionType) === 2) {
|
||||
return Number(p?.id) > 0;
|
||||
}
|
||||
return !!(p.name && String(p.name).trim() !== '');
|
||||
}
|
||||
|
||||
function buildFormKvParameterList(
|
||||
changes: any[],
|
||||
tableData: any[],
|
||||
@ -406,24 +414,23 @@ function buildFormKvParameterList(
|
||||
isEditMode: boolean,
|
||||
original: OriginalParamSnapshot,
|
||||
) {
|
||||
const isValid = (p: any) =>
|
||||
p.name && String(p.name).trim() !== '' && p.value && String(p.value).trim() !== '';
|
||||
|
||||
const changeById = new Map(changes.map((c) => [Number(c.id), c]));
|
||||
const removedIds = new Set(
|
||||
changes.filter((c) => c.optionType === 2).map((c) => Number(c.id)),
|
||||
);
|
||||
|
||||
if (!isEditMode) {
|
||||
if (changes.length) return changes;
|
||||
if (changes.length) return changes.filter(isPersistableFormKvRow);
|
||||
return (tableData || [])
|
||||
.map((item) => mapFormKvRow(stripFormKvMeta(item), 1, fieldPosition))
|
||||
.filter(isValid);
|
||||
.filter(isPersistableFormKvRow);
|
||||
}
|
||||
|
||||
const result: any[] = [];
|
||||
changes.filter((c) => c.optionType === 2).forEach((c) => result.push(c));
|
||||
|
||||
const presentServerIds = new Set<number>();
|
||||
|
||||
(tableData || []).forEach((item) => {
|
||||
const rest = stripFormKvMeta(item);
|
||||
const id = normalizeRowId(rest);
|
||||
@ -435,6 +442,8 @@ function buildFormKvParameterList(
|
||||
const tracked = changeById.get(id);
|
||||
if (tracked && tracked.optionType !== 2) {
|
||||
result.push(tracked);
|
||||
const trackedServerId = Number(tracked.id);
|
||||
if (trackedServerId > 0) presentServerIds.add(trackedServerId);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -443,6 +452,7 @@ function buildFormKvParameterList(
|
||||
const baseline = serverId ? original.rowById.get(serverId) : undefined;
|
||||
|
||||
if (serverId && baseline) {
|
||||
presentServerIds.add(serverId);
|
||||
if (!isSameFormKvRow(rest, baseline)) {
|
||||
result.push(mapFormKvRow(rest, 3, fieldPosition, serverId));
|
||||
}
|
||||
@ -454,7 +464,22 @@ function buildFormKvParameterList(
|
||||
}
|
||||
});
|
||||
|
||||
return result.filter(isValid);
|
||||
// VXE removeRecords 丢失时,仍按「原始快照有、当前表无」补删,避免库里残留
|
||||
original.ids.forEach((serverId) => {
|
||||
if (removedIds.has(serverId) || presentServerIds.has(serverId)) return;
|
||||
const baseline = original.rowById.get(serverId);
|
||||
if (!baseline?.name) return;
|
||||
result.push({
|
||||
id: serverId,
|
||||
name: baseline.name,
|
||||
value: baseline.alias || '',
|
||||
description: baseline.description || '',
|
||||
optionType: 2,
|
||||
fieldPosition,
|
||||
});
|
||||
});
|
||||
|
||||
return result.filter(isPersistableFormKvRow);
|
||||
}
|
||||
|
||||
function mapFormKvChanges(
|
||||
@ -476,9 +501,7 @@ function mapFormKvChanges(
|
||||
...(actionRows.updateRecords || []).map((r) => mapRow(r, 3)),
|
||||
];
|
||||
|
||||
return list.filter(
|
||||
(p) => p.name && String(p.name).trim() !== '' && p.value && String(p.value).trim() !== '',
|
||||
);
|
||||
return list.filter(isPersistableFormKvRow);
|
||||
}
|
||||
|
||||
export interface InterfaceDetailSnapshot {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user