fix(swap): EQD-5320 单行发送Email按钮报'平仓流水id解析为空'——同事fa927b21新增的单行按钮传swap_flow_event.EncryptId(加密串,全站enid惯例),而端点原只按逗号分隔数字解析long.TryParse必败;控制器兼容双形态令牌:非数字即DecryptLong解密(失败返0不抛,非法串忽略),错误文案附原始入参便于定位;批量按钮(数字id)行为不变

This commit is contained in:
hjhan
2026-08-21 15:41:56 +08:00
parent b9968dc80a
commit 23a02e06c4
+11 -3
View File
@@ -1237,7 +1237,8 @@ namespace YLErp.Web.Controllers
/// EQD-5320 批量发送结算确认书邮件——经服务端代理 bond-omsBondOmsInterface_BaseUrl 出口),
/// 替代前端直连 /trs_hub_api 反向代理(未配 nginx 的环境 404)。
/// </summary>
/// <param name="swapFlowEventIds">平仓流水id,逗号分隔</param>
/// <param name="swapFlowEventIds">平仓流水id,逗号分隔;单个令牌兼容【数字】与【EncryptId 加密串】两种形态
/// (批量按钮传网格数字id,单行按钮传 swap_flow_event.EncryptId——全站 enid 惯例)</param>
[HttpPost]
public JsonResult BatchSendSettleEmail(string swapFlowEventIds)
{
@@ -1248,14 +1249,21 @@ namespace YLErp.Web.Controllers
var ids = new List<long>();
foreach (var s in swapFlowEventIds.Split(',', StringSplitOptions.RemoveEmptyEntries))
{
if (long.TryParse(s.Trim(), out var id))
var token = s.Trim();
long id;
if (!long.TryParse(token, out id) || id <= 0)
{
// 非数字令牌按 EncryptId 解密(解密失败/非法串返回0,不抛出)
try { id = DecryptLong(token); } catch { id = 0; }
}
if (id > 0)
{
ids.Add(id);
}
}
if (ids.Count == 0)
{
return JsonError("平仓流水id解析为空");
return JsonError("平仓流水id解析为空(既非数字也非有效加密ID):" + swapFlowEventIds);
}
var result = new SwapEndConfirmService(CurUser).BatchSendSettleEmail(ids);
return string.IsNullOrEmpty(result) ? JsonSuccess("发送成功") : JsonError(result);