28 lines
1.3 KiB
C#
28 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
|
||
namespace YLErp.Web.Controllers
|
||
{
|
||
public class BondController : BaseController
|
||
{
|
||
|
||
[AllowAnonymous]
|
||
public JsonResult CalcBond(string underlyingCode, decimal price, string priceType, string targetDate = null, string source = null)
|
||
{
|
||
// EQD-6953:source 标记调用场景(unwind=平仓页;录入页不传)。BondCalcHepler 已记录
|
||
// 完整请求参数与成败结果,此处仅补场景维度,定位问题时先按 source 区分入口再看参数。
|
||
LogFactory.GetLogger("BondController").Info(
|
||
$"CalcBond source={source ?? "(未标记)"} underlyingCode={underlyingCode} price={price} priceType={priceType} targetDate={targetDate ?? "(空→代理默认T+1)"}");
|
||
string errorMsg;
|
||
var obj = BondCalcHepler.BondCalc(underlyingCode, price, priceType, out errorMsg, targetDate);
|
||
if (obj == null)
|
||
{
|
||
// 透传计算器返回的真实原因(债券不存在/信息不全/参数非法/服务异常),前端以非阻塞 toast 展示
|
||
return JsonError(errorMsg ?? "计算价格失败");
|
||
}
|
||
|
||
return JsonSuccess("", obj);
|
||
}
|
||
}
|
||
}
|