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 errorMsg; var obj = BondCalcHepler.BondCalc(underlyingCode, price, priceType, out errorMsg, targetDate); if (obj == null) { // 透传计算器返回的真实原因(债券不存在/信息不全/参数非法/服务异常),前端以非阻塞 toast 展示 return JsonError(errorMsg ?? "计算价格失败"); } return JsonSuccess("", obj); } } }