using Org.BouncyCastle.Asn1.Ocsp; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using YLErp.Model; namespace YLErp.Helpers { /// /// 计算器帮助类 /// public class BondCalcHepler { /// /// 计算器 /// /// public static CalBondResult BondCalc(string underlyingCode,decimal price,string priceType="DP") { var baseUrl = Environment.GetEnvironmentVariable("BondOmsInterface_BaseUrl"); var calculateUrl = "/calc/cal_bond_value"; CalcBondRequest request = new CalcBondRequest() { bondId= underlyingCode, price = price.ToString(), priceType = priceType, }; if (!string.IsNullOrEmpty(baseUrl)) { var httpHelper = new HttpHelper(baseUrl, null); // http 请求 Web项目接口 var result = httpHelper.PostRequestNoAuth(calculateUrl, request).Result; if (result != null && !result.success) { LogFactory.GetLogger("BondCalcHepler").Info("计算器计算失败:" + result.message); } else { return result.data; } } return null; } } }